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) # + # ### Drawing configuration
# 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 graph2 = Graph() matrix2 = graph2.standard_som_distance_matrix(length, width) list_edges = graph2.make_list_edges_distances(matrix2) netxgraph2 = graph2.build_networkx_graph(list_edges) map1 = MapClass(data, length, width, learning_rate, number_epochs, matrix2, sigma, data_lables, batch_size, shuffle, netxgraph2, special_shape_map) # + # ### Drawing configuration # drawtype="rbg" tries to draw colors on map - needs an input data with 3 dimensions or columns (colors) # drawtype="black-white" draws black-white - needs an input data with one dimension or column (gray_colors) # drawtype="networkx" graph drawing using the networkx library # drawtype="None" - default draws empty space # Also there is networkx graph drawing