-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdecomposition.h
69 lines (47 loc) · 2.28 KB
/
decomposition.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
/* decomposition.h -*- C++ -*-
Jeremy Barnes, 7 October 2009
Copyright (c) 2009 Jeremy Barnes. All rights reserved.
Various schemes to decompose the training data.
*/
#ifndef __ausdm__decomposition_h__
#define __ausdm__decomposition_h__
#include "jml/db/persistent_fwd.h"
#include "data.h"
#include "jml/utils/configuration.h"
/*****************************************************************************/
/* DECOMPOSITION */
/*****************************************************************************/
struct Decomposition {
virtual ~Decomposition() {}
virtual distribution<float>
decompose(const distribution<float> & model_outputs, int order = -1)
const = 0;
/** Perform a decomposition to the given order (number of values) and
then reconstruct, returning the reconstructed version. If order is
-1, then it will be done to the natural order of the decomposition.
*/
virtual distribution<float>
recompose(const distribution<float> & model_outputs,
const distribution<float> & decomposition,
int order) const = 0;
/** Which order values should be passed to recompose? */
virtual std::vector<int> recomposition_orders() const = 0;
void poly_serialize(ML::DB::Store_Writer & store) const;
static boost::shared_ptr<Decomposition>
poly_reconstitute(ML::DB::Store_Reader & store);
void save(const std::string & filename) const;
static boost::shared_ptr<Decomposition> load(const std::string & filename);
static boost::shared_ptr<Decomposition>
create(const std::string & type);
static bool known_type(const std::string & type);
virtual void serialize(ML::DB::Store_Writer & store) const = 0;
virtual void reconstitute(ML::DB::Store_Reader & store) = 0;
virtual void init(const ML::Configuration & config) = 0;
virtual std::string class_id() const = 0;
virtual void train(const Data & training_data,
const Data & testing_data,
const ML::Configuration & config) = 0;
/** The dimensionality of the decomposition */
virtual size_t size() const = 0;
};
#endif /* __ausdm__decomposition_h__ */