按照MS的示例进行操作
https://github.com/tautvydasversockas/TaxiFarePrediction/blob/master/TaxiFarePrediction/Program.cs
任务
我的项目是预测特定时间的乘客数量,例如
输入 年=2018,月=10,日=24,类型=normal输出是Count = 2180
我有一个简单的csv文件,大约1800行
日,月,年,小时,数量,类型24,10,2018,7,1860,normal..
数量是7点钟的乘客数,类型是日期的类型,如normal=周一到周五,Xmas等
两个问题
我不知道为什么日、月、年、小时、数量的数据类型是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[] {//我更倾向于它们是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), } } );
对不起我的英语不好,提前谢谢你
回答:
月份特征是可以的(你也可以将其转换为分类特征)。它与温度、白天时间、天气状况等相关。但日期如果不处理是不好的。你应该使用日期和年份特征生成新的特征,如周末、节假日。这个问题有一个很好的示例,请查看: