Untitled
unknown
plain_text
14 days ago
583 B
6
Indexable
from re import X
import panda as pd
import sklearn.model_selection as sk
import matplotlib.pyplot as plt
data={ 'Hours':[1,2,3,4,5,6,7,8],
'Result':[0,0,0,0,1,1,1,1]}
df=pd.DataFrame(data)
plt.xlabel('Hours Studied')
plt.ylabel('Pass/Fail')
plt.scatter(df['Hours'],df['Result'], color='blue' , marker='o')
plt.show()
X_train,X_test,Y_train,Y_test=train_test_split(df[['Hours']],df['Result'], test_size=0.25)
model=LogisticRegression()
model.fit(X_train,Y_train)
new_prediction=model.predict([[4.5]])
print("prediction for 4.5 hours studied:", new_prediction)Editor is loading...
Leave a Comment