SHOGUN  v1.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
List of all members | 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, CConverter, 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.

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

SGIOio
Parallelparallel
Versionversion
Parameterm_parameters
Parameterm_model_selection_parameters

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

destructor

Definition at line 119 of file SGObject.cpp.

Member Function Documentation

SGIO * get_global_io ( )

get the io object

Returns
io object

Definition at line 217 of file SGObject.cpp.

Parallel * get_global_parallel ( )

get the parallel object

Returns
parallel object

Definition at line 230 of file SGObject.cpp.

Version * get_global_version ( )

get the version object

Returns
version object

Definition at line 243 of file SGObject.cpp.

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

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

Parameters
param_namename of the parameter
Returns
description of the parameter

Definition at line 482 of file SGObject.cpp.

index_t get_modsel_param_index ( const char *  param_name)

Returns index of model selection parameter with provided index

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

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

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
genericset to the type of the generic if returning TRUE
Returns
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!

Parameters
filewhere to load from
prefixprefix for members
Returns
TRUE if done, otherwise FALSE

Definition at line 325 of file SGObject.cpp.

void load_serializable_post ( ) throw (ShogunException)
protectedvirtual

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
ShogunExceptionWill be thrown if an error occurres.

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

Definition at line 422 of file SGObject.cpp.

void load_serializable_pre ( ) throw (ShogunException)
protectedvirtual

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
ShogunExceptionWill 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

Parameters
prefixprefix for members

Definition at line 261 of file SGObject.cpp.

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

Save this object to file.

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

Definition at line 267 of file SGObject.cpp.

void save_serializable_post ( ) throw (ShogunException)
protectedvirtual

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
ShogunExceptionWill be thrown if an error occurres.

Reimplemented in CKernel.

Definition at line 432 of file SGObject.cpp.

void save_serializable_pre ( ) throw (ShogunException)
protectedvirtual

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
ShogunExceptionWill 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

Definition at line 35 of file SGObject.cpp.

void set_global_io ( SGIO io)

set the io object

Parameters
ioio object to use

Definition at line 210 of file SGObject.cpp.

void set_global_parallel ( Parallel parallel)

set the parallel object

Parameters
parallelparallel object to use

Definition at line 223 of file SGObject.cpp.

void set_global_version ( Version version)

set the version object

Parameters
versionversion 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

io

Definition at line 288 of file SGObject.h.

Parameter* m_model_selection_parameters

model selection parameters

Definition at line 300 of file SGObject.h.

Parameter* m_parameters

parameters

Definition at line 297 of file SGObject.h.

Parallel* parallel

parallel

Definition at line 291 of file SGObject.h.

Version* version

version

Definition at line 294 of file SGObject.h.


The documentation for this class was generated from the following files:

SHOGUN Machine Learning Toolbox - Documentation