Kernel: Python 3 (system-wide)
Загрузить набор данных Duncan.csv и поместить его в папку "data"
Задача 1. Построить линейные регрессионные зависимости: Prestige(Incom)
1 способ: Строится линейная зависимость методом наименьших квадратов. Определить какие точки являются выбросами. Перестроить линейную зависимость по данным, которые не содержать выбросы. 2 способ: Постоить линейную регрессивную зависимость, используя М-регрессию на основе функции Хьюбера (ссылка). Идентифицировать выбросы.
In [1]:
In [8]:
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-8-1bf432406d0a> in <module>
----> 1 df = Duncan.read_csv('data/iris.csv',sep =',' )
NameError: name 'Duncan' is not defined
In [4]:
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-4-f42fab0dee4c> in <module>
----> 1 print(type(df))
2 df
NameError: name 'df' is not defined
In [5]:
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-5-08c554537916> in <module>
----> 1 df.index
NameError: name 'df' is not defined
In [6]:
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-6-095286801caf> in <module>
----> 1 X=df.prestige
2 X= df.iloc[:,4] #prestige
3 print(X)
NameError: name 'df' is not defined
In [7]:
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-7-829126943118> in <module>
----> 1 Y = df.income
2 Y = df.iloc[:,2] #income
3 print(Y)
NameError: name 'df' is not defined
In [3]:
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-3-f17b9b11cbea> in <module>
1 plt.figure(figsize=(5,5))
----> 2 idx1 = (Y==1)
3 idx2 = (Y==2)
4 plt.scatter(X, Y, s=36 ,c='r')
5
NameError: name 'Y' is not defined
<Figure size 360x360 with 0 Axes>
In [8]:
2146
45.0
47.68888888888889
In [9]:
2274.2301234567904
In [10]:
1884
45.0
41.86666666666667
In [11]:
146028
47.68888888888889
In [12]:
89845.8666667
1996.5748148148148
970.83654321
41.86666666666667
In [40]:
0.0199525544353
40.9151515152
In [41]:
42.5512609788
42.5712135333
42.7108814143
42.4315456522
42.7108814143
42.651023751
42.7707390776
42.7108814143
41.9526843458
42.6709763055
42.052447118
42.6909288599
42.8505492954
42.0923522268
42.3716879889
41.6733485837
42.4315456522
42.5313084244
41.8130164647
42.7507865232
41.6933011381
41.593538366
41.733206247
41.2343923861
41.5735858115
41.9726369002
42.2519726623
42.052447118
41.4339179305
41.4937755938
41.1146770595
41.2144398317
41.2942500494
41.1146770595
41.1745347228
41.3940128216
41.3142026039
41.0548193962
40.9750091785
41.2343923861
41.0348668418
41.1346296139
41.0747719506
41.733206247
41.1146770595
In [42]:
In [43]:
/usr/local/lib/python3.4/dist-packages/ipykernel/__main__.py:2: FutureWarning: reshape is deprecated and will raise in a subsequent release. Please use .values.reshape(...) instead
from ipykernel import kernelapp as app
LinearRegression(copy_X=True, fit_intercept=True, n_jobs=1, normalize=False)
In [44]:
HuberRegressor(alpha=0.0001, epsilon=1.35, fit_intercept=True, max_iter=100,
tol=1e-05, warm_start=False)
In [45]:
In [0]:
In [0]:
In [0]: