Skip to content

Exception using CollectionDataSource #156

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
mjmckp opened this issue May 15, 2018 · 4 comments
Closed

Exception using CollectionDataSource #156

mjmckp opened this issue May 15, 2018 · 4 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@mjmckp
Copy link

mjmckp commented May 15, 2018

System information

  • Windows 10 Pro 64 Bit
  • .NET framework 4.7
  • libraries built from master branch

Issue

The code below (a self-contained repro) throws a null reference exception on line

var peek = DataView._peeks[index] as Peek<TRow, TDst>;
since peek is null when attempting to get the value of the Label column.

        public class Data
        {
            [ColumnName("Features")]
            [VectorType(2)]
            public float[] Features;

            [ColumnName("Label")]
            public bool Label;
        }

        public class Prediction
        {
            [ColumnName("PredictedLabel")]
            public bool PredictedLabel;
        }

        static void Train(IEnumerable<Data> data)
        {
            var pipeline = new LearningPipeline();
            pipeline.Add(CollectionDataSource.Create(data));
            pipeline.Add(new FastForestBinaryClassifier());
            var model = pipeline.Train<Data, Prediction>();
        }

        static void Main(string[] args)
        {
            var data = new Data[1];
            data[0] = new Data();
            data[0].Features = new float[] { 0.0f, 1.0f };
            data[0].Label = false;

            Train(data);
        }
@shauheen shauheen added the bug Something isn't working label May 15, 2018
@shauheen shauheen added this to the 0518 milestone May 15, 2018
@Ivanidzo4ka
Copy link
Contributor

It sounds weird but we expect label column to be float value instead of bool. @TomFinley can probably add more details. Meanwhile, should we add converter inside pipeline? @GalOshri @shauheen

@mjmckp
Copy link
Author

mjmckp commented May 16, 2018

That's highly unintuitive given that the 1) label type, 2) predicted label type, and 3) classifier output type are all boolean.

@TomFinley
Copy link
Contributor

Hi @Ivanidzo4ka are we confident in this diagnosis? I think the trainer can accept bool values?

@Ivanidzo4ka
Copy link
Contributor

Should work now, addressed in #183.

@ghost ghost locked as resolved and limited conversation to collaborators Mar 30, 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

No branches or pull requests

4 participants