ML Lab 05
ML Lab 05
BSE 7A
FALL 2024
LAB JOURNAL # 5
Lab Task # 1:
Load a dataset suitable for a regression problem (e.g., a dataset containing a single feature and
a target variable). Choose a degree for the polynomial regression (e.g., linear, quadratic, cubic).
Implement polynomial regression using Python libraries (e.g., scikit-learn) to fit the model to the
training data. Make predictions on the test data and evaluate the model's performance using
regression evaluation metrics (e.g., Mean Squared Error, R-squared). Visualize the polynomial
regression model along with the data points to see how well it fits the data. Experiment with
different polynomial degrees and observe how they affect the model's performance. Discuss the
trade-offs between underfitting and overfitting.
Lab Task # 2:
Load a dataset with multiple features and a target variable. Explore the dataset to understand its
structure, feature types, and the relationships between features and the target variable. Visualize
the data to identify any nonlinear patterns that may benefit from polynomial regression.
Preprocess the dataset as needed. Implement polynomial feature engineering by creating
polynomial features for the selected variables. Choose an appropriate degree for the polynomial
transformation (e.g., quadratic, cubic). Visualize the newly engineered features and their
relationship with the target variable. Implement polynomial regression using Python libraries
(e.g., scikit-learn) to fit the model to the training data. Utilize the polynomial features generated
in the previous step. Train the model and make predictions on the test data. Evaluate the
performance of the polynomial regression model using appropriate regression evaluation metrics
(e.g., Mean Squared Error, R-squared). Visualize the model's predictions and compare them to
the actual target values Experiment with different degrees for the polynomial features and
observe how they impact the model's performance. Discuss the trade-offs between model
complexity and performance Further, discuss the results, including insights gained from the
analysis, the importance of feature selection, and the trade-offs involved in choosing polynomial
degrees.
Conclusion:
All the tasks were performed successfully.