File tree 1 file changed +7
-8
lines changed
test/Microsoft.ML.Tests/Scenarios/Api
1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -40,16 +40,15 @@ public void FirstExperienceWithML()
40
40
// Concatenate all features into a vector.
41
41
Features : row . SepalWidth . ConcatWith ( row . SepalLength , row . PetalWidth , row . PetalLength ) ) ) ;
42
42
43
- // Create a learner and train it.
44
- var learner = preprocess . AppendEstimator ( row => row . Label . SdcaPredict ( row . Features , l1Coefficient : 0.1 ) ) ;
45
- var classifier = learner . Fit ( data ) ;
43
+ var pipeline = preprocess
44
+ // Append the trainer to the training pipeline.
45
+ . AppendEstimator ( row => row . Label . PredictWithSdca ( row . Features ) )
46
+ . AppendEstimator ( row => row . PredictedLabel . KeyToValue ( ) ) ;
46
47
47
- // Add another transformer that converts the integer prediction into string .
48
- var finalTransformer = classifier . AppendTransformer ( row => row . PredictedLabel . KeyToValue ( ) ) ;
48
+ // Train the model and make some predictions .
49
+ var model = pipeline . Fit < IrisExample , IrisPrediction > ( data ) ;
49
50
50
- // Make a prediction engine and predict.
51
- engine = finalTransformer . MakePredictionEngine < IrisExample , IrisPrediction > ( ) ;
52
- IrisPrediction prediction = engine . Predict ( new IrisExample
51
+ IrisPrediction prediction = model . Predict ( new IrisExample
53
52
{
54
53
SepalWidth = 3.3f ,
55
54
SepalLength = 1.6f ,
You can’t perform that action at this time.
0 commit comments