diff options
author | 2019-08-13 18:10:02 -0400 | |
---|---|---|
committer | 2019-08-13 18:10:02 -0400 | |
commit | a882ad00515e730bad5e52fa29b74f461a5b9cd6 (patch) | |
tree | 5c892f1dc5b501aa3f7355e97f24cca277a473db /Metrics/Metrics-Calculation/metrics_plot/utils | |
parent | Configurations for generation and new domain for generation ecore model (diff) | |
download | VIATRA-Generator-a882ad00515e730bad5e52fa29b74f461a5b9cd6.tar.gz VIATRA-Generator-a882ad00515e730bad5e52fa29b74f461a5b9cd6.tar.zst VIATRA-Generator-a882ad00515e730bad5e52fa29b74f461a5b9cd6.zip |
change exploration value function
Diffstat (limited to 'Metrics/Metrics-Calculation/metrics_plot/utils')
-rw-r--r-- | Metrics/Metrics-Calculation/metrics_plot/utils/DistributionMetrics.py | 10 | ||||
-rw-r--r-- | Metrics/Metrics-Calculation/metrics_plot/utils/GraphType.py | 3 |
2 files changed, 13 insertions, 0 deletions
diff --git a/Metrics/Metrics-Calculation/metrics_plot/utils/DistributionMetrics.py b/Metrics/Metrics-Calculation/metrics_plot/utils/DistributionMetrics.py index 6e707108..cf532bc5 100644 --- a/Metrics/Metrics-Calculation/metrics_plot/utils/DistributionMetrics.py +++ b/Metrics/Metrics-Calculation/metrics_plot/utils/DistributionMetrics.py | |||
@@ -5,6 +5,16 @@ def ks_distance(samples1, samples2): | |||
5 | value, p = stats.ks_2samp(samples1, samples2) | 5 | value, p = stats.ks_2samp(samples1, samples2) |
6 | return (value, p) | 6 | return (value, p) |
7 | 7 | ||
8 | def manual_ks(pdf1, pdf2): | ||
9 | result = 0 | ||
10 | sum1 = 0 | ||
11 | sum2 = 0 | ||
12 | for(a, b) in zip(pdf1, pdf2): | ||
13 | sum1 += a | ||
14 | sum2 += b | ||
15 | result = max(result, abs(sum1-sum2)) | ||
16 | return result | ||
17 | |||
8 | def js_distance(samples1, samples2): | 18 | def js_distance(samples1, samples2): |
9 | map1 = fromSamples(samples1) | 19 | map1 = fromSamples(samples1) |
10 | map2 = fromSamples(samples2) | 20 | map2 = fromSamples(samples2) |
diff --git a/Metrics/Metrics-Calculation/metrics_plot/utils/GraphType.py b/Metrics/Metrics-Calculation/metrics_plot/utils/GraphType.py index 0a9a95c5..41054294 100644 --- a/Metrics/Metrics-Calculation/metrics_plot/utils/GraphType.py +++ b/Metrics/Metrics-Calculation/metrics_plot/utils/GraphType.py | |||
@@ -10,6 +10,7 @@ class GraphCollection: | |||
10 | self.out_ds = [] | 10 | self.out_ds = [] |
11 | self.nas = [] | 11 | self.nas = [] |
12 | self.mpcs = [] | 12 | self.mpcs = [] |
13 | self.nts = [] | ||
13 | self.name = name | 14 | self.name = name |
14 | models = reader.readmultiplefiles(path, number, shouldShuffle) | 15 | models = reader.readmultiplefiles(path, number, shouldShuffle) |
15 | print(len(models)) | 16 | print(len(models)) |
@@ -19,6 +20,8 @@ class GraphCollection: | |||
19 | self.out_ds.append(out_d) | 20 | self.out_ds.append(out_d) |
20 | self.nas.append(na) | 21 | self.nas.append(na) |
21 | self.mpcs.append(mpc) | 22 | self.mpcs.append(mpc) |
23 | if(constants.Node_TYPE_KEY in contents): | ||
24 | self.nts.append(contents[constants.Node_TYPE_KEY]) | ||
22 | 25 | ||
23 | #Graph stat for one graph | 26 | #Graph stat for one graph |
24 | class GraphStat: | 27 | class GraphStat: |