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

按照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),                                }                }                );

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


回答:

月份特征是可以的(你也可以将其转换为分类特征)。它与温度、白天时间、天气状况等相关。但日期如果不处理是不好的。你应该使用日期年份特征生成新的特征,如周末节假日。这个问题有一个很好的示例,请查看:

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

Related Posts

使用LSTM在Python中预测未来值

这段代码可以预测指定股票的当前日期之前的值,但不能预测…

如何在gensim的word2vec模型中查找双词组的相似性

我有一个word2vec模型,假设我使用的是googl…

dask_xgboost.predict 可以工作但无法显示 – 数据必须是一维的

我试图使用 XGBoost 创建模型。 看起来我成功地…

ML Tuning – Cross Validation in Spark

我在https://spark.apache.org/…

如何在React JS中使用fetch从REST API获取预测

我正在开发一个应用程序,其中Flask REST AP…

如何分析ML.NET中多类分类预测得分数组?

我在ML.NET中创建了一个多类分类项目。该项目可以对…

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注