1rst Exp
1rst Exp
import pandas as pd
import numpy as np
# Load dataset
df = pd.read_csv('diabetes.csv')
print(df.info())
# Scale features
scaler = StandardScaler()
# Train model
# Evaluate model
y_pred = model.predict(X_test_scaled)
print("Confusion Matrix:")
print(confusion_matrix(y_test, y_pred))
while True:
try:
except ValueError:
("Pregnancies: ", True), ("Glucose: ", False), ("Blood Pressure: ", False),
("Skin Thickness: ", False), ("Insulin: ", False), ("BMI: ", False),
]]
# Predict diabetes
new_sample = scaler.transform([values])
prediction = model.predict(new_sample)[0]
probability = model.predict_proba(new_sample)[0].max()
result = "DIABETIC" if prediction else "NOT DIABETIC"
plt.xlabel('Glucose')
plt.ylabel('Frequency')
plt.show()