Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes

CSGObject Class Reference


Detailed Description

Class SGObject is the base class of all shogun objects.

Apart from dealing with reference counting that is used to manage shogung objects in memory (erase unused object, avoid cleaning objects when they are still in use), it provides interfaces for:

  1. parallel - to determine the number of used CPUs for a method (cf. Parallel)
  2. io - to output messages and general i/o (cf. IO)
  3. version - to provide version information of the shogun version used (cf. Version)

Definition at line 60 of file SGObject.h.

Inherited by CArray< bool >, CArray< char >, CArray< CPlifBase * >, CArray< float32_t >, CArray< float64_t >, CArray< int32_t >, CCache< char >, CCache< float64_t >, CCache< KERNELCACHE_ELEM >, CCache< ST >, CCache< TSparseEntry< float64_t > >, CCache< TSparseEntry< ST > >, CCache< uint16_t >, CCache< uint32_t >, CCache< uint8_t >, CDynamicArray< float64_t >, CDynamicArray< int32_t >, CDynamicArray< uint64_t >, CMemoryMappedFile< ST >, CTrie< DNATrie >, CTrie< POIMTrie >, CAlphabet, CArray< T >, CBinaryStream< T >, CBitString, CCache< T >, CClassifier, CCompressor, CCplex, CDistance, CDistribution, CDynamicArray< T >, CDynamicArrayPtr, CDynProg, CFeatures, CFile, CGCArray< T >, CGMNPLib, CGNPPLib, CHash, CIntronList, CKernel, CKernelNormalizer, CLabels, CList, CListElement, CMath, CMemoryMappedFile< T >, CNode, CPerformanceMeasures, CPlifBase, CPlifMatrix, CPreProc, CQPBSVMLib, CSegmentLoss, CSerializableFile, CSerializableFile::TSerializableReader, CSet< T >, CSignal, CSignalModel, CSimpleFile< T >, CTaxonomy, CTime, CTrainPredMaster, CTrie< Trie >, and MKLMultiClassOptimizationBase.

List of all members.

Public Member Functions

 CSGObject ()
 CSGObject (const CSGObject &orig)
virtual ~CSGObject ()
virtual const char * get_name () const =0
virtual bool is_generic (EPrimitiveType *generic) const
template<class T >
void set_generic ()
void unset_generic ()
virtual void print_serializable (const char *prefix="")
virtual bool save_serializable (CSerializableFile *file, const char *prefix="")
virtual bool load_serializable (CSerializableFile *file, const char *prefix="")
void set_io (IO *io)
IOget_io ()
void set_parallel (Parallel *parallel)
Parallelget_parallel ()
void set_version (Version *version)
Versionget_version ()

Public Attributes

IOio
Parallelparallel
Versionversion

Protected Member Functions

virtual void load_serializable_pre () throw (ShogunException)
virtual void load_serializable_post () throw (ShogunException)
virtual void save_serializable_pre () throw (ShogunException)
virtual void save_serializable_post () throw (ShogunException)

Protected Attributes

Parameterm_parameters

Constructor & Destructor Documentation

CSGObject (  ) 

default constructor

Definition at line 103 of file SGObject.cpp.

CSGObject ( const CSGObject orig  ) 

copy constructor

Definition at line 112 of file SGObject.cpp.

~CSGObject (  )  [virtual]

destructor

Definition at line 119 of file SGObject.cpp.


Member Function Documentation

IO * get_io (  ) 

get the io object

Returns:
io object

Definition at line 159 of file SGObject.cpp.

virtual const char* get_name (  )  const [pure virtual]

Returns the name of the SGSerializable instance. It MUST BE the CLASS NAME without the prefixed `C'.

Returns:
name of the SGSerializable

Implemented in CDistanceMachine, CKernelMachine, CKernelPerceptron, CKNN, CLDA, CLinearClassifier, CLPBoost, CLPM, CMKL, MKLMultiClassGLPK, MKLMultiClassGradient, MKLMultiClassOptimizationBase, CPerceptron, CPluginEstimate, CSubGradientLPM, CDomainAdaptationSVM, CDomainAdaptationSVMLinear, CGMNPLib, CGMNPSVM, CGNPPLib, CGNPPSVM, CGPBTSVM, CLaRank, CLibLinear, CLibSVM, CLibSVMMultiClass, CLibSVMOneClass, CMPDSVM, CQPBSVMLib, CScatterSVM, CSubGradientSVM, CSVM, CSVMLight, CSVMLin, CSVMOcas, CSVMSGD, CWDSVMOcas, CHierarchical, CKMeans, CBrayCurtisDistance, CCanberraMetric, CCanberraWordDistance, CChebyshewMetric, CChiSquareDistance, CCosineDistance, CCustomDistance, CEuclidianDistance, CGeodesicMetric, CHammingWordDistance, CJensenMetric, CKernelDistance, CManhattanMetric, CManhattanWordDistance, CMinkowskiMetric, CRealDistance, CSimpleDistance< ST >, CSparseDistance< ST >, CSparseEuclidianDistance, CStringDistance< ST >, CTanimotoDistance, CGHMM, CHistogram, CHMM, CLinearHMM, CPerformanceMeasures, CAlphabet, CAttributeFeatures, CCombinedDotFeatures, CCombinedFeatures, CDummyFeatures, CExplicitSpecFeatures, CFKFeatures, CHashedWDFeatures, CHashedWDFeaturesTransposed, CImplicitWeightedSpecFeatures, CLabels, CLBPPyrDotFeatures, CPolyFeatures, CRealFileFeatures, CSimpleFeatures< ST >, CSNPFeatures, CSparseFeatures< ST >, CSparsePolyFeatures, CStringFeatures< ST >, CTOPFeatures, CWDFeatures, CSignalModel, CTrainPredMaster, CAUCKernel, CAvgDiagKernelNormalizer, CChi2Kernel, CCombinedKernel, CCommUlongStringKernel, CCommWordStringKernel, CConstKernel, CCustomKernel, CDiagKernel, CDiceKernelNormalizer, CDistanceKernel, CDotKernel, CFirstElementKernelNormalizer, CFixedDegreeStringKernel, CGaussianKernel, CGaussianMatchStringKernel, CGaussianShiftKernel, CGaussianShortRealKernel, CHistogramIntersectionKernel, CHistogramWordStringKernel, CIdentityKernelNormalizer, CLinearKernel, CLinearStringKernel, CLocalAlignmentStringKernel, CLocalityImprovedStringKernel, CMatchWordStringKernel, CMultitaskKernelMaskNormalizer, CMultitaskKernelMaskPairNormalizer, CMultitaskKernelMklNormalizer, CMultitaskKernelNormalizer, CMultitaskKernelPlifNormalizer, CNode, CTaxonomy, CMultitaskKernelTreeNormalizer, COligoStringKernel, CPolyKernel, CPolyMatchStringKernel, CPolyMatchWordStringKernel, CPyramidChi2, CRegulatoryModulesStringKernel, CRidgeKernelNormalizer, CSalzbergWordStringKernel, CScatterKernelNormalizer, CSigmoidKernel, CSimpleLocalityImprovedStringKernel, CSNPStringKernel, CSparseKernel< ST >, CSparseSpatialSampleStringKernel, CSpectrumMismatchRBFKernel, CSpectrumRBFKernel, CSqrtDiagKernelNormalizer, CStringKernel< ST >, CTanimotoKernelNormalizer, CTensorProductPairKernel, CVarianceKernelNormalizer, CWeightedCommWordStringKernel, CWeightedDegreePositionStringKernel, CWeightedDegreeRBFKernel, CWeightedDegreeStringKernel, CZeroMeanCenterKernelNormalizer, CArray< T >, CArray2< T >, CArray3< T >, CAsciiFile, CBinaryFile, CBinaryStream< T >, CBitString, CCache< T >, CCompressor, CCplex, CDynamicArray< T >, CDynamicArrayPtr, CFile, CGCArray< T >, CHash, CListElement, CList, CMath, CMemoryMappedFile< T >, CSerializableAsciiFile, SerializableAsciiReader00, CSet< T >, CSignal, CSimpleFile< T >, CTime, CTrie< Trie >, CLogPlusOne, CNormOne, CPCACut, CPreProc, CPruneVarSubMean, CSortUlongString, CSortWordString, CKRR, CLibSVR, CSVRLight, CDynProg, CIntronList, CPlif, CPlifArray, CPlifMatrix, CSegmentLoss, CSimpleDistance< float64_t >, CSparseDistance< float64_t >, CStringDistance< uint16_t >, CSimpleFeatures< uint32_t >, CSimpleFeatures< float64_t >, CSimpleFeatures< uint16_t >, CSparseFeatures< float64_t >, CStringFeatures< uint8_t >, CStringFeatures< char >, CStringFeatures< uint16_t >, CStringKernel< char >, CStringKernel< uint16_t >, CStringKernel< uint64_t >, CArray< CPlifBase * >, CArray< float64_t >, CArray< float32_t >, CArray< int32_t >, CArray< char >, CArray< bool >, CArray2< CPlifBase * >, CArray2< float64_t >, CArray2< float32_t >, CArray2< int32_t >, CArray3< float64_t >, CCache< uint32_t >, CCache< ST >, CCache< float64_t >, CCache< TSparseEntry< ST > >, CCache< uint8_t >, CCache< KERNELCACHE_ELEM >, CCache< char >, CCache< uint16_t >, CCache< TSparseEntry< float64_t > >, CDynamicArray< float64_t >, CDynamicArray< int32_t >, CDynamicArray< uint64_t >, CMemoryMappedFile< ST >, CTrie< DNATrie >, and CTrie< POIMTrie >.

Parallel * get_parallel (  ) 

get the parallel object

Returns:
parallel object

Definition at line 172 of file SGObject.cpp.

Version * get_version (  ) 

get the version object

Returns:
version object

Definition at line 185 of file SGObject.cpp.

bool is_generic ( EPrimitiveType generic  )  const [virtual]

If the SGSerializable is a class template then TRUE will be returned and GENERIC is set to the type of the generic.

Parameters:
generic set to the type of the generic if returning TRUE
Returns:
TRUE if a class template.

Definition at line 191 of file SGObject.cpp.

bool load_serializable ( CSerializableFile file,
const char *  prefix = "" 
) [virtual]

Load this object from file. If it will fail (returning FALSE) then this object will contain inconsistent data and should not be used!

Parameters:
file where to load from
prefix prefix for members
Returns:
TRUE if done, otherwise FALSE

Definition at line 263 of file SGObject.cpp.

void load_serializable_post ( void   )  throw (ShogunException) [protected, virtual]

Can (optionally) be overridden to post-initialize some member variables which are not PARAMETER::ADD'ed. Make sure that at first the overridden method BASE_CLASS::LOAD_SERIALIZABLE_POST is called.

Exceptions:
ShogunException Will be thrown if an error occurres.

Reimplemented in CLinearHMM, CAlphabet, CGaussianKernel, CKernel, CWeightedDegreePositionStringKernel, and CList.

Definition at line 318 of file SGObject.cpp.

void load_serializable_pre (  )  throw (ShogunException) [protected, virtual]

Can (optionally) be overridden to pre-initialize some member variables which are not PARAMETER::ADD'ed. Make sure that at first the overridden method BASE_CLASS::LOAD_SERIALIZABLE_PRE is called.

Exceptions:
ShogunException Will be thrown if an error occurres.

Definition at line 313 of file SGObject.cpp.

void print_serializable ( const char *  prefix = ""  )  [virtual]

prints registered parameters out

Parameters:
prefix prefix for members

Definition at line 203 of file SGObject.cpp.

bool save_serializable ( CSerializableFile file,
const char *  prefix = "" 
) [virtual]

Save this object to file.

Parameters:
file where to save the object; will be closed during returning if PREFIX is an empty string.
prefix prefix for members
Returns:
TRUE if done, otherwise FALSE

Definition at line 209 of file SGObject.cpp.

void save_serializable_post (  )  throw (ShogunException) [protected, virtual]

Can (optionally) be overridden to post-initialize some member variables which are not PARAMETER::ADD'ed. Make sure that at first the overridden method BASE_CLASS::SAVE_SERIALIZABLE_POST is called.

Exceptions:
ShogunException Will be thrown if an error occurres.

Reimplemented in CKernel.

Definition at line 328 of file SGObject.cpp.

void save_serializable_pre (  )  throw (ShogunException) [protected, virtual]

Can (optionally) be overridden to pre-initialize some member variables which are not PARAMETER::ADD'ed. Make sure that at first the overridden method BASE_CLASS::SAVE_SERIALIZABLE_PRE is called.

Exceptions:
ShogunException Will be thrown if an error occurres.

Reimplemented in CKernel.

Definition at line 323 of file SGObject.cpp.

void set_generic< floatmax_t > (  ) 

set generic type to T

void set_io ( IO io  ) 

set the io object

Parameters:
io io object to use

Definition at line 152 of file SGObject.cpp.

void set_parallel ( Parallel parallel  ) 

set the parallel object

Parameters:
parallel parallel object to use

Definition at line 165 of file SGObject.cpp.

void set_version ( Version version  ) 

set the version object

Parameters:
version version object to use

Definition at line 178 of file SGObject.cpp.

void unset_generic (  ) 

unset generic type

this has to be called in classes specializing a template class

Definition at line 198 of file SGObject.cpp.


Member Data Documentation

IO* io

Definition at line 263 of file SGObject.h.

Parameter* m_parameters [protected]

Definition at line 268 of file SGObject.h.

Definition at line 264 of file SGObject.h.

Definition at line 265 of file SGObject.h.


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

SHOGUN Machine Learning Toolbox - Documentation