Session Ready
Exercise

Visualizing the RSS Minima

In this exercise you will compute and visualize how RSS varies for different values of model parameters. Start by holding the intercept constant, but vary the slope: and for each slope value, you'll compute the model values, and the resulting RSS. Once you have an array of RSS values, you will determine minimal RSS value, in code, and from that minimum, determine the slope that resulted in that minimal RSS.

Use pre-loaded data arrays x_data, y_data, and empty container rss_list to get started.

Instructions
100 XP
  • For each trial value a1 in a1_array, use model() to predict the model value, and then compute_rss() with y_data, y_model, store the output rss_value in rss_list.
  • Convert rss_list to a np.array(), then use np.min() to find the minimum value in rss_array.
  • Use np.where() to find the corresponding trial value and assign the result to best_a1.
  • Use plot_rss_vs_parameters() to visually confirm your values agree with the figure shown.