Module Expr Str ImportFrom alias Import alias identifier ImportFrom alias ImportFrom alias ImportFrom alias Import alias identifier ImportFrom alias Assign NameStore Num FunctionDef arguments args NameParam NameParam defaults NameLoad body Expr Str Assign NameStore Call AttributeLoad NameLoad attr Call NameLoad NameLoad keyword Str keyword Call NameLoad Num Num keyword Num If NameLoad body Assign NameStore Call AttributeLoad NameLoad attr Call NameLoad NameLoad keyword Str keyword ListLoad Num keyword Num orelse Assign NameStore Call AttributeLoad NameLoad attr SubscriptLoad AttributeLoad NameLoad attr Index Num Return TupleLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str With Call NameLoad NameLoad Str NameStore body Expr Call AttributeLoad NameLoad attr Str For TupleStore NameStore NameStore Call NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr BinOpMod Str TupleLoad BinOpAdd NameLoad Num NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam NameParam defaults NameLoad body Assign NameStore ListComp Num comprehension NameStore Call NameLoad Num SubscriptLoad AttributeLoad NameLoad attr Index Num For NameStore Call NameLoad Num NameLoad body If NameLoad body Expr Call AttributeLoad NameLoad attr keyword BinOpAdd NameLoad NameLoad Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Assign NameStore SubscriptLoad Call AttributeLoad NameLoad attr NameLoad ExtSlice Slice Index Num For NameStore Call NameLoad Num SubscriptLoad AttributeLoad NameLoad attr Index Num body AugAssignAdd SubscriptStore NameLoad Index NameLoad SubscriptLoad NameLoad Index NameLoad For NameStore Call NameLoad Num Call NameLoad NameLoad body AugAssignDiv SubscriptStore NameLoad Index NameLoad Call NameLoad NameLoad Return Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Call AttributeLoad NameLoad attr NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam NameParam defaults body Assign NameStore Num Assign NameStore Call NameLoad NameLoad keyword NameLoad keyword NameLoad keyword NameLoad Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Num For TupleStore NameStore NameStore NameLoad body Assign TupleStore NameStore NameStore TupleLoad SubscriptLoad NameLoad Index NameLoad SubscriptLoad NameLoad Index NameLoad Assign TupleStore NameStore NameStore TupleLoad SubscriptLoad Call AttributeLoad NameLoad attr NameLoad Index NameLoad SubscriptLoad Call AttributeLoad NameLoad attr NameLoad Index NameLoad Assign NameStore Call NameLoad NameLoad NameLoad NameLoad NameLoad Num NameLoad keyword NameLoad Assign NameStore Call NameLoad NameLoad NameLoad Print BinOpMod Str TupleLoad BinOpAdd NameLoad Num NameLoad NameLoad AugAssignAdd NameStore NameLoad AugAssignDiv NameStore NameLoad Print BinOpMod Str NameLoad Assign NameStore SubscriptLoad AttributeLoad NameLoad attr Index Num For NameStore Call NameLoad NameLoad body For NameStore Call NameLoad BinOpAdd NameLoad Num NameLoad body Print BinOpMod Str TupleLoad NameLoad NameLoad Assign NameStore BinOpAdd SubscriptLoad NameLoad ExtSlice Slice Index NameLoad SubscriptLoad NameLoad ExtSlice Slice Index NameLoad Assign NameStore BinOpAdd SubscriptLoad NameLoad ExtSlice Slice Index NameLoad SubscriptLoad NameLoad ExtSlice Slice Index NameLoad Assign NameStore Call AttributeLoad NameLoad attr TupleLoad NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr TupleLoad NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Num Assign NameStore Num For TupleStore NameStore NameStore NameLoad body Assign TupleStore NameStore NameStore TupleLoad SubscriptLoad NameLoad Index NameLoad SubscriptLoad NameLoad Index NameLoad Assign TupleStore NameStore NameStore TupleLoad SubscriptLoad Call AttributeLoad NameLoad attr NameLoad Index NameLoad SubscriptLoad Call AttributeLoad NameLoad attr NameLoad Index NameLoad Assign NameStore Call NameLoad NameLoad NameLoad NameLoad NameLoad Num NameLoad keyword NameLoad Assign NameStore Call NameLoad NameLoad NameLoad Print BinOpMod Str TupleLoad BinOpAdd NameLoad Num NameLoad NameLoad AugAssignAdd NameStore NameLoad AugAssignDiv NameStore NameLoad If CompareGt NameLoad BinOpAdd NameLoad NameLoad body Print BinOpMod Str TupleLoad NameLoad NameLoad NameLoad NameLoad BinOpSub NameLoad NameLoad Assign NameStore NameLoad orelse Assign NameStore Call AttributeLoad NameLoad attr NameLoad Num Num Assign NameStore Call AttributeLoad NameLoad attr NameLoad Num Num For NameStore Call NameLoad NameLoad body For NameStore Call NameLoad BinOpAdd NameLoad Num NameLoad body For NameStore Call NameLoad BinOpAdd NameLoad Num NameLoad body Print BinOpMod Str TupleLoad NameLoad NameLoad NameLoad Assign NameStore BinOpAdd BinOpAdd SubscriptLoad NameLoad ExtSlice Slice Index NameLoad SubscriptLoad NameLoad ExtSlice Slice Index NameLoad SubscriptLoad NameLoad ExtSlice Slice Index NameLoad Assign NameStore BinOpAdd BinOpAdd SubscriptLoad NameLoad ExtSlice Slice Index NameLoad SubscriptLoad NameLoad ExtSlice Slice Index NameLoad SubscriptLoad NameLoad ExtSlice Slice Index NameLoad Assign NameStore Call AttributeLoad NameLoad attr TupleLoad NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr TupleLoad NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Num Assign NameStore Num For TupleStore NameStore NameStore NameLoad body Assign TupleStore NameStore NameStore TupleLoad SubscriptLoad NameLoad Index NameLoad SubscriptLoad NameLoad Index NameLoad Assign TupleStore NameStore NameStore TupleLoad SubscriptLoad Call AttributeLoad NameLoad attr NameLoad Index NameLoad SubscriptLoad Call AttributeLoad NameLoad attr NameLoad Index NameLoad Assign NameStore Call NameLoad NameLoad NameLoad NameLoad NameLoad Num NameLoad keyword NameLoad Assign NameStore Call NameLoad NameLoad NameLoad Print BinOpMod Str TupleLoad BinOpAdd NameLoad Num NameLoad NameLoad AugAssignAdd NameStore NameLoad AugAssignDiv NameStore NameLoad If CompareGt NameLoad BinOpAdd NameLoad NameLoad body Print BinOpMod Str TupleLoad NameLoad NameLoad NameLoad NameLoad NameLoad BinOpSub NameLoad NameLoad Assign NameStore NameLoad orelse Assign NameStore Call AttributeLoad NameLoad attr NameLoad Num Num Assign NameStore Call AttributeLoad NameLoad attr NameLoad Num Num Return TupleLoad NameLoad NameLoad decorator_list FunctionDef arguments args defaults body Expr Str Assign NameStore Str Assign NameStore Call NameLoad keyword Num keyword Str Print Str Assign TupleStore NameStore NameStore Call NameLoad Str Assign TupleStore NameStore NameStore Call NameLoad Str keyword NameLoad Assign TupleStore NameStore NameStore Call NameLoad NameLoad NameLoad NameLoad NameLoad Num Num Num Assign NameStore Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr TupleLoad NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad Assign NameStore ListComp Num comprehension NameStore Call NameLoad Num SubscriptLoad AttributeLoad NameLoad attr Index Num Assign NameStore Num Assign NameStore Num Assign NameStore Num Assign NameStore Call NameLoad NameLoad keyword NameLoad keyword NameLoad keyword NameLoad Assign NameStore Num For TupleStore NameStore NameStore NameLoad body Assign TupleStore NameStore NameStore TupleLoad SubscriptLoad NameLoad Index NameLoad SubscriptLoad NameLoad Index NameLoad Assign TupleStore NameStore NameStore TupleLoad SubscriptLoad Call AttributeLoad NameLoad attr NameLoad Index NameLoad SubscriptLoad Call AttributeLoad NameLoad attr NameLoad Index NameLoad Assign NameStore Call NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad keyword NameLoad Assign NameStore Call NameLoad NameLoad NameLoad Print BinOpMod Str TupleLoad BinOpAdd NameLoad Num NameLoad NameLoad AugAssignAdd NameStore NameLoad Assign NameStore Num For NameStore NameLoad body Assign SubscriptStore NameLoad Index NameLoad SubscriptLoad NameLoad Index NameLoad AugAssignAdd NameStore Num AugAssignAdd NameStore Num AugAssignDiv NameStore NameLoad Print BinOpMod Str NameLoad Print Str Expr Call NameLoad Call AttributeLoad NameLoad attr NameLoad BinOpAdd NameLoad Str Assign NameStore Call NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad keyword NameLoad Expr Call NameLoad Call AttributeLoad NameLoad attr NameLoad BinOpAdd NameLoad Str decorator_list If CompareEq NameLoad Str body Expr Call NameLoad
N/A N/A  Amazon Access Challenge Code for ensemble

Marios Michaildis script for Amazon .

Uses 3-way interactions with forward feature selection and logistic regression

based on Paul Duan's Script.
 

 __future__ division N/A numpy np sklearn preprocessing sklearn.linear_model LogisticRegression sklearn.metrics roc_auc_score N/A XGBoostClassifier xg sklearn.cross_validation StratifiedKFold N/A SEED 42 load_data N/A N/A filename use_labels N/A True N/A N/A 
    Load data from CSV files and return them as numpy arrays
    The use_labels parameter indicates whether one should
    read the first column (containing class labels). If false,
    return all 0s. 
     N/A data N/A N/A np loadtxt N/A open filename delimiter , usecols N/A range 1 9 skiprows 1 N/A use_labels N/A N/A labels N/A N/A np loadtxt N/A open filename delimiter , usecols N/A 0 skiprows 1 N/A N/A labels N/A N/A np zeros N/A N/A data shape N/A 0 N/A N/A labels data N/A save_results N/A N/A predictions filename N/A N/A N/A Given a vector of predictions, save results in CSV format. N/A N/A open filename w f N/A N/A N/A N/A f write id,ACTION
 N/A N/A i pred N/A enumerate predictions N/A N/A N/A N/A f write N/A %d,%f
 N/A N/A i 1 pred N/A bagged_set N/A N/A X_t y_c model seed estimators xt update_seed N/A True N/A N/A baggedpred N/A 0.0 N/A d N/A range 0 N/A N/A xt shape N/A 0 N/A n N/A range 0 estimators N/A N/A update_seed N/A N/A N/A N/A model set_params random_state N/A seed n N/A N/A N/A model fit X_t y_c N/A preds N/A N/A N/A model predict_proba xt N/A N/A N/A 1 N/A j N/A range 0 N/A N/A xt shape N/A 0 N/A N/A N/A baggedpred N/A j N/A preds N/A j N/A j N/A range 0 N/A len baggedpred N/A N/A N/A baggedpred N/A j N/A float estimators N/A N/A N/A np array baggedpred N/A printfilcsve N/A N/A X filename N/A N/A N/A N/A N/A np savetxt filename X N/A Make_3way N/A N/A X Xt model y seed n atleast N/A N/A N/A grand_auc 0.0 N/A kfolder N/A StratifiedKFold y n_folds n shuffle True random_state seed N/A encoder N/A N/A preprocessing OneHotEncoder N/A Xs N/A N/A encoder fit_transform X N/A i 0 N/A N/A train_index test_index kfolder N/A N/A N/A X_train X_cv N/A N/A Xs N/A train_index N/A Xs N/A test_index N/A N/A y_train y_cv N/A N/A N/A N/A np array y N/A train_index N/A N/A N/A np array y N/A test_index N/A preds N/A bagged_set X_train y_train model SEED 1 X_cv update_seed True N/A roc_auc N/A roc_auc_score y_cv preds N/A N/A AUC (fold %d/%d): %f N/A N/A i 1 n roc_auc N/A grand_auc roc_auc N/A grand_auc n N/A N/A Total AUC is %f grand_auc N/A columns_length N/A N/A X shape N/A 1 N/A j N/A range columns_length N/A N/A d N/A range N/A j 1 columns_length N/A N/A N/A Adding columns' interraction %d and %d N/A j d N/A new_column_train N/A N/A X N/A N/A N/A j N/A X N/A N/A N/A d N/A new_column_test N/A N/A Xt N/A N/A N/A j N/A Xt N/A N/A N/A d N/A X N/A N/A np column_stack N/A X new_column_train N/A Xt N/A N/A np column_stack N/A Xt new_column_test N/A encoder N/A N/A preprocessing OneHotEncoder N/A Xs N/A N/A encoder fit_transform X N/A mean_auc 0.0 N/A i 0 N/A N/A train_index test_index kfolder N/A N/A N/A X_train X_cv N/A N/A Xs N/A train_index N/A Xs N/A test_index N/A N/A y_train y_cv N/A N/A N/A N/A np array y N/A train_index N/A N/A N/A np array y N/A test_index N/A preds N/A bagged_set X_train y_train model SEED 1 X_cv update_seed True N/A roc_auc N/A roc_auc_score y_cv preds N/A N/A AUC (fold %d/%d): %f N/A N/A i 1 n roc_auc N/A mean_auc roc_auc N/A mean_auc n N/A N/A mean_auc N/A grand_auc atleast N/A N/A N/A There is uplift by considering variables %d  and %d as new auc: %f with previous best: %f, difference of %f ! N/A j d mean_auc grand_auc N/A mean_auc grand_auc N/A grand_auc mean_auc N/A N/A X N/A N/A np delete X -1 1 N/A Xt N/A N/A np delete Xt -1 1 N/A j N/A range columns_length N/A N/A d N/A range N/A j 1 columns_length N/A N/A m N/A range N/A d 1 columns_length N/A N/A N/A Adding columns' interraction %d and %d and %d N/A j d m N/A new_column_train N/A N/A N/A X N/A N/A N/A j N/A X N/A N/A N/A d N/A X N/A N/A N/A m N/A new_column_test N/A N/A N/A Xt N/A N/A N/A j N/A Xt N/A N/A N/A d N/A Xt N/A N/A N/A m N/A X N/A N/A np column_stack N/A X new_column_train N/A Xt N/A N/A np column_stack N/A Xt new_column_test N/A encoder N/A N/A preprocessing OneHotEncoder N/A Xs N/A N/A encoder fit_transform X N/A mean_auc 0.0 N/A i 0 N/A N/A train_index test_index kfolder N/A N/A N/A X_train X_cv N/A N/A Xs N/A train_index N/A Xs N/A test_index N/A N/A y_train y_cv N/A N/A N/A N/A np array y N/A train_index N/A N/A N/A np array y N/A test_index N/A preds N/A bagged_set X_train y_train model SEED 1 X_cv update_seed True N/A roc_auc N/A roc_auc_score y_cv preds N/A N/A AUC (fold %d/%d): %f N/A N/A i 1 n roc_auc N/A mean_auc roc_auc N/A mean_auc n N/A N/A mean_auc N/A grand_auc atleast N/A N/A N/A There is uplift by considering variables %d  and %d and %d as new auc: %f with previous best: %f, difference of %f ! N/A j d m mean_auc grand_auc N/A mean_auc grand_auc N/A grand_auc mean_auc N/A N/A X N/A N/A np delete X -1 1 N/A Xt N/A N/A np delete Xt -1 1 N/A N/A X Xt N/A main N/A N/A N/A N/A N/A 
    Fit models and make predictions.
    We'll use one-hot encoding to transform our categorical features
    into binary features.
    y and X will be numpy array objects.
     N/A filename main_logit_3way_best N/A model N/A LogisticRegression C 0.7 penalty l2 N/A loading data N/A N/A y X N/A load_data train.csv N/A N/A y_test X_test N/A load_data test.csv use_labels False N/A N/A X X_test N/A Make_3way X X_test model y 1 5 7.5e-05 N/A encoder N/A N/A preprocessing OneHotEncoder N/A N/A N/A encoder fit N/A N/A np vstack N/A X X_test N/A X N/A N/A encoder transform X N/A X_test N/A N/A encoder transform X_test N/A train_stacker N/A 0.0 N/A k N/A range 0 N/A N/A X shape N/A 0 N/A mean_auc 0.0 N/A bagging 1 N/A n 5 N/A kfolder N/A StratifiedKFold y n_folds n shuffle True random_state SEED N/A i 0 N/A N/A train_index test_index kfolder N/A N/A N/A X_train X_cv N/A N/A X N/A train_index N/A X N/A test_index N/A N/A y_train y_cv N/A N/A N/A N/A np array y N/A train_index N/A N/A N/A np array y N/A test_index N/A preds N/A bagged_set X_train y_train model SEED bagging X_cv update_seed True N/A roc_auc N/A roc_auc_score y_cv preds N/A N/A AUC (fold %d/%d): %f N/A N/A i 1 n roc_auc N/A mean_auc roc_auc N/A no 0 N/A real_index test_index N/A N/A N/A train_stacker N/A real_index N/A preds N/A no N/A no 1 N/A i 1 N/A mean_auc n N/A N/A  Average AUC: %f mean_auc N/A  printing train datasets  N/A N/A printfilcsve N/A N/A np array train_stacker N/A filename .train.csv N/A preds N/A bagged_set X y model SEED bagging X_test update_seed True N/A N/A printfilcsve N/A N/A np array preds N/A filename .test.csv N/A N/A N/A __name__ __main__ N/A N/A N/A main