Added own code and answers to assignment_2 notebook#2
Open
Conversation
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 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_predictorsvariable 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 thatnumeric_predictorsneeded to a dataframe since later in the code there is the.columnsmethod 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