Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
var mlContext = new MLContext(seed: 0);
_textLoader = mlContext.Data.TextReader(new TextLoader.Arguments()
Separator = ",",
HasHeader = true,
Column = new[]
new TextLoader.Column("Name", DataKind.Text, 0),
new TextLoader.Column("Age", DataKind.Num, 1),
new TextLoader.Column("Gender", DataKind.Text, 2),
new TextLoader.Column("Label", DataKind.Text, 3),
// split data 80/20
var dvTrain = _textLoader.Read(TrainDataPath);
// Train
var dataProcessPipeline = mlContext.Transforms.Categorical.MapValueToKey("Label", "LabelKeys")
.Append(mlContext.Transforms.Text.FeaturizeText("Gender", "GenderFeaturized"))
.Append(mlContext.Transforms.Concatenate("Features", "Age", "GenderFeaturized"));
ConsoleHelper.PeekDataViewInConsole<AgeRange>(mlContext, dvTrain, dataProcessPipeline);
ConsoleHelper.PeekVectorColumnDataInConsole(mlContext, "Features", dvTrain, dataProcessPipeline, 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.