# How can I use patterns from data analysis to make a predictive machine learning model?

I'm trying to make a predictive model that can predict how well a product will sell in the future based on certain parameters. I've made some visualizations showing the relationship between the data. The visualization shows that there's a clear relationship between how warm it is outside and the amount of sales for a certain product.

I have 10 years worth of data for how much a product sold each week along with the temperature for each week. If I split the data, so I only have 8 years worth of data for how much it sold and keep the 10 years data of temperature, what ML algorithm would be best to use to predict the last 2 years of amount of sales?

First, you should categorize your variables. You have temperature data as a predictor/independent variable. Assuming you have the degree value of the temperature, your variable is numeric - which means you could treat it as a continuous variable. You could instead process your data and turn this into a ordinal categorical variable - but this would require you to select a threshold temperature $T_{0}$, and declare temperatures below $T_{0}$ to be 'cold' and temperature above $T_{0}$ to be 'hot'. Of course, you could also split up the temperature scale into more than one category if you thought a binary categorization lost too much information of value. And, of course, your decision for what value to use as $T_{0}$ will influence the predictive value of this transformation.