1 | // This file is a part of Framsticks SDK. http://www.framsticks.com/ |
---|
2 | // Copyright (C) 1999-2021 Maciej Komosinski and Szymon Ulatowski. |
---|
3 | // See LICENSE.txt for details. |
---|
4 | |
---|
5 | #ifndef DISTRIBUTION_MEASURE_H |
---|
6 | #define DISTRIBUTION_MEASURE_H |
---|
7 | |
---|
8 | #include "simil-measure-base.h" |
---|
9 | #include "EMD/emd.h" |
---|
10 | #include <random> |
---|
11 | |
---|
12 | class SimilMeasureDistribution : public SimilMeasureBase |
---|
13 | { |
---|
14 | public: |
---|
15 | SimilMeasureDistribution(); |
---|
16 | ~SimilMeasureDistribution() {}; |
---|
17 | int setParams(std::vector<double> params); |
---|
18 | void calculateFuns(); |
---|
19 | void calculateFun(std::pair<double, float> *fun, const Model &sampled); |
---|
20 | double compareFuns(); |
---|
21 | double EMD(std::pair<double, float> *fun1, std::pair<double, float> *fun2); |
---|
22 | double density; |
---|
23 | int samples_num; |
---|
24 | int bin_num; |
---|
25 | /// Interface to local parameters |
---|
26 | Param localpar; |
---|
27 | |
---|
28 | protected: |
---|
29 | std::pair<double, float> *funs[2]; |
---|
30 | SolidsShapeTypeModel *sst_models[2]; |
---|
31 | void (SimilMeasureDistribution::*distribution_fun)(int samples_taken, std::uniform_int_distribution<> &distribution, const Model &sampled, std::vector<double> &dist_vect); |
---|
32 | |
---|
33 | void fillPointsWeights(std::pair<double, float> *fun, feature_t *points, float *weights); |
---|
34 | double getDistance(); |
---|
35 | void D2(int samples_taken, std::uniform_int_distribution<> &distribution, const Model &sampled, std::vector<double> &dist_vect); |
---|
36 | void D1(int samples_taken, std::uniform_int_distribution<> &distribution, const Model &sampled, std::vector<double> &dist_vect); |
---|
37 | void D3(int samples_taken, std::uniform_int_distribution<> &distribution, const Model &sampled, std::vector<double> &dist_vect); |
---|
38 | void D4(int samples_taken, std::uniform_int_distribution<> &distribution, const Model &sampled, std::vector<double> &dist_vect); |
---|
39 | void A3(int samples_taken, std::uniform_int_distribution<> &distribution, const Model &sampled, std::vector<double> &dist_vect); |
---|
40 | |
---|
41 | private: |
---|
42 | std::mt19937 rndgen; |
---|
43 | }; |
---|
44 | |
---|
45 | #endif /* DISTRIBUTION_MEASURE_H */ |
---|
46 | |
---|