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, output_dense_layers=1, output_dense_units=128) c_nn.include_self_comparison = False c_nn.weighted_classes = True c_nn.class_weights_approximation = 'stochastic'
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)
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, allow_less_clusters=False) en = None # dp = Simple2DPointDataProvider(min_cluster_count=1, max_cluster_count=10, allow_less_clusters=False) en = SimpleFCEmbedding(output_size=3, hidden_layers=[2], final_activation='tanh') c_nn = ClusterNNMergedInputs(dp, 3, en) c_nn.minibatch_size = 2 c_nn.validate_every_nth_epoch = 1 c_nn.debug_mode = True # c_nn.use_cluster_count_loss = False # c_nn.use_similarities_loss = False # c_nn.fixed_cluster_count_output = dp.get_max_cluster_count() # c_nn.f_cluster_count = lambda: 10 # c_nn.minibatch_size = 200 # c_nn._get_keras_loss()
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 c_nn.class_weights_post_processing_f = lambda x: np.sqrt(x)
# 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], final_activation='tanh') # en = None c_nn = ClusterNNTry00_V02(dp, 50, en, lstm_layers=15, lstm_units=128, cluster_count_dense_layers=1, cluster_count_dense_units=128, output_dense_layers=1, output_dense_units=256) 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.validate_every_nth_epoch = 10 # c_nn.f_cluster_count = lambda: 10 c_nn.minibatch_size = 200 # i = 0 # start = time()
from impl.data.image.cifar100_data_provider import Cifar100DataProvider from impl.data.image.birds200_data_provider import Birds200DataProvider from impl.data.audio.timit_data_provider import TIMITDataProvider from impl.nn.base.embedding_nn.cnn_embedding import CnnEmbedding from impl.nn.base.embedding_nn.cnn_bdlstm_embedding import CnnBDLSTMEmbedding from impl.nn.base.embedding_nn.simple_fc_embedding import SimpleFCEmbedding from impl.nn.base.embedding_nn.bdlstm_embedding import BDLSTMEmbedding is_linux = platform == "linux" or platform == "linux2" top_dir = "/cluster/home/meierbe8/data/MT/" if is_linux else "G:/tmp/" ds_dir = "./" if is_linux else "../" dp = Simple2DPointDataProvider(min_cluster_count=1, max_cluster_count=3, allow_less_clusters=False) en = SimpleFCEmbedding(hidden_layers=[2]) autosave_dir = top_dir + 'test/autosave_ClusterNN_playground' # Define the possible input counts input_counts = [3, 4, 5] # Create an array with all possible models models = [] master_network = None for input_count in reversed(sorted(input_counts)): print("Initialize model with {} inputs...".format(input_count)) # cnn = ClusterNNMergedInputs(dp, input_count, en, weighted_classes=True) cnn = MinimalClusterNN(dp, input_count, en, weighted_classes=True)