public static Make ( string label, |
||
label | string | The label. |
x | The Range to process. | |
count | int | (Optional) number of. |
Résultat |
/// <summary>Gets base conditionals.</summary> /// <param name="x">The Matrix to process.</param> /// <returns>An array of measure.</returns> private Measure[] GetBaseConditionals(Matrix x) { Measure[] features = new Measure[x.Cols]; for (int i = 0; i < features.Length; i++) { Property p = this.Descriptor.At(i); var f = new Measure { Discrete = p.Discrete, Label = this.Descriptor.ColumnAt(i), }; IEnumerable<Statistic> fstats; if (f.Discrete) fstats = x[i, VectorType.Col].Distinct().OrderBy(d => d) .Select(d => Statistic.Make(p.Convert(d).ToString(), d, 1)); else fstats = x[i, VectorType.Col].Segment(this.Width) .Select(d => Statistic.Make(f.Label, d, 1)); f.Probabilities = fstats.ToArray(); features[i] = f; } return features; }
/// <summary>Gets label statistics.</summary> /// <param name="y">The Vector to process.</param> /// <returns>An array of statistic.</returns> private Statistic[] GetLabelStats(Vector y) { var stats = y.Stats(); Statistic[] statistics = new Statistic[stats.Rows]; for (int i = 0; i < statistics.Length; i++) { double yVal = stats[i, 0]; var s = Statistic.Make(this.Descriptor.Label.Convert(stats[i, 0]).ToString(), yVal); s.Count = (int)stats[i, 1]; s.Probability = stats[i, 2]; statistics[i] = s; } return statistics; }