[PYTHON] Supervised learning (regression) 1 Basics

Aidemy 2020/10/28

Introduction

Hello, it is Yope! I am a liberal arts student, but I was interested in the possibilities of AI, so I went to the AI-specialized school "Aidemy" to study. I would like to share the knowledge gained here with you, and I am summarizing it on Qiita. I am very happy that many people have read the previous summary article. Thank you! This is the first post of supervised learning (regression). Nice to meet you.

What to learn this time ・ About supervised learning (regression) ・ Linear regression method

Supervised learning (regression)

(Review) Machine learning method

・ There are three methods for machine learning. "Supervised learning," "unsupervised learning," and "reinforcement learning." ・ Of these, supervised learning can be divided into two categories: “classification” and “regression”. The regression we learn this time predicts continuous values such as __stock prices and market prices. __

Linear regression

What is linear regression?

-Linear regression is __ that predicts the movement of the data after that from the formula (graph = linear) of the data that is already known. The graph at this time is always a straight line (linear function).

Coefficient of determination

-The coefficient of determination __ indicates how well the data predicted by linear regression and the actual data match. -In scikit-learn used for supervised learning, the coefficient of determination takes a value between __0 and __. It can be said that the larger the value, the higher the degree of agreement. -When outputting the coefficient of determination, use __print (model.score (test_X, test_y)) __.

Linear simple regression

-Linear simple regression is a linear regression __ that obtains one data (y) to be predicted from one data (x). -That is, it means that __a and b are inferred, assuming that the data can be represented by "y = ax + b". -For guessing a and b, one is the __least squares method __. This is to set a and b such that __ the sum of the squares of the difference between the actual y and the estimated y (that is, ax + b) is minimized. -The reason why the difference is squared by this method is that it is not necessary to consider the positive or negative of the data.

-To use linear (simple) regression, use __ "model = LinearRegression ()" __.

-Execute linear simple regression![Screenshot 2020-10-28 22.51.22.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/698700/81a106d8- 132a-1d47-1c60-aeb09af5f07b.png)

Linear multiple regression

-__ Linear multiple regression __ is a linear regression in which one data (y) is to be predicted and multiple data (x1, x2 ...) __ are used for the prediction. .. -That is, it means guessing a and b, assuming that the data can be represented by "y = a1x1 + a2x2 ... + b". -Even in linear multiple regression, the prediction of a and b is performed by the least squares method. -Also, you can use LinearRegression (). It automatically determines whether it is simple regression or multiple regression.

-Perform linear multiple regression![Screenshot 2020-10-28 22.52.10.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/698700/e8978f4f- 77ce-3b68-24fd-8d851359c030.png)

Summary

-Linear regression, which is one of supervised learning (regression), predicts the movement of data after that from an already known data formula (graph = linear). -Linear regression includes "linear simple regression" which predicts one and "linear multiple regression" which has multiple predictions.

This time is over. Thank you for reading until the end.

Recommended Posts

Supervised learning (regression) 1 Basics
Python: Supervised Learning (Regression)
Machine Learning: Supervised --Linear Regression
Basics of Supervised Learning Part 1-Simple Regression- (Note)
Supervised learning 1 Basics of supervised learning (classification)
Supervised learning (regression) 2 Advanced edition
Supervised machine learning (classification / regression)
Basics of Supervised Learning Part 3-Multiple Regression (Implementation)-(Notes)-
Python: Application of supervised learning (regression)
Unsupervised learning 1 Basics
Supervised learning (classification)
Python: Unsupervised Learning: Basics
Machine Learning: Supervised --AdaBoost
Machine learning logistic regression
Basics of regression analysis
Python: Supervised Learning (Classification)
Basics of Machine Learning (Notes)
Python: Supervised Learning: Hyperparameters Part 1
Supervised Learning 3 Hyperparameters and Tuning (2)
Understand machine learning ~ ridge regression ~.
Machine Learning: Supervised --Random Forest
Python: Supervised Learning: Hyperparameters Part 2
Supervised learning ~ Beginner's memo ~ (scikit-learn)
Machine learning stacking template (regression)
Supervised learning 2 Hyperparameters and tuning (1)
Machine Learning: Supervised --Decision Tree
Machine learning algorithm (logistic regression)
Machine learning beginners try linear regression
Machine learning algorithm (multiple regression analysis)
Machine learning algorithm (simple regression analysis)
Classification and regression in machine learning
Deep learning learned by implementation 1 (regression)
Machine Learning: Supervised --Linear Discriminant Analysis
(python) Deep Learning Library Chainer Basics Basics
<Course> Machine Learning Chapter 3: Logistic Regression Model
Machine learning algorithm (generalization of linear regression)
[Learning memo] Basics of class by python
Machine learning with python (2) Simple regression analysis
Python learning basics ~ What is type conversion? ~
[Machine learning] Supervised learning using kernel density estimation
<Course> Machine Learning Chapter 1: Linear Regression Model
<Course> Machine Learning Chapter 2: Nonlinear Regression Model
Stock price forecast using machine learning (regression)
Machine learning algorithm (linear regression summary & regularization)
[Machine learning] Regression analysis using scikit learn
Deep Learning from mathematical basics (during attendance)