Changeset 37 for trunk/src/SVM.h


Ignore:
Timestamp:
Feb 13, 2004, 4:46:31 PM (19 years ago)
Author:
Peter
Message:

SVM.get_output added

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/SVM.h

    r36 r37  
    88#include "vector.h"
    99#include "matrix.h"
     10
    1011
    1112// Standard C++ includes
     
    3435    */
    3536    inline thep_gsl_api::vector get_alpha() const;
     37
     38    /**
     39       Function will return the output from SVM
     40    */
     41    inline thep_gsl_api::vector get_output() const;
     42
    3643   
    3744     
     
    4148    thep_gsl_api::vector target_;
    4249    thep_gsl_api::vector alpha_;
     50    double bias_;
    4351
    4452    /**
    45        Private function that determines when to stop the training
     53       Private function that determines when to stop the training.
     54       The test is done in two steps. First, we check that the
     55       functional margin is at least 2 - epsilon. Second, we check
     56       that the gap between the primal and the dual object is less
     57       than epsilon.
     58
    4659    */
    4760    bool SVM::stop(const thep_gsl_api::vector& target_,
     
    5568    return alpha_;
    5669  }
     70
     71  thep_gsl_api::vector SVM::get_output() const 
     72  {
     73    thep_gsl_api::vector bias(target_.size(), false, false);
     74    bias.set_all(bias_);
     75    return kernel_ * alpha_.mul_elements(target_) + bias;
     76   
     77  }
    5778}; // namespace thep_c++_tools
    5879
Note: See TracChangeset for help on using the changeset viewer.