dotnet / dotnet/machinelearning
Cannot use LearnerFeatureSelectionTransform due to "does not derive from 'Microsoft.ML.ITrainer" error
- Dominant language
- C#
- Stars
- 9.4k
- Forks
- 2k
- Avg merge
- 2d 20h
- Merged PRs (30d)
- 11
Description
### System information
- **OS version/distro**: ubuntu 18.04
- **.NET Version (eg., dotnet --info)**: 2.1
### Issue
- **What did you do?**
I build mlnet from source and I'm running a command like this:
`dotnet path_to/MML.dll Train trainer=LightGBMBinary{} loader=TextLoader{col=Label:R4:0 col=Features:R4:1-5 col=Text:TX:6 hasHeader=-} xf=TextTransform{col=TextTransformed:Text wordExtractor=NGramExtractorTransform{ngram=2}} xf=LearnerFeatureSelectionTransform{topk=1000 f=AveragedPerceptron{iter=10} feat=TextTransformed} xf=Concat{col=Features:Features,TextTransformed} cache=- randomSeed=1 norm=No v=+`
- **What happened?**
The program failed with this error:
Error during class instantiation
Loadable class 'AveragedPerceptron' does not derive from 'Microsoft.ML.ITrainer`1[[Microsoft.ML.Model.IPredictorWithFeatureWeights`1[[System.Single, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], Microsoft.ML.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51]]'
Exception context:
Throwing component: Environment
- **What did you expect?**
I expected it to train a model using the LearnerFeatureSelectionTransform on the Text features.
I think it may be related to this issue: https://github.com/dotnet/machinelearning/issues/726
The code has this comment which may also be related. https://github.com/dotnet/machinelearning/blob/5dbfd8acac0bf798957eea122f1413209cdf07dc/src/Microsoft.ML.Transforms/LearnerFeatureSelection.cs#L43
// ML.Transforms doesn't have a direct reference to ML.StandardTrainers, so use ComponentCatalog to create the Filter
Contributor guide
Assessment
This issue has not been assessed yet.