'siam_k': 2, 'siam_ne': 20, 'spec_ne': 100, 'siam_lr': 1e-3, 'spec_lr': 1e-6, 'siam_patience': 10, 'spec_patience': 20, 'siam_drop': 0.1, 'spec_drop': 0.001, 'batch_size': 64, 'siam_reg': None, 'spec_reg': None , 'siam_n': None, 'siamese_tot_pairs': 3200, 'arch': [ {'type': 'relu', 'size': 512}, {'type': 'relu', 'size': 512}, {'type': 'relu', 'size': 4}, ], 'use_approx': False, 'use_all_data': True, } # preprocess dataset data = get_data(params) # run spectral net x_spectralnet, y_spectralnet = run_net(data, params)
for x in train_motoric_indices ]), axis=0) eval_x_motoric = np.concatenate(tuple([ preprocessed_data[1][x - delay:x + 750 - delay] for x in eval_motoric_indices ]), axis=0) eval_y_motoric = np.concatenate(tuple([ preprocessed_data[3][x - delay:x + 750 - delay] for x in eval_motoric_indices ]), axis=0) else: train_x_motoric = preprocessed_data[0] train_y_motoric = preprocessed_data[2] eval_x_motoric = preprocessed_data[1] eval_y_motoric = preprocessed_data[3] statistics.distances( (train_x_motoric, eval_x_motoric, train_y_motoric, eval_y_motoric), 'takens_MI_only') # Exploring data statistics # Process into spectral-net format, create pairs for siamese network data = get_data( params, (train_x_motoric, eval_x_motoric, train_y_motoric, eval_y_motoric)) # run spectral net x_spectralnet, y_spectralnet = run_net(data, params)
'siam_n': ..., 'siamese_tot_pairs': ..., 'arch': [ { 'type': 'relu', 'size':... }, { 'type': 'relu', 'size':... }, { 'type': 'relu', 'size':... }, ], 'use_approx': ..., } # load dataset x_train, x_test, y_train, y_test = load_new_dataset_data() new_dataset_data = (x_train, x_test, y_train, y_test) # preprocess dataset data = get_data(params, new_dataset_data) # run spectral net x_spectralnet, y_spectralnet = run_net(data, params)
''' Experiments on Caltech101-20 and NoisyMNIST. ''' import os import sys # add directories in src/ to path sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__),'..'))) # set cuda os.environ['CUDA_VISIBLE_DEVICES'] = '0' from applications.MvSCN import run_net from core.Config import load_config from core.data import get_data # load config for NoisyMNIST config = load_config('./config/noisymnist.yaml') # load config for Caltech101-20 # config = load_config('./config/Caltech101-20.yaml') # use pretrained SiameseNet. config['siam_pre_train'] = True # LOAD DATA data_list = get_data(config) # RUN EXPERIMENT x_final_list, scores = run_net(data_list, config)