Commit bf584f0d authored by Vadim Pisarevsky's avatar Vadim Pisarevsky

fixed a couple of warnings and 2 possible bugs

parent 02885b8b
...@@ -601,8 +601,8 @@ float CvGBTrees::find_optimal_value( const CvMat* _Idx ) ...@@ -601,8 +601,8 @@ float CvGBTrees::find_optimal_value( const CvMat* _Idx )
case ABSOLUTE_LOSS: case ABSOLUTE_LOSS:
{ {
float* residuals = new float[n]; float* residuals = new float[n];
for (int i=0; i<n; ++i) for (int i=0; i<n; ++i, ++idx)
residuals[i] = (resp_data[*idx] - cur_data[*idx++]); residuals[i] = (resp_data[*idx] - cur_data[*idx]);
icvSortFloat(residuals, n, 0.0f); icvSortFloat(residuals, n, 0.0f);
if (n % 2) if (n % 2)
gamma = residuals[n/2]; gamma = residuals[n/2];
...@@ -613,8 +613,8 @@ float CvGBTrees::find_optimal_value( const CvMat* _Idx ) ...@@ -613,8 +613,8 @@ float CvGBTrees::find_optimal_value( const CvMat* _Idx )
case HUBER_LOSS: case HUBER_LOSS:
{ {
float* residuals = new float[n]; float* residuals = new float[n];
for (int i=0; i<n; ++i) for (int i=0; i<n; ++i, ++idx)
residuals[i] = (resp_data[*idx] - cur_data[*idx++]); residuals[i] = (resp_data[*idx] - cur_data[*idx]);
icvSortFloat(residuals, n, 0.0f); icvSortFloat(residuals, n, 0.0f);
int n_half = n >> 1; int n_half = n >> 1;
...@@ -781,9 +781,6 @@ float CvGBTrees::predict( const CvMat* _sample, const CvMat* _missing, ...@@ -781,9 +781,6 @@ float CvGBTrees::predict( const CvMat* _sample, const CvMat* _missing,
void CvGBTrees::write_params( CvFileStorage* fs ) const void CvGBTrees::write_params( CvFileStorage* fs ) const
{ {
CV_FUNCNAME( "CvGBTrees::write_params" );
__BEGIN__;
const char* loss_function_type_str = const char* loss_function_type_str =
params.loss_function_type == SQUARED_LOSS ? "SquaredLoss" : params.loss_function_type == SQUARED_LOSS ? "SquaredLoss" :
params.loss_function_type == ABSOLUTE_LOSS ? "AbsoluteLoss" : params.loss_function_type == ABSOLUTE_LOSS ? "AbsoluteLoss" :
...@@ -806,8 +803,6 @@ void CvGBTrees::write_params( CvFileStorage* fs ) const ...@@ -806,8 +803,6 @@ void CvGBTrees::write_params( CvFileStorage* fs ) const
data->is_classifier = !problem_type(); data->is_classifier = !problem_type();
data->write_params( fs ); data->write_params( fs );
data->is_classifier = 0; data->is_classifier = 0;
__END__;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment