diff options
author | ArenBabikian <aren.babikian@mail.mcgill.ca> | 2019-08-28 05:56:34 -0400 |
---|---|---|
committer | ArenBabikian <aren.babikian@mail.mcgill.ca> | 2020-06-07 19:41:36 -0400 |
commit | 4c34e22d23197ca6b03827a24e9339f88f82df5f (patch) | |
tree | 96450d132cc4bd6be7127a9bd11716e932bf3507 /Metrics/Metrics-Calculation/ca.mcgill.ecse.dslreasoner.realistic.metrics.calculator/xtend-gen/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculator/distance/KSDistance.java | |
parent | Pre-realisticBranchCreation Commit (diff) | |
download | VIATRA-Generator-4c34e22d23197ca6b03827a24e9339f88f82df5f.tar.gz VIATRA-Generator-4c34e22d23197ca6b03827a24e9339f88f82df5f.tar.zst VIATRA-Generator-4c34e22d23197ca6b03827a24e9339f88f82df5f.zip |
VAMPIRE: integrate local Vampire executeable #32
Diffstat (limited to 'Metrics/Metrics-Calculation/ca.mcgill.ecse.dslreasoner.realistic.metrics.calculator/xtend-gen/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculator/distance/KSDistance.java')
-rw-r--r-- | Metrics/Metrics-Calculation/ca.mcgill.ecse.dslreasoner.realistic.metrics.calculator/xtend-gen/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculator/distance/KSDistance.java | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/Metrics/Metrics-Calculation/ca.mcgill.ecse.dslreasoner.realistic.metrics.calculator/xtend-gen/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculator/distance/KSDistance.java b/Metrics/Metrics-Calculation/ca.mcgill.ecse.dslreasoner.realistic.metrics.calculator/xtend-gen/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculator/distance/KSDistance.java new file mode 100644 index 00000000..638ff332 --- /dev/null +++ b/Metrics/Metrics-Calculation/ca.mcgill.ecse.dslreasoner.realistic.metrics.calculator/xtend-gen/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculator/distance/KSDistance.java | |||
@@ -0,0 +1,93 @@ | |||
1 | package ca.mcgill.ecse.dslreasoner.realistic.metrics.calculator.distance; | ||
2 | |||
3 | import ca.mcgill.ecse.dslreasoner.realistic.metrics.calculator.distance.CostDistance; | ||
4 | import ca.mcgill.ecse.dslreasoner.realistic.metrics.calculator.metrics.MetricSampleGroup; | ||
5 | import java.util.ArrayList; | ||
6 | import java.util.HashMap; | ||
7 | import java.util.List; | ||
8 | import java.util.Set; | ||
9 | import org.eclipse.xtext.xbase.lib.CollectionLiterals; | ||
10 | |||
11 | @SuppressWarnings("all") | ||
12 | public class KSDistance extends CostDistance { | ||
13 | private static Object ksTester /* Skipped initializer because of errors */; | ||
14 | |||
15 | private MetricSampleGroup g; | ||
16 | |||
17 | public KSDistance(final MetricSampleGroup g) { | ||
18 | this.g = g; | ||
19 | } | ||
20 | |||
21 | @Override | ||
22 | public double mpcDistance(final List<Double> samples) { | ||
23 | throw new Error("Unresolved compilation problems:" | ||
24 | + "\nThe field KSDistance.ksTester refers to the missing type Object" | ||
25 | + "\nkolmogorovSmirnovStatistic cannot be resolved"); | ||
26 | } | ||
27 | |||
28 | @Override | ||
29 | public double naDistance(final List<Double> samples) { | ||
30 | throw new Error("Unresolved compilation problems:" | ||
31 | + "\nThe field KSDistance.ksTester refers to the missing type Object" | ||
32 | + "\nkolmogorovSmirnovStatistic cannot be resolved"); | ||
33 | } | ||
34 | |||
35 | @Override | ||
36 | public double outDegreeDistance(final List<Double> samples) { | ||
37 | throw new Error("Unresolved compilation problems:" | ||
38 | + "\nThe field KSDistance.ksTester refers to the missing type Object" | ||
39 | + "\nkolmogorovSmirnovStatistic cannot be resolved"); | ||
40 | } | ||
41 | |||
42 | public double typedOutDegreeDistance(final HashMap<String, List<Integer>> map) { | ||
43 | throw new Error("Unresolved compilation problems:" | ||
44 | + "\nThe field KSDistance.ksTester refers to the missing type Object" | ||
45 | + "\nkolmogorovSmirnovStatistic cannot be resolved"); | ||
46 | } | ||
47 | |||
48 | public double nodeTypeDistance(final HashMap<String, Double> samples) { | ||
49 | HashMap<String, Double> typesDistMap = this.g.nodeTypeSamples; | ||
50 | ArrayList<Double> sourceDist = CollectionLiterals.<Double>newArrayList(); | ||
51 | ArrayList<Double> instanceDist = CollectionLiterals.<Double>newArrayList(); | ||
52 | Set<String> _keySet = typesDistMap.keySet(); | ||
53 | for (final String key : _keySet) { | ||
54 | { | ||
55 | sourceDist.add(typesDistMap.get(key)); | ||
56 | instanceDist.add(samples.getOrDefault(key, Double.valueOf(0.0))); | ||
57 | } | ||
58 | } | ||
59 | return this.ks_distance_two_dist(sourceDist, instanceDist); | ||
60 | } | ||
61 | |||
62 | public double edgeTypeDistance(final HashMap<String, Double> samples) { | ||
63 | HashMap<String, Double> typesDistMap = this.g.edgeTypeSamples; | ||
64 | ArrayList<Double> sourceDist = CollectionLiterals.<Double>newArrayList(); | ||
65 | ArrayList<Double> instanceDist = CollectionLiterals.<Double>newArrayList(); | ||
66 | Set<String> _keySet = typesDistMap.keySet(); | ||
67 | for (final String key : _keySet) { | ||
68 | { | ||
69 | sourceDist.add(typesDistMap.get(key)); | ||
70 | instanceDist.add(samples.getOrDefault(key, Double.valueOf(0.0))); | ||
71 | } | ||
72 | } | ||
73 | return this.ks_distance_two_dist(sourceDist, instanceDist); | ||
74 | } | ||
75 | |||
76 | public double ks_distance_two_dist(final List<Double> dist1, final List<Double> dist2) { | ||
77 | double ksStatistics = 0.0; | ||
78 | double sum1 = 0.0; | ||
79 | double sum2 = 0.0; | ||
80 | for (int i = 0; (i < dist1.size()); i++) { | ||
81 | { | ||
82 | double _sum1 = sum1; | ||
83 | Double _get = dist1.get(i); | ||
84 | sum1 = (_sum1 + (_get).doubleValue()); | ||
85 | double _sum2 = sum2; | ||
86 | Double _get_1 = dist2.get(i); | ||
87 | sum2 = (_sum2 + (_get_1).doubleValue()); | ||
88 | ksStatistics = Math.max(ksStatistics, Math.abs((sum1 - sum2))); | ||
89 | } | ||
90 | } | ||
91 | return ksStatistics; | ||
92 | } | ||
93 | } | ||