-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Labels
APIIssues pertaining the friendly APIIssues pertaining the friendly APIP1Priority of the issue for triage purpose: Needs to be fixed soon.Priority of the issue for triage purpose: Needs to be fixed soon.documentationRelated to documentation of ML.NETRelated to documentation of ML.NETenhancementNew feature or requestNew feature or request
Description
public class Digit
{
[Column("0")] public float Up;
[Column("1")] public float Middle;
[Column("2")] public float Bottom;
[Column("3")] public float UpLeft;
[Column("4")] public float BottomLeft;
[Column("5")] public float TopRight;
[Column("6")] public float BottomRight;
[Column("7")] [ColumnName("Label")] public float Label;
}
public class DigitPrediction
{
[ColumnName("PredictedLabel")]
public uint ExpectedDigit;
[ColumnName("Score")]
public float[] Score;
}
var pipeline = new LearningPipeline();
var data = new Digit[]
{
new Digit { Up = 1, Middle = 0, Bottom = 1, UpLeft = 1, BottomLeft = 1, TopRight = 1, BottomRight = 1, Label = 0 },
new Digit { Up = 0, Middle = 0, Bottom = 0, UpLeft = 0, BottomLeft = 0, TopRight = 1, BottomRight = 1, Label = 1 },
new Digit { Up = 1, Middle = 1, Bottom = 1, UpLeft = 0, BottomLeft = 1, TopRight = 1, BottomRight = 0, Label = 2 },
new Digit { Up = 1, Middle = 1, Bottom = 1, UpLeft = 0, BottomLeft = 0, TopRight = 1, BottomRight = 1, Label = 3 },
new Digit { Up = 0, Middle = 1, Bottom = 0, UpLeft = 1, BottomLeft = 1, TopRight = 1, BottomRight = 1, Label = 4 },
new Digit { Up = 1, Middle = 1, Bottom = 1, UpLeft = 1, BottomLeft = 1, TopRight = 0, BottomRight = 1, Label = 5 },
new Digit { Up = 1, Middle = 1, Bottom = 1, UpLeft = 1, BottomLeft = 1, TopRight = 0, BottomRight = 1, Label = 6 },
new Digit { Up = 1, Middle = 0, Bottom = 0, UpLeft = 0, BottomLeft = 0, TopRight = 1, BottomRight = 1, Label = 7 },
new Digit { Up = 1, Middle = 1, Bottom = 1, UpLeft = 1, BottomLeft = 1, TopRight = 1, BottomRight = 1, Label = 8 },
new Digit { Up = 1, Middle = 1, Bottom = 1, UpLeft = 1, BottomLeft = 0, TopRight = 1, BottomRight = 1, Label = 9 }
};
pipeline.Add(CollectionDataSource.Create(data));
pipeline.Add(new ColumnConcatenator("Features", "Up", "Middle", "Bottom", "UpLeft", "BottomLeft", "TopRight", "BottomRight"));
pipeline.Add(new StochasticDualCoordinateAscentClassifier());
var model = pipeline.Train<Digit, DigitPrediction>();
var prediction = model.Predict(new Digit
{
Up = 1,
Middle = 1,
Bottom = 1,
UpLeft = 1,
BottomLeft = 1,
TopRight = 1,
BottomRight = 1});
I have this wonderful test, but for ExpectedDigit is shifted by 1. I.e if it predict digit 9, it put 10 into expectedDigit
Metadata
Metadata
Assignees
Labels
APIIssues pertaining the friendly APIIssues pertaining the friendly APIP1Priority of the issue for triage purpose: Needs to be fixed soon.Priority of the issue for triage purpose: Needs to be fixed soon.documentationRelated to documentation of ML.NETRelated to documentation of ML.NETenhancementNew feature or requestNew feature or request