Skip to content

Added own code and answers to assignment_2 notebook#2

Open
amera6 wants to merge 1 commit intomainfrom
assignment-2
Open

Added own code and answers to assignment_2 notebook#2
amera6 wants to merge 1 commit intomainfrom
assignment-2

Conversation

@amera6
Copy link
Copy Markdown
Owner

@amera6 amera6 commented Dec 6, 2025

What changes are you trying to make? (e.g. Adding or removing code, refactoring existing code, adding reports)

I inputted my own code into the notebook under the designated areas for assignment answers. This included: finding the shape of the MPG dataset, calculating the number of predictors, pulling the top 5 results with respects to horsepower, splitting data into a training and testing set, running a multivariate linear regression model, and calculating the RMSPE after predicting on the testing set. I also answered the three short answer questions regarding bivariate regression plots.

What did you learn from the changes you have made?

I learned how to run a multivariate linear regression using Python. This is new to me as all of my regression/biostatistics training has been done in R.

Was there another approach you were thinking about making? If so, what approach(es) were you thinking of?

I was testing out ways to calculate the number of predictor variables without hardcoding any numbers, however, I did not know how to do this while keeping the answer to just one line of code.

Were there any challenges? If so, what issue(s) did you face? How did you overcome it?

I was initially having trouble working though the regression code as I didn't know how to properly index the numerical predictor variables. I was getting confused as to whether my numeric_predictors variable needed to be a list of names or a dataframe itself. After running into multiple errors that had very long messages that were hard to interpret, I ran the regression code and error message into ChatGPT to help me understand where I was going wrong. After this, I was able to understand that numeric_predictors needed to a dataframe since later in the code there is the .columns method applied which can only work on dataframes.

How were these changes tested?

I either re-executed the code cells if I wanted to test out the whole chunk, or I would create a new temporary cell to test out single lines of code. If the code ran properly, I would input that line into the original code cell and delete the temporary one.

A reference to a related issue in your repository (if applicable)

Checklist

  • I can confirm that my changes are working as intended

Copy link
Copy Markdown

@anjali-deshpande-hub anjali-deshpande-hub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants