-
Notifications
You must be signed in to change notification settings - Fork 2.7k
LogisticRegression example using MNIST #327
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@matnatx The issue is we need to convert/map label column "Number" to a key using MapValueToKey() method during transformation so that the values of label column "Number" are converted into Numerical values and stored in key. (refer to this Microsoft documentation to know details of this API here
we need to use the name of key as LabelColumnName in the training algorithm.
After appending the trainer to pipeLine you can convert back the key to label column.
In SDCA trainer the mapping is done automatically. But for all other MultiClassClassification trainers we need to do explicit mapping of label. For more details please see the issues dotnet/machinelearning#2656, dotnet/machinelearning#2628, dotnet/machinelearning#3060 related to this. Please try the above code and Let me know if you still face any issue, ok? Adding @CESARDELATORRE for reference. |
The suggested code works! Many Thanks. |
@prathyusha12345 Thank you very much! This was very helpful. |
I am trying to change MNIST example that uses the StochasticDualCoordinateAscent to use LogisticRegression instead but get the following exception thrown:
Schema mismatch for label column '': expected Key, got R4
Parameter name: labelCol
Does anyone know what this means and how I can fix this?
I only changed:
var trainer = mLContext.MulticlassClassification.Trainers.StochasticDualCoordinateAscent(labelColumnName: "Number", featureColumnName: DefaultColumnNames.Features);
To:
var trainer = mLContext.MulticlassClassification.Trainers.LogisticRegression(labelColumnName: "Number", featureColumnName: DefaultColumnNames.Features);
Thanks!
The text was updated successfully, but these errors were encountered: