f1 score model implementation
# Import Libraries from sklearn.model_selection import train_test_split from sklearn.metrics import precision_score, recall_score, f1_score from sklearn.ensemble import RandomForestClassifier # Feature Engineering y=df.pop('class') X_train, X_test, y_train, y_test = train_test_split(df, y, test_size=0.1, random_state=42) # Model Implementation clf = RandomForestClassifier() clf = clf.fit(X_train, y_train) predictions=clf.predict(X_test) print(f1_score(predictions,y_test))