function best_meta = select_cv(X, y, fn_train, fn_loss, fn_predict, metaparams)
% Funckija za izbor najboljeg metaparametra unakrsnom validacijom

    num_metaparams = length(metaparams);
	errors = zeros(num_metaparams, 1);
    
	% Unakrsnom validacijom racunamo procenu kvaliteta modela sa i-tim metaparametrom
    for i = 1:num_metaparams
        errors(i) = eval_cv(X, y, @(X, y) fn_train(X, y, metaparams(i)), fn_loss, fn_predict);
    end
    
    [~, best_ind] = min(errors);
    best_meta = metaparams(best_ind);

end
