def __init__(self): self.logger = self.__create_logger() self.train = Train() self.eye = Goldeneye() self.sts = SignalTrackingSystem(queue=self.eye.result) self.info_number = 0 self.rounds_done = 0 self.stop_signals = [] self.signals_seen = 0
def test_10(self): myTrainInfo = Train() myTrainInfo.assign_graph( process_input('TrainsPythonGA/data/input.txt')) self.assertEquals(myTrainInfo.routes_in_distance('CC', 30), 7)
def test_1(self): myTrainInfo = Train() myTrainInfo.assign_graph( process_input('TrainsPythonGA/data/input.txt')) self.assertEquals(myTrainInfo.calculate_distance('ABC'), 9)
def test_9(self): myTrainInfo = Train() myTrainInfo.assign_graph( process_input('TrainsPythonGA/data/input.txt')) self.assertEquals(myTrainInfo.calculate_shortest_route('BB'), 9)
def test_7(self): myTrainInfo = Train() myTrainInfo.assign_graph( process_input('TrainsPythonGA/data/input.txt')) self.assertEquals(myTrainInfo.calculate_strips('AC', 4, 'Y'), 3)
#load dataset from text text_database = Getdata() data = text_database.Getdata_from_textfile('Data\MaleFemale.txt') #set only the output column #remove the text values from the dataset #Normalize data #Required Automation source = data[:, 1:4] target = data[:, :1] #Split data for training and testing split_data = Split() s_train, s_test, t_train, t_test = split_data.general_split(source, target) #Choose classifer and build trained model clf = Classifiers(log=True) train = Train() trained_model_nb = train.train_model(clf.navie_bayes(), s_train, t_train) #Predict predicted_output = trained_model_nb.predict(s_test) print('Input:') print(s_test) print('Output:') print(predicted_output) #Check performance nb_performance = Performance_metrix() nb_performance.measure_performance(source, target, trained_model_nb)
print "The application will now end." raise SystemExit return 0 if __name__ == '__main__': clean_screen() presentation() if len(sys.argv) == 1: input_path = 'TrainsPythonGA/data/input.txt' else: input_path = sys.argv[1] myTrainInfo = Train() myTrainInfo.assign_graph(process_input(input_path)) mode = insert_mode() if mode == '1': print myTrainInfo.calculate_distance(insert_path()) elif mode == '2': print myTrainInfo.calculate_strips(insert_strip(), int(insert_max_stops()), specify_stops()) elif mode == '3': print myTrainInfo.calculate_shortest_route(insert_strip()) else: print myTrainInfo.routes_in_distance(insert_strip(), int(insert_max_dist()))