def postprocess(test_path): submit_path = 'home/' + function.get_paths()['SUBMISSION_PATH'] os.chdir('post_processing') cmd = 'sh ./post_processing.sh {0} home/features/Astar_test.f home/scores/final.score {1}'.format( test_path, submit_path) print cmd os.system(cmd)
def predict(test_path): model_path = 'home/' + function.get_paths()['MODEL_DIR_PATH'] os.chdir('train_and_predict') train_dir = os.getcwd() test_file = 'home/features/all_test.f' os.chdir('Kmeans') cmd = 'python train_predict.py home/features/Kmeans_train+valid.f home/features/Kmeans_test.f {0} home/scores/K.score'.format( test_path) print cmd os.system(cmd) os.chdir(train_dir) os.chdir('BinarySearch') cmd = './predict.sh {0} {1} {2}BS.model home/scores/BS.score'.format( test_file, test_path, model_path) print cmd os.system(cmd) os.chdir(train_dir) os.chdir('Astar') cmd = 'python predict.py {0} {1} {2}AS.model home/scores/AS.score'.format( test_file, test_path, model_path) print cmd os.system(cmd) os.chdir(train_dir)
def main(): top_dir = os.getcwd() raw_dir = 'home/' + function.get_paths()['TRAIN_DATA_DIR_PATH'] aux_dir = 'home/auxiliary_data/' test_path = 'home/' + function.get_paths()['TEST_DATA_PATH'] function.generate_features(raw_dir, aux_dir+'dummyTrain.csv', test_path, '_null.f', '_test.f') os.chdir(top_dir) concate_features() os.chdir(top_dir) predict(test_path) os.chdir(top_dir) weighted_average() os.chdir(top_dir) postprocess(test_path) os.chdir(top_dir)
def main(): top_dir = os.getcwd() raw_dir = 'home/' + function.get_paths()['TRAIN_DATA_DIR_PATH'] aux_dir = 'home/auxiliary_data/' test_path = 'home/' + function.get_paths()['TEST_DATA_PATH'] function.generate_features(raw_dir, aux_dir + 'dummyTrain.csv', test_path, '_null.f', '_test.f') os.chdir(top_dir) concate_features() os.chdir(top_dir) predict(test_path) os.chdir(top_dir) weighted_average() os.chdir(top_dir) postprocess(test_path) os.chdir(top_dir)
def main(): top_dir = os.getcwd() raw_dir = 'home/' + function.get_paths()['TRAIN_DATA_DIR_PATH'] cmd = 'python util/gen_Train+Valid.py {0}Train.csv {0}Valid.csv {0}ValidSolution.csv auxiliary_data/Train+Valid.csv'.format( function.get_paths()['TRAIN_DATA_DIR_PATH']) print cmd os.system(cmd) function.generate_features(raw_dir, raw_dir + 'Train.csv', raw_dir + 'Valid.csv', '_train.f', '_valid.f') os.chdir(top_dir) concate_features() os.chdir(top_dir) set_list = ['all', 'Kmeans'] merge_train_and_valid(set_list, raw_dir) os.chdir(top_dir) train() os.chdir(top_dir)
def train(): model_path = 'home/' + function.get_paths()['MODEL_DIR_PATH'] os.chdir('train_and_predict') train_dir = os.getcwd() train_file = 'home/features/all_train+valid.f' ref_file = 'home/auxiliary_data/Train+Valid.csv' os.chdir('BinarySearch') cmd = './train.sh {0} {1} {2}BS.model'.format(train_file, ref_file, model_path) print cmd os.system(cmd) os.chdir(train_dir) os.chdir('Astar') cmd = 'python train.py {0} {1} {2}AS.model -m 1'.format(train_file, ref_file, model_path) print cmd os.system(cmd) os.chdir(train_dir)
def main(): top_dir = os.getcwd() raw_dir = 'home/' + function.get_paths()['TRAIN_DATA_DIR_PATH'] cmd = 'python util/gen_Train+Valid.py {0}Train.csv {0}Valid.csv {0}ValidSolution.csv auxiliary_data/Train+Valid.csv'.format(function.get_paths()['TRAIN_DATA_DIR_PATH']) print cmd os.system(cmd) function.generate_features(raw_dir, raw_dir+'Train.csv', raw_dir+'Valid.csv', '_train.f', '_valid.f') os.chdir(top_dir) concate_features() os.chdir(top_dir) set_list = ['all', 'Kmeans'] merge_train_and_valid(set_list, raw_dir) os.chdir(top_dir) train() os.chdir(top_dir)
def train(): model_path = 'home/' + function.get_paths()['MODEL_DIR_PATH'] os.chdir('train_and_predict') train_dir = os.getcwd() train_file = 'home/features/all_train+valid.f' ref_file = 'home/auxiliary_data/Train+Valid.csv' os.chdir('BinarySearch') cmd = './train.sh {0} {1} {2}BS.model'.format(train_file, ref_file, model_path) print cmd os.system(cmd) os.chdir(train_dir) os.chdir('Astar') cmd = 'python train.py {0} {1} {2}AS.model -m 1'.format( train_file, ref_file, model_path) print cmd os.system(cmd) os.chdir(train_dir)
def predict(test_path): model_path = 'home/' + function.get_paths()['MODEL_DIR_PATH'] os.chdir('train_and_predict') train_dir = os.getcwd() test_file = 'home/features/all_test.f' os.chdir('Kmeans') cmd = 'python train_predict.py home/features/Kmeans_train+valid.f home/features/Kmeans_test.f {0} home/scores/K.score'.format(test_path) print cmd os.system(cmd) os.chdir(train_dir) os.chdir('BinarySearch') cmd = './predict.sh {0} {1} {2}BS.model home/scores/BS.score'.format(test_file, test_path, model_path) print cmd os.system(cmd) os.chdir(train_dir) os.chdir('Astar') cmd = 'python predict.py {0} {1} {2}AS.model home/scores/AS.score'.format(test_file, test_path, model_path) print cmd os.system(cmd) os.chdir(train_dir)
def postprocess(test_path): submit_path = 'home/' + function.get_paths()['SUBMISSION_PATH'] os.chdir('post_processing') cmd = 'sh ./post_processing.sh {0} home/features/Astar_test.f home/scores/final.score {1}'.format(test_path, submit_path) print cmd os.system(cmd)