Untitled2 - Jupyter Notebook
Untitled2 - Jupyter Notebook
In [ ]: #Predicting if a person will buy an insurance or not based on age using logistic
0 22 0
1 25 0
2 47 1
3 52 0
4 46 1
In [7]: df shape
Out[7]: (27, 2)
1 of 4 14-09-2023, 15:31
Untitled2 - Jupyter Notebook http://localhost:8890/notebooks/Desktop/Lakshya%2021-CSE-84/Untitl...
Out[36]: (9, 1)
Out[37]: (18, 1)
Out[39]: ▾ LogisticRegression
LogisticRegression()
In [40]: X_test
Out[40]:
age
17 58
14 49
18 19
3 52
23 45
10 18
20 21
21 26
4 46
Out[42]: 0.8888888888888888
Out[43]: 0.8888888888888888
Out[48]: array([[0.1312933]])
2 of 4 14-09-2023, 15:31
Untitled2 - Jupyter Notebook http://localhost:8890/notebooks/Desktop/Lakshya%2021-CSE-84/Untitl...
Out[49]: array([-4.92847769])
In [55]: age=45
pred_function(age)
Out[55]: 0.7245211304910166
In [ ]:
3 of 4 14-09-2023, 15:31
Untitled2 - Jupyter Notebook http://localhost:8890/notebooks/Desktop/Lakshya%2021-CSE-84/Untitl...
4 of 4 14-09-2023, 15:31