Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
uninline code in CrossValidation.h
  • Loading branch information
Soeren Sonnenburg committed Oct 17, 2011
1 parent 002b7bb commit cb90e0d
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 35 deletions.
23 changes: 14 additions & 9 deletions src/shogun/evaluation/CrossValidation.cpp
Expand Up @@ -22,15 +22,6 @@ CCrossValidation::CCrossValidation()
init();
}

CCrossValidation::~CCrossValidation()
{
SG_UNREF(m_machine);
SG_UNREF(m_features);
SG_UNREF(m_labels);
SG_UNREF(m_splitting_strategy);
SG_UNREF(m_evaluation_criterium);
}

CCrossValidation::CCrossValidation(CMachine* machine, CFeatures* features,
CLabels* labels, CSplittingStrategy* splitting_strategy,
CEvaluation* evaluation_criterium)
Expand All @@ -50,6 +41,20 @@ CCrossValidation::CCrossValidation(CMachine* machine, CFeatures* features,
SG_REF(m_evaluation_criterium);
}

CCrossValidation::~CCrossValidation()
{
SG_UNREF(m_machine);
SG_UNREF(m_features);
SG_UNREF(m_labels);
SG_UNREF(m_splitting_strategy);
SG_UNREF(m_evaluation_criterium);
}

EEvaluationDirection CCrossValidation::get_evaluation_direction()
{
return m_evaluation_criterium->get_evaluation_direction();
}

void CCrossValidation::init()
{
m_machine=NULL;
Expand Down
53 changes: 27 additions & 26 deletions src/shogun/evaluation/CrossValidation.h
Expand Up @@ -28,31 +28,35 @@ class CEvaluation;
* m_conf_int_alpha is the probability for an error, i.e. the value does not lie
* in the confidence interval.
*/
typedef struct

class CrossValidationResult
{
/** mean */
float64_t mean;
/** has conf int */
bool has_conf_int;
/** conf int low */
float64_t conf_int_low;
/** conf int up */
float64_t conf_int_up;
/** conf int alpha */
float64_t conf_int_alpha;

/** print result */
void print_result()
{
if (has_conf_int)
public:
/** print result */
void print_result()
{
SG_SPRINT("[%f,%f] with alpha=%f, mean=%f\n", conf_int_low, conf_int_up,
conf_int_alpha, mean);
if (has_conf_int)
{
SG_SPRINT("[%f,%f] with alpha=%f, mean=%f\n", conf_int_low,
conf_int_up, conf_int_alpha, mean);
}
else
SG_SPRINT("%f\n", mean);
}
else
SG_SPRINT("%f\n", mean);
}
} CrossValidationResult;

public:
/** mean */
float64_t mean;
/** has conf int */
bool has_conf_int;
/** conf int low */
float64_t conf_int_low;
/** conf int up */
float64_t conf_int_up;
/** conf int alpha */
float64_t conf_int_alpha;

};

/** @brief base class for cross-validation evaluation.
* Given a learning machine, a splitting strategy, an evaluation criterium,
Expand Down Expand Up @@ -95,10 +99,7 @@ class CCrossValidation: public CSGObject
virtual ~CCrossValidation();

/** @return in which direction is the best evaluation value? */
inline EEvaluationDirection get_evaluation_direction()
{
return m_evaluation_criterium->get_evaluation_direction();
}
EEvaluationDirection get_evaluation_direction();

/** method for evaluation. Performs cross-validation.
* Is repeated m_num_runs. If this number is larger than one, a confidence
Expand Down

0 comments on commit cb90e0d

Please sign in to comment.