Exemplo n.º 1
0
                      'patient_id': val[1],
                      'time_begin': val[2],  # [hour, minute]
                      'duration': 10,  # seconds
                      'brain_state': val[3],
                      'add_id': '(M)',
                      # model parameters ------------------------
                      'visible_size': 'all',  # 'all' or scalar
                      'hidden_size': 0,  # improve: portion
                      'lambda': 0,
                      'af': 'relu',  # 'relu', 'linear', 'sigmoid'
                      'bias': True,
                      'window_size': 0,
                      'resample': 512,
                      # train parameters -------------------------
                      'loss_function': 'mae',  # 'mse' or 'mae'
                      'lr': 0.0002,
                      'batch_size': 5,
                      'shuffle': False,
                      'normalization': 'standard_positive',  # 'min_max', 'standard', None
                      'epochs': 23}

            utrain.train_and_test(params)
            ufig.plot_train_test(ids_all[-1], [1, 3, 5, 7])

        ufig.plot_multi_boxplots(ids=ids_attempt, x='batch_size', y='correlation', hue='brain_state',
                                 save_name=pre + 'corr' + post, ylim=(0, 1))
        #ufig.plot_multi_boxplots(ids=ids_attempt, x='patient_id', y='mae', hue='brain_state', save_name=pre + 'mae' + post)
        #ufig.plot_multi_boxplots(ids=ids_attempt, x='patient_id', y='mse', hue='brain_state', save_name=pre + 'mse' + post)

    ufig.mean_weights(ids=ids_all, save_name=pre)
Exemplo n.º 2
0
                'loss_function': 'mae',  # 'mse' or 'mae'
                'lr': 0.001,
                'batch_size': 2560,
                'shuffle': False,
                'normalization':
                'standard_positive',  # 'min_max', 'standard', None
                'epochs': 250
            }

            utrain.train_and_test(params)
            ufig.plot_train_test(ids_attempt[-1], [3, 8, 13, 17],
                                 lim_nr_samples=2000)

        ufig.plot_multi_boxplots(ids=ids_attempt,
                                 x='patient_id',
                                 y='correlation',
                                 hue='brain_state',
                                 save_name=pre + 'corr' + post)
        ufig.plot_multi_boxplots(ids=ids_attempt,
                                 x='patient_id',
                                 y='mae',
                                 hue='brain_state',
                                 save_name=pre + 'mae' + post)
        ufig.plot_multi_boxplots(ids=ids_attempt,
                                 x='patient_id',
                                 y='mse',
                                 hue='brain_state',
                                 save_name=pre + 'mse' + post)

    ufig.mean_weights(ids=ids_all, save_name=pre)
Exemplo n.º 3
0
        for i in range(3):
            ids.append('batch_size_' + str(val) + '_' + pre + '_ID07_32h07m_' + str(i))
            if custom_set:
                custom_test_set = {'time_begin': [32, 7, 20],
                                   'duration': 10,
                                   'batch_size': 50}
                utrain.predict(ids[-1], custom_test_set=custom_test_set)
                utrain.distance(ids[-1])
            print('0')
            ids.append('batch_size_' + str(val) + '_' + pre + '_ID07_35h15m_' + str(i))
            if custom_set:
                custom_test_set = {'time_begin': [35, 15, 20],
                                   'duration': 10,
                                   'batch_size': 50}
                utrain.predict(ids[-1], custom_test_set=custom_test_set)
                utrain.distance(ids[-1])
            print('1')
            ids.append('batch_size_' + str(val) + '_' + pre + '_ID07_38h22m_' + str(i))
            if custom_set:
                custom_test_set = {'time_begin': [38, 22, 20],
                                   'duration': 10,
                                   'batch_size': 50}
                utrain.predict(ids[-1], custom_test_set=custom_test_set)
                utrain.distance(ids[-1])
            print('2')
        print('---------------------------------------------')

    ufig.plot_multi_boxplots(ids=ids, x='batch_size', y='correlation', hue='brain_state',
                             save_name='batch_size_' + pre, ylim=(0, 1))
    ufig.mean_weights(ids=ids, save_name='batch_size_' + pre, hidden=True, diagonal=True)