logestic regression
import pandas as pd from sklearn import linear_model import matplotlib.pyplot as plt In [59]: df = pd . read_csv ( "areadata.csv" ) df Out[59]: age bought_insaurance 0 22 0 1 25 0 2 47 1 3 52 0 4 46 1 5 56 0 6 24 0 7 65 1 8 23 0 9 32 1 10 43 1 11 34 1 12 45 0 13 54 1 14 65 0 15 13 0 16 42 1 17 35 0 18 53 1 19 61 0 20 62 0 In [60]: % matplotlib inline plt . xlabel ( "age" ) plt . ylabel ( "bought_insaurance" ) plt . scatter ( df . age , df . bought_insaurance , color = "red" , marker = "." ) Out[60]: <matplotlib.collections.PathCollection at 0x18712cad548> In [63]: from sklearn.model_selection import train_test_split x_train , x_test , y_train , y_test = train_test_split ( df [[ "age" ]], df . bought_insaurance , test_size = 0.1 ) In [66]: x_test Out[66]: age 1 25 9 32 4 46 In [67]: x_train Out[67]: age 20 62 12 45 16 42 8 23 18 53 13 54 19 61 7 65 17 35 14 65 2 47 0 22 3 52 6 24 15 13 11 34 ...