'greyblue', 'lilac', 'green', 'red', 'cyan', 'violet', 'yellow', 'white', 'darkgrey', 'mediumgrey', 'lightgrey'] # + # Graph setup # - amount_vertecies = 100 percent_edges = 0.5 graph1 = Graph() matrix1 = graph1.create_matrix(amount_vertecies) edges1 = graph1.generate_edges(amount_vertecies, percent_edges) matrix1 = graph1.add_edges(matrix1, edges1) # + # Network configuration data = rgb_colors data_lables = color_names batch_size = 2 length = 10 width = 10 number_iterations = 100 shuffle = True
# - # for now amount_verticies has to be a multiplication of length and width amount_nodes = 400 percent_edges = 0.5 # + # using graph class to generate matrix graph1 = Graph() # + # matrix genaration matrix1 = graph1.create_matrix(amount_nodes) edges1 = graph1.generate_edges(amount_nodes, percent_edges) matrix1 = graph1.add_edges(matrix1, edges1) list_edges = graph1.make_list_edges_distances(matrix1) netxgraph1 = graph1.build_networkx_graph(list_edges) # + # matrix1 # - # This initializes regular SOM grid matrix, it needs to be passes instead of matrix1 for it to work # Also one needs to experiment with sigma to achieve good results learning rate matrix2 = graph1.standard_som_distance_matrix(length, width) matrix2 map1 = MapClass(data, length, width, learning_rate, number_epochs, matrix2, sigma, data_lables, batch_size, shuffle, netxgraph1)