for i in range(3): trialTime = datetime.datetime.now() svm = SVC(kernel=kern) line = "%d," % ((i + 1) * pulsar_step) logging.info('Getting Data............') pulsar_data = data_handler.getPulsarData(1, (i + 1) * pulsar_step) logging.info('Fitting Data............') svm.fit(pulsar_data[0], pulsar_data[1]) logging.info('Testing Data............') test_data_prediction = svm.predict(pulsar_data[2]) res = data_handler.recordResults(1, 0, config.pulsar_results, pulsar_data[3], test_data_prediction, approach, False) trialTime = (datetime.datetime.now() - trialTime).seconds line += "%.2f," % trialTime for item in res: line += '%.5f,' % item line = line[:-1] + "\n" file.write(line) logging.info("FINISHED TEST #%d/10 time: %d" % ((i + 1), trialTime)) file.close() else: pulsar_data = data_handler.getPulsarData(1, pulsar_size)
clf = DecisionTreeClassifier(max_depth=best_depth, min_samples_leaf=best_leaf, min_samples_split=pow(10, i)) line = "%d," % (pow(10, i)) logging.info('Getting Data............') pulsar_data = data_handler.getPulsarData(1, pulsar_size) logging.info('Fitting Data............') clf.fit(pulsar_data[0], pulsar_data[1]) logging.info('Testing Data............') test_data_prediction = clf.predict(pulsar_data[2]) res = data_handler.recordResults(1, 0, config.pulsar_results, pulsar_data[3], test_data_prediction, "./DT/DT_", False) trialTime = (datetime.datetime.now() - trialTime).seconds line += "%.2f," % trialTime for item in res: line += '%.5f,' % item line = line[:-1] + "\n" file.write(line) logging.info("FINISHED TEST #%d/20 time: %d" % ((i + 1), trialTime)) file.close() else: pulsar_data = data_handler.getPulsarData(1, pulsar_size)
learning_rate_init=learn, hidden_layer_sizes=(wide, deep), random_state=1) line = "%d," % ((i + 1) * dota_step) logging.info('Getting Data............') dota_data = data_handler.getDotaData(1, (i + 1) * dota_step) logging.info('Fitting Data............') clf.fit(dota_data[0], dota_data[1]) logging.info('Testing Data............') test_data_prediction = clf.predict(dota_data[2]) res = data_handler.recordResults(1, -1, config.dota_results, dota_data[3], test_data_prediction, "./ANN/ANN_", False) trialTime = (datetime.datetime.now() - trialTime).seconds line += "%.2f," % trialTime for item in res: line += "%.5f%%," % item line = line[:-1] + "\n" file.write(line) logging.info("FINISHED TEST #%d/10 time: %d" % ((i + 1), (trialTime))) file.close() else: dota_data = data_handler.getDotaData(1, dota_size) clf.fit(dota_data[0], dota_data[1])
for i in range(3, 5): # for testing trialTime = datetime.datetime.now() svm = SVC(kernel = kern) line = "%d," % ((i + 1) * dota_step) logging.info('Getting Data............') dota_data = data_handler.getDotaData(1, (i + 1) * dota_step) logging.info('Fitting Data............') svm.fit(dota_data[0], dota_data[1]) logging.info('Testing Data............') test_data_prediction = svm.predict(dota_data[2]) res = data_handler.recordResults(1, -1, config.dota_results,dota_data[3], test_data_prediction, approach, False) trialTime = (datetime.datetime.now() - trialTime).seconds line += "%.2f," %trialTime for item in res: line += "%.5f%%," % item line = line[:-1] + "\n" file.write(line) logging.info("FINISHED TEST #%d/10 time: %d" % ((i + 1), trialTime)) file.close() else: logging.info('getting data.............') dota_data = data_handler.getDotaData(1, dota_size)