DEFAULT_SIZE = (20, 20) DEFAULT_FIRST_MOVE = (10, 10) PLAY_WITH_AI = True AI_VS_AI = True AI_FIRST = True RANDOM_START = True # Static AI parameters DEFAULT_ALPHA_BETA_DEPTH = 1 DEFAULT_ALPHA_BETA_WIDTH = 10 ANN_ALPHA_BETA_DEPTH = 4 PRINT_EVALUATION = False # EA parameters SHOW_PLOT = True POP_SIZE = 40 NGEN = 30 CXPB = 0.8 MUTPB = 0.5 TOURNAMENT_SIZE = 10 MAX_FIT = 10000.0 ELITISM = 1 # ANN parameters LAYER_SIZES = [400, 25, 5, 1] NEEDED_WEIGHTS = new_ann.get_weights_needed(LAYER_SIZES) NEEDED_BIASES = new_ann.get_biases_needed(LAYER_SIZES) # Testing... SIZES = [(10, 10)]
# # :type filter_shape: tuple or list of length 4 # # :param filter_shape: (number of filters, num input feature maps, filter height, filter width) # # # :type image_shape: tuple or list of length 4 # # :param image_shape: (batch size, num input feature maps, image height, image width) # # ann = LeNetConvPoolLayer(rng, input1d, filter_shape=(2, 3, 5, 5), image_shape=(4,3,20,20), poolsize=(2,2)) # # print(ann.output) import numpy as np from ann import new_ann layer_sizes = [5, 10, 1] print("Weights needed", new_ann.get_weights_needed(layer_sizes)) print("Biases needed", new_ann.get_biases_needed(layer_sizes)) test_weights = [0.1, 0.3, 0.4, 0.1, 0.3, 0.1, 0.3, 0.4, 0.1, 0.3, 0.1, 0.3, 0.4, 0.1, 0.3, 0.1, 0.3, 0.4, 0.1, 0.3, 0.1, 0.3, 0.4, 0.1, 0.3, 0.1, 0.3, 0.4, 0.1, 0.3, 0.1, 0.3, 0.4, 0.1, 0.3, 0.1, 0.3, 0.4, 0.1, 0.3, 0.1, 0.3, 0.4, 0.1, 0.3, 0.1, 0.3, 0.4, 0.1, 0.3, 0.1, 0.3, 0.4, 0.1, 0.3, 0.1, 0.3, 0.4, 0.1, 0.3] test_biases = [0.1, 0.3, 0.4, 0.1, 0.2, 0.1, 0.3, 0.4, 0.1, 0.2, 0.1] actual_weights = [np.array([[0.1, 0.3, 0.4, 0.1, 0.3, 0.1, 0.3, 0.4, 0.1, 0.3], [0.1, 0.3, 0.4, 0.1, 0.3, 0.1, 0.3, 0.4, 0.1, 0.3], [0.1, 0.3, 0.4, 0.1, 0.3, 0.1, 0.3, 0.4, 0.1, 0.3], [0.1, 0.3, 0.4, 0.1, 0.3, 0.1, 0.3, 0.4, 0.1, 0.3], [0.1, 0.3, 0.4, 0.1, 0.3, 0.1, 0.3, 0.4, 0.1, 0.3]]), np.array([[0.1], [0.3], [0.4], [0.1], [0.3], [0.1], [0.3], [0.4], [0.1], [0.3]])] # in --> [out] actual_biases = [np.array([0.1, 0.3, 0.4, 0.1, 0.2, 0.1, 0.3, 0.4, 0.1, 0.2]), np.array([0.1])] # out splitted_weights = new_ann.convert_weights_to_arrays(layer_sizes, test_weights)