简体   繁体   English

多组的随机森林回归

[英]Random Forest Regression for Multiple Groups

I have monthly weather data all sampled from the past four years for about 50 different locations.我收集了过去四年中大约 50 个不同地点的所有月度天气数据。 Is there a way I can create a singular Random Forest Regression model that creates predictions for all 50 locations on their own?有没有一种方法可以创建一个奇异的随机森林回归模型,它可以自己为所有 50 个位置创建预测? I don't want to have to create 50 different models, as that seems time-expensive.我不想创建 50 个不同的模型,因为这似乎很耗时。 I don't think one-hot-encoding the names of the locations works, because the train/test/split then only takes the data from one of the locations to test with.我认为对位置名称进行一次热编码是行不通的,因为 train/test/split 然后只从其中一个位置获取数据进行测试。

My data looks something like this:我的数据看起来像这样:

Month Year Location Temp月 年 地点 温度

3 2018 city1 42 3 2018 城市1 42

3 2018 city2 50 3 2018 城市2 50

3 2018 city3 30 3 2018 城市3 30

4 2018 city1 50 4 2018 城市1 50

4 2018 city2 55 4 2018 城市2 55

4 2018 city3 60 4 2018 城市3 60

... ...

12 2021 city1 20 12 2021 城市1 20

12 2021 city2 40 12 2021 城市2 40

12 2021 city3 30 12 2021 城市3 30

And I want predictions for the next x number of months for city1, city2, city3, and so on.我想要预测 city1、city2、city3 等接下来的x个月。

I think Random Forest Regression is not the most appropriate model for this kind of task.我认为随机森林回归不是这类任务最合适的模型。 A more appropriate model is a Recurrent Neural Network (RNN).更合适的模型是循环神经网络 (RNN)。 Your problem fits exactly as a many-to-many sequence prediction as described in this blog.您的问题完全符合博客中描述的多对多序列预测。

In your skin, I would create a list of 50 RNN models and train for each city separately (can be done programmatically and reasonably quick with multiple processes and threads depending on the power of your computer and the size of your data).在你的皮肤中,我会创建一个包含 50 个 RNN 模型的列表,并分别为每个城市进行训练(可以通过多个进程和线程以编程方式和相当快的速度完成,具体取决于你的计算机的能力和数据的大小)。

To get a startup code, you can google many-to-many model prediction with RNN .An example is this blog post.要获得启动代码,您可以使用 RNN 谷歌多对多模型预测。例如这篇博文。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM