Changeset 746 for trunk/yat


Ignore:
Timestamp:
Feb 11, 2007, 10:26:35 AM (16 years ago)
Author:
Peter
Message:

Fixes #146

Location:
trunk/yat/classifier
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/yat/classifier/Kernel.h

    r720 r746  
    146146
    147147
    148     ///
    149     /// Created Kernel is built from selected features in data. The
    150     /// @a index corresponds to which rows in data to use for the
    151     /// calculation of the returned Kernel.
    152     ///
    153     /// @return Dynamically allocated Kernel based on selected features
    154     ///
    155     /// @Note Returns a dynamically allocated Kernel, which has
    156     /// to be deleted by the caller to avoid memory leaks.
    157     ///
    158     /// @todo remove this function
    159     virtual const Kernel* selected(const std::vector<size_t>& index) const=0;
    160 
    161148    /**
    162149       \brief number of samples
  • trunk/yat/classifier/KernelLookup.cc

    r720 r746  
    143143  KernelLookup::selected(const std::vector<size_t>& inputs) const
    144144  {
    145     const Kernel* kernel = kernel_->selected(inputs);
    146     return new KernelLookup(*kernel, row_index_, column_index_, true);
     145    const Kernel* kernel;
     146    if (kernel_->weighted()){
     147      const MatrixLookupWeighted* ml =
     148        dynamic_cast<const MatrixLookupWeighted*>(data());
     149      assert(ml);
     150      const MatrixLookupWeighted* ms =
     151        new MatrixLookupWeighted(*ml,inputs,true);
     152      kernel = kernel_->make_kernel(*ms, false);
     153    }
     154    else {
     155      const MatrixLookup* m =
     156        dynamic_cast<const MatrixLookup*>(data());
     157      assert(m);
     158      // matrix with selected features
     159      const MatrixLookup* ms = new MatrixLookup(*m,inputs,true);
     160      kernel = kernel_->make_kernel(*ms,true);
     161    }
     162    return new KernelLookup(*kernel, true);
    147163  }
    148164
  • trunk/yat/classifier/Kernel_MEV.cc

    r680 r746  
    7676
    7777
    78   const Kernel_MEV* Kernel_MEV::selected(const std::vector<size_t>& index) const
    79   {
    80     return new Kernel_MEV(*this, index);
    81   }
    82 
    83 
    8478
    8579}}} // of namespace classifier, yat, and theplu
  • trunk/yat/classifier/Kernel_MEV.h

    r680 r746  
    106106
    107107
    108     ///
    109     /// @see Kernel_MEV(const Kernel_MEV&, const std::vector<size_t>&);
    110 
    111     ///
    112     /// @note returns dynamically allocated pointer that must be
    113     /// deleted by the caller to avoid memory leaks.
    114     ///
    115     const Kernel_MEV* selected(const std::vector<size_t>& index) const;
    116 
    117108  private:
    118109    ///
  • trunk/yat/classifier/Kernel_SEV.cc

    r680 r746  
    9494
    9595
    96   const Kernel* Kernel_SEV::selected(const std::vector<size_t>& index) const
    97   {
    98     return new Kernel_SEV(*this, index);
    99   }
    100 
    101 
    10296}}} // of namespace classifier, yat, and theplu
  • trunk/yat/classifier/Kernel_SEV.h

    r680 r746  
    102102
    103103
    104     ///
    105     /// @todo doc
    106     ///
    107     const Kernel* selected(const std::vector<size_t>& index) const;
    108 
    109104  private:
    110105    ///
  • trunk/yat/classifier/MatrixLookupWeighted.h

    r720 r746  
    165165    /// underlying matrix to avoid multiple lookups.
    166166    ///
    167     /// If @a row_vectors is true the new MatrixLookupWeighted will be consist
     167    /// If @a row_vectors is true the new MatrixLookupWeighted will consist
    168168    /// of the row vectors defined by @a index. This means that the
    169169    /// created MatrixLookupWeighted will fullfill:
    170170    /// \f$ MatrixLookupWeighted(i,j)=ml(i,index[j])\f$
    171171    ///
    172     /// If @a row_vectors is false the new MatrixLookupWeighted will be consist
     172    /// If @a row_vectors is false the new MatrixLookupWeighted will consist
    173173    /// of the rolumn vectors defined by @a index. This means that the
    174174    /// created MatrixLookupWeighted will fullfill:
Note: See TracChangeset for help on using the changeset viewer.