Machinelearning: Unintuitive error when giving array to OneHotEncoder

Created on 21 Feb 2019  路  1Comment  路  Source: dotnet/machinelearning

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();
    }
bug

Most helpful comment

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

>All comments

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rebecca-burwei picture rebecca-burwei  路  3Comments

frankhaugen picture frankhaugen  路  3Comments

maxt3r picture maxt3r  路  3Comments

pgovind picture pgovind  路  3Comments

daholste picture daholste  路  3Comments