Changeset 233 for trunk/src/WeNNI.cc


Ignore:
Timestamp:
Feb 21, 2005, 3:52:30 PM (18 years ago)
Author:
Peter
Message:

function added

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/WeNNI.cc

    r228 r233  
    1515  WeNNI::WeNNI(const gslapi::matrix& matrix,const gslapi::matrix& flag,
    1616               const u_int neighbours)
    17     : NNI(matrix,flag,neighbours)
     17    : NNI(matrix,flag,neighbours), imputed_data_raw_(matrix)
    1818  {
    1919    //estimate();
     
    3434      sort(distance.begin(),distance.end(),
    3535                pair_value_compare<u_int,double>());
     36      bool row_imputed=true;
    3637      for (unsigned int j=0; j<data_.columns(); j++) {
    3738        vector<u_int> knn=nearest_neighbours(j,distance);
     
    4748        }
    4849        // No impute if no contributions from neighbours.
    49         if (norm)
     50        if (norm){
     51          imputed_data_raw_(i,j) = new_value/norm;
    5052          imputed_data_(i,j)=
    51             weight_(i,j)*data_(i,j) + (1-weight_(i,j)) * new_value/norm;
     53            weight_(i,j)*data_(i,j) + (1-weight_(i,j))* imputed_data_raw_(i,j);
     54        }
    5255        else
    53           not_imputed_.push_back(i);
     56          row_imputed=false;
    5457      }
     58      if (!row_imputed)
     59        not_imputed_.push_back(i);
    5560    }
    5661    return not_imputed_.size();
Note: See TracChangeset for help on using the changeset viewer.