forked from Javert899/pm4js-sandbox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
aaa.html
94 lines (89 loc) · 2.79 KB
/
aaa.html
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<html>
<head>
<script src="scripts/generic/jquery.min.js"></script>
<script src="scripts/generic/statistics.min.js"></script>
<script src="scripts/generic/plotly-2.1.0.min.js"></script>
<script src="scripts/generic/jszip.min.js"></script>
<script src="scripts/generic/jszip-utils.min.js"></script>
<script src="scripts/pm4js_latest.js"></script>
</head>
<body>
<div id="plotlyMLStatGraph" style="width: 100%; height: 100%;">
</div>
<script type="text/javascript">
JSZipUtils.getBinaryContent('running-example.jsonocel.zip', function(err, data) {
if(err) {
throw err; // or handle err
}
JSZip.loadAsync(data).then(function (zip) {
console.log(zip);
for (f in zip.files) {
console.log(f);
zip.file(f).async("string").then(function(unzipped) {
console.log(unzipped);
});
}
});
});
/*function getStatistic(fea, targetVariable, metric) {
let fea2 = OcelObjectFeatures.transformToDct(fea);
let metricVariables = {};
for (let v of fea["featureNames"]) {
metricVariables[v] = "metric";
}
var stats = new Statistics(fea2, metricVariables);
let varValues = [];
for (let v of fea["featureNames"]) {
if (v != targetVariable) {
let val = null;
if (metric == "correlationCoefficient") {
val = stats.correlationCoefficient(v, targetVariable).correlationCoefficient;
}
else if (metric == "covariance") {
val = stats.covariance(v, targetVariable).covariance;
}
else if (metric == "goodmanKruskalsGamma") {
val = stats.goodmanKruskalsGamma(v, targetVariable).gamma;
}
else if (metric == "kendallsTau") {
val = stats.kendallsTau(v, targetVariable).b.tauB;
}
else if (metric == "spearmansRho") {
val = stats.spearmansRho(v, targetVariable).rho;
}
varValues.push([v, val]);
}
}
varValues.sort((a, b) => { return b[1] - a[1]; });
return varValues;
}
function drawStatisticsInPlot(stats, plotDiv="plotlyMLStatGraph") {
let XAxis = [];
let YAxis = [];
for (let stat of stats) {
XAxis.push(stat[1]);
YAxis.push(stat[0]);
}
let trace1 = {
type: 'scatter',
x: XAxis,
y: YAxis,
mode: 'markers',
name: 'Percent of estimated voting age population'
};
let data = [trace1];
Plotly.newPlot(plotDiv, data);
}
$.get("logs/example_table.jsonocel", function(stri) {
let ocel = JsonOcelImporter.apply(stri);
fea = OcelObjectFeatures.apply(ocel);
fea = OcelObjectFeatures.scaling(fea);
fea = OcelObjectFeatures.filterOnVariance(fea, 0.1);
console.log(fea["featureNames"]);
let varValues = getStatistic(fea, "@@obj_lif_dur", "spearmansRho");
console.log(varValues);
drawStatisticsInPlot(varValues);
});*/
</script>
</body>
</html>