PLearn 0.1
Public Member Functions | Static Public Member Functions | Static Public Attributes | Static Protected Member Functions | Protected Attributes | Private Types
PLearn::WeightedCostFunction Class Reference

A costfunction that allows to reweight another costfunction (weight being last element of target) Returns target.lastElement() * costfunc(output,target.subVec(0,target.length()-1));. More...

#include <WeightedCostFunction.h>

Inheritance diagram for PLearn::WeightedCostFunction:
Inheritance graph
[legend]
Collaboration diagram for PLearn::WeightedCostFunction:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 WeightedCostFunction ()
 WeightedCostFunction (Ker the_costfunc)
virtual string classname () const
virtual OptionListgetOptionList () const
virtual OptionMapgetOptionMap () const
virtual RemoteMethodMapgetRemoteMethodMap () const
virtual WeightedCostFunctiondeepCopy (CopiesMap &copies) const
virtual string info () const
 Returns a bit more informative string about object (default returns classname())
virtual void makeDeepCopyFromShallowCopy (CopiesMap &copies)
 Does the necessary operations to transform a shallow copy (this) into a deep copy by deep-copying all the members that need to be.
virtual real evaluate (const Vec &output, const Vec &target) const
 ** Subclasses must override this method **

Static Public Member Functions

static string _classname_ ()
static OptionList_getOptionList_ ()
static RemoteMethodMap_getRemoteMethodMap_ ()
static Object_new_instance_for_typemap_ ()
static bool _isa_ (const Object *o)
static void _static_initialize_ ()
static const PPathdeclaringFile ()

Static Public Attributes

static StaticInitializer _static_initializer_

Static Protected Member Functions

static void declareOptions (OptionList &ol)
 Declare options (data fields) for the class.

Protected Attributes

Ker costfunc

Private Types

typedef Kernel inherited

Detailed Description

A costfunction that allows to reweight another costfunction (weight being last element of target) Returns target.lastElement() * costfunc(output,target.subVec(0,target.length()-1));.

Definition at line 55 of file WeightedCostFunction.h.


Member Typedef Documentation

Reimplemented from PLearn::Kernel.

Definition at line 57 of file WeightedCostFunction.h.


Constructor & Destructor Documentation

PLearn::WeightedCostFunction::WeightedCostFunction ( ) [inline]

Definition at line 63 of file WeightedCostFunction.h.

: costfunc() {}
PLearn::WeightedCostFunction::WeightedCostFunction ( Ker  the_costfunc) [inline]

Definition at line 64 of file WeightedCostFunction.h.

        :costfunc(the_costfunc) {}

Member Function Documentation

string PLearn::WeightedCostFunction::_classname_ ( ) [static]

Reimplemented from PLearn::Kernel.

Definition at line 49 of file WeightedCostFunction.cc.

OptionList & PLearn::WeightedCostFunction::_getOptionList_ ( ) [static]

Reimplemented from PLearn::Kernel.

Definition at line 49 of file WeightedCostFunction.cc.

RemoteMethodMap & PLearn::WeightedCostFunction::_getRemoteMethodMap_ ( ) [static]

Reimplemented from PLearn::Kernel.

Definition at line 49 of file WeightedCostFunction.cc.

bool PLearn::WeightedCostFunction::_isa_ ( const Object o) [static]

Reimplemented from PLearn::Kernel.

Definition at line 49 of file WeightedCostFunction.cc.

Object * PLearn::WeightedCostFunction::_new_instance_for_typemap_ ( ) [static]

Reimplemented from PLearn::Object.

Definition at line 49 of file WeightedCostFunction.cc.

StaticInitializer WeightedCostFunction::_static_initializer_ & PLearn::WeightedCostFunction::_static_initialize_ ( ) [static]

Reimplemented from PLearn::Kernel.

Definition at line 49 of file WeightedCostFunction.cc.

string PLearn::WeightedCostFunction::classname ( ) const [virtual]

Reimplemented from PLearn::Object.

Definition at line 49 of file WeightedCostFunction.cc.

void PLearn::WeightedCostFunction::declareOptions ( OptionList ol) [static, protected]

Declare options (data fields) for the class.

Redefine this in subclasses: call declareOption(...) for each option, and then call inherited::declareOptions(options). Please call the inherited method AT THE END to get the options listed in a consistent order (from most recently defined to least recently defined).

  static void MyDerivedClass::declareOptions(OptionList& ol)
  {
      declareOption(ol, "inputsize", &MyObject::inputsize_,
                    OptionBase::buildoption,
                    "The size of the input; it must be provided");
      declareOption(ol, "weights", &MyObject::weights,
                    OptionBase::learntoption,
                    "The learned model weights");
      inherited::declareOptions(ol);
  }
Parameters:
olList of options that is progressively being constructed for the current class.

Reimplemented from PLearn::Kernel.

Definition at line 61 of file WeightedCostFunction.cc.

References PLearn::OptionBase::buildoption, costfunc, and PLearn::declareOption().

Here is the call graph for this function:

static const PPath& PLearn::WeightedCostFunction::declaringFile ( ) [inline, static]

Reimplemented from PLearn::Kernel.

Definition at line 67 of file WeightedCostFunction.h.

{ return "weighted "+costfunc->info(); }
WeightedCostFunction * PLearn::WeightedCostFunction::deepCopy ( CopiesMap copies) const [virtual]

Reimplemented from PLearn::Kernel.

Definition at line 49 of file WeightedCostFunction.cc.

real PLearn::WeightedCostFunction::evaluate ( const Vec x1,
const Vec x2 
) const [virtual]

** Subclasses must override this method **

returns K(x1,x2)

Implements PLearn::Kernel.

Definition at line 57 of file WeightedCostFunction.cc.

References PLearn::TVec< T >::length(), and PLearn::TVec< T >::subVec().

{ return target[target.length()-1] * costfunc(output,target.subVec(0,target.length()-1)); }

Here is the call graph for this function:

OptionList & PLearn::WeightedCostFunction::getOptionList ( ) const [virtual]

Reimplemented from PLearn::Object.

Definition at line 49 of file WeightedCostFunction.cc.

OptionMap & PLearn::WeightedCostFunction::getOptionMap ( ) const [virtual]

Reimplemented from PLearn::Object.

Definition at line 49 of file WeightedCostFunction.cc.

RemoteMethodMap & PLearn::WeightedCostFunction::getRemoteMethodMap ( ) const [virtual]

Reimplemented from PLearn::Object.

Definition at line 49 of file WeightedCostFunction.cc.

virtual string PLearn::WeightedCostFunction::info ( ) const [inline, virtual]

Returns a bit more informative string about object (default returns classname())

Returns:
Information about the object

Reimplemented from PLearn::Object.

Definition at line 69 of file WeightedCostFunction.h.

    { return "weighted "+costfunc->info(); }
void PLearn::WeightedCostFunction::makeDeepCopyFromShallowCopy ( CopiesMap copies) [virtual]

Does the necessary operations to transform a shallow copy (this) into a deep copy by deep-copying all the members that need to be.

This needs to be overridden by every class that adds "complex" data members to the class, such as Vec, Mat, PP<Something>, etc. Typical implementation:

  void CLASS_OF_THIS::makeDeepCopyFromShallowCopy(CopiesMap& copies)
  {
      inherited::makeDeepCopyFromShallowCopy(copies);
      deepCopyField(complex_data_member1, copies);
      deepCopyField(complex_data_member2, copies);
      ...
  }
Parameters:
copiesA map used by the deep-copy mechanism to keep track of already-copied objects.

Reimplemented from PLearn::Kernel.

Definition at line 51 of file WeightedCostFunction.cc.

References PLearn::deepCopyField().

Here is the call graph for this function:


Member Data Documentation

Reimplemented from PLearn::Kernel.

Definition at line 67 of file WeightedCostFunction.h.

Definition at line 60 of file WeightedCostFunction.h.

Referenced by declareOptions().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines