Changeset 233


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

function added

Location:
trunk/src
Files:
2 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();
  • trunk/src/WeNNI.h

    r228 r233  
    4040    u_int estimate(void);
    4141
     42    ///
     43    /// @return A const reference to.
     44    ///
     45    const gslapi::matrix& imputed_data_raw(void) const
     46    { return imputed_data_raw_; }
     47
     48
     49
    4250  private:
    4351
    44 
     52    gslapi::matrix imputed_data_raw_;
    4553  };
    4654
Note: See TracChangeset for help on using the changeset viewer.