Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- from sklearn import <model_name>
- from sklearn.metrics import accuracy_score, recall_score, precision_score, f1_score, r2_score
- from sklearn.cross_validation import train_test_split
- train_data, test_data, train_label, test_label = train_test_split(
- df['features'],
- df['label'],
- test_size=0.33,
- random_state=42
- )
- model = <model_name>(iterations=2, depth=2, learning_rate=1, loss_function='RMSE', logging_level='Verbose')
- model.fit(train_data, train_label,)
- preds_class = model.predict(train_data)
- print(" accuracy = ", accuracy_score(preds_class, train_label))
- print(" recall_score = ", recall_score(preds_class, train_label))
- print(" precision_score = ", precision_score(preds_class, train_label))
- print(" f1_score = ", f1_score(preds_class, train_label))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement