Skip to content

R4 label works with some but not all binary classification trainers #2750

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

Closed
daholste opened this issue Feb 26, 2019 · 2 comments · Fixed by #2804
Closed

R4 label works with some but not all binary classification trainers #2750

daholste opened this issue Feb 26, 2019 · 2 comments · Fixed by #2804
Assignees
Labels
bug Something isn't working
Milestone

Comments

@daholste
Copy link
Contributor

daholste commented Feb 26, 2019

This code:

using System;
using Microsoft.ML.Data;

namespace Microsoft.ML.Samples
{
    internal static class Program
    {
        static void Main(string[] args)
        {
            var context = new MLContext();
            var options = new TextLoader.Options()
            {
                Columns = new TextLoader.Column[]
                {
                    new TextLoader.Column("Label", DataKind.Single, 0),
                    new TextLoader.Column("Sentiment", DataKind.String, 1)
                },
                HasHeader = true
            };
            var loader = context.Data.CreateTextLoader(options);
            var data = loader.Read(@"C:\AutoMLDotNet\src\Samples\Data\wikipedia-detox-250-line-data.tsv");
            var estimator = context.Transforms.Text.FeaturizeText("Features", "Sentiment")
                .Append(context.BinaryClassification.Trainers.AveragedPerceptron());
            var transformer = estimator.Fit(data);
            var scoredData = transformer.Transform(data);
            var metrics = context.BinaryClassification.EvaluateNonCalibrated(scoredData);
            Console.WriteLine(metrics.Accuracy);
            Console.WriteLine("Press any key...");
            Console.ReadLine();
        }
    }
}

works great!

If you replace AveragedPerceptron with LogisticRegression, it throws the exception:

 'Schema mismatch for label column: expected Bool, got R4'

This may indicate a bug in label schema validation with some binary learners

@Ivanidzo4ka
Copy link
Contributor

related to #2628

@Ivanidzo4ka Ivanidzo4ka added the bug Something isn't working label Feb 27, 2019
@Ivanidzo4ka Ivanidzo4ka self-assigned this Feb 28, 2019
@eerhardt
Copy link
Member

eerhardt commented Mar 1, 2019

I'm not sure this meets "Project 13". I don't see how this would be an API breaking. We can fix this after v1 without a breaking change.

@TomFinley @shauheen

@shauheen shauheen added this to the 0319 milestone Mar 5, 2019
@ghost ghost locked as resolved and limited conversation to collaborators Mar 24, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants