Assignment 2 - #2
Open
alf-99 wants to merge 2 commits into
Open
Conversation
added 2 commits
January 19, 2026 01:18
- Load price data from parquet files - Create lag features, returns, and price ranges - Convert to pandas and calculate moving averages - Answer written analysis questions
- Built four model pipelines with different preprocessors and regressors - LinearRegression with simple preprocessing performed best (MSE: -4351.6) - Fixed OneHotEncoder issue with handle_unknown='ignore' - Analyzed feature importance using LinearRegression coefficients - Exported best model as pickle file
fyellow
suggested changes
Jan 28, 2026
fyellow
left a comment
There was a problem hiding this comment.
Good work overall! SHAP was not actually used you relied on linear model coefficients. Please redo and submit
Owner
Author
|
Hi, I have tried installing SHAP in many ways. Including the steps outlined in slack thread by Jesus. And several other configurations. It just not working on the environment. Please kindly provide a fix from the environment file if possible. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes are you trying to make? (e.g. Adding or removing code, refactoring existing code, adding reports)
I completed Assignment 2 on forest fire prediction. The main changes were:
-Loading and preprocessing the forest fire dataset (13 features, 517 samples).
-Creating two different preprocessing pipelines (simple scaling vs scaling + log transform).
-Building four model combinations: LinearRegression + kNN + RandomForest with both preprocessors.
-Tuning hyperparameters using GridSearchCV with 5-fold cross-validation.
-Evaluating models using negative mean squared error.
-Analyzing feature importance using LinearRegression coefficients.
-Saving the best-performing model (though pickle file not included per submission rules).
What did you learn from the changes you have made?
-How to construct multiple pipeline combinations for systematic comparison.
-That simple LinearRegression can outperform more complex models like RandomForest on some datasets.
-The importance of handling unknown categories in OneHotEncoder during cross-validation (used handle_unknown='ignore').
-How to extract and interpret feature importance from linear models.
-That month features (September, October) were most predictive of forest fire area, suggesting strong seasonal patterns.
Was there another approach you were thinking about making? If so, what approach(es) were you thinking of?
I considered using more advanced models like GradientBoosting or SVR, but kept RandomForest as the "advanced" model as required.
For feature importance, I wanted to use SHAP but installation failed, so I used LinearRegression coefficients instead.
Were there any challenges? If so, what issue(s) did you face? How did you overcome it?
-OneHotEncoder issue: Cross-validation folds had missing month categories (e.g., 'dec', 'nov' in some folds but not others). This caused "unknown categories" errors.
Solution: Added handle_unknown='ignore' to OneHotEncoder, which encodes unknown categories as zeros.
-SHAP installation: Couldn't install SHAP due to environment issues. Also it took long time to grasp the necessary info.
Solution: Used LinearRegression coefficients for feature importance analysis instead.
-Model performance interpretation: Negative MSE scores were confusing at first.
Solution: Realized higher (less negative) scores indicate better performance.
How were these changes tested?
-Used 5-fold cross-validation for all model evaluations.
-Compared four different pipeline configurations systematically.
-Verified all code runs from top to bottom without errors.
A reference to a related issue in your repository (if applicable)
N/A - This is Assignment 2 submission.
Checklist