-
-
Notifications
You must be signed in to change notification settings - Fork 1k
/
Preprocessor.h
108 lines (93 loc) · 2.75 KB
/
Preprocessor.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* Written (W) 1999-2009 Soeren Sonnenburg
* Written (W) 1999-2008 Gunnar Raetsch
* Copyright (C) 1999-2009 Fraunhofer Institute FIRST and Max-Planck-Society
*/
#ifndef _CPREPROCESSOR__H__
#define _CPREPROCESSOR__H__
#include <shogun/lib/common.h>
#include <shogun/base/SGObject.h>
#include <shogun/features/FeatureTypes.h>
#include <shogun/features/Features.h>
namespace shogun
{
class CFeatures;
enum EFeatureType;
enum EFeatureClass;
enum EPreprocessorType
{
P_UNKNOWN=0,
P_NORMONE=10,
P_LOGPLUSONE=20,
P_SORTWORDSTRING=30,
P_SORTULONGSTRING=40,
P_SORTWORD=50,
P_PRUNEVARSUBMEAN=60,
P_DECOMPRESSSTRING=70,
P_DECOMPRESSCHARSTRING=80,
P_DECOMPRESSBYTESTRING=90,
P_DECOMPRESSWORDSTRING=100,
P_DECOMPRESSULONGSTRING=110,
P_RANDOMFOURIERGAUSS=120,
P_PCA=130,
P_KERNELPCACUT=140,
P_NORMDERIVATIVELEM3=150,
P_DIMENSIONREDUCTIONPREPROCESSOR=160,
P_CLASSICMDS=170,
P_LOCALLYLINEAREMBEDDING=180,
P_ISOMAP=190,
P_LANDMARKISOMAP=200,
P_CLASSICISOMAP=210,
P_LANDMARKMDS=220,
P_HESSIANLOCALLYLINEAREMBEDDING=230,
P_LOCALTANGENTSPACEALIGNMENT=240
};
class CFeatures;
/** @brief Class Preprocessor defines a preprocessor interface.
*
* Preprocessors are transformation functions that don't change the domain of
* the input features. These functions can be applied in-place if the input
* features fit in memory or can be applied on-the-fly when (depending on
* features) a feature caching strategy is applied. However, if the individual
* features are in \f$\bf{R}\f$ they have to stay in \f$\bf{R}\f$ although the
* dimensionality of the feature vectors is allowed change.
*
* As preprocessors might need a certain initialization they may expect that
* the init() function is called before anything else. The actual preprocessing
* is feature type dependent and thus coordinated in the sub-classes, cf. e.g.
* CSimplePreprocessor .
*/
class CPreprocessor : public CSGObject
{
public:
/** constructor
*
* @param name preprocessor's name
* @param id preprocessor's id
*/
CPreprocessor();
/** destructor
*
*/
virtual ~CPreprocessor();
/// initialize preprocessor from features
virtual bool init(CFeatures* f)=0;
/// cleanup
virtual void cleanup()=0;
/** return feature type with which objects derived
from CPreprocessor can deal */
virtual EFeatureType get_feature_type()=0;
/** return feature class
like Sparse,Simple,...
*/
virtual EFeatureClass get_feature_class()=0;
/// return a type of preprocessor
virtual EPreprocessorType get_type() const=0;
};
}
#endif // _CPREPROCESSOR__H__