machinelearning icon indicating copy to clipboard operation
machinelearning copied to clipboard

Cannot combine OneVersusAll with FieldAwareFactorizationMachine

Open rauhs opened this issue 8 years ago • 9 comments

The following:

OneVersusAll.With(new FieldAwareFactorizationMachineBinaryClassifier(), false);

throws a Predictor doesn't implement the expected interface. How could I combine the two?

rauhs avatar Jul 27 '18 09:07 rauhs

Thanks for reporting, @rauhs. We should update The FieldAwareFactorizationMachineBinaryClassifier to implement the IValueMapper interface.

sfilipi avatar Jul 30 '18 15:07 sfilipi

Any update on this?

rauhs avatar Oct 09 '18 06:10 rauhs

No. This is still an outstanding issue. How important is it for you @rauhs ?

Zruty0 avatar Nov 05 '18 17:11 Zruty0

I guess not all that important after all. I just wanted to try it out.

rauhs avatar Nov 08 '18 06:11 rauhs

FieldAwareFactorizationMachine doesn't implement the correct interface. Neither of the casts below work, which means OVA cannot use FAF.

var mlContext = new MLContext();
var faf = mlContext.BinaryClassification.Trainers.FieldAwareFactorizationMachine(new[] { "Features" });

var invalidCast = faf as
    ITrainerEstimator<
        ISingleFeaturePredictionTransformer<IPredictorProducing<float>>,
        IPredictorProducing<float>>;

var invalidCast2 = faf as
    ITrainerEstimator<
        IPredictionTransformer<IPredictorProducing<float>>,
        IPredictorProducing<float>>;

var ova = mlContext.MulticlassClassification.Trainers.OneVersusAll(faf);

Before changing OVA to take IPredictionTransformer instead of ISingleFeaturePredictionTransformer, FAF needs further work to implement one of the interfaces above. @sfilipi / @Ivanidzo4ka do you know how to do it? FAF interface looks different than other BinaryClassifiers (say Sdca): image

shmoradims avatar Nov 29 '18 23:11 shmoradims

After spending some time on this, I realized that FAF is the only binary trainer with multiple feature columns (string[] featureColumns), whereas other trainers have only one feature column. This is making FAF an odd trainer that doesn't fit the existing interfaces. We'd need to adjust all the trainer interfaces to accommodate this case. This won't be a trivial fix.

Given that @rauhs thinks this is not an important scenario, I'm putting this item in the backlog to be visited later.

shmoradims avatar Nov 30 '18 23:11 shmoradims

Notable: FieldAwareFactorizationMachine is the only of our binary learners which doesn't work with OVA.

justinormont avatar Dec 04 '18 10:12 justinormont

@wschin What is the status on this?

codemzs avatar Jun 30 '19 04:06 codemzs

Unassigning @wschin as he is on other topics.

justinormont avatar May 10 '21 18:05 justinormont