Skip to content

Unintuitive error when giving array to OneHotEncoder #2678

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
rauhs opened this issue Feb 21, 2019 · 1 comment · Fixed by #3763
Closed

Unintuitive error when giving array to OneHotEncoder #2678

rauhs opened this issue Feb 21, 2019 · 1 comment · Fixed by #3763
Assignees
Labels
bug Something isn't working

Comments

@rauhs
Copy link
Contributor

rauhs commented Feb 21, 2019

The following will throw a very ugly exception only when calling Preview() and not before:

    public class MlDataEx
    {
      public string[] A { get; set; }
      public MlDataEx(string a)
      {
        this.A = new[] { a };
      }
    }

    public static void MlStuff()
    {
      var ctx = new MLContext();
      var dv = ctx.Data.ReadFromEnumerable(new[] { new MlDataEx("A") });
      var data = ctx.Transforms.Categorical.OneHotEncoding("A").Fit(dv).Transform(dv).Preview();
    }
@Ivanidzo4ka Ivanidzo4ka self-assigned this Feb 21, 2019
@Ivanidzo4ka Ivanidzo4ka added the bug Something isn't working label Feb 21, 2019
@Ivanidzo4ka
Copy link
Contributor

Thank you for reporting this, and especially thank you for this wonderful snippet of code which allow to reproduce problem easily.

@shauheen shauheen added this to the 0219 milestone Feb 21, 2019
@shauheen shauheen removed this from the 0219 milestone Mar 5, 2019
codemzs added a commit to codemzs/machinelearning that referenced this issue May 22, 2019
codemzs added a commit that referenced this issue May 22, 2019
… resulting vector is sparse. (#3763)

* Create indicies array for sparse vector in KeyToValue transfomer only when resulting vector is sparse.

* PR feedback.

* cleanup.

* cleanup.

* port changes from PR #2678.
@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
3 participants