-
-
Notifications
You must be signed in to change notification settings - Fork 1k
/
Transformer.h
62 lines (51 loc) · 1.22 KB
/
Transformer.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
/*
* This software is distributed under BSD 3-clause license (see LICENSE file).
*
* Authors: Wuwei Lin
*/
#ifndef TRANSFORMER_H_
#define TRANSFORMER_H_
#include <shogun/lib/config.h>
#include <shogun/base/SGObject.h>
#include <shogun/lib/common.h>
namespace shogun
{
class CFeatures;
/** @brief class Transformer used to transform data
*
*/
class CTransformer : public CSGObject
{
public:
/** constructor */
CTransformer() : CSGObject()
{
}
/** destructor */
virtual ~CTransformer()
{
}
/** get name */
virtual const char* get_name() const
{
return "Transformer";
}
/** Fit transformer to features */
virtual void fit(CFeatures* features)
{
}
/** Fit transformer to features and labels */
virtual void fit(CFeatures* features, CLabels* labels)
{
SG_SNOTIMPLEMENTED;
}
/** Apply transform to features. If transform is performed in place,
* underlying data of input features will be reused if possible.
* @param features features to transform
* @param inplace whether transform in place
* @return the result feature object after applying the transformer
* */
virtual CFeatures* apply(CFeatures* features, bool inplace = true) = 0;
};
}
#endif /* TRANSFORMER_H_ */