machine learning (code with harry and other)

Linear Regression code with herry
In [1]:
from IPython.display import Image
from IPython.core.display import HTML 
from IPython.display import IFrame
In [4]:
Image(url= "https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhF-63Pf6FYdFZq7LzjuEg6UCuvKj0-gy9XgcjGpKtta3x0VTh84tabWwkmW96AQEQlVzI7o0EUlW60Nec-cq0bc8jicwFznKEX7XAP501GGZ3_MpWUL758w6VqcWWMy9hzyp-YWz6ddD4/s640/Screenshot+%25285555%2529.png")
Out[4]:
In [7]:
import matplotlib.pyplot as plt
import numpy as np
from sklearn import datasets,linear_model
from sklearn.metrics import mean_squared_error
In [8]:
diabetes=datasets.load_diabetes()
In [24]:
diabetes
Out[24]:
{'data': array([[ 0.03807591,  0.05068012,  0.06169621, ..., -0.00259226,
          0.01990842, -0.01764613],
        [-0.00188202, -0.04464164, -0.05147406, ..., -0.03949338,
         -0.06832974, -0.09220405],
        [ 0.08529891,  0.05068012,  0.04445121, ..., -0.00259226,
          0.00286377, -0.02593034],
        ...,
        [ 0.04170844,  0.05068012, -0.01590626, ..., -0.01107952,
         -0.04687948,  0.01549073],
        [-0.04547248, -0.04464164,  0.03906215, ...,  0.02655962,
          0.04452837, -0.02593034],
        [-0.04547248, -0.04464164, -0.0730303 , ..., -0.03949338,
         -0.00421986,  0.00306441]]),
 'target': array([151.,  75., 141., 206., 135.,  97., 138.,  63., 110., 310., 101.,
         69., 179., 185., 118., 171., 166., 144.,  97., 168.,  68.,  49.,
         68., 245., 184., 202., 137.,  85., 131., 283., 129.,  59., 341.,
         87.,  65., 102., 265., 276., 252.,  90., 100.,  55.,  61.,  92.,
        259.,  53., 190., 142.,  75., 142., 155., 225.,  59., 104., 182.,
        128.,  52.,  37., 170., 170.,  61., 144.,  52., 128.,  71., 163.,
        150.,  97., 160., 178.,  48., 270., 202., 111.,  85.,  42., 170.,
        200., 252., 113., 143.,  51.,  52., 210.,  65., 141.,  55., 134.,
         42., 111.,  98., 164.,  48.,  96.,  90., 162., 150., 279.,  92.,
         83., 128., 102., 302., 198.,  95.,  53., 134., 144., 232.,  81.,
        104.,  59., 246., 297., 258., 229., 275., 281., 179., 200., 200.,
        173., 180.,  84., 121., 161.,  99., 109., 115., 268., 274., 158.,
        107.,  83., 103., 272.,  85., 280., 336., 281., 118., 317., 235.,
         60., 174., 259., 178., 128.,  96., 126., 288.,  88., 292.,  71.,
        197., 186.,  25.,  84.,  96., 195.,  53., 217., 172., 131., 214.,
         59.,  70., 220., 268., 152.,  47.,  74., 295., 101., 151., 127.,
        237., 225.,  81., 151., 107.,  64., 138., 185., 265., 101., 137.,
        143., 141.,  79., 292., 178.,  91., 116.,  86., 122.,  72., 129.,
        142.,  90., 158.,  39., 196., 222., 277.,  99., 196., 202., 155.,
         77., 191.,  70.,  73.,  49.,  65., 263., 248., 296., 214., 185.,
         78.,  93., 252., 150.,  77., 208.,  77., 108., 160.,  53., 220.,
        154., 259.,  90., 246., 124.,  67.,  72., 257., 262., 275., 177.,
         71.,  47., 187., 125.,  78.,  51., 258., 215., 303., 243.,  91.,
        150., 310., 153., 346.,  63.,  89.,  50.,  39., 103., 308., 116.,
        145.,  74.,  45., 115., 264.,  87., 202., 127., 182., 241.,  66.,
         94., 283.,  64., 102., 200., 265.,  94., 230., 181., 156., 233.,
         60., 219.,  80.,  68., 332., 248.,  84., 200.,  55.,  85.,  89.,
         31., 129.,  83., 275.,  65., 198., 236., 253., 124.,  44., 172.,
        114., 142., 109., 180., 144., 163., 147.,  97., 220., 190., 109.,
        191., 122., 230., 242., 248., 249., 192., 131., 237.,  78., 135.,
        244., 199., 270., 164.,  72.,  96., 306.,  91., 214.,  95., 216.,
        263., 178., 113., 200., 139., 139.,  88., 148.,  88., 243.,  71.,
         77., 109., 272.,  60.,  54., 221.,  90., 311., 281., 182., 321.,
         58., 262., 206., 233., 242., 123., 167.,  63., 197.,  71., 168.,
        140., 217., 121., 235., 245.,  40.,  52., 104., 132.,  88.,  69.,
        219.,  72., 201., 110.,  51., 277.,  63., 118.,  69., 273., 258.,
         43., 198., 242., 232., 175.,  93., 168., 275., 293., 281.,  72.,
        140., 189., 181., 209., 136., 261., 113., 131., 174., 257.,  55.,
         84.,  42., 146., 212., 233.,  91., 111., 152., 120.,  67., 310.,
         94., 183.,  66., 173.,  72.,  49.,  64.,  48., 178., 104., 132.,
        220.,  57.]),
 'frame': None,
 'DESCR': '.. _diabetes_dataset:\n\nDiabetes dataset\n----------------\n\nTen baseline variables, age, sex, body mass index, average blood\npressure, and six blood serum measurements were obtained for each of n =\n442 diabetes patients, as well as the response of interest, a\nquantitative measure of disease progression one year after baseline.\n\n**Data Set Characteristics:**\n\n  :Number of Instances: 442\n\n  :Number of Attributes: First 10 columns are numeric predictive values\n\n  :Target: Column 11 is a quantitative measure of disease progression one year after baseline\n\n  :Attribute Information:\n      - age     age in years\n      - sex\n      - bmi     body mass index\n      - bp      average blood pressure\n      - s1      tc, T-Cells (a type of white blood cells)\n      - s2      ldl, low-density lipoproteins\n      - s3      hdl, high-density lipoproteins\n      - s4      tch, thyroid stimulating hormone\n      - s5      ltg, lamotrigine\n      - s6      glu, blood sugar level\n\nNote: Each of these 10 feature variables have been mean centered and scaled by the standard deviation times `n_samples` (i.e. the sum of squares of each column totals 1).\n\nSource URL:\nhttps://www4.stat.ncsu.edu/~boos/var.select/diabetes.html\n\nFor more information see:\nBradley Efron, Trevor Hastie, Iain Johnstone and Robert Tibshirani (2004) "Least Angle Regression," Annals of Statistics (with discussion), 407-499.\n(https://web.stanford.edu/~hastie/Papers/LARS/LeastAngle_2002.pdf)',
 'feature_names': ['age',
  'sex',
  'bmi',
  'bp',
  's1',
  's2',
  's3',
  's4',
  's5',
  's6'],
 'data_filename': 'c:\\users\\hi-tech\\appdata\\local\\programs\\python\\python38-32\\lib\\site-packages\\sklearn\\datasets\\data\\diabetes_data.csv.gz',
 'target_filename': 'c:\\users\\hi-tech\\appdata\\local\\programs\\python\\python38-32\\lib\\site-packages\\sklearn\\datasets\\data\\diabetes_target.csv.gz'}
In [51]:
diabetes_x=diabetes.data[:,np.newaxis,2]
# diabetes_x=diabetes.data
In [68]:
diabetes_x_train=diabetes_x[:-30]   # last ke 60 ko chhodkar(skip kar)
diabetes_x_test=diabetes_x[-30:]    # last ke 40
In [23]:
diabetes_x_train
Out[23]:
array([[ 0.06169621],
       [-0.05147406],
       [ 0.04445121],
       [-0.01159501],
       [-0.03638469],
       [-0.04069594],
       [-0.04716281],
       [-0.00189471],
       [ 0.06169621],
       [ 0.03906215],
       [-0.08380842],
       [ 0.01750591],
       [-0.02884001],
       [-0.00189471],
       [-0.02560657],
       [-0.01806189],
       [ 0.04229559],
       [ 0.01211685],
       [-0.0105172 ],
       [-0.01806189],
       [-0.05686312],
       [-0.02237314],
       [-0.00405033],
       [ 0.06061839],
       [ 0.03582872],
       [-0.01267283],
       [-0.07734155],
       [ 0.05954058],
       [-0.02129532],
       [-0.00620595],
       [ 0.04445121],
       [-0.06548562],
       [ 0.12528712],
       [-0.05039625],
       [-0.06332999],
       [-0.03099563],
       [ 0.02289497],
       [ 0.01103904],
       [ 0.07139652],
       [ 0.01427248],
       [-0.00836158],
       [-0.06764124],
       [-0.0105172 ],
       [-0.02345095],
       [ 0.06816308],
       [-0.03530688],
       [-0.01159501],
       [-0.0730303 ],
       [-0.04177375],
       [ 0.01427248],
       [-0.00728377],
       [ 0.0164281 ],
       [-0.00943939],
       [-0.01590626],
       [ 0.0250506 ],
       [-0.04931844],
       [ 0.04121778],
       [-0.06332999],
       [-0.06440781],
       [-0.02560657],
       [-0.00405033],
       [ 0.00457217],
       [-0.00728377],
       [-0.0374625 ],
       [-0.02560657],
       [-0.02452876],
       [-0.01806189],
       [-0.01482845],
       [-0.02991782],
       [-0.046085  ],
       [-0.06979687],
       [ 0.03367309],
       [-0.00405033],
       [-0.02021751],
       [ 0.00241654],
       [-0.03099563],
       [ 0.02828403],
       [-0.03638469],
       [-0.05794093],
       [-0.0374625 ],
       [ 0.01211685],
       [-0.02237314],
       [-0.03530688],
       [ 0.00996123],
       [-0.03961813],
       [ 0.07139652],
       [-0.07518593],
       [-0.00620595],
       [-0.04069594],
       [-0.04824063],
       [-0.02560657],
       [ 0.0519959 ],
       [ 0.00457217],
       [-0.06440781],
       [-0.01698407],
       [-0.05794093],
       [ 0.00996123],
       [ 0.08864151],
       [-0.00512814],
       [-0.06440781],
       [ 0.01750591],
       [-0.04500719],
       [ 0.02828403],
       [ 0.04121778],
       [ 0.06492964],
       [-0.03207344],
       [-0.07626374],
       [ 0.04984027],
       [ 0.04552903],
       [-0.00943939],
       [-0.03207344],
       [ 0.00457217],
       [ 0.02073935],
       [ 0.01427248],
       [ 0.11019775],
       [ 0.00133873],
       [ 0.05846277],
       [-0.02129532],
       [-0.0105172 ],
       [-0.04716281],
       [ 0.00457217],
       [ 0.01750591],
       [ 0.08109682],
       [ 0.0347509 ],
       [ 0.02397278],
       [-0.00836158],
       [-0.06117437],
       [-0.00189471],
       [-0.06225218],
       [ 0.0164281 ],
       [ 0.09618619],
       [-0.06979687],
       [-0.02129532],
       [-0.05362969],
       [ 0.0433734 ],
       [ 0.05630715],
       [-0.0816528 ],
       [ 0.04984027],
       [ 0.11127556],
       [ 0.06169621],
       [ 0.01427248],
       [ 0.04768465],
       [ 0.01211685],
       [ 0.00564998],
       [ 0.04660684],
       [ 0.12852056],
       [ 0.05954058],
       [ 0.09295276],
       [ 0.01535029],
       [-0.00512814],
       [ 0.0703187 ],
       [-0.00405033],
       [-0.00081689],
       [-0.04392938],
       [ 0.02073935],
       [ 0.06061839],
       [-0.0105172 ],
       [-0.03315126],
       [-0.06548562],
       [ 0.0433734 ],
       [-0.06225218],
       [ 0.06385183],
       [ 0.03043966],
       [ 0.07247433],
       [-0.0191397 ],
       [-0.06656343],
       [-0.06009656],
       [ 0.06924089],
       [ 0.05954058],
       [-0.02668438],
       [-0.02021751],
       [-0.046085  ],
       [ 0.07139652],
       [-0.07949718],
       [ 0.00996123],
       [-0.03854032],
       [ 0.01966154],
       [ 0.02720622],
       [-0.00836158],
       [-0.01590626],
       [ 0.00457217],
       [-0.04285156],
       [ 0.00564998],
       [-0.03530688],
       [ 0.02397278],
       [-0.01806189],
       [ 0.04229559],
       [-0.0547075 ],
       [-0.00297252],
       [-0.06656343],
       [-0.01267283],
       [-0.04177375],
       [-0.03099563],
       [-0.00512814],
       [-0.05901875],
       [ 0.0250506 ],
       [-0.046085  ],
       [ 0.00349435],
       [ 0.05415152],
       [-0.04500719],
       [-0.05794093],
       [-0.05578531],
       [ 0.00133873],
       [ 0.03043966],
       [ 0.00672779],
       [ 0.04660684],
       [ 0.02612841],
       [ 0.04552903],
       [ 0.04013997],
       [-0.01806189],
       [ 0.01427248],
       [ 0.03690653],
       [ 0.00349435],
       [-0.07087468],
       [-0.03315126],
       [ 0.09403057],
       [ 0.03582872],
       [ 0.03151747],
       [-0.06548562],
       [-0.04177375],
       [-0.03961813],
       [-0.03854032],
       [-0.02560657],
       [-0.02345095],
       [-0.06656343],
       [ 0.03259528],
       [-0.046085  ],
       [-0.02991782],
       [-0.01267283],
       [-0.01590626],
       [ 0.07139652],
       [-0.03099563],
       [ 0.00026092],
       [ 0.03690653],
       [ 0.03906215],
       [-0.01482845],
       [ 0.00672779],
       [-0.06871905],
       [-0.00943939],
       [ 0.01966154],
       [ 0.07462995],
       [-0.00836158],
       [-0.02345095],
       [-0.046085  ],
       [ 0.05415152],
       [-0.03530688],
       [-0.03207344],
       [-0.0816528 ],
       [ 0.04768465],
       [ 0.06061839],
       [ 0.05630715],
       [ 0.09834182],
       [ 0.05954058],
       [ 0.03367309],
       [ 0.05630715],
       [-0.06548562],
       [ 0.16085492],
       [-0.05578531],
       [-0.02452876],
       [-0.03638469],
       [-0.00836158],
       [-0.04177375],
       [ 0.12744274],
       [-0.07734155],
       [ 0.02828403],
       [-0.02560657],
       [-0.06225218],
       [-0.00081689],
       [ 0.08864151],
       [-0.03207344],
       [ 0.03043966],
       [ 0.00888341],
       [ 0.00672779],
       [-0.02021751],
       [-0.02452876],
       [-0.01159501],
       [ 0.02612841],
       [-0.05901875],
       [-0.03638469],
       [-0.02452876],
       [ 0.01858372],
       [-0.0902753 ],
       [-0.00512814],
       [-0.05255187],
       [-0.02237314],
       [-0.02021751],
       [-0.0547075 ],
       [-0.00620595],
       [-0.01698407],
       [ 0.05522933],
       [ 0.07678558],
       [ 0.01858372],
       [-0.02237314],
       [ 0.09295276],
       [-0.03099563],
       [ 0.03906215],
       [-0.06117437],
       [-0.00836158],
       [-0.0374625 ],
       [-0.01375064],
       [ 0.07355214],
       [-0.02452876],
       [ 0.03367309],
       [ 0.0347509 ],
       [-0.03854032],
       [-0.03961813],
       [-0.00189471],
       [-0.03099563],
       [-0.046085  ],
       [ 0.00133873],
       [ 0.06492964],
       [ 0.04013997],
       [-0.02345095],
       [ 0.05307371],
       [ 0.04013997],
       [-0.02021751],
       [ 0.01427248],
       [-0.03422907],
       [ 0.00672779],
       [ 0.00457217],
       [ 0.03043966],
       [ 0.0519959 ],
       [ 0.06169621],
       [-0.00728377],
       [ 0.00564998],
       [ 0.05415152],
       [-0.00836158],
       [ 0.114509  ],
       [ 0.06708527],
       [-0.05578531],
       [ 0.03043966],
       [-0.02560657],
       [ 0.10480869],
       [-0.00620595],
       [-0.04716281],
       [-0.04824063],
       [ 0.08540807],
       [-0.01267283],
       [-0.03315126],
       [-0.00728377],
       [-0.01375064],
       [ 0.05954058],
       [ 0.02181716],
       [ 0.01858372],
       [-0.01159501],
       [-0.00297252],
       [ 0.01750591],
       [-0.02991782],
       [-0.02021751],
       [-0.05794093],
       [ 0.06061839],
       [-0.04069594],
       [-0.07195249],
       [-0.05578531],
       [ 0.04552903],
       [-0.00943939],
       [-0.03315126],
       [ 0.04984027],
       [-0.08488624],
       [ 0.00564998],
       [ 0.02073935],
       [-0.00728377],
       [ 0.10480869],
       [-0.02452876],
       [-0.00620595],
       [-0.03854032],
       [ 0.13714305],
       [ 0.17055523],
       [ 0.00241654],
       [ 0.03798434],
       [-0.05794093],
       [-0.00943939],
       [-0.02345095],
       [-0.0105172 ],
       [-0.03422907],
       [-0.00297252],
       [ 0.06816308],
       [ 0.00996123],
       [ 0.00241654],
       [-0.03854032],
       [ 0.02612841],
       [-0.08919748],
       [ 0.06061839],
       [-0.02884001],
       [-0.02991782],
       [-0.0191397 ],
       [-0.04069594],
       [ 0.01535029],
       [-0.02452876],
       [ 0.00133873],
       [ 0.06924089],
       [-0.06979687],
       [-0.02991782],
       [-0.046085  ],
       [ 0.01858372],
       [ 0.00133873],
       [-0.03099563],
       [-0.00405033],
       [ 0.01535029],
       [ 0.02289497],
       [ 0.04552903],
       [-0.04500719],
       [-0.03315126],
       [ 0.097264  ],
       [ 0.05415152],
       [ 0.12313149],
       [-0.08057499],
       [ 0.09295276],
       [-0.05039625],
       [-0.01159501],
       [-0.0277622 ],
       [ 0.05846277]])
In [16]:
# temp example for slicing  (not part of this program)
lst=[1,2,3,4,5,6,7,8,9]
print(lst[:-4])
print(lst[-4:])
[1, 2, 3, 4, 5]
[6, 7, 8, 9]
In [66]:
diabetes_y_train=diabetes_x[:-30]
diabetes_y_test=diabetes_x[-30:]
In [65]:
model=linear_model.LinearRegression()
model
Out[65]:
LinearRegression()
In [54]:
model.fit(diabetes_x_train,diabetes_y_train)
Out[54]:
LinearRegression()
In [21]:
diabetes_y_predicted=model.predict(diabetes_x_test)
diabetes_y_predicted
Out[21]:
array([[ 0.08540807],
       [-0.00081689],
       [ 0.00672779],
       [ 0.00888341],
       [ 0.08001901],
       [ 0.07139652],
       [-0.02452876],
       [-0.0547075 ],
       [-0.03638469],
       [ 0.0164281 ],
       [ 0.07786339],
       [-0.03961813],
       [ 0.01103904],
       [-0.04069594],
       [-0.03422907],
       [ 0.00564998],
       [ 0.08864151],
       [-0.03315126],
       [-0.05686312],
       [-0.03099563],
       [ 0.05522933],
       [-0.06009656],
       [ 0.00133873],
       [-0.02345095],
       [-0.07410811],
       [ 0.01966154],
       [-0.01590626],
       [-0.01590626],
       [ 0.03906215],
       [-0.0730303 ]])
In [25]:
print("mean square error is : ",mean_squared_error(diabetes_y_test,diabetes_y_predicted))
mean square error is :  2.2631812327954014e-33
In [29]:
print("weights : ",model.coef_)
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-29-7138b2b2d4a9> in <module>
----> 1 print("weights : ",model.coef_)

AttributeError: 'LinearRegression' object has no attribute 'coef_'
In [47]:
 from sklearn.datasets import load_boston
In [32]:
boston=load_boston()
model.fit(boston.data, boston.target)
print("weights : ",model.coef_)
weights :  [-1.08011358e-01  4.64204584e-02  2.05586264e-02  2.68673382e+00
 -1.77666112e+01  3.80986521e+00  6.92224640e-04 -1.47556685e+00
  3.06049479e-01 -1.23345939e-02 -9.52747232e-01  9.31168327e-03
 -5.24758378e-01]
In [48]:
print("intercept : ",model.intercept_)
intercept :  [-5.42101086e-19]
In [71]:
plt.scatter(diabetes_x_test,diabetes_y_test)
plt.show()
In [42]:
plt.plot(diabetes_x_test,diabetes_y_predicted)
Out[42]:
[<matplotlib.lines.Line2D at 0x5570f28>]

code in one cell

In [72]:
import matplotlib.pyplot as plt
import numpy as np
from sklearn import datasets, linear_model
from sklearn.metrics import mean_squared_error
from sklearn.datasets import load_boston


diabetes = datasets.load_diabetes()
diabetes_x = diabetes.data[:, np.newaxis, 2]
# diabetes_x=diabetes.data
diabetes_x_train = diabetes_x[:-30]   # last ke 60 ko chhodkar(skip kar)
diabetes_x_test = diabetes_x[-30:]    # last ke 40
diabetes_y_train = diabetes_x[:-30]
diabetes_y_test = diabetes_x[-30:]
model = linear_model.LinearRegression()
model.fit(diabetes_x_train, diabetes_y_train)
diabetes_y_predicted = model.predict(diabetes_x_test)
print("mean square error is : ", mean_squared_error(
    diabetes_y_test, diabetes_y_predicted))
boston = load_boston()
model.fit(boston.data, boston.target)
print("weights : ", model.coef_)
print("intercept : ", model.intercept_)
plt.scatter(diabetes_x_test, diabetes_y_test)
plt.show()
plt.plot(diabetes_x_test, diabetes_y_predicted)
plt.show()
mean square error is :  2.2631812327954014e-33
weights :  [-1.08011358e-01  4.64204584e-02  2.05586264e-02  2.68673382e+00
 -1.77666112e+01  3.80986521e+00  6.92224640e-04 -1.47556685e+00
  3.06049479e-01 -1.23345939e-02 -9.52747232e-01  9.31168327e-03
 -5.24758378e-01]
intercept :  36.459488385089855
In [ ]:
 
In [1]:
from IPython.display import Image
from IPython.core.display import HTML 
from IPython.display import IFrame

Linear Regression

In [4]:
Image(url= "https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhF-63Pf6FYdFZq7LzjuEg6UCuvKj0-gy9XgcjGpKtta3x0VTh84tabWwkmW96AQEQlVzI7o0EUlW60Nec-cq0bc8jicwFznKEX7XAP501GGZ3_MpWUL758w6VqcWWMy9hzyp-YWz6ddD4/s640/Screenshot+%25285555%2529.png")
Out[4]:
In [7]:
import matplotlib.pyplot as plt
import numpy as np
from sklearn import datasets,linear_model
from sklearn.metrics import mean_squared_error
In [8]:
diabetes=datasets.load_diabetes()
In [24]:
diabetes
Out[24]:
{'data': array([[ 0.03807591,  0.05068012,  0.06169621, ..., -0.00259226,
          0.01990842, -0.01764613],
        [-0.00188202, -0.04464164, -0.05147406, ..., -0.03949338,
         -0.06832974, -0.09220405],
        [ 0.08529891,  0.05068012,  0.04445121, ..., -0.00259226,
          0.00286377, -0.02593034],
        ...,
        [ 0.04170844,  0.05068012, -0.01590626, ..., -0.01107952,
         -0.04687948,  0.01549073],
        [-0.04547248, -0.04464164,  0.03906215, ...,  0.02655962,
          0.04452837, -0.02593034],
        [-0.04547248, -0.04464164, -0.0730303 , ..., -0.03949338,
         -0.00421986,  0.00306441]]),
 'target': array([151.,  75., 141., 206., 135.,  97., 138.,  63., 110., 310., 101.,
         69., 179., 185., 118., 171., 166., 144.,  97., 168.,  68.,  49.,
         68., 245., 184., 202., 137.,  85., 131., 283., 129.,  59., 341.,
         87.,  65., 102., 265., 276., 252.,  90., 100.,  55.,  61.,  92.,
        259.,  53., 190., 142.,  75., 142., 155., 225.,  59., 104., 182.,
        128.,  52.,  37., 170., 170.,  61., 144.,  52., 128.,  71., 163.,
        150.,  97., 160., 178.,  48., 270., 202., 111.,  85.,  42., 170.,
        200., 252., 113., 143.,  51.,  52., 210.,  65., 141.,  55., 134.,
         42., 111.,  98., 164.,  48.,  96.,  90., 162., 150., 279.,  92.,
         83., 128., 102., 302., 198.,  95.,  53., 134., 144., 232.,  81.,
        104.,  59., 246., 297., 258., 229., 275., 281., 179., 200., 200.,
        173., 180.,  84., 121., 161.,  99., 109., 115., 268., 274., 158.,
        107.,  83., 103., 272.,  85., 280., 336., 281., 118., 317., 235.,
         60., 174., 259., 178., 128.,  96., 126., 288.,  88., 292.,  71.,
        197., 186.,  25.,  84.,  96., 195.,  53., 217., 172., 131., 214.,
         59.,  70., 220., 268., 152.,  47.,  74., 295., 101., 151., 127.,
        237., 225.,  81., 151., 107.,  64., 138., 185., 265., 101., 137.,
        143., 141.,  79., 292., 178.,  91., 116.,  86., 122.,  72., 129.,
        142.,  90., 158.,  39., 196., 222., 277.,  99., 196., 202., 155.,
         77., 191.,  70.,  73.,  49.,  65., 263., 248., 296., 214., 185.,
         78.,  93., 252., 150.,  77., 208.,  77., 108., 160.,  53., 220.,
        154., 259.,  90., 246., 124.,  67.,  72., 257., 262., 275., 177.,
         71.,  47., 187., 125.,  78.,  51., 258., 215., 303., 243.,  91.,
        150., 310., 153., 346.,  63.,  89.,  50.,  39., 103., 308., 116.,
        145.,  74.,  45., 115., 264.,  87., 202., 127., 182., 241.,  66.,
         94., 283.,  64., 102., 200., 265.,  94., 230., 181., 156., 233.,
         60., 219.,  80.,  68., 332., 248.,  84., 200.,  55.,  85.,  89.,
         31., 129.,  83., 275.,  65., 198., 236., 253., 124.,  44., 172.,
        114., 142., 109., 180., 144., 163., 147.,  97., 220., 190., 109.,
        191., 122., 230., 242., 248., 249., 192., 131., 237.,  78., 135.,
        244., 199., 270., 164.,  72.,  96., 306.,  91., 214.,  95., 216.,
        263., 178., 113., 200., 139., 139.,  88., 148.,  88., 243.,  71.,
         77., 109., 272.,  60.,  54., 221.,  90., 311., 281., 182., 321.,
         58., 262., 206., 233., 242., 123., 167.,  63., 197.,  71., 168.,
        140., 217., 121., 235., 245.,  40.,  52., 104., 132.,  88.,  69.,
        219.,  72., 201., 110.,  51., 277.,  63., 118.,  69., 273., 258.,
         43., 198., 242., 232., 175.,  93., 168., 275., 293., 281.,  72.,
        140., 189., 181., 209., 136., 261., 113., 131., 174., 257.,  55.,
         84.,  42., 146., 212., 233.,  91., 111., 152., 120.,  67., 310.,
         94., 183.,  66., 173.,  72.,  49.,  64.,  48., 178., 104., 132.,
        220.,  57.]),
 'frame': None,
 'DESCR': '.. _diabetes_dataset:\n\nDiabetes dataset\n----------------\n\nTen baseline variables, age, sex, body mass index, average blood\npressure, and six blood serum measurements were obtained for each of n =\n442 diabetes patients, as well as the response of interest, a\nquantitative measure of disease progression one year after baseline.\n\n**Data Set Characteristics:**\n\n  :Number of Instances: 442\n\n  :Number of Attributes: First 10 columns are numeric predictive values\n\n  :Target: Column 11 is a quantitative measure of disease progression one year after baseline\n\n  :Attribute Information:\n      - age     age in years\n      - sex\n      - bmi     body mass index\n      - bp      average blood pressure\n      - s1      tc, T-Cells (a type of white blood cells)\n      - s2      ldl, low-density lipoproteins\n      - s3      hdl, high-density lipoproteins\n      - s4      tch, thyroid stimulating hormone\n      - s5      ltg, lamotrigine\n      - s6      glu, blood sugar level\n\nNote: Each of these 10 feature variables have been mean centered and scaled by the standard deviation times `n_samples` (i.e. the sum of squares of each column totals 1).\n\nSource URL:\nhttps://www4.stat.ncsu.edu/~boos/var.select/diabetes.html\n\nFor more information see:\nBradley Efron, Trevor Hastie, Iain Johnstone and Robert Tibshirani (2004) "Least Angle Regression," Annals of Statistics (with discussion), 407-499.\n(https://web.stanford.edu/~hastie/Papers/LARS/LeastAngle_2002.pdf)',
 'feature_names': ['age',
  'sex',
  'bmi',
  'bp',
  's1',
  's2',
  's3',
  's4',
  's5',
  's6'],
 'data_filename': 'c:\\users\\hi-tech\\appdata\\local\\programs\\python\\python38-32\\lib\\site-packages\\sklearn\\datasets\\data\\diabetes_data.csv.gz',
 'target_filename': 'c:\\users\\hi-tech\\appdata\\local\\programs\\python\\python38-32\\lib\\site-packages\\sklearn\\datasets\\data\\diabetes_target.csv.gz'}
In [51]:
diabetes_x=diabetes.data[:,np.newaxis,2]
# diabetes_x=diabetes.data
In [68]:
diabetes_x_train=diabetes_x[:-30]   # last ke 60 ko chhodkar(skip kar)
diabetes_x_test=diabetes_x[-30:]    # last ke 40
In [23]:
diabetes_x_train
Out[23]:
array([[ 0.06169621],
       [-0.05147406],
       [ 0.04445121],
       [-0.01159501],
       [-0.03638469],
       [-0.04069594],
       [-0.04716281],
       [-0.00189471],
       [ 0.06169621],
       [ 0.03906215],
       [-0.08380842],
       [ 0.01750591],
       [-0.02884001],
       [-0.00189471],
       [-0.02560657],
       [-0.01806189],
       [ 0.04229559],
       [ 0.01211685],
       [-0.0105172 ],
       [-0.01806189],
       [-0.05686312],
       [-0.02237314],
       [-0.00405033],
       [ 0.06061839],
       [ 0.03582872],
       [-0.01267283],
       [-0.07734155],
       [ 0.05954058],
       [-0.02129532],
       [-0.00620595],
       [ 0.04445121],
       [-0.06548562],
       [ 0.12528712],
       [-0.05039625],
       [-0.06332999],
       [-0.03099563],
       [ 0.02289497],
       [ 0.01103904],
       [ 0.07139652],
       [ 0.01427248],
       [-0.00836158],
       [-0.06764124],
       [-0.0105172 ],
       [-0.02345095],
       [ 0.06816308],
       [-0.03530688],
       [-0.01159501],
       [-0.0730303 ],
       [-0.04177375],
       [ 0.01427248],
       [-0.00728377],
       [ 0.0164281 ],
       [-0.00943939],
       [-0.01590626],
       [ 0.0250506 ],
       [-0.04931844],
       [ 0.04121778],
       [-0.06332999],
       [-0.06440781],
       [-0.02560657],
       [-0.00405033],
       [ 0.00457217],
       [-0.00728377],
       [-0.0374625 ],
       [-0.02560657],
       [-0.02452876],
       [-0.01806189],
       [-0.01482845],
       [-0.02991782],
       [-0.046085  ],
       [-0.06979687],
       [ 0.03367309],
       [-0.00405033],
       [-0.02021751],
       [ 0.00241654],
       [-0.03099563],
       [ 0.02828403],
       [-0.03638469],
       [-0.05794093],
       [-0.0374625 ],
       [ 0.01211685],
       [-0.02237314],
       [-0.03530688],
       [ 0.00996123],
       [-0.03961813],
       [ 0.07139652],
       [-0.07518593],
       [-0.00620595],
       [-0.04069594],
       [-0.04824063],
       [-0.02560657],
       [ 0.0519959 ],
       [ 0.00457217],
       [-0.06440781],
       [-0.01698407],
       [-0.05794093],
       [ 0.00996123],
       [ 0.08864151],
       [-0.00512814],
       [-0.06440781],
       [ 0.01750591],
       [-0.04500719],
       [ 0.02828403],
       [ 0.04121778],
       [ 0.06492964],
       [-0.03207344],
       [-0.07626374],
       [ 0.04984027],
       [ 0.04552903],
       [-0.00943939],
       [-0.03207344],
       [ 0.00457217],
       [ 0.02073935],
       [ 0.01427248],
       [ 0.11019775],
       [ 0.00133873],
       [ 0.05846277],
       [-0.02129532],
       [-0.0105172 ],
       [-0.04716281],
       [ 0.00457217],
       [ 0.01750591],
       [ 0.08109682],
       [ 0.0347509 ],
       [ 0.02397278],
       [-0.00836158],
       [-0.06117437],
       [-0.00189471],
       [-0.06225218],
       [ 0.0164281 ],
       [ 0.09618619],
       [-0.06979687],
       [-0.02129532],
       [-0.05362969],
       [ 0.0433734 ],
       [ 0.05630715],
       [-0.0816528 ],
       [ 0.04984027],
       [ 0.11127556],
       [ 0.06169621],
       [ 0.01427248],
       [ 0.04768465],
       [ 0.01211685],
       [ 0.00564998],
       [ 0.04660684],
       [ 0.12852056],
       [ 0.05954058],
       [ 0.09295276],
       [ 0.01535029],
       [-0.00512814],
       [ 0.0703187 ],
       [-0.00405033],
       [-0.00081689],
       [-0.04392938],
       [ 0.02073935],
       [ 0.06061839],
       [-0.0105172 ],
       [-0.03315126],
       [-0.06548562],
       [ 0.0433734 ],
       [-0.06225218],
       [ 0.06385183],
       [ 0.03043966],
       [ 0.07247433],
       [-0.0191397 ],
       [-0.06656343],
       [-0.06009656],
       [ 0.06924089],
       [ 0.05954058],
       [-0.02668438],
       [-0.02021751],
       [-0.046085  ],
       [ 0.07139652],
       [-0.07949718],
       [ 0.00996123],
       [-0.03854032],
       [ 0.01966154],
       [ 0.02720622],
       [-0.00836158],
       [-0.01590626],
       [ 0.00457217],
       [-0.04285156],
       [ 0.00564998],
       [-0.03530688],
       [ 0.02397278],
       [-0.01806189],
       [ 0.04229559],
       [-0.0547075 ],
       [-0.00297252],
       [-0.06656343],
       [-0.01267283],
       [-0.04177375],
       [-0.03099563],
       [-0.00512814],
       [-0.05901875],
       [ 0.0250506 ],
       [-0.046085  ],
       [ 0.00349435],
       [ 0.05415152],
       [-0.04500719],
       [-0.05794093],
       [-0.05578531],
       [ 0.00133873],
       [ 0.03043966],
       [ 0.00672779],
       [ 0.04660684],
       [ 0.02612841],
       [ 0.04552903],
       [ 0.04013997],
       [-0.01806189],
       [ 0.01427248],
       [ 0.03690653],
       [ 0.00349435],
       [-0.07087468],
       [-0.03315126],
       [ 0.09403057],
       [ 0.03582872],
       [ 0.03151747],
       [-0.06548562],
       [-0.04177375],
       [-0.03961813],
       [-0.03854032],
       [-0.02560657],
       [-0.02345095],
       [-0.06656343],
       [ 0.03259528],
       [-0.046085  ],
       [-0.02991782],
       [-0.01267283],
       [-0.01590626],
       [ 0.07139652],
       [-0.03099563],
       [ 0.00026092],
       [ 0.03690653],
       [ 0.03906215],
       [-0.01482845],
       [ 0.00672779],
       [-0.06871905],
       [-0.00943939],
       [ 0.01966154],
       [ 0.07462995],
       [-0.00836158],
       [-0.02345095],
       [-0.046085  ],
       [ 0.05415152],
       [-0.03530688],
       [-0.03207344],
       [-0.0816528 ],
       [ 0.04768465],
       [ 0.06061839],
       [ 0.05630715],
       [ 0.09834182],
       [ 0.05954058],
       [ 0.03367309],
       [ 0.05630715],
       [-0.06548562],
       [ 0.16085492],
       [-0.05578531],
       [-0.02452876],
       [-0.03638469],
       [-0.00836158],
       [-0.04177375],
       [ 0.12744274],
       [-0.07734155],
       [ 0.02828403],
       [-0.02560657],
       [-0.06225218],
       [-0.00081689],
       [ 0.08864151],
       [-0.03207344],
       [ 0.03043966],
       [ 0.00888341],
       [ 0.00672779],
       [-0.02021751],
       [-0.02452876],
       [-0.01159501],
       [ 0.02612841],
       [-0.05901875],
       [-0.03638469],
       [-0.02452876],
       [ 0.01858372],
       [-0.0902753 ],
       [-0.00512814],
       [-0.05255187],
       [-0.02237314],
       [-0.02021751],
       [-0.0547075 ],
       [-0.00620595],
       [-0.01698407],
       [ 0.05522933],
       [ 0.07678558],
       [ 0.01858372],
       [-0.02237314],
       [ 0.09295276],
       [-0.03099563],
       [ 0.03906215],
       [-0.06117437],
       [-0.00836158],
       [-0.0374625 ],
       [-0.01375064],
       [ 0.07355214],
       [-0.02452876],
       [ 0.03367309],
       [ 0.0347509 ],
       [-0.03854032],
       [-0.03961813],
       [-0.00189471],
       [-0.03099563],
       [-0.046085  ],
       [ 0.00133873],
       [ 0.06492964],
       [ 0.04013997],
       [-0.02345095],
       [ 0.05307371],
       [ 0.04013997],
       [-0.02021751],
       [ 0.01427248],
       [-0.03422907],
       [ 0.00672779],
       [ 0.00457217],
       [ 0.03043966],
       [ 0.0519959 ],
       [ 0.06169621],
       [-0.00728377],
       [ 0.00564998],
       [ 0.05415152],
       [-0.00836158],
       [ 0.114509  ],
       [ 0.06708527],
       [-0.05578531],
       [ 0.03043966],
       [-0.02560657],
       [ 0.10480869],
       [-0.00620595],
       [-0.04716281],
       [-0.04824063],
       [ 0.08540807],
       [-0.01267283],
       [-0.03315126],
       [-0.00728377],
       [-0.01375064],
       [ 0.05954058],
       [ 0.02181716],
       [ 0.01858372],
       [-0.01159501],
       [-0.00297252],
       [ 0.01750591],
       [-0.02991782],
       [-0.02021751],
       [-0.05794093],
       [ 0.06061839],
       [-0.04069594],
       [-0.07195249],
       [-0.05578531],
       [ 0.04552903],
       [-0.00943939],
       [-0.03315126],
       [ 0.04984027],
       [-0.08488624],
       [ 0.00564998],
       [ 0.02073935],
       [-0.00728377],
       [ 0.10480869],
       [-0.02452876],
       [-0.00620595],
       [-0.03854032],
       [ 0.13714305],
       [ 0.17055523],
       [ 0.00241654],
       [ 0.03798434],
       [-0.05794093],
       [-0.00943939],
       [-0.02345095],
       [-0.0105172 ],
       [-0.03422907],
       [-0.00297252],
       [ 0.06816308],
       [ 0.00996123],
       [ 0.00241654],
       [-0.03854032],
       [ 0.02612841],
       [-0.08919748],
       [ 0.06061839],
       [-0.02884001],
       [-0.02991782],
       [-0.0191397 ],
       [-0.04069594],
       [ 0.01535029],
       [-0.02452876],
       [ 0.00133873],
       [ 0.06924089],
       [-0.06979687],
       [-0.02991782],
       [-0.046085  ],
       [ 0.01858372],
       [ 0.00133873],
       [-0.03099563],
       [-0.00405033],
       [ 0.01535029],
       [ 0.02289497],
       [ 0.04552903],
       [-0.04500719],
       [-0.03315126],
       [ 0.097264  ],
       [ 0.05415152],
       [ 0.12313149],
       [-0.08057499],
       [ 0.09295276],
       [-0.05039625],
       [-0.01159501],
       [-0.0277622 ],
       [ 0.05846277]])
In [16]:
# temp example for slicing  (not part of this program)
lst=[1,2,3,4,5,6,7,8,9]
print(lst[:-4])
print(lst[-4:])
[1, 2, 3, 4, 5]
[6, 7, 8, 9]
In [66]:
diabetes_y_train=diabetes_x[:-30]
diabetes_y_test=diabetes_x[-30:]
In [65]:
model=linear_model.LinearRegression()
model
Out[65]:
LinearRegression()
In [54]:
model.fit(diabetes_x_train,diabetes_y_train)
Out[54]:
LinearRegression()
In [21]:
diabetes_y_predicted=model.predict(diabetes_x_test)
diabetes_y_predicted
Out[21]:
array([[ 0.08540807],
       [-0.00081689],
       [ 0.00672779],
       [ 0.00888341],
       [ 0.08001901],
       [ 0.07139652],
       [-0.02452876],
       [-0.0547075 ],
       [-0.03638469],
       [ 0.0164281 ],
       [ 0.07786339],
       [-0.03961813],
       [ 0.01103904],
       [-0.04069594],
       [-0.03422907],
       [ 0.00564998],
       [ 0.08864151],
       [-0.03315126],
       [-0.05686312],
       [-0.03099563],
       [ 0.05522933],
       [-0.06009656],
       [ 0.00133873],
       [-0.02345095],
       [-0.07410811],
       [ 0.01966154],
       [-0.01590626],
       [-0.01590626],
       [ 0.03906215],
       [-0.0730303 ]])
In [25]:
print("mean square error is : ",mean_squared_error(diabetes_y_test,diabetes_y_predicted))
mean square error is :  2.2631812327954014e-33
In [29]:
print("weights : ",model.coef_)
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-29-7138b2b2d4a9> in <module>
----> 1 print("weights : ",model.coef_)

AttributeError: 'LinearRegression' object has no attribute 'coef_'
In [47]:
 from sklearn.datasets import load_boston
In [32]:
boston=load_boston()
model.fit(boston.data, boston.target)
print("weights : ",model.coef_)
weights :  [-1.08011358e-01  4.64204584e-02  2.05586264e-02  2.68673382e+00
 -1.77666112e+01  3.80986521e+00  6.92224640e-04 -1.47556685e+00
  3.06049479e-01 -1.23345939e-02 -9.52747232e-01  9.31168327e-03
 -5.24758378e-01]
In [48]:
print("intercept : ",model.intercept_)
intercept :  [-5.42101086e-19]
In [71]:
plt.scatter(diabetes_x_test,diabetes_y_test)
plt.show()
In [42]:
plt.plot(diabetes_x_test,diabetes_y_predicted)
Out[42]:
[<matplotlib.lines.Line2D at 0x5570f28>]

code in one cell (Linear Regression)

In [72]:
import matplotlib.pyplot as plt
import numpy as np
from sklearn import datasets, linear_model
from sklearn.metrics import mean_squared_error
from sklearn.datasets import load_boston


diabetes = datasets.load_diabetes()
diabetes_x = diabetes.data[:, np.newaxis, 2]
# diabetes_x=diabetes.data
diabetes_x_train = diabetes_x[:-30]   # last ke 60 ko chhodkar(skip kar)
diabetes_x_test = diabetes_x[-30:]    # last ke 40
diabetes_y_train = diabetes_x[:-30]
diabetes_y_test = diabetes_x[-30:]
model = linear_model.LinearRegression()
model.fit(diabetes_x_train, diabetes_y_train)
diabetes_y_predicted = model.predict(diabetes_x_test)
print("mean square error is : ", mean_squared_error(
    diabetes_y_test, diabetes_y_predicted))
boston = load_boston()
model.fit(boston.data, boston.target)
print("weights : ", model.coef_)
print("intercept : ", model.intercept_)
plt.scatter(diabetes_x_test, diabetes_y_test)
plt.show()
plt.plot(diabetes_x_test, diabetes_y_predicted)
plt.show()
mean square error is :  2.2631812327954014e-33
weights :  [-1.08011358e-01  4.64204584e-02  2.05586264e-02  2.68673382e+00
 -1.77666112e+01  3.80986521e+00  6.92224640e-04 -1.47556685e+00
  3.06049479e-01 -1.23345939e-02 -9.52747232e-01  9.31168327e-03
 -5.24758378e-01]
intercept :  36.459488385089855

K Nearest Neighbor Classification

In [2]:
from sklearn import datasets
iris=datasets.load_iris()
In [3]:
print(iris.DESCR)
.. _iris_dataset:

Iris plants dataset
--------------------

**Data Set Characteristics:**

    :Number of Instances: 150 (50 in each of three classes)
    :Number of Attributes: 4 numeric, predictive attributes and the class
    :Attribute Information:
        - sepal length in cm
        - sepal width in cm
        - petal length in cm
        - petal width in cm
        - class:
                - Iris-Setosa
                - Iris-Versicolour
                - Iris-Virginica
                
    :Summary Statistics:

    ============== ==== ==== ======= ===== ====================
                    Min  Max   Mean    SD   Class Correlation
    ============== ==== ==== ======= ===== ====================
    sepal length:   4.3  7.9   5.84   0.83    0.7826
    sepal width:    2.0  4.4   3.05   0.43   -0.4194
    petal length:   1.0  6.9   3.76   1.76    0.9490  (high!)
    petal width:    0.1  2.5   1.20   0.76    0.9565  (high!)
    ============== ==== ==== ======= ===== ====================

    :Missing Attribute Values: None
    :Class Distribution: 33.3% for each of 3 classes.
    :Creator: R.A. Fisher
    :Donor: Michael Marshall (MARSHALL%PLU@io.arc.nasa.gov)
    :Date: July, 1988

The famous Iris database, first used by Sir R.A. Fisher. The dataset is taken
from Fisher's paper. Note that it's the same as in R, but not as in the UCI
Machine Learning Repository, which has two wrong data points.

This is perhaps the best known database to be found in the
pattern recognition literature.  Fisher's paper is a classic in the field and
is referenced frequently to this day.  (See Duda & Hart, for example.)  The
data set contains 3 classes of 50 instances each, where each class refers to a
type of iris plant.  One class is linearly separable from the other 2; the
latter are NOT linearly separable from each other.

.. topic:: References

   - Fisher, R.A. "The use of multiple measurements in taxonomic problems"
     Annual Eugenics, 7, Part II, 179-188 (1936); also in "Contributions to
     Mathematical Statistics" (John Wiley, NY, 1950).
   - Duda, R.O., & Hart, P.E. (1973) Pattern Classification and Scene Analysis.
     (Q327.D83) John Wiley & Sons.  ISBN 0-471-22361-1.  See page 218.
   - Dasarathy, B.V. (1980) "Nosing Around the Neighborhood: A New System
     Structure and Classification Rule for Recognition in Partially Exposed
     Environments".  IEEE Transactions on Pattern Analysis and Machine
     Intelligence, Vol. PAMI-2, No. 1, 67-71.
   - Gates, G.W. (1972) "The Reduced Nearest Neighbor Rule".  IEEE Transactions
     on Information Theory, May 1972, 431-433.
   - See also: 1988 MLC Proceedings, 54-64.  Cheeseman et al"s AUTOCLASS II
     conceptual clustering system finds 3 classes in the data.
   - Many, many more ...
In [6]:
feature=iris.data
label=iris.target
In [7]:
print(feature[0],"     ",label[0])
[5.1 3.5 1.4 0.2]       0
In [15]:
print(feature[64],"     ",label[64])
[5.6 2.9 3.6 1.3]       1
In [16]:
from sklearn.neighbors import KNeighborsClassifier
In [18]:
clf=KNeighborsClassifier()
In [19]:
clf.fit(feature,label)
Out[19]:
KNeighborsClassifier()
In [23]:
preds=clf.predict([[1,1,1,1]])
preds
Out[23]:
array([0])
In [25]:
preds=clf.predict([[31,1,1,1]])
preds
Out[25]:
array([2])

code in one cell (K Nearest Neighbor Classification)

In [29]:
from sklearn import datasets
from sklearn.neighbors import KNeighborsClassifier

#Loading datasets
iris=datasets.load_iris()

#printing description and features
#print(iris.DESCR)
feature=iris.data
label=iris.target
print(feature[0],"     ",label[0])
print(feature[64],"     ",label[64])

#Training the classifier

clf=KNeighborsClassifier()
clf.fit(feature,label)
preds1=clf.predict([[1,1,1,1]])
print("prediction1 ",preds1)
preds2=clf.predict([[31,1,1,1]])
print("prediction2 ",preds2)
[5.1 3.5 1.4 0.2]       0
[5.6 2.9 3.6 1.3]       1
prediction1  [0]
prediction2  [2]
In [ ]:
 

Comments

Popular posts from this blog

bookmarks

problem from contest

numpy(Python for data science)

Rural Development