diff --git a/.idea/workspace.xml b/.idea/workspace.xml index e97f849..cc8febf 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,7 +2,8 @@ - + + @@ -34,8 +35,8 @@ - - + + @@ -823,8 +824,8 @@ - - + + diff --git a/prepare_data.py b/prepare_data.py index 9e149fb..0d38a6b 100644 --- a/prepare_data.py +++ b/prepare_data.py @@ -6,6 +6,7 @@ import numpy as np import h5py import gc import math +import keras.backend as K # functions for saving, loading and shuffling whole arrays to ram @@ -319,7 +320,8 @@ def generate_X_and_y(dictionary, max_word, max_num_vowels, content, vowels, acce if len(word_accetuations) > 0: y_value = 1/len(word_accetuations) for el in word_accetuations: - y[i][el] = y_value + # y[i][el] = y_value + y[i][el] = 1 else: y[i][0] = 1 # y[i][generate_presentable_y(word_accetuations, list(el[3]), max_num_vowels)] = 1 @@ -457,6 +459,11 @@ def generate_X_and_y_RAM_efficient(name, split_number): h5f.close() +# metric for calculation of correct results +def actual_accuracy(y_true, y_pred): + return K.mean(K.equal(K.mean(K.equal(K.round(y_true), K.round(y_pred)), axis=-1), 1.0)) + + # generator for inputs for tracking of data fitting def generate_fake_epoch(orig_X, orig_X_additional, orig_y, batch_size): size = orig_X.shape[0]