简体   繁体   中英

Random Forest Regression for Multiple Groups

I have monthly weather data all sampled from the past four years for about 50 different locations. Is there a way I can create a singular Random Forest Regression model that creates predictions for all 50 locations on their own? I don't want to have to create 50 different models, as that seems time-expensive. 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.

My data looks something like this:

Month Year Location Temp

3 2018 city1 42

3 2018 city2 50

3 2018 city3 30

4 2018 city1 50

4 2018 city2 55

4 2018 city3 60

...

12 2021 city1 20

12 2021 city2 40

12 2021 city3 30

And I want predictions for the next x number of months for city1, city2, city3, and so on.

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). 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).

To get a startup code, you can google many-to-many model prediction with RNN .An example is this blog post.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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