Ignore:
Timestamp:
Feb 22, 2007, 6:18:15 PM (15 years ago)
Author:
Peter
Message:

addresses #57

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/yat/classifier/NBC.cc

    r767 r768  
    7474  bool NBC::train()
    7575  {   
    76     sigma_=centroids_=utility::matrix(data_.rows(), target_.nof_classes());
     76    sigma2_=centroids_=utility::matrix(data_.rows(), target_.nof_classes());
    7777    utility::matrix nof_in_class(data_.rows(), target_.nof_classes());
    7878   
     
    106106    assert(data_.rows()==input.rows());
    107107
    108     std::log(sigma_(i,c)) +
    109 
    110108    prediction = utility::matrix(centroids_.columns(),input.columns());
    111     for (size_t c=0; c<centroid_.columns(); ++c) {
     109    for (size_t c=0; c<centroids_.columns(); ++c) {
    112110      double sum_ln_sigma=0;
    113111      for (size_t i=0; i<sigma2_.rows(); ++i)
     
    119117        prediction(c,s) = sum_ln_sigma;
    120118        for (size_t i=0; i<input.columns(); ++i) {
    121           prediction(c,s) += std::pow(input(i,s)-mean_(i,c),2)/sigma2_(i,c);
     119          prediction(c,s) += std::pow(input(i,s)-centroids_(i,c),2)/sigma2_(i,c);
    122120        }
    123121      }
Note: See TracChangeset for help on using the changeset viewer.