What is a residual(잔여, 남은)?
The difference between the observed value (y) and the predicted value (Yhat) is called the residual (e). When we look at a regression plot, the residual is the distance from the data point to the fitted regression line.
So what is a residual plot?
A residual plot is a graph that shows the residuals on the vertical y-axis and the independent variable on the horizontal x-axis.
예) Residual Plot 그리기 (y=0 평균값을 중심으로 Residual을 그려준다.)
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
path = 'https://s3-api.us-geo.objectstorage.softlayer.net/cf-courses-data/CognitiveClass/DA0101EN/automobileEDA.csv'
df = pd.read_csv(path)
import seaborn as sns
sns.residplot(df['highway-mpg'], df['price'])
plt.show()
>>
'IT > Python' 카테고리의 다른 글
[파이썬] Boolean string methods (Yes or No) (0) | 2020.06.29 |
---|---|
[파이썬] Pandas Cheat Sheet (0) | 2020.06.17 |
[파이썬] Model Development (Linear Regression (선형 회귀)) (0) | 2020.06.16 |
[파이썬] Data Analysis (0) | 2020.06.13 |
[파이썬] Data wrangling (0) | 2020.06.12 |