function cls_out = check_regression_sett(cls_in, def_sett)

% cls_out = check_regression_sett(cls_in, def_sett)
% 
% This function check member variables of chosen classification algorithm 
% structure. It checks if this variables are set correctly or are not set
% and returns the structure with corrected (default) settings.
%
% cls_in            - input classification algorithm structure
% cls_out           - output classification algorithm structure
% def_sett          - default setting for classification algorithms
%
% Supported regression algorithms and settings:
%   a) Classification and Regression Trees algorithm
%      - No settings yet (TODO)
%
%
%
% --
% ing. Zoltán Galáž
% xgalaz00@stud.feec.vutbr.cz       
% 
% Department of Telecommunications
% Faculty of Electrical Engineering and Communication
% Brno University of Technology

%% Paths and variables
if ((nargin < 2) || (isempty(def_sett)))  
    def_sett.def_alg = 'cart';
    def_sett.cart    = struct();
else
    
    % Default regression algorithm to use
    if (~isfield(def_sett, 'def_alg'))
        def_sett.def_alg = 'cart';
    end
    
    def_sett.cart = struct();
    % TODO: add options for Cart algorithm
end

if (~isfield(cls_in, 'alg'))
    cls_in.alg = def_sett.def_alg;
end

%% Lower the algorithm specification (for consistency)
cls_in.alg = lower(cls_in.alg);

%% Check the classification algorithm description
% ------------------------------------------------------------------------
% 1) Classification and Regression Trees algorithm
if (strcmp(cls_in.alg, 'classificationandregressiontrees')         || ...
    strcmp(cls_in.alg, 'classification and regression trees')      || ...
    strcmp(cls_in.alg, 'regressiontrees')                          || ...
    strcmp(cls_in.alg, 'regression trees')                         || ...
    strcmp(cls_in.alg, 'cart algorithm')                           || ...
    strcmp(cls_in.alg, 'cart'))
    
    % Classification and Regression Trees algorithm settings
    cls_out = cls_in;
else
    cls_out = [];
end