Administrative Information
Title | Linear Regression |
Duration | 60 |
Module | A |
Lesson Type | Practical |
Focus | Practical - AI Modelling |
Topic | AI modeling |
Keywords
linear regression, maximum likelihood, maximum a posteriori, basis functions,
Learning Goals
- To be able to fit a linear regression model using various estimation approaches and fitting methods with the use of Python and suitable packages
- To be able to use efficient matrix operations in linear regression
Expected Preparation
Learning Events to be Completed Before
Obligatory for Students
- A review of basic linear algebra and solving linear systems numerically.
Optional for Students
None.
References and background for students
- Scikit-learn documentation and examples: https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LinearRegression.html
Recommended for Teachers
- A review of how the numpy functions used in the notebook are parameterized.
Lesson materials
Instructions for Teachers
This learning event consist of laboratory tasks that shall be solved by the students with the help of the leading instructor.
Prepare a notebook environment with numpy, matplotlib and scikit-learn installed.
Outline/time schedule
Duration (min) | Description | Concepts |
---|---|---|
5 | Brief of the tasks to be conducted | |
5 | Generating linear datasets with Gaussian noise | additive noise, np.random.randn() |
15 | Fitting and evaluating linear regression models in via linear solvers | matrix operations in numpy, np.linalg.solve(), RMSE, plotting |
10 | Transforming samples and polynomial regression | Vandermonde-matrix, np.power.outer() |
10 | Fitting and evaluating linear models with regularization | Numerical stability, condition number, plotting |
15 | Fitting a linear model on real datasets | scikit-learn: StandardScaler(), LinearRegression() |
Acknowledgements
The Human-Centered AI Masters programme was Co-Financed by the Connecting Europe Facility of the European Union Under Grant №CEF-TC-2020-1 Digital Skills 2020-EU-IA-0068.