if __name__ == '__main__': # Difference to test_cluster_nn_try00.py: No embedding is used and the network always returns that 10 clusters were # found, but some of them may be empty from sys import platform from impl.data.simple_2d_point_data_provider import Simple2DPointDataProvider from impl.nn.base.embedding_nn.simple_fc_embedding import SimpleFCEmbedding is_linux = platform == "linux" or platform == "linux2" top_dir = "/cluster/home/meierbe8/data/MT/" if is_linux else "G:/tmp/" fixedc = 3 dp = Simple2DPointDataProvider(min_cluster_count=fixedc, max_cluster_count=fixedc, allow_less_clusters=False, use_extended_data_gen=True) # dp = Simple2DPointDataProvider(min_cluster_count=1, max_cluster_count=10, allow_less_clusters=False) en = SimpleFCEmbedding(output_size=8, hidden_layers=[16, 32, 64, 64], hidden_activation=LeakyReLU(), final_activation='tanh') # en = None c_nn = ClusterNNTry00_V11(dp, 102, en, lstm_layers=5, lstm_units=96, cluster_count_dense_layers=1, cluster_count_dense_units=128,
from impl.nn.base.embedding_nn.cnn_embedding import CnnEmbedding is_linux = platform == "linux" or platform == "linux2" top_dir = "/cluster/home/meierbe8/data/MT_gpulab/" if is_linux else "G:/tmp/" ds_dir = "./" if is_linux else "../" p = Augmentor.Pipeline() p.random_distortion(probability=1, grid_width=4, grid_height=4, magnitude=8) p.flip_left_right(probability=0.5) # p.flip_top_bottom(probability=0.5) # p.rotate90(probability=0.5) # p.rotate270(probability=0.5) dp = Simple2DPointDataProvider( min_cluster_count=1, max_cluster_count=5, use_extended_data_gen=True, sigma=0.05 ) en = None def get_cnn(): c_nn = ClusterNNTry00_V146(dp, 72, en, lstm_layers=14, internal_embedding_size=96*3, cluster_count_dense_layers=1, cluster_count_dense_units=256, output_dense_layers=0, output_dense_units=256, cluster_count_lstm_layers=1, cluster_count_lstm_units=128, kl_embedding_size=128, kl_divergence_factor=0., simplified_center_loss_factor=0.) c_nn.include_self_comparison = False c_nn.weighted_classes = True c_nn.class_weights_approximation = 'stochastic' c_nn.minibatch_size = 200 c_nn.class_weights_post_processing_f = lambda x: np.sqrt(x) c_nn.set_loss_weight('similarities_output', 5.0) c_nn.optimizer = Adadelta(lr=5.0)
max_cluster_count=10) dp.target_min_cluster_count = 10 dp.target_max_cluster_count = 10 en = CnnEmbedding(output_size=100, cnn_layers_per_block=1, block_feature_counts=[32, 64], fc_layer_feature_counts=[], hidden_activation='relu', final_activation='relu', batch_norm_for_init_layer=True, cnn_filter_size=5) fixedc = 2 dp = Simple2DPointDataProvider( min_cluster_count=fixedc, max_cluster_count=fixedc, ) en = None dp = DummyDataProvider([[ [0.1, 0.9], [0.2, 0.8], ], [ [0.3, 0.7], [0.2, 0.7], [0, 1], ], [[0, 1], [2, 3]]]) dp = Simple2DPointDataProvider( min_cluster_count=1, max_cluster_count=3,
if __name__ == '__main__': # Difference to test_cluster_nn_try00.py: No embedding is used and the network always returns that 10 clusters were # found, but some of them may be empty from sys import platform from impl.data.simple_2d_point_data_provider import Simple2DPointDataProvider from impl.nn.base.embedding_nn.simple_fc_embedding import SimpleFCEmbedding is_linux = platform == "linux" or platform == "linux2" top_dir = "/cluster/home/meierbe8/data/MT/" if is_linux else "G:/tmp/" fixedc = 7 dp = Simple2DPointDataProvider(min_cluster_count=fixedc, max_cluster_count=fixedc, allow_less_clusters=False) # dp = Simple2DPointDataProvider(min_cluster_count=1, max_cluster_count=10, allow_less_clusters=False) en = SimpleFCEmbedding(output_size=2, hidden_layers=[16, 32, 64, 64], hidden_activation=LeakyReLU(), final_activation='tanh') # en = None c_nn = ClusterNNTry00_V08(dp, 50, en, lstm_layers=3, pre_lstm_layers=3, lstm_units=64, cluster_count_dense_layers=1,
import matplotlib matplotlib.use('Agg') from impl.nn.try01.cluster_nn_try01 import ClusterNNTry01 if __name__ == '__main__': from sys import platform from impl.data.simple_2d_point_data_provider import Simple2DPointDataProvider from impl.nn.base.embedding_nn.simple_fc_embedding import SimpleFCEmbedding is_linux = platform == "linux" or platform == "linux2" top_dir = "/cluster/home/meierbe8/data/MT/" if is_linux else "G:/tmp/" dp = Simple2DPointDataProvider() en = SimpleFCEmbedding() #en = None # DO NOT USE ANY embedding (just use the twodimensional-points) c_nn = ClusterNNTry01(dp, 50, en, iterations=2) c_nn.minibatch_size = 96 c_nn.build_networks() # Enable autosave and try to load the latest configuration autosave_dir = top_dir + 'test/autosave_ClusterNNTry01' c_nn.register_autosave(autosave_dir) c_nn.try_load_from_autosave(autosave_dir) # Train a loooong time c_nn.train(1000000)
from impl.nn.try03_kmeans.cluster_nn_try03_kmeans_v04 import ClusterNNTry03KMeansV04 if __name__ == '__main__': from sys import platform from impl.data.simple_2d_point_data_provider import Simple2DPointDataProvider from impl.nn.base.embedding_nn.simple_fc_embedding import SimpleFCEmbedding is_linux = platform == "linux" or platform == "linux2" top_dir = "/cluster/home/meierbe8/data/MT/" if is_linux else "G:/tmp/" testing = False if testing: dp = Simple2DPointDataProvider(min_cluster_count=3, max_cluster_count=3) en = SimpleFCEmbedding(hidden_layers=0, output_size=2) en = None #en = None # DO NOT USE ANY embedding (just use the twodimensional-points) c_nn = ClusterNNTry03KMeansV04(dp, 3, en, lstm_layers=0, lstm_units=8, kmeans_itrs=2, cluster_count_dense_layers=0, cluster_count_dense_units=1, kmeans_input_dimension=2) c_nn.weighted_classes = True c_nn.minibatch_size = 2
if __name__ == '__main__': # Difference to test_cluster_nn_try00.py: No embedding is used and the network uses weighted classes from sys import platform from impl.data.simple_2d_point_data_provider import Simple2DPointDataProvider from impl.nn.base.embedding_nn.simple_fc_embedding import SimpleFCEmbedding is_linux = platform == "linux" or platform == "linux2" top_dir = "/cluster/home/meierbe8/data/MT/" if is_linux else "G:/tmp/" #fixedc = 5 #dp = Simple2DPointDataProvider(min_cluster_count=fixedc, max_cluster_count=fixedc, allow_less_clusters=False) dp = Simple2DPointDataProvider(min_cluster_count=1, max_cluster_count=10) #en = SimpleFCEmbedding() en = None c_nn = ClusterNNTry00(dp, 50, en, weighted_classes=True) # c_nn.f_cluster_count = lambda: 10 c_nn.minibatch_size = 200 c_nn.class_weights_approximation = 'stochastic' # i = 0 # start = time() # while True: # try: # print(i)