@@ -305,6 +305,36 @@ public void TestPfiBinaryClassificationOnSparseFeatures(bool saveModel)
305305
306306 Done ( ) ;
307307 }
308+
309+ [ Fact ]
310+ public void TestBinaryClassificationWithoutCalibrator ( )
311+ {
312+ var dataPath = GetDataPath ( "breast-cancer.txt" ) ;
313+ var ff = ML . BinaryClassification . Trainers . FastForest ( ) ;
314+ var data = ML . Data . LoadFromTextFile ( dataPath ,
315+ new [ ] { new TextLoader . Column ( "Label" , DataKind . Boolean , 0 ) ,
316+ new TextLoader . Column ( "Features" , DataKind . Single , 1 , 9 ) } ) ;
317+ var model = ff . Fit ( data ) ;
318+ var pfi = ML . BinaryClassification . PermutationFeatureImportance ( model , data ) ;
319+
320+ // For the following metrics higher is better, so minimum delta means more important feature, and vice versa
321+ Assert . Equal ( 7 , MaxDeltaIndex ( pfi , m => m . AreaUnderRocCurve . Mean ) ) ;
322+ Assert . Equal ( 1 , MinDeltaIndex ( pfi , m => m . AreaUnderRocCurve . Mean ) ) ;
323+ Assert . Equal ( 3 , MaxDeltaIndex ( pfi , m => m . Accuracy . Mean ) ) ;
324+ Assert . Equal ( 1 , MinDeltaIndex ( pfi , m => m . Accuracy . Mean ) ) ;
325+ Assert . Equal ( 3 , MaxDeltaIndex ( pfi , m => m . PositivePrecision . Mean ) ) ;
326+ Assert . Equal ( 1 , MinDeltaIndex ( pfi , m => m . PositivePrecision . Mean ) ) ;
327+ Assert . Equal ( 3 , MaxDeltaIndex ( pfi , m => m . PositiveRecall . Mean ) ) ;
328+ Assert . Equal ( 1 , MinDeltaIndex ( pfi , m => m . PositiveRecall . Mean ) ) ;
329+ Assert . Equal ( 3 , MaxDeltaIndex ( pfi , m => m . NegativePrecision . Mean ) ) ;
330+ Assert . Equal ( 1 , MinDeltaIndex ( pfi , m => m . NegativePrecision . Mean ) ) ;
331+ Assert . Equal ( 2 , MaxDeltaIndex ( pfi , m => m . NegativeRecall . Mean ) ) ;
332+ Assert . Equal ( 1 , MinDeltaIndex ( pfi , m => m . NegativeRecall . Mean ) ) ;
333+ Assert . Equal ( 3 , MaxDeltaIndex ( pfi , m => m . F1Score . Mean ) ) ;
334+ Assert . Equal ( 1 , MinDeltaIndex ( pfi , m => m . F1Score . Mean ) ) ;
335+ Assert . Equal ( 7 , MaxDeltaIndex ( pfi , m => m . AreaUnderPrecisionRecallCurve . Mean ) ) ;
336+ Assert . Equal ( 1 , MinDeltaIndex ( pfi , m => m . AreaUnderPrecisionRecallCurve . Mean ) ) ;
337+ }
308338 #endregion
309339
310340 #region Multiclass Classification Tests
0 commit comments