Some styling changes
This commit is contained in:
@@ -42,6 +42,9 @@ namespace cv {
|
||||
* where @f$ \bar{y} = frac{1}{y}\sum_{i=1}^{n} y_i @f$.
|
||||
* For example, a model having R2Score = 0.85, explains 85 \% variability of
|
||||
* the response data around its mean.
|
||||
*
|
||||
* @tparam AdjustedR2 If true, then the Adjusted R2 score will be used.
|
||||
* Otherwise, the regular R2 score is used.
|
||||
*/
|
||||
|
||||
template<bool AdjustedR2>
|
||||
@@ -49,7 +52,7 @@ class R2Score
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Run prediction and calculate the R squared or Adjusted R sauared error.
|
||||
* Run prediction and calculate the R squared or Adjusted R squared error.
|
||||
*
|
||||
* @param model A regression model.
|
||||
* @param data Column-major data containing test items.
|
||||
|
||||
@@ -18,8 +18,8 @@ namespace cv {
|
||||
template<bool AdjustedR2>
|
||||
template<typename MLAlgorithm, typename DataType, typename ResponsesType>
|
||||
double R2Score<AdjustedR2>::Evaluate(MLAlgorithm& model,
|
||||
const DataType& data,
|
||||
const ResponsesType& responses)
|
||||
const DataType& data,
|
||||
const ResponsesType& responses)
|
||||
{
|
||||
if (data.n_cols != responses.n_cols)
|
||||
{
|
||||
@@ -50,7 +50,8 @@ double R2Score<AdjustedR2>::Evaluate(MLAlgorithm& model,
|
||||
return totalSumSquared ? 1.0 : DBL_MIN;
|
||||
// Returning adjusted R-squared.
|
||||
double rsq = 1 - (residualSumSquared / totalSumSquared);
|
||||
return (1 - ((1 - rsq) * ((data.n_cols - 1) / (data.n_cols - data.n_rows - 1))));
|
||||
return (1 - ((1 - rsq) * ((data.n_cols - 1) /
|
||||
(data.n_cols - data.n_rows - 1))));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -212,7 +212,6 @@ TEST_CASE("AdjR2ScoreTest", "[CVTest]")
|
||||
<= 1e-7);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test the mean squared error with matrix responses.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user