# Introduction to AI

# Module 6: Introduction to machine learning

## Summary

**Topics**: This is the first module that will get us into machine learning. We will cover the following:- An overview of machine learning and the types of methods in ML
- Very simple unsupervised and supervised methods include clustering, local learning, and regression

**Length**: This module will take one week to complete**Assigned chapters:**Most of Chapter 19 (we will finish it in the next module)

## machine learning

What is machine learning and how has AI become synonymous with ML in the mainstream media? If you refer back to our Venn diagram on the home page of the class, you will note that AI is larger than ML, yet the AI that is in the news is mostly ML.

Machine learning focuses on adaptive methods, or those methods that can adapt the behavior of the agent over time given experience in the environment. The AI methods we have studied so far have not been adaptive. Even when we did replanning (through contingency plans or execution monitoring and replanning), the plan was not adapting to new experiences.

Since there are several full classes at OU on machine learning and since this is an overview class (see the diagram posted in announcements to learn more), we will not dive deeply into any of the ML topics but will give an overview of a wide variety of machine learning methods. This module specifically gets us started on what machine learning is and discusses some of the simple ML methods. Later modules will jump more into specific ML methods.

Arthur Samuel, shown on the right, was one of the early pioneers of ML, working to develop a machine learning checkers player in 1955! You can read a short history of his player here. His player was inspirational for many beginning ML. Furthermore, games are a really fun way to get more people interested in AI in the first place – they get involved in playing games and want to make the AI play better!

### ML Checkers

Arthur Samuel, one of the pioneers of ML

Developed an ML checkers player similar to Reinforcement Learning

Students play the most checkers games at once

How many can we get interested in AI if we teach them to develop AI checkers players?

## Assignments for Module 6

### Topic 1: Introduction to machine learning

Before we jump into machine learning methods, we need to understand some fundamentals of ML! This topic will cover the basics of the types of ML methods,

- (30 min) Reading
- Read Section 19-19.2 (Introduction through Supervised Learning)

- (30 min) ML introduction
- Complete the exercise on the introduction to machine learning

### Topic 2: how to train ML

When I present this in in-person class, I usually discuss training after we do some specific models. But the new version of the book has this before the other methods we are doing in this module so I’m going to have you read about it here. If it feels out of order or feels too general (e.g. you need some methods to make it more concrete), feel free to do Topics 3 & 4 and then come back to this topic. The goal of what we will discuss in this topic is how you should train machine learning models, how to evaluate performance, and how to recognize overfitting and to hopefully stop it from happening.

- (30 min) Reading
- Read Section 19.4 (yes, we skipped 19.3, that will be the focus of the next module! This one is on Model Selection and Optimization)

- (30 min)
- What is overfitting? How does it affect how we should train our ML model? Watch the video to learn about training/testing/validation sets and hyperparameters.
- Copy of the slides
- A quick article on over and underfitting in ML

- How should we evaluate our ML models? What is a good performance metric?
- Copy of the slides
- Please read more about the MANY different ways to evaluate models at this webpage (this is the one referenced in the video)
- AI2ES had an excellent discussion about ML verification recently. If you go to this link, the 2nd talk (30 min) focuses on verification of models. The slides and full links to all talks are here.

- What is a learning curve? How do I know if my model is really learning?
- Copy of the slides

- What does the training data usually look like? This is a super short video just to make sure we are on the same page for notation for the methods in this module
- Copy of the slides

- What is overfitting? How does it affect how we should train our ML model? Watch the video to learn about training/testing/validation sets and hyperparameters.
- Complete the exercise on training ML methods

### Topic 3: linear regression

The first learning method we are going to study is one of the simplest yet it is very powerful! Regression is sometimes seen as a statistics method (remember our Venn diagram on the homepage!) yet it is also an ML method. We will study regression (predicting real numbers) and logistic regression (predicting classes) in this topic.

- (30 min) Reading
- Read Section 19.6 (we skipped over 19.5, read Linear Regression and Classification)

### Topic 4: clustering and nearest neighbors

For the final topic in the introduction to ML, we will explore a few fun, easy, and incredibly useful ML methods. The first is clustering, and the second and third are lazy learning methods, where the data form the model rather than learning a specific model. Enjoy!

- (30 min) Reading
- Read Section 19.7 (Nonparametric models)

- (30 min)
- K-means clustering
- Copy of the slides from me, copy of the slides I also showed from Dr Moore

- K-nearest neighbors and kernel regression
- Copy of the slides from me, copy of the slides I also showed from Dr Moore
- Note that there is a more advanced but still conceptually simple and powerful method shown in the end of his slides which I did not cover but might be useful for one of your ML projects: locally weighted regression. Feel free to read about it in the slides and to use it in the project if you think it would be a good fit!

- K-means clustering
- Complete the exercise on clustering and kernel regression

## project for module 6

### Project

There is no new project assigned this module (you will have two projects in machine learning but not assigned here!). However, you should be working hard on Project 4!

## suggested schedule for module 6

### week 1 (Oct 17-24)

- Monday-Tuesday: Complete Topics 1 & 2 (they are both short)
- Wednesday-Thursday: Complete Topic 3
- Friday-Sunday: Complete Topic 4