A machine learning project that predicts ice cream profits based on temperature using linear regression. The model is trained on historical data and can make predictions for any given temperature in Celsius.
The project uses a dataset from Kaggle that contains historical data of ice cream sales and corresponding temperatures: Temperature and Ice Cream Sales Dataset
- Temperature conversion from Fahrenheit to Celsius
- Linear regression model for profit prediction
- Interactive visualization of predictions
- Historical data visualization
- Beautiful matplotlib plots with custom styling
The project uses the following Python packages:
kagglehub: For downloading the datasetpandas: For data manipulation and analysisnumpy: For numerical operationsscikit-learn: For the linear regression modelmatplotlib: For creating visualizationsseaborn: For enhanced plot styling
- Clone the repository:
git clone https://github.com/JulianSchwabCommits/IceCreamSalesVsTemperature.git
cd IceCreamSalesVsTemperature- Install the required packages:
pip install -r requirements.txt- Train the model:
python train_model.pyThis will:
- Download the dataset
- Convert temperatures to Celsius
- Train the linear regression model
- Save the model as 'ice_cream_model.pkl'
- Make predictions:
python predict.pyThis will:
- Load the trained model
- Prompt you to enter a temperature in Celsius
- Display a visualization showing:
- Historical data points (blue dots)
- Regression line (green line)
- Your prediction point (red dot)