Public Member Functions | Public Attributes | Protected Member Functions

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 76 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< SGSparseVectorEntry< float64_t > >, CCache< SGSparseVectorEntry< ST > >, CCache< SGSparseVectorEntry< T > >, CCache< ST >, CCache< uint16_t >, CCache< uint32_t >, CCache< uint8_t >, CDynamicArray< float64_t >, CDynamicArray< index_t >, CDynamicArray< int32_t >, CDynamicArray< uint64_t >, CDynamicObjectArray< CDynamicArray< index_t > >, CDynamicObjectArray< CModelSelectionParameters >, CDynamicObjectArray< CParameterCombination >, CMemoryMappedFile< ST >, CParseBuffer< SGSparseVectorEntry< T > >, CParseBuffer< VwExample >, CTrie< DNATrie >, CTrie< POIMTrie >, CAlphabet, CArray< T >, CBinaryStream< T >, CBitString, CCache< T >, CCompressor, CCplex, CCrossValidation, CDistance, CDistribution, CDynamicArray< T >, CDynamicObjectArray< T >, CDynProg, CEvaluation, CFeatures, CFile, CGCArray< T >, CGMNPLib, CGNPPLib, CGUIClassifier, CGUIDistance, CGUIFeatures, CGUIHMM, CGUIKernel, CGUILabels, CGUIMath, CGUIPluginEstimate, CGUIPreprocessor, CGUIStructure, CGUITime, CHash, CHashSet, CIntronList, CIOBuffer, CKernel, CKernelNormalizer, CLabels, CList, CListElement, CLossFunction, CMachine, CMath, CMemoryMappedFile< T >, CModelSelection, CModelSelectionParameters, CNode, CParameterCombination, CParseBuffer< T >, CPlifBase, CPlifMatrix, CPreprocessor, CQPBSVMLib, CSegmentLoss, CSerializableFile, CSerializableFile::TSerializableReader, CSet< T >, CSignal, CSimpleFile< T >, CSplittingStrategy, CStatistics, CStreamingFile, CSubset, CTaxonomy, CTime, CTrie< Trie >, CVwCacheReader, CVwCacheWriter, CVwEnvironment, CVwLearner, CVwParser, CVwRegressor, 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_global_io (SGIO *io)
SGIOget_global_io ()
void set_global_parallel (Parallel *parallel)
Parallelget_global_parallel ()
void set_global_version (Version *version)
Versionget_global_version ()
SGVector< char * > get_modelsel_names ()
char * get_modsel_param_descr (const char *param_name)
index_t get_modsel_param_index (const char *param_name)

Public Attributes


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)

Constructor & Destructor Documentation

CSGObject (  ) 

default constructor

Definition at line 104 of file SGObject.cpp.

CSGObject ( const CSGObject orig  ) 

copy constructor

Definition at line 112 of file SGObject.cpp.

~CSGObject (  )  [virtual]


Definition at line 119 of file SGObject.cpp.

Member Function Documentation

SGIO * get_global_io (  ) 

get the io object

io object

Definition at line 217 of file SGObject.cpp.

Parallel * get_global_parallel (  ) 

get the parallel object

parallel object

Definition at line 230 of file SGObject.cpp.

Version * get_global_version (  ) 

get the version object

version object

Definition at line 243 of file SGObject.cpp.

SGVector< char * > get_modelsel_names (  ) 
vector of names of all parameters which are registered for model selection

Definition at line 469 of file SGObject.cpp.

char * get_modsel_param_descr ( const char *  param_name  ) 

Returns description of a given parameter string, if it exists. SG_ERROR otherwise

param_name name of the parameter
description of the parameter

Definition at line 480 of file SGObject.cpp.

index_t get_modsel_param_index ( const char *  param_name  ) 

Returns index of model selection parameter with provided index

param_name name of model selection parameter
index of model selection parameter with provided name, -1 if there is no such

Definition at line 493 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'.

name of the SGSerializable

Implemented in CAveragedPerceptron, CGaussianNaiveBayes, CKNN, CLDA, CMKL, MKLMultiClassGLPK, MKLMultiClassGradient, MKLMultiClassOptimizationBase, CPerceptron, CPluginEstimate, CDomainAdaptationSVM, CDomainAdaptationSVMLinear, CGMNPLib, CGMNPSVM, CGNPPLib, CGNPPSVM, CGPBTSVM, CLaRank, CLibLinear, CLibSVM, CLibSVMMultiClass, CLibSVMOneClass, CMPDSVM, COnlineLibLinear, COnlineSVMSGD, CQPBSVMLib, CScatterSVM, CSGDQN, CSubGradientSVM, CSVM, CSVMLight, CSVMLin, CSVMOcas, CSVMSGD, CWDSVMOcas, CVwCacheReader, CVwNativeCacheReader, CVwNativeCacheWriter, CVwAdaptiveLearner, CVwNonAdaptiveLearner, CVowpalWabbit, CVwEnvironment, CVwLearner, CVwParser, CVwRegressor, CGMM, CHierarchical, CKMeans, CAttenuatedEuclidianDistance, CBrayCurtisDistance, CCanberraMetric, CCanberraWordDistance, CChebyshewMetric, CChiSquareDistance, CCosineDistance, CCustomDistance, CEuclidianDistance, CGeodesicMetric, CHammingWordDistance, CJensenMetric, CKernelDistance, CManhattanMetric, CManhattanWordDistance, CMinkowskiMetric, CRealDistance, CSimpleDistance< ST >, CSparseDistance< ST >, CSparseEuclidianDistance, CStringDistance< ST >, CTanimotoDistance, CGaussian, CGHMM, CHistogram, CHMM, CLinearHMM, CPositionalPWM, CContingencyTableEvaluation, CAccuracyMeasure, CErrorRateMeasure, CBALMeasure, CWRACCMeasure, CF1Measure, CCrossCorrelationMeasure, CRecallMeasure, CPrecisionMeasure, CSpecificityMeasure, CCrossValidation, CMeanSquaredError, CMulticlassAccuracy, CPRCEvaluation, CROCEvaluation, CSplittingStrategy, CStratifiedCrossValidationSplitting, CAlphabet, CAttributeFeatures, CCombinedDotFeatures, CCombinedFeatures, CDummyFeatures, CExplicitSpecFeatures, CFKFeatures, CHashedWDFeatures, CHashedWDFeaturesTransposed, CImplicitWeightedSpecFeatures, CLabels, CLBPPyrDotFeatures, CPolyFeatures, CRealFileFeatures, CSimpleFeatures< ST >, CSNPFeatures, CSparseFeatures< ST >, CSparsePolyFeatures, CStreamingSimpleFeatures< T >, CStreamingSparseFeatures< T >, CStreamingStringFeatures< T >, CStreamingVwFeatures, CStringFeatures< ST >, CSubset, CTOPFeatures, CWDFeatures, CAsciiFile, CBinaryFile, CBinaryStream< T >, CFile, CIOBuffer, CMemoryMappedFile< T >, CParseBuffer< T >, CSerializableAsciiFile, SerializableAsciiReader00, CSimpleFile< T >, CStreamingAsciiFile, CStreamingFile, CStreamingFileFromFeatures, CStreamingFileFromSimpleFeatures< T >, CStreamingFileFromSparseFeatures< T >, CStreamingFileFromStringFeatures< T >, CStreamingVwCacheFile, CStreamingVwFile, CANOVAKernel, CAUCKernel, CAvgDiagKernelNormalizer, CBesselKernel, CCauchyKernel, CChi2Kernel, CCircularKernel, CCombinedKernel, CCommUlongStringKernel, CCommWordStringKernel, CConstKernel, CCustomKernel, CDiagKernel, CDiceKernelNormalizer, CDistanceKernel, CDistantSegmentsKernel, CDotKernel, CExponentialKernel, CFirstElementKernelNormalizer, CFixedDegreeStringKernel, CGaussianKernel, CGaussianMatchStringKernel, CGaussianShiftKernel, CGaussianShortRealKernel, CHistogramIntersectionKernel, CHistogramWordStringKernel, CIdentityKernelNormalizer, CInverseMultiQuadricKernel, CLinearKernel, CLinearStringKernel, CLocalAlignmentStringKernel, CLocalityImprovedStringKernel, CLogKernel, CMatchWordStringKernel, CMultiquadricKernel, CMultitaskKernelMaskNormalizer, CMultitaskKernelMaskPairNormalizer, CMultitaskKernelMklNormalizer, CMultitaskKernelNormalizer, CMultitaskKernelPlifNormalizer, CNode, CTaxonomy, CMultitaskKernelTreeNormalizer, COligoStringKernel, CPolyKernel, CPolyMatchStringKernel, CPolyMatchWordStringKernel, CPowerKernel, CPyramidChi2, CRationalQuadraticKernel, CRegulatoryModulesStringKernel, CRidgeKernelNormalizer, CSalzbergWordStringKernel, CScatterKernelNormalizer, CSigmoidKernel, CSimpleLocalityImprovedStringKernel, CSNPStringKernel, CSparseKernel< ST >, CSparseSpatialSampleStringKernel, CSpectrumMismatchRBFKernel, CSpectrumRBFKernel, CSphericalKernel, CSplineKernel, CSqrtDiagKernelNormalizer, CStringKernel< ST >, CTanimotoKernelNormalizer, CTensorProductPairKernel, CTStudentKernel, CVarianceKernelNormalizer, CWaveKernel, CWaveletKernel, CWeightedCommWordStringKernel, CWeightedDegreePositionStringKernel, CWeightedDegreeRBFKernel, CWeightedDegreeStringKernel, CZeroMeanCenterKernelNormalizer, CArray< T >, CArray2< T >, CArray3< T >, CBitString, CCache< T >, CCompressor, CDynamicArray< T >, CDynamicObjectArray< T >, CGCArray< T >, CHash, CHashSet, CListElement, CList, CSet< T >, CSignal, CTime, CTrie< Trie >, CHingeLoss, CLogLoss, CLogLossMargin, CLossFunction, CSmoothHingeLoss, CSquaredHingeLoss, CSquaredLoss, CDistanceMachine, CKernelMachine, CLinearMachine, COnlineLinearMachine, CCplex, CMath, CStatistics, CGridSearchModelSelection, CModelSelection, CModelSelectionParameters, CParameterCombination, CDecompressString< ST >, CDimensionReductionPreprocessor, CHessianLocallyLinearEmbedding, CIsomap, CKernelLocallyLinearEmbedding, CKernelPCA, CLaplacianEigenmaps, CLocallyLinearEmbedding, CLocalTangentSpaceAlignment, CLogPlusOne, CMultidimensionalScaling, CNormOne, CPCA, CPruneVarSubMean, CRandomFourierGaussPreproc, CSortUlongString, CSortWordString, CSparsePreprocessor< ST >, CStringPreprocessor< ST >, CKRR, CLibSVR, CSVRLight, CDynProg, CIntronList, CPlif, CPlifArray, CPlifMatrix, CSegmentLoss, CGUIClassifier, CGUIDistance, CGUIFeatures, CGUIHMM, CGUIKernel, CGUILabels, CGUIMath, CGUIPluginEstimate, CGUIPreprocessor, CGUIStructure, CGUITime, CSimpleDistance< float64_t >, CSparseDistance< float64_t >, CStringDistance< uint16_t >, CSimpleFeatures< uint32_t >, CSimpleFeatures< float64_t >, CSimpleFeatures< T >, CSimpleFeatures< uint16_t >, CSparseFeatures< float64_t >, CSparseFeatures< T >, CStringFeatures< T >, CStringFeatures< uint8_t >, CStringFeatures< char >, CStringFeatures< uint16_t >, CMemoryMappedFile< ST >, CParseBuffer< VwExample >, CParseBuffer< SGSparseVectorEntry< T > >, CStringKernel< uint16_t >, CStringKernel< char >, 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< SGSparseVectorEntry< ST > >, CCache< uint32_t >, CCache< ST >, CCache< SGSparseVectorEntry< float64_t > >, CCache< float64_t >, CCache< uint8_t >, CCache< KERNELCACHE_ELEM >, CCache< char >, CCache< uint16_t >, CCache< SGSparseVectorEntry< T > >, CDynamicArray< float64_t >, CDynamicArray< int32_t >, CDynamicArray< index_t >, CDynamicArray< uint64_t >, CDynamicObjectArray< CDynamicArray< index_t > >, CDynamicObjectArray< CParameterCombination >, CDynamicObjectArray< CModelSelectionParameters >, CTrie< DNATrie >, CTrie< POIMTrie >, CStringPreprocessor< uint16_t >, and CStringPreprocessor< uint64_t >.

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.

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

Definition at line 249 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!

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

Definition at line 325 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.

ShogunException Will be thrown if an error occurres.

Reimplemented in CLinearHMM, CAlphabet, CANOVAKernel, CCircularKernel, CExponentialKernel, CGaussianKernel, CInverseMultiQuadricKernel, CKernel, CWeightedDegreePositionStringKernel, and CList.

Definition at line 422 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.

ShogunException Will be thrown if an error occurres.

Definition at line 417 of file SGObject.cpp.

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

prints registered parameters out

prefix prefix for members

Definition at line 261 of file SGObject.cpp.

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

Save this object to file.

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

Definition at line 267 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.

ShogunException Will be thrown if an error occurres.

Reimplemented in CKernel.

Definition at line 432 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.

ShogunException Will be thrown if an error occurres.

Reimplemented in CKernel.

Definition at line 427 of file SGObject.cpp.

void set_generic< floatmax_t > (  ) 

set generic type to T

void set_global_io ( SGIO io  ) 

set the io object

io io object to use

Definition at line 210 of file SGObject.cpp.

void set_global_parallel ( Parallel parallel  ) 

set the parallel object

parallel parallel object to use

Definition at line 223 of file SGObject.cpp.

void set_global_version ( Version version  ) 

set the version object

version version object to use

Definition at line 236 of file SGObject.cpp.

void unset_generic (  ) 

unset generic type

this has to be called in classes specializing a template class

Definition at line 256 of file SGObject.cpp.

Member Data Documentation

SGIO* io


Definition at line 288 of file SGObject.h.

model selection parameters

Definition at line 300 of file SGObject.h.


Definition at line 297 of file SGObject.h.


Definition at line 291 of file SGObject.h.


Definition at line 294 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