0

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 点钟的 Passagers 数量 Type 是日期的类型,例如 normal=monday to friday Xmas 等


两个问题

我不知道为什么 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),

                                }
                }
                );

对不起我的英语不好,提前谢谢

4

1 回答 1

0

月份特征没问题(您也可以将其转换为分类特征)它与温度、白​​天时间、天气条件等有关。但不经过处理是不好的。您应该使用周末假期等日期年份功能生成新功能。这个问题有一个很好的示例,请查看:

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

于 2019-03-07T21:13:46.180 回答