1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-31 00:03:03 +04:00

removed many extra whitespaces; fixed 1 warning

This commit is contained in:
Vadim Pisarevsky
2014-08-03 03:08:25 +04:00
parent 28ca6ac05e
commit 2520e335d1
17 changed files with 79 additions and 81 deletions
+8 -8
View File
@@ -1137,7 +1137,7 @@ public:
fs << "iterations" << params.termCrit.maxCount;
fs << "}" << "}";
}
void write( FileStorage& fs ) const
{
if( layer_sizes.empty() )
@@ -1145,7 +1145,7 @@ public:
int i, l_count = layer_count();
fs << "layer_sizes" << layer_sizes;
write_params( fs );
size_t esz = weights[0].elemSize();
@@ -1168,7 +1168,7 @@ public:
}
fs << "]";
}
void read_params( const FileNode& fn )
{
String activ_func_name = (String)fn["activation_function"];
@@ -1186,7 +1186,7 @@ public:
f_param2 = (double)fn["f_param2"];
set_activ_func( activ_func, f_param1, f_param2 );
min_val = (double)fn["min_val"];
max_val = (double)fn["max_val"];
min_val1 = (double)fn["min_val1"];
@@ -1194,11 +1194,11 @@ public:
FileNode tpn = fn["training_params"];
params = Params();
if( !tpn.empty() )
{
String tmethod_name = (String)tpn["train_method"];
if( tmethod_name == "BACKPROP" )
{
params.trainMethod = Params::BACKPROP;
@@ -1216,7 +1216,7 @@ public:
}
else
CV_Error(CV_StsParseError, "Unknown training method (should be BACKPROP or RPROP)");
FileNode tcn = tpn["term_criteria"];
if( !tcn.empty() )
{
@@ -1236,7 +1236,7 @@ public:
}
}
}
void read( const FileNode& fn )
{
clear();
+5 -5
View File
@@ -174,10 +174,10 @@ public:
for( pidx = node->parent; pidx >= 0 && nodes[pidx].right == nidx;
nidx = pidx, pidx = nodes[pidx].parent )
;
if( pidx < 0 )
break;
nidx = nodes[pidx].right;
}
}
@@ -340,7 +340,7 @@ public:
}
printf("%d trees. C=%.2f, training error=%.1f%%, working set size=%d (out of %d)\n", (int)roots.size(), C, err*100./n, (int)sidx.size(), n);
}*/
// renormalize weights
if( sumw > FLT_EPSILON )
normalizeWeights();
@@ -453,14 +453,14 @@ public:
FileNode trees_node = fn["trees"];
FileNodeIterator it = trees_node.begin();
CV_Assert( ntrees == (int)trees_node.size() );
for( int treeidx = 0; treeidx < ntrees; treeidx++, ++it )
{
FileNode nfn = (*it)["nodes"];
readTree(nfn);
}
}
Boost::Params bparams;
vector<double> sumResult;
};
+1 -1
View File
@@ -750,7 +750,7 @@ public:
void setTrainTestSplit(int count, bool shuffle)
{
int i, nsamples = getNSamples();
CV_Assert( 0 <= count < nsamples );
CV_Assert( 0 <= count && count < nsamples );
trainSampleIdx.release();
testSampleIdx.release();
-1
View File
@@ -1363,4 +1363,3 @@ float CvGBTrees::predict( const cv::Mat& sample, const cv::Mat& _missing,
}
#endif
+1 -1
View File
@@ -338,7 +338,7 @@ public:
cv::parallel_for_(cv::Range(0, nsamples),
NBPredictBody(c, cov_rotate_mats, inv_eigen_values, avg, samples,
var_idx, cls_labels, results, resultsProb, rawOutput));
return (float)value;
}
+3 -3
View File
@@ -248,9 +248,9 @@ namespace ml
virtual const std::vector<Node>& getNodes() const { return nodes; }
virtual const std::vector<Split>& getSplits() const { return splits; }
virtual const std::vector<int>& getSubsets() const { return subsets; }
Params params0, params;
vector<int> varIdx;
vector<int> compVarIdx;
vector<uchar> varType;
@@ -263,7 +263,7 @@ namespace ml
vector<int> classLabels;
vector<float> missingSubst;
bool _isClassifier;
Ptr<WorkData> w;
};
+1 -1
View File
@@ -393,7 +393,7 @@ public:
{
impl.write(fs);
}
void read( const FileNode& fn )
{
impl.read(fn);
+3 -3
View File
@@ -292,7 +292,7 @@ public:
if( vcount > 0 )
exp( R, R );
}
void calc( int vcount, int var_count, const float* vecs,
const float* another, Qfloat* results )
{
@@ -353,7 +353,7 @@ static void sortSamplesByClasses( const Mat& _samples, const Mat& _responses,
class_ranges.push_back(i+1);
}
}
//////////////////////// SVM implementation //////////////////////////////
ParamGrid SVM::getDefaultGrid( int param_id )
@@ -1205,7 +1205,7 @@ public:
int max_iter;
double C[2]; // C[0] == Cn, C[1] == Cp
Ptr<SVM::Kernel> kernel;
SelectWorkingSet select_working_set_func;
CalcRho calc_rho_func;
GetRow get_row_func;
+14 -14
View File
@@ -372,7 +372,7 @@ void DTreesImpl::setDParams(const Params& _params)
if( params.CVFolds == 1 )
params.CVFolds = 0;
if( params.regressionAccuracy < 0 )
CV_Error( CV_StsOutOfRange, "params.regression_accuracy should be >= 0" );
}
@@ -637,7 +637,7 @@ void DTreesImpl::calcValue( int nidx, const vector<int>& _sidx )
cv_sum2[j] += t*t*wval;
cv_count[j] += wval;
}
for( j = 0; j < cv_n; j++ )
{
sum += cv_sum[j];
@@ -656,7 +656,7 @@ void DTreesImpl::calcValue( int nidx, const vector<int>& _sidx )
w->cv_Tn[nidx*cv_n + j] = INT_MAX;
}
}
node->node_risk = sum2 - (sum/sumw)*sum;
node->value = sum/sumw;
}
@@ -822,7 +822,7 @@ void DTreesImpl::clusterCategories( const double* vectors, int n, int m, double*
min_idx = idx;
}
}
if( min_idx != labels[i] )
modified = true;
labels[i] = min_idx;
@@ -1116,18 +1116,18 @@ DTreesImpl::WSplit DTreesImpl::findSplitCatReg( int vi, const vector<int>& _sidx
// (there should be a very little loss in accuracy)
for( i = 0; i < mi; i++ )
sum[i] *= counts[i];
for( subset_i = 0; subset_i < mi-1; subset_i++ )
{
int idx = (int)(sum_ptr[subset_i] - sum);
double ni = counts[idx];
if( ni > FLT_EPSILON )
{
double s = sum[idx];
lsum += s; L += ni;
rsum -= s; R -= ni;
if( L > FLT_EPSILON && R > FLT_EPSILON )
{
double val = (lsum*lsum*R + rsum*rsum*L)/(L*R);
@@ -1139,7 +1139,7 @@ DTreesImpl::WSplit DTreesImpl::findSplitCatReg( int vi, const vector<int>& _sidx
}
}
}
WSplit split;
if( best_subset >= 0 )
{
@@ -1372,17 +1372,17 @@ bool DTreesImpl::cutTree( int root, double T, int fold, double min_alpha )
}
nidx = node->left;
}
for( pidx = node->parent; pidx >= 0 && w->wnodes[pidx].right == nidx;
nidx = pidx, pidx = w->wnodes[pidx].parent )
;
if( pidx < 0 )
break;
nidx = w->wnodes[pidx].right;
}
return false;
}
@@ -1807,7 +1807,7 @@ int DTreesImpl::readSplit( const FileNode& fn )
}
split.c = (float)cmpNode;
}
split.quality = (float)fn["quality"];
splits.push_back(split);
@@ -1894,7 +1894,7 @@ Ptr<DTrees> DTrees::create(const DTrees::Params& params)
p->setDParams(params);
return p;
}
}
}