Kaggle competition: Mechanisms of Action (MoA) Prediction
<SOS> metric: MeanColumnwiseLogLoss Kaggle data source: mechanisms-of-action-(moa)-prediction<define_variables>
import numpy as np
import pandas as pd
import os
set5=set(i for i in train[(train['killStreaks']>3)&(train['weaponsAcquired']> 30)].index.tolist() )<define_variables>
submission = pd.read_csv('/kaggle/input/lish-moa/sample_submission.csv')
 public_ids = list(submission['sig_id'].values)
 submission.shape
set6=set(i for i in train[(train['killStreaks']>3)&(train['weaponsAcquired']> 30)].index.tolist() )<define_variables>
test = pd.read_csv('/kaggle/input/lish-moa/test_features.csv')
 test_ids = list(test['sig_id'].values)
 private_ids = list(set(test_ids)-set(public_ids))
len(private_ids )
sets=set1 | set2 | set3 | set4 | set5 | set6<drop_column>
def make_filename(idx):
return glob.glob('.. /input/moa-1082020/' + str(idx)+ '.csv')[0]
def read_predictions(idx):
temp = pd.read_csv(make_filename(idx))
return temp
train.drop(train.index[list(sets)],inplace=True )<drop_column>
predictions = []
predictions.append(pd.read_csv('.. /input/blendings/submissionfeats.csv'))
predictions.append(pd.read_csv('.. /input/blendings/submissionorj.csv'))
train.drop(['roadkillsrate'],axis=1,inplace=True)
 train.columns.drop('winPlacePerc')==test.columns<feature_engineering>
y_pred = pd.DataFrame()
y_pred['sig_id'] = predictions[0]['sig_id']
for column in target_columns:
column_data = []
for i in range(len(predictions)) :
column_data.append(predictions[i][column])
 y_pred[column] = np.mean(column_data, axis=0)
 y_pred.shape
<feature_engineering><EOS> 
submission = pd.DataFrame(index = public_ids + private_ids, columns=target_columns)
 submission.index.name = 'sig_id'
submission[:] = 0
submission.loc[y_pred.sig_id,:] = y_pred[target_columns].values
submission.loc[test[test.cp_type == 'ctl_vehicle'].sig_id] = 0
submission.to_csv('submission.csv', index=True)