Kaggle competition: Microsoft Malware Prediction
<SOS> metric: AUC Kaggle data source: microsoft-malware-prediction<load_from_csv>
import pandas as pd, numpy as np, os, gc
import matplotlib.pyplot as plt
from datetime import datetime
from datetime import timedelta
train = pd.read_csv('/kaggle/input/restaurant-revenue-prediction/train.csv.zip')
 test = pd.read_csv('/kaggle/input/restaurant-revenue-prediction/test.csv.zip')
 train_Id = train.Id
test_Id = test.Id
train.drop('Id', axis=1, inplace=True)
 test.drop('Id', axis=1, inplace=True )<set_options>
dtypes = {}
dtypes['MachineIdentifier'] = 'str'
dtypes['AvSigVersion'] = 'category'
dtypes['HasDetections'] = 'int8'
df_train = pd.read_csv('.. /input/microsoft-malware-prediction/train.csv', usecols=list(dtypes.keys()), dtype=dtypes)
 print('Loaded',len(df_train),'rows of train.CSV!')
 df_test = pd.read_csv('.. /input/microsoft-malware-prediction/test.csv', usecols=list(dtypes.keys())[0:-1], dtype=dtypes)
 print('Loaded',len(df_test),'rows of test.CSV!')
 df_test2 = pd.read_csv(".. /input/msft-malware-my-best-submission-on-the-private-lb/xdeepfm_submission_CV0.737726_YTS_KnlV32_publicLB0pt688_private_LB0pt662.csv")
 print('Loaded',len(df_test),'rows of super_blend.csv!')
 datedictAS = np.load('.. /input/malware-timestamps/AvSigVersionTimestamps.npy')[() ]
df_test['Date'] = df_test['AvSigVersion'].map(datedictAS)
 df_train['Date'] = df_train['AvSigVersion'].map(datedictAS)
 df_test2 = pd.merge(df_test2, df_test, on='MachineIdentifier', how='left')
 df_test2['AvSigVersion2'] = df_test2['AvSigVersion'].map(lambda x: np.int(x.split('.')[1]))
pd.options.display.max_columns = None
pd.options.display.max_rows = 80
pd.options.display.float_format = '{:.2f}'.format
%matplotlib inline
warnings.filterwarnings('ignore')
 %matplotlib inline<data_type_conversions>
df_test2.loc[(df_test2['AvSigVersion2']==275)|(df_test2['AvSigVersion2']==273),'HasDetections'] *= 0.6
train['pd_date'] = pd.to_datetime(train['Open Date'], format='%m/%d/%Y')
 train['Open_Year'] = train['pd_date'].dt.strftime('%Y')
 train['Open_Month'] = train['pd_date'].dt.strftime('%m')
 train = train.drop('pd_date',axis=1)
 train = train.drop('Open Date',axis=1 )<feature_engineering>
df_test2.loc[ df_test2['Date']>datetime(2018,11,21,0,0),'HasDetections'] *= 0.6
test['pd_date'] = pd.to_datetime(test['Open Date'], format='%m/%d/%Y')
 test['Open_Year'] = test['pd_date'].dt.strftime('%Y')
 test['Open_Month'] = test['pd_date'].dt.strftime('%m')
 test = test.drop('pd_date',axis=1)
 test = test.drop('Open Date',axis=1 )<count_values>
df_test2[['MachineIdentifier','HasDetections']].to_csv('PrivateLeaderboard.csv', index=False )