You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
from sklearn.ensemble import RandomForestRegressor
from sklearn.model_selection import train_test_split
X = cancer_patient.drop(["Level"], axis = 1)
y = cancer_patient["Level"]
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = 0.2)
rfr = RandomForestRegressor()
rfr.fit(X_train, y_train)
rfr.score(X_test, y_test)
y_pred = rfr.predict(X_test)
from sklearn.metrics import classification_report
y_true = y_test
target_names = ["Low", "Medium", "High"]
print(classification_report(y_true, y_pred, target_names=target_names)) #y_true = represents the true values of the target variable , y_pred = represents the predicted values of the target variable