#ifndef KD_train_H
#define KD_train_H

#include <stdio.h>
#include <pthread.h>
#include <stdlib.h>
#include "config.h"
#include "mfcc.h"
#include "matrix.h"
#include "mlp.h"
#include "mlp_train.h"
#include "dtw.h"
#include "classifier.h"
#include "dictionary.h"

#ifndef METACENTRUM
    #include "cell_mat_wrapper.h"
    #include <matio.h>
#endif

#define KD_train_DEBUG

double *KD_train_grad_paralel(cell *pairs, mlp *net, double b);
void KD_train_minimize (cell *pairs, mlp* net, double b, double lp, double max_error, unsigned int max_iter, const char *logfile, const char *mlpfile);

// EXTRAKCE PRIZNAKU
matrix *KD_train_transform (matrix *seq, mlp *net);

// NACITANI DAT A ZPRACOVANI NACTENYCH DAT
void KD_train_add_word_to_list(list *L_words, char *word);
cell *KD_train_create_train_pairs3 (dictionary *dict, dictionary *not_belong, int report);
matrix *KD_train_find_diferent_words(dictionary *dict_op, cell *phone_structure);
dictionary *KD_train_create_dictionary(cell *dict);

double KD_train_lk (double DWW, double DWO);
double KD_train_lk2 (double DWW, double DWO, double border);

// AUC
double KD_train_auc(cell *pairs, mlp *net);
double KD_train_auc2(cell *pairs);
double KD_train_energy(cell *pairs, mlp *net, double b, unsigned int start, unsigned int end);
double KD_train_energy_paralel (cell *pairs, mlp *net, double b);
void *KD_train_energy_thread(void *arg);

#endif