Skip to content

Comments

Better answers in Linear Regression exercise#108

Open
jorgeorpinel wants to merge 3 commits intogoogle:mainfrom
jorgeorpinel:main
Open

Better answers in Linear Regression exercise#108
jorgeorpinel wants to merge 3 commits intogoogle:mainfrom
jorgeorpinel:main

Conversation

@jorgeorpinel
Copy link

@jorgeorpinel jorgeorpinel commented Feb 17, 2026

This notebook is linked from https://developers.google.com/machine-learning/crash-course/linear-regression/programming-exercise

Suggested improvements:

  1. Better code to get the most common payment type
  2. Improved explanation around how fast the first experiment converges:
    • Epoch no. 5 in the plot is actually the 6th epoch (since they're 0-indexed)
    • Quantified how well the model fits the data, putting RMSE in context
  3. Expands explanation around a larger batch size (2nd set of experiments): The reason 20 epochs are not enough for the training to converge is that the model "learns" less times in each epoch.

Note: A helper notebook used for this PR can be found and run at https://colab.research.google.com/drive/16xShaKthamjBGkSWM2gqIo3pB1xvYwLA .

@jorgeorpinel jorgeorpinel changed the title A few improvements to answers in the main Linear Regression exercise Better answers in Linear Regression exercise Feb 17, 2026
"source": [
"#@title Double-click to view answers about the correlation matrix\n",
"\n",
"# Which feature correlates most strongly to the label FARE?\n",
Copy link
Author

Choose a reason for hiding this comment

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

Here, the answer could use this code:

training_corr['FARE'].abs().nlargest(2).index[1]

"print(answer)\n",
"\n",
"\n",
"# Which feature correlates least strongly to the label FARE?\n",
Copy link
Author

Choose a reason for hiding this comment

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

And here:

training_corr['FARE'].abs().nsmallest(2).index[0]

Copy link
Author

@jorgeorpinel jorgeorpinel left a comment

Choose a reason for hiding this comment

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

Just noticed another potential improvement ☝🏼

Left comments instead of updating the PR code since the repo seems to be inactive (no response at all here)...

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.

1 participant