# Get Train and test sets train_set, test_set, chord_train_set, chord_test_set = data_class.get_ind_train_and_test_set( train_set_size, test_set_size) if chord_embed_method == 'embed': chord_dim = chord_embedding_dim elif chord_embed_method == 'onehot': chord_dim = num_chords elif chord_embed_method == 'int': chord_dim = 1 if next_chord_feature: chord_dim = chord_dim * 2 # Load model for chord embeddings chord_embed_model = chord_model.Embed_Chord_Model(chord_model_path) # Build Melody Model print('creating model...') model = Sequential() # model.add(LSTM(lstm_size, batch_size=batch_size, input_shape=(step_size, new_num_notes+chord_dim+counter_size), stateful=True)) model.add( LSTM(lstm_size, batch_input_shape=(batch_size, step_size, new_num_notes + chord_dim + counter_size), stateful=True)) model.add(Dense(new_num_notes)) model.add(Activation('sigmoid')) if optimizer == 'RMS': optimizer = RMSprop(lr=learning_rate) if optimizer == 'Adam': optimizer = Adam(lr=learning_rate)
self.f_score.append(round(statistics.mean(f_scores), 2)) self.sequence_cross_entropy.append( round(statistics.mean(sequence_cross_entropies), 2)) self.transition_cross_entropy.append( round(statistics.mean(transition_cross_entropies), 2)) self.steady_state_cross_entropy.append( round(statistics.mean(steady_state_cross_entropies), 2)) print(f'\nF-score:\t\t\t{self.f_score[-1]}') print(f'Cross entropy:\t\t\t{self.sequence_cross_entropy[-1]}') print( f'Transition cross entropy:\t{self.transition_cross_entropy[-1]}' ) print( f'Steady state cross entropy:\t{self.steady_state_cross_entropy[-1]}' ) if __name__ == '__main__': if len(sys.argv) > 1: if len(sys.argv) > 2: evaluation = Evaluation( interval=1, chord_embed_model=chord_model.Embed_Chord_Model(sys.argv[1])) evaluation.import_model(name=sys.argv[2]) evaluation.evaluate() else: print('Please specify the polyphonic model path.') else: print('Please specify the chord model path.')