SHOGUN  v1.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
List of all members | Public Member Functions | Protected Member Functions | Protected Attributes
CSplittingStrategy Class Reference

Detailed Description

Abstract base class for all splitting types. Takes a CLabels instance and generates a desired number of subsets which are being accessed by their indices via the method generate_subset_indices(...).

When being extended, the abstract method build_subsets() has to be implemented AND to be called in the constructor of sub-classes. Implementations have to fill the DynArray<index_t> elements in the (inherited) m_subset_indices variable. Note that these elements are already created by the constructor of this class - they just have to be filled. Every element represents one index subset.

Definition at line 34 of file SplittingStrategy.h.

Inheritance diagram for CSplittingStrategy:
Inheritance graph
[legend]

Public Member Functions

 CSplittingStrategy ()
 CSplittingStrategy (CLabels *labels, index_t num_subsets)
virtual ~CSplittingStrategy ()
SGVector< index_tgenerate_subset_indices (index_t subset_idx)
SGVector< index_tgenerate_subset_inverse (index_t subset_idx)
index_t get_num_subsets () const
virtual const char * get_name () const
- Public Member Functions inherited from CSGObject
 CSGObject ()
 CSGObject (const CSGObject &orig)
virtual ~CSGObject ()
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)

Protected Member Functions

virtual void build_subsets ()=0
- Protected Member Functions inherited from CSGObject
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

CLabelsm_labels
CDynamicObjectArray
< CDynamicArray< index_t > > * 
m_subset_indices

Additional Inherited Members

- Public Attributes inherited from CSGObject
SGIOio
Parallelparallel
Versionversion
Parameterm_parameters
Parameterm_model_selection_parameters

Constructor & Destructor Documentation

constructor

Definition at line 16 of file SplittingStrategy.cpp.

CSplittingStrategy ( CLabels labels,
index_t  num_subsets 
)

constructor

Parameters
labelslabels to be (possibly) used for splitting
num_subsetsdesired number of subsets, the labels are split into

Definition at line 21 of file SplittingStrategy.cpp.

~CSplittingStrategy ( )
virtual

destructor

Definition at line 81 of file SplittingStrategy.cpp.

Member Function Documentation

virtual void build_subsets ( )
protectedpure virtual

Abstract method. Has to fill the elements of the m_subset_indices variable with concrete indices. Note that CDynamicArray<index_t> instances for every subset are created in the constructor of this class - they just have to be filled.

Implemented in CStratifiedCrossValidationSplitting.

SGVector< index_t > generate_subset_indices ( index_t  subset_idx)

generates a newly created SGVector<index_t> with indices of the subset with the desired index

Parameters
subset_idxsubset index of the to be generated vector indices
Returns
newly created vector of subset indices of the specified subset is written here. do not forget to free_vector

Definition at line 87 of file SplittingStrategy.cpp.

SGVector< index_t > generate_subset_inverse ( index_t  subset_idx)

generates a newly created SGVector<index_t> with inverse indices of the subset with the desired index. inverse here means all other indices.

Parameters
subset_idxsubset index of the to be generated inverse indices
Returns
newly created vector of the subset's inverse indices is written here. do not forget to free_vector

Definition at line 104 of file SplittingStrategy.cpp.

virtual const char* get_name ( ) const
virtual
Returns
name of the SGSerializable

Implements CSGObject.

Reimplemented in CStratifiedCrossValidationSplitting.

Definition at line 74 of file SplittingStrategy.h.

index_t get_num_subsets ( ) const
Returns
number of subsets

Definition at line 69 of file SplittingStrategy.h.

Member Data Documentation

CLabels* m_labels
protected

labels

Definition at line 90 of file SplittingStrategy.h.

CDynamicObjectArray<CDynamicArray<index_t> >* m_subset_indices
protected

subset indices

Definition at line 92 of file SplittingStrategy.h.


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

SHOGUN Machine Learning Toolbox - Documentation