<jupyter_start><jupyter_text>Practical logistic Regression<jupyter_code>import pandas as pd
from matplotlib import pyplot as plt
%matplotlib inline
import seaborn as sb
df=pd.read_csv("C:/Users/Bharathi/Downloads/insurance_data.csv")
df.head()
plt.scatter(df.age,df.bought_insurance)
sb.regplot(x="age",y="bought_insurance",data=df,
          logistic=True,n_boot=500,y_jitter=.03)
from sklearn.model_selection import train_test_split
X_train, X_test, y_train, y_test=train_test_split(df[['age']],df.bought_insurance,test_size=0.1,random_state=66)
X_test
from sklearn.linear_model import LogisticRegression
model=LogisticRegression()
model.fit(X_train,y_train)
model.predict(X_test)
model.predict_proba(X_test)
model.predict([[22]])
model.predict([[22]])
model.score(X_test,y_test)
X_test<jupyter_output><empty_output>
StarcoderdataJupyterStructuredCleanDedup