- rf.fit(X_train, y_train)
-
- joblib.dump(rf, '/tmp/ad/RF')
- print('--------------------------- Training Score------------------------------------')
- score(X_test, y_test, rf)
- print('--------------------------- Test Score------------------------------------')
- test = pd.read_csv('/tmp/ad/ue_test.csv')
- test = test[UEKeyList]
- y = category(test, [sigstr, PRB, tput])
- y =le.transform(y)
- ps = preprocess(test)
- ps.process()
- test = ps.data.drop(['UEID', 'MeasTimestampRF'], axis = 1)
- score(test, y, rf)
-
-def score(X, y, model):
- y_pred = model.predict(X)
- print('Accuracy : {}'.format(accuracy_score(y, y_pred)))
-
- print('confusion matrix : {}'.format(confusion_matrix(y, y_pred)))
- print('f1-score : {}'.format(f1_score(y, y_pred, average = 'macro')))
+ rf.fit(X_train, y_train) # Fit the RFC model
+ print("X_train cols:", X_train.columns)
+ joblib.dump(rf, 'ad/RF') # Save the RF model