Changeset 172


Ignore:
Timestamp:
Sep 28, 2004, 11:53:45 AM (19 years ago)
Author:
Jari Häkkinen
Message:

Fixed stupid bug; now the original data is kept during whole impute
algorithm, i.e. imputed values are not used to impute other values.

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/NNI.cc

    r146 r172  
    1515  NNI::NNI(gslapi::matrix& matrix,const gslapi::matrix& weight,
    1616           const u_int neighbours)
    17     : data_(matrix), weight_(weight), neighbours_(neighbours)
     17    : data_(matrix), imputed_data_(matrix), neighbours_(neighbours),
     18      weight_(weight)
    1819  {
    1920  }
  • trunk/src/NNI.h

    r146 r172  
    2929    virtual ~NNI(void) {};
    3030
     31    const gslapi::matrix& imputed_data(void) const { return imputed_data_; }
     32
    3133  protected:
    3234    vector<pair<u_int,double> > calculate_distances(const u_int) const;
     
    3638
    3739    gslapi::matrix& data_;
     40    gslapi::matrix imputed_data_;
     41    u_int neighbours_;
    3842    const gslapi::matrix& weight_;
    39     u_int neighbours_;
    4043  };
    4144
  • trunk/src/WeNNI.cc

    r157 r172  
    4242        // No impute if no contributions from neighbours.
    4343        if (norm)
    44           data_(i,j)=weight_(i,j)*data_(i,j)+(1-weight_(i,j))*new_value/norm;
     44          imputed_data_(i,j)=weight_(i,j)*data_(i,j)+(1-weight_(i,j))*new_value/norm;
    4545      }
    4646    }
  • trunk/src/kNNI.cc

    r157 r172  
    4949          // No impute if no contributions from neighbours.
    5050          if (norm)
    51             data_(mv_rows_[i],j)=new_value/norm;
     51            imputed_data_(mv_rows_[i],j)=new_value/norm;
    5252        }
    5353    }
  • trunk/test/data/wenni_result.data

    r157 r172  
    880.2234 0.77639 0.38783 0.28953 0.62376 0.5445 0.32489 0.22388 0.238746 0.23468 0.1234
    990.2388 0.234688 0.43687 0.86456 0.65654 0.6864 0.879645 0.98454 0.98731 0.164897 0.1234
    10 0.1968 0.153987 0.13684 0.14685 0.316135 0.5286 0.69435 0.13634 0.18351 0.577498730752 0.1234
     100.1968 0.153987 0.13684 0.14685 0.316135 0.5286 0.69435 0.13634 0.18351 0.577488912729 0.1234
    11110.6865 0.213687 0.12368 0.18564 0.897654 0.4945 0.789654 0.45547 0.98466 0.66136 0.1234
    12120.9835 0.963154 0.964664 0.132369 0.983316 0.3276 0.376513 0.34941 0.387433 0.31685 0.1234
  • trunk/test/test_nni.cc

    r146 r172  
    4343  std::ifstream control_stream(knni_result.c_str());
    4444  theplu::gslapi::matrix control(control_stream);
    45   control-=data;
     45  control-=knni.imputed_data();
    4646  for (unsigned int i=0; i<control.rows(); i++)
    4747    for (unsigned int j=0; j<control.columns(); j++)
     
    6464  control_stream.open(wenni_result.c_str());
    6565  control=theplu::gslapi::matrix(control_stream);
    66   control-=data;
     66  control-=wenni.imputed_data();
    6767  for (unsigned int i=0; i<control.rows(); i++)
    6868    for (unsigned int j=0; j<control.columns(); j++)
Note: See TracChangeset for help on using the changeset viewer.