<s> "<STR_LIT>" <EOL> import pandas as pd <EOL> from sklearn . pipeline import Pipeline <EOL> from sklearn . preprocessing import PolynomialFeatures , MinMaxScaler <EOL> from sklearn . linear_model import LogisticRegression as LR <EOL> train_file = '<STR_LIT>' <EOL> test_file = '<STR_LIT>' <EOL> output_file = '<STR_LIT>' <EOL> train = pd . read_csv ( train_file ) <EOL> test = pd . read_csv ( test_file ) <EOL> train . drop ( '<STR_LIT>' , axis = <NUM_LIT:1> , inplace = True ) <EOL> assert ( set ( train . c1 . unique ( ) ) == set ( test . c1 . unique ( ) ) ) <EOL> train_dummies = pd . get_dummies ( train . c1 ) <EOL> train_num = pd . concat ( ( train . drop ( '<STR_LIT>' , axis = <NUM_LIT:1> ) , train_dummies ) , axis = <NUM_LIT:1> ) <EOL> test_dummies = pd . get_dummies ( test . c1 ) <EOL> test_num = pd . concat ( ( test . drop ( '<STR_LIT>' , axis = <NUM_LIT:1> ) , test_dummies ) , axis = <NUM_LIT:1> ) <EOL> y_train = train_num . target . values <EOL> x_train = train_num . drop ( '<STR_LIT:target>' , axis = <NUM_LIT:1> ) <EOL> x_test = test_num . drop ( '<STR_LIT>' , axis = <NUM_LIT:1> ) <EOL> print "<STR_LIT>" <EOL> pipeline = MinMaxScaler ( ) <EOL> x_train_new = pipeline . fit_transform ( x_train ) <EOL> x_test_new = pipeline . transform ( x_test ) <EOL> print "<STR_LIT>" <EOL> lr = LR ( ) <EOL> lr . fit ( x_train_new , y_train ) <EOL> print "<STR_LIT>" <EOL> p = lr . predict_proba ( x_test_new ) <EOL> print "<STR_LIT>" <EOL> test_num [ '<STR_LIT>' ] = p [ : , <NUM_LIT:1> ] <EOL> test_num . to_csv ( output_file , columns = ( '<STR_LIT>' , '<STR_LIT>' ) , index = None ) </s>
