-
-
Notifications
You must be signed in to change notification settings - Fork 1k
/
EmbeddingConverter.h
106 lines (82 loc) · 2.34 KB
/
EmbeddingConverter.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
/*
* 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) 2011 Sergey Lisitsyn
* Copyright (C) 2011 Sergey Lisitsyn
*/
#ifndef EMBEDDINGCONVERTER_H_
#define EMBEDDINGCONVERTER_H_
#include <shogun/lib/config.h>
#include <shogun/converter/Converter.h>
#include <shogun/features/Features.h>
#include <shogun/features/DenseFeatures.h>
#include <shogun/distance/Distance.h>
#include <shogun/kernel/Kernel.h>
namespace shogun
{
class CFeatures;
class CDistance;
class CKernel;
/** @brief class EmbeddingConverter (part of the Efficient Dimensionality
* Reduction Toolkit) used to construct embeddings of
* features, e.g. construct dense numeric embedding of string features
*/
class CEmbeddingConverter: public CConverter
{
public:
/** constructor */
CEmbeddingConverter();
/** destructor */
virtual ~CEmbeddingConverter();
/** applies to the given data, returns embedding
* @param features features to embed
* @return embedding features
*/
virtual CFeatures* apply(CFeatures* features) = 0;
/** embed given features, acts the same as apply, but returns
* DenseFeatures
* @param features features to embed
* @return embedding simple features
*/
virtual CDenseFeatures<float64_t>* embed(CFeatures* features);
/** setter for target dimension
* @param dim target dimension
*/
void set_target_dim(int32_t dim);
/** getter for target dimension
* @return target dimension
*/
int32_t get_target_dim() const;
/** setter for distance
* @param distance distance to set
*/
void set_distance(CDistance* distance);
/** getter for distance
* @return distance
*/
CDistance* get_distance() const;
/** setter for kernel
* @param kernel kernel to set
*/
void set_kernel(CKernel* kernel);
/** getter for kernel
* @return kernel
*/
CKernel* get_kernel() const;
virtual const char* get_name() const { return "EmbeddingConverter"; };
protected:
/** default init */
void init();
protected:
/** target dim of dimensionality reduction preprocessor */
int32_t m_target_dim;
/** distance to be used */
CDistance* m_distance;
/** kernel to be used */
CKernel* m_kernel;
};
}
#endif /* DIMENSIONREDUCTIONPREPROCESSOR_H_ */