aboutsummaryrefslogtreecommitdiffstats
path: root/Metrics
diff options
context:
space:
mode:
authorLibravatar chuningli <lilylcn13@gmail.com>2019-05-28 15:41:38 -0400
committerLibravatar chuningli <lilylcn13@gmail.com>2019-05-28 15:41:38 -0400
commit40f2c622be40debb9c98b3805008085b1935c5fc (patch)
tree3dca3654034cbf46302869e483888c49fcf0a45d /Metrics
parentadded plot median ks distance line (diff)
downloadVIATRA-Generator-40f2c622be40debb9c98b3805008085b1935c5fc.tar.gz
VIATRA-Generator-40f2c622be40debb9c98b3805008085b1935c5fc.tar.zst
VIATRA-Generator-40f2c622be40debb9c98b3805008085b1935c5fc.zip
calculate metrics at the end of model generation
Diffstat (limited to 'Metrics')
-rw-r--r--Metrics/Metrics-Calculation/ca.mcgill.ecse.dslreasoner.realistic.metrics.calculator/src/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculator/app/PartialInterpretationMetric.xtend12
1 files changed, 9 insertions, 3 deletions
diff --git a/Metrics/Metrics-Calculation/ca.mcgill.ecse.dslreasoner.realistic.metrics.calculator/src/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculator/app/PartialInterpretationMetric.xtend b/Metrics/Metrics-Calculation/ca.mcgill.ecse.dslreasoner.realistic.metrics.calculator/src/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculator/app/PartialInterpretationMetric.xtend
index 1a7e846b..d786e6f0 100644
--- a/Metrics/Metrics-Calculation/ca.mcgill.ecse.dslreasoner.realistic.metrics.calculator/src/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculator/app/PartialInterpretationMetric.xtend
+++ b/Metrics/Metrics-Calculation/ca.mcgill.ecse.dslreasoner.realistic.metrics.calculator/src/ca/mcgill/ecse/dslreasoner/realistic/metrics/calculator/app/PartialInterpretationMetric.xtend
@@ -19,7 +19,7 @@ class PartialInterpretationMetric {
19 var static state = 0; 19 var static state = 0;
20 20
21 // calculate the metrics for a state 21 // calculate the metrics for a state
22 def static void calculateMetric(PartialInterpretation partial, String path, String currentStateId){ 22 def static void calculateMetric(PartialInterpretation partial, String path, String currentStateId, Integer counter){
23 val metrics = new ArrayList<Metric>(); 23 val metrics = new ArrayList<Metric>();
24 metrics.add(new OutDegreeMetric()); 24 metrics.add(new OutDegreeMetric());
25 metrics.add(new NodeActivityMetric()); 25 metrics.add(new NodeActivityMetric());
@@ -27,7 +27,7 @@ class PartialInterpretationMetric {
27 27
28 //make dir since the folder can be none existing 28 //make dir since the folder can be none existing
29 new File(path).mkdir(); 29 new File(path).mkdir();
30 val filename = path + "/state_"+currentStateId+".csv"; 30 val filename = path + "/state_"+currentStateId+"-"+counter+".csv";
31 state++; 31 state++;
32 val metricCalculator = new PartialInterpretationGraph(partial, metrics, currentStateId); 32 val metricCalculator = new PartialInterpretationGraph(partial, metrics, currentStateId);
33 33
@@ -44,10 +44,16 @@ class PartialInterpretationMetric {
44 // state codes that will record the trajectory 44 // state codes that will record the trajectory
45 val stateCodes = newArrayList() 45 val stateCodes = newArrayList()
46 46
47 var counter = 0
47 //transform and record the state codes for each state 48 //transform and record the state codes for each state
48 while(trajectory.doNextTransformation){ 49 while(trajectory.doNextTransformation){
49 //println(trajectory.stateCoder.createStateCode) 50 //println(trajectory.stateCoder.createStateCode)
50 stateCodes.add(trajectory.stateCoder.createStateCode.toString) 51 val stateId = trajectory.stateCoder.createStateCode.toString
52 val interpretation = trajectory.getModel();
53 //calculate metrics of current state
54 calculateMetric(interpretation as PartialInterpretation, "debug/metric/output", stateId, counter)
55 stateCodes.add(stateId)
56 counter++
51 } 57 }
52 58
53 59