1. Learn
  2. /
  3. Courses
  4. /
  5. Introduction to Linear Modeling in Python

Connected

Exercise

Linear Model in Oceanography

Time-series data provides a context in which the "slope" of the linear model represents a "rate-of-change".

In this exercise, you will use measurements of sea level change from 1970 to 2010, build a linear model of that changing sea level and use it to make a prediction about the future sea level rise.

Instructions

100 XP
  • Import and use LinearRegression(fit_intercept=True) to initialize a linear model.
  • Pass in the pre-loaded and reshaped years and levels data into model.fit() to fit the model.
  • Use model.predict() to predict a single future_level for future_year = 2100 and print() the result.
  • Use model.predict() to forecast many levels_forecast and plot the result with the pre-defined plot_data_and_forecast().