if __name__ == '__main__': ''' Train and test neural network. ''' # Load data. path_weights = "resources/nn_weights_reduced.bin" path_train = "resources/crimes_training_ones.bin" # path_train = "resources/crimes_samples_training.bin" path_tests = "resources/crimes_testing_ones.bin" # path_tests = "resources/crimes_samples_testing.bin" print "Normalizing train" crime_train = CrimeData(path_train) crime_train.data[:, 22:24], mean_x_y, std_x_y = z_norm_by_feature( crime_train.data[:, 22:24]) crime_train.data[:, 1:5], mean_time, std_time = z_norm_by_feature( crime_train.data[:, 1:5]) crime_train.data = np.hstack( (crime_train.data[:, 0:12], crime_train.data[:, 22:24])) print "Normalizing test" crime_test = CrimeData(path_tests) crime_test.data[:, 22:24] = z_norm_by_feature(crime_test.data[:, 22:24], mean_x_y, std_x_y) crime_test.data[:, 1:5] = z_norm_by_feature(crime_test.data[:, 1:5], mean_time, std_time) crime_test.data = np.hstack( (crime_test.data[:, 0:12], crime_test.data[:, 22:24]))