Data Collection
First things first, I needed data. I started to find some websites for historical NBA game data. I focused on getting the results of the Knicks and Magic games, like, their scores, who won, and maybe some basic stats.
- I Hunted Down Past Game Results: Found some good, Free to use datasets of scores and key stats.
- I Grabbed Some Basic Stats: I looked at things like points per game, field goal percentage, maybe some rebounding numbers.
Simple stuff.
Data Cleaning

After collect the data I need, I have to do some basic data cleaning:
- Checked the Format: Ensure the date, team names, and score are in a consistent format.
- Fixed Data Types: Convert scores to numbers.
Feature Engineering
Now that I do some data cleaning, Time for some simple feature engineering:
- Win/Loss Column: Create a column indicating whether the team I'm focusing on won (1) or lost (0) the game.
- Home/Away Indicator: Add a column specifying if the team was playing at home (1) or away (0).
Simple Model Building
Now, I need to build a simple model for prediction. I thought a simple model would be a good starting point. I basically just wanted to see if I could predict a win or a loss.
- I Chose a Basic Model: I went with a logistic regression. It's pretty straightforward for this kind of yes/no prediction.
- I Split the Data: I took my data and split it into a "training" set and a "testing" set. The training set is what the model learns from, and the testing set is what I use to see how well it does.
- I Trained the Model: I fed the training data to the model and let it do its thing. It's basically figuring out the relationship between the stats and whether the team won or lost.
Model Evaluation
- I Tested the Model: I used the testing data to see how well the model predicted the outcomes. Got a simple accuracy score.
Model Refinement
Based on the evaluation of the initial model, I have to explore the following refinements:
- Feature Selection: Try different combinations of features to see which ones improve the model's performance.
- Parameter Tuning: Adjust the settings of the model to optimize its accuracy.
Making Predictions
Finally, I'm able to predict the outcome of future games. I just get the same kind of stats for an upcoming game, plug them into my model, and see what it spits out. Of course, it's just a prediction, not a guarantee!
So, that's how I spent my time today. It was a fun little project, and who knows, maybe I'll actually get pretty good at predicting these games. Or maybe not, it all depend, but it's a good experience anyway!