visualize_rgb(map1.weights) # + classification # + # + tens_try = map1.weights.view(length, width, 3) plt.imshow(tens_try) classification = map1.classify_all(map1.convert_data_tensor(data)) for i in range(len(classification)): loc_tuple = map1.get_location(classification[i]) plt.text(loc_tuple[1], loc_tuple[0], color_names[i], ha='center', va='center', bbox=dict(facecolor='white', alpha=0.5, lw=0)) z # plt.text(0, 1, color_names[1], ha='center', va='center', # bbox=dict(facecolor='white', alpha=0.5, lw=0)) plt.show() # - visualize_rgb(map1)
shuffle=True) return trainloader, dim, number_rows_data # - def large_cycle(map_, training_data): basic_visualization(map_display(map_.map)) print(map_display(map_.map)) for i in range(number_iterations): cycle(map_, training_data) basic_visualization(map_display(map_.map)) print(map_display(map_.map)) training, dim, number_rows_data = load_data(data) map1 = MapClass(length, width, dim, move_closer_coef, number_iterations) map1.weights_to_map() map1.step(training, verbose=True) map1.cycle(training, verbose=True) map1.classify_all(map1.convert_data_tensor(data)) map1.convert_data_tensor(data)