@@ -451,23 +451,12 @@ public void MetacomponentsFunctionAsExpectedOva()
451451 separatorChar : TestDatasets . iris . fileSeparator ) ;
452452
453453 // Create a model training an OVA trainer with a binary classifier.
454- var anomalyDetectionTrainer = mlContext . AnomalyDetection . Trainers . RandomizedPca ( ) ;
455- var anomalyDetectionPipeline = mlContext . Transforms . Concatenate ( "Features" , Iris . Features )
456- . AppendCacheCheckpoint ( mlContext )
457- . Append ( mlContext . Transforms . Conversion . MapValueToKey ( "Label" ) )
458- . Append ( mlContext . MulticlassClassification . Trainers . OneVersusAll ( anomalyDetectionTrainer ) )
459- . Append ( mlContext . Transforms . Conversion . MapKeyToValue ( "PredictedLabel" ) ) ;
460-
461- // Fit the binary classification pipeline.
462- Assert . Throws < InvalidOperationException > ( ( ) => anomalyDetectionPipeline . Fit ( data ) ) ;
463-
464- // Create a model training an OVA trainer with a binary classifier.
465- var binaryclassificationTrainer = mlContext . BinaryClassification . Trainers . LogisticRegression (
454+ var binaryClassificationTrainer = mlContext . BinaryClassification . Trainers . LogisticRegression (
466455 new LogisticRegressionBinaryClassificationTrainer . Options { MaximumNumberOfIterations = 10 , NumberOfThreads = 1 , } ) ;
467456 var binaryClassificationPipeline = mlContext . Transforms . Concatenate ( "Features" , Iris . Features )
468457 . AppendCacheCheckpoint ( mlContext )
469458 . Append ( mlContext . Transforms . Conversion . MapValueToKey ( "Label" ) )
470- . Append ( mlContext . MulticlassClassification . Trainers . OneVersusAll ( binaryclassificationTrainer ) ) ;
459+ . Append ( mlContext . MulticlassClassification . Trainers . OneVersusAll ( binaryClassificationTrainer ) ) ;
471460
472461 // Fit the binary classification pipeline.
473462 var binaryClassificationModel = binaryClassificationPipeline . Fit ( data ) ;
@@ -477,53 +466,6 @@ public void MetacomponentsFunctionAsExpectedOva()
477466
478467 // Evaluate the model.
479468 var binaryClassificationMetrics = mlContext . MulticlassClassification . Evaluate ( binaryClassificationPredictions ) ;
480-
481- // Create a model training an OVA trainer with a clustering trainer.
482- var kmeansTrainer = mlContext . Clustering . Trainers . KMeans (
483- new KMeansTrainer . Options { MaximumNumberOfIterations = 10 , NumberOfThreads = 1 , } ) ;
484-
485- Assert . Throws < ArgumentOutOfRangeException > ( ( ) =>
486- mlContext . Transforms . Concatenate ( "Features" , Iris . Features )
487- . AppendCacheCheckpoint ( mlContext )
488- . Append ( mlContext . Transforms . Conversion . MapValueToKey ( "Label" ) )
489- . Append ( mlContext . MulticlassClassification . Trainers . OneVersusAll ( kmeansTrainer ) )
490- . Append ( mlContext . Transforms . Conversion . MapKeyToValue ( "PredictedLabel" ) ) ) ;
491-
492- // Create a model training an OVA trainer with a multiclass classification trainer.
493- var multiclassTrainer = mlContext . MulticlassClassification . Trainers . LogisticRegression (
494- new LogisticRegressionMulticlassClassificationTrainer . Options { MaximumNumberOfIterations = 10 , NumberOfThreads = 1 , } ) ;
495- Assert . Throws < ArgumentOutOfRangeException > ( ( ) =>
496- mlContext . Transforms . Concatenate ( "Features" , Iris . Features )
497- . AppendCacheCheckpoint ( mlContext )
498- . Append ( mlContext . Transforms . Conversion . MapValueToKey ( "Label" ) )
499- . Append ( mlContext . MulticlassClassification . Trainers . OneVersusAll ( multiclassTrainer ) )
500- . Append ( mlContext . Transforms . Conversion . MapKeyToValue ( "PredictedLabel" ) ) ) ;
501-
502- // Create a model training an OVA trainer with a ranking trainer.
503- var rankingTrainer = mlContext . Ranking . Trainers . FastTree (
504- new FastTreeRankingTrainer . Options { NumberOfTrees = 2 , NumberOfThreads = 1 , } ) ;
505- // Todo #2920: Make this fail somehow.
506- var rankingPipeline = mlContext . Transforms . Concatenate ( "Features" , Iris . Features )
507- . AppendCacheCheckpoint ( mlContext )
508- . Append ( mlContext . Transforms . Conversion . MapValueToKey ( "Label" ) )
509- . Append ( mlContext . MulticlassClassification . Trainers . OneVersusAll ( rankingTrainer ) )
510- . Append ( mlContext . Transforms . Conversion . MapKeyToValue ( "PredictedLabel" ) ) ;
511-
512- // Fit the invalid pipeline.
513- Assert . Throws < ArgumentOutOfRangeException > ( ( ) => rankingPipeline . Fit ( data ) ) ;
514-
515- // Create a model training an OVA trainer with a regressor.
516- var regressionTrainer = mlContext . Regression . Trainers . PoissonRegression (
517- new PoissonRegressionTrainer . Options { MaximumNumberOfIterations = 10 , NumberOfThreads = 1 , } ) ;
518- // Todo #2920: Make this fail somehow.
519- var regressionPipeline = mlContext . Transforms . Concatenate ( "Features" , Iris . Features )
520- . AppendCacheCheckpoint ( mlContext )
521- . Append ( mlContext . Transforms . Conversion . MapValueToKey ( "Label" ) )
522- . Append ( mlContext . MulticlassClassification . Trainers . OneVersusAll ( regressionTrainer ) )
523- . Append ( mlContext . Transforms . Conversion . MapKeyToValue ( "PredictedLabel" ) ) ;
524-
525- // Fit the invalid pipeline.
526- Assert . Throws < ArgumentOutOfRangeException > ( ( ) => regressionPipeline . Fit ( data ) ) ;
527469 }
528470 }
529471}
0 commit comments