@@ -47,9 +47,9 @@ public static void Example()
47
47
// Featurize the text column through the FeaturizeText API.
48
48
// Then append a binary classifier, setting the "Label" column as the label of the dataset, and
49
49
// the "Features" column produced by FeaturizeText as the features column.
50
- var pipeline = mlContext . Transforms . Text . FeaturizeText ( "SentimentText " , "Features " )
50
+ var pipeline = mlContext . Transforms . Text . FeaturizeText ( "Features " , "SentimentText " )
51
51
. AppendCacheCheckpoint ( mlContext ) // Add a data-cache step within a pipeline.
52
- . Append ( mlContext . BinaryClassification . Trainers . SdcaNonCalibrated ( labelColumnName : "Sentiment" , featureColumnName : "Features" , l2Regularization : 0.001f ) ) ;
52
+ . Append ( mlContext . BinaryClassification . Trainers . SdcaLogisticRegression ( labelColumnName : "Sentiment" , featureColumnName : "Features" , l2Regularization : 0.001f ) ) ;
53
53
54
54
// Step 3: Run Cross-Validation on this pipeline.
55
55
var cvResults = mlContext . BinaryClassification . CrossValidate ( data , pipeline , labelColumnName : "Sentiment" ) ;
@@ -59,7 +59,7 @@ public static void Example()
59
59
60
60
// If we wanted to specify more advanced parameters for the algorithm,
61
61
// we could do so by tweaking the 'advancedSetting'.
62
- var advancedPipeline = mlContext . Transforms . Text . FeaturizeText ( "SentimentText " , "Features " )
62
+ var advancedPipeline = mlContext . Transforms . Text . FeaturizeText ( "Features " , "SentimentText " )
63
63
. Append ( mlContext . BinaryClassification . Trainers . SdcaLogisticRegression (
64
64
new SdcaLogisticRegressionBinaryTrainer . Options {
65
65
LabelColumnName = "Sentiment" ,
@@ -69,7 +69,7 @@ public static void Example()
69
69
} ) ) ;
70
70
71
71
// Run Cross-Validation on this second pipeline.
72
- var cvResults_advancedPipeline = mlContext . BinaryClassification . CrossValidate ( data , pipeline , labelColumnName : "Sentiment" , numberOfFolds : 3 ) ;
72
+ var cvResults_advancedPipeline = mlContext . BinaryClassification . CrossValidate ( data , advancedPipeline , labelColumnName : "Sentiment" , numberOfFolds : 3 ) ;
73
73
accuracies = cvResults_advancedPipeline . Select ( r => r . Metrics . Accuracy ) ;
74
74
Console . WriteLine ( accuracies . Average ( ) ) ;
75
75
0 commit comments