使用错误的数据类型加载数据

load data with wrong datakind

MS

关注样本

https://github.com/tautvydasversockas/TaxiFarePrediction/blob/master/TaxiFarePrediction/Program.cs


任务

我的项目是预测特定时间的乘客数量,例如


Input 
Year=2018,Month=10,Day=24,Type=normal
and the output is
Count = 2180

我有一个简单的csv文件,大约1800行

Day,Month,Year,Hour,Count,Type
24,10,2018,7,1860,normal
.
.

Count 是 7 点钟的乘客数 Type 是日期的类型,例如 正常=周一到周五 圣诞节等


两个问题

我不知道为什么日、月、年、小时数的DataKind是R4,不应该是I4吗?

  public int Day;
  new TextLoader.Column("Day", DataKind.R4, 0),

低准确度 我试过 "FastTree" , "FastForest" 实际是2860人,结果是53人 我有 1800 行数据 我选择了其中的 1300 个作为训练数据 保留作为评估的测试数据 为我的预测留了一天

     public class TaxiTrip
            {
                [Column("0")]
                public float Day;

                [Column("1")]
                public float Month;

                [Column("2")]
                public float Year;

                [Column("3")]
                public float Hour;

                [Column("4")]
                public float Count;

                [Column("5")]
                public string Type;


            }

            public class TaxiTripFarePrediction
            {
                [ColumnName("Score")]
                public int predictCount;
            }
    _textLoader = mlContext.Data.CreateTextLoader(new TextLoader.Arguments()
                {
                    Separators = new[] { ',' },
                    HasHeader = true,
                    Column = new[]
                                {
//i prefer they are DataKind.I4
                                    new TextLoader.Column("Day", DataKind.R4, 0),
                                    new TextLoader.Column("Month", DataKind.R4, 1),
                                    new TextLoader.Column("Year", DataKind.R4, 2),
                                    new TextLoader.Column("Hour", DataKind.R4, 3),
                                    new TextLoader.Column("Count", DataKind.R4, 4),
                                    new TextLoader.Column("Type", DataKind.Text, 5),

                                }
                }
                );

抱歉我的英语不好, 在此先感谢

month特征就可以了(也可以转换成分类特征)。它与温度、白​​天时间、天气条件等相关。但是 day 不处理是不好的。您应该使用 dayyear 功能生成新功能,例如 weekendholiday 。这个问题有一个很好的示例,请查看:

https://github.com/dotnet/machinelearning-samples/tree/master/samples/csharp/getting-started/Regression_BikeSharingDemand