Changeset 157


Ignore:
Timestamp:
Sep 16, 2004, 1:55:22 AM (17 years ago)
Author:
Jari Häkkinen
Message:

Changed algorithm to make no impute on values if no contributions exists.
This is the case when all weights are zero for a row or weights are zero
in for rows in such a way that they cancel out.
Changed the test data files acordingly.

Location:
trunk
Files:
5 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/WeNNI.cc

    r146 r157  
    4040          norm+=1.0/(distance[*k].second);
    4141        }
    42         data_(i,j)=weight_(i,j)*data_(i,j)+(1-weight_(i,j))*new_value/norm;
     42        // No impute if no contributions from neighbours.
     43        if (norm)
     44          data_(i,j)=weight_(i,j)*data_(i,j)+(1-weight_(i,j))*new_value/norm;
    4345      }
    4446    }
  • trunk/src/kNNI.cc

    r146 r157  
    4747            norm+=1.0/(distance[*k].second);
    4848          }
    49           data_(mv_rows_[i],j)=new_value/norm;
     49          // No impute if no contributions from neighbours.
     50          if (norm)
     51            data_(mv_rows_[i],j)=new_value/norm;
    5052        }
    5153    }
Note: See TracChangeset for help on using the changeset viewer.