Skip to content

Commit

Permalink
more CppCheck warnings solved
Browse files Browse the repository at this point in the history
  • Loading branch information
kosloot committed Feb 14, 2024
1 parent 0619b31 commit 0d112e5
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
3 changes: 2 additions & 1 deletion include/timbl/Features.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,8 @@ namespace Timbl {
double weight;
void Statistics( double );
void NumStatistics( std::vector<FeatureValue *>&, double );
void ChiSquareStatistics( std::vector<FeatureValue *>&, const Targets& );
void ChiSquareStatistics( const std::vector<FeatureValue *>&,
const Targets& );
void ChiSquareStatistics( const Targets& );
void SharedVarianceStatistics( const Targets&, int );
void StandardDeviationStatistics();
Expand Down
4 changes: 2 additions & 2 deletions src/Features.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ namespace Timbl {
// And the split. info.
//
split_info = 0.0;
for ( const auto& fv : values_array ){
for ( const auto* fv : values_array ){
double Prob = fv->ValFreq() / (double)TotalVals;
if ( Prob > 0 ) {
split_info += Prob * Log2(Prob);
Expand All @@ -426,7 +426,7 @@ namespace Timbl {
}
}

void Feature::ChiSquareStatistics( vector<FeatureValue *>& FVA,
void Feature::ChiSquareStatistics( const vector<FeatureValue *>& FVA,
const Targets& Targs ){
size_t Num_Vals = FVA.size();
chi_square = 0.0;
Expand Down
2 changes: 1 addition & 1 deletion src/Instance.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ namespace Timbl {
}

ostream& operator<<( ostream& os, const Instance& I ){
for ( const auto& it : I.FV ){
for ( const auto* it : I.FV ){
os << it << ", ";
}
os << I.TV << " " << I.sample_weight;
Expand Down
4 changes: 2 additions & 2 deletions src/Statistics.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ namespace Timbl {
const Targets& targets ) const {
os << "Confusion Matrix:" << endl;
os << " ";
for ( const auto& val : targets.values_array ){
for ( const auto* val : targets.values_array ){
// Print the class names.
os.width(6);
os.setf(ios::right, ios::adjustfield);
Expand Down Expand Up @@ -155,7 +155,7 @@ namespace Timbl {
size_t FP = 0;
size_t FN = 0;
size_t TN = 0;
ValueClass *tv = targets.values_array[i];
const ValueClass *tv = targets.values_array[i];
size_t testCount = 0;
for ( unsigned int j=0; j < size; ++j ){
testCount += mat[i][j];
Expand Down
2 changes: 1 addition & 1 deletion src/Targets.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ namespace Timbl {
tie = false;
auto It = distribution.begin();
if ( It != distribution.end() ){
Vfield *pnt = It->second;
const Vfield *pnt = It->second;
size_t Max = pnt->Freq();
if ( do_rand ){
int nof_best=1, pick=1;
Expand Down

0 comments on commit 0d112e5

Please sign in to comment.