Kaggle competition: MLDM Classification Competition
<SOS> metric: meanfscore Kaggle data source: mldm-classification-competition<predict_on_test>
if not 'sklearn' in sys.modules.keys() :
pip.main(['install', 'sklearn'])
cnn_test_preds = cnn_model.predict(X_test_pad)
 cnn_test_preds_binary = list(map(lambda x: 1 if x >= 0.5 else 0, cnn_test_preds))
cnn_train_preds = cnn_model.predict(X_train_pad)
 cnn_train_preds_binary = list(map(lambda x: 1 if x >= 0.5 else 0, cnn_train_preds))
cnn_val_preds = cnn_model.predict(X_val_pad)
 cnn_val_preds_binary = list(map(lambda x: 1 if x >= 0.5 else 0, cnn_val_preds))<save_to_csv>
train = pd.read_csv('.. /input/train.csv')
 train_y = train.Quality
predictor_cols = ['fixed.acidity','volatile.acidity','citric.acid','residual.sugar','chlorides','free.sulfur.dioxide','total.sulfur.dioxide','density','pH','sulphates','alcohol']
train_X = train[predictor_cols]
imp = SimpleImputer(missing_values=np.nan, strategy='mean')
 imp = imp.fit(train_X )
<set_options>
train_X_imp = imp.transform(train_X)
 my_model = RandomForestClassifier(n_estimators=100)
 my_model.fit(train_X_imp, train_y )
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
 print("GPU is available: {}".format(torch.cuda.is_available()))<load_pretrained>
feature_importances = pd.DataFrame(my_model.feature_importances_,
index = train_X.columns,
columns=['importance'] ).sort_values('importance', ascending=False)
 feature_importances
tokenizer = RobertaTokenizer.from_pretrained('roberta-base')
 model = RobertaForSequenceClassification.from_pretrained('roberta-base' ).to(device )<categorify>
test = pd.read_csv('.. /input/test.csv')
 test_X = test[predictor_cols]
test_X_imp = imp.transform(test_X)
 predicted_q = my_model.predict(test_X_imp)
 print(predicted_q)
<define_variables><EOS> 
my_submission = pd.DataFrame({'Id': test.Id, 'Quality': predicted_q})
 my_submission.to_csv('submission.csv', index=False )