-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
200 lines (171 loc) · 10.2 KB
/
index.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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
<!DOCTYPE html>
<html lang="it">
<head>
<meta charset="UTF-8">
<meta name="description" content="Regression analysis visualizer">
<meta name="keywords" content="regression, linear, logarithmic, power, exponential, polynomial, visualization">
<meta name="author" content="Lemuel Puglisi">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Regression Analysis</title>
<link rel="icon" href="assets/icon.svg">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BmbxuPwQa2lc/FVzBcNJ7UAyJxM6wuqIj61tLrc4wSX0szH/Ev+nYRRuWlolflfl" crossorigin="anonymous">
<link rel="stylesheet" href="./css/main.css">
<!-- Libraries -->
<script src="lib/p5core/p5.min.js"></script>
<script src="lib/regression/regression.min.js"></script>
<!-- Project -->
<script src="src/Core.js"></script>
<script src="src/Mapper.js"></script>
<script src="src/Point.js"></script>
<script src="src/Distribution.js"></script>
<script src="src/RegressionManager.js"></script>
<script src="src/Error.js"></script>
</head>
<body>
<div class="container-fluid">
<div class="px-3 py-3 pt-md-5 pb-md-4 mx-auto text-center bg-light shadow ">
<h2 class="display-4">Regression Analysis Visualizer</h2>
<p class="lead">
L'analisi della regressione è una tecnica usata per analizzare una serie
di dati che consistono in una variabile dipendente e una o più variabili
indipendenti. Lo scopo è stimare un'eventuale relazione funzionale esistente
tra la variabile dipendente e le variabili indipendenti.
La seguente applicazione calcola in tempo reale la funzione (lineare o non)
che approssima al meglio la distribuzione di punti inseriti nel piano attraverso
la tecnica di regressione indicata nel form. <mark> È possibile aggiungere punti
nel grafico utilizzando il puntatore del mouse e cliccando sulla regione di
spazio in cui si vuole posizionare il punto</mark>. In alternativa, è possibile
aggiungere punti attraverso il form sottostante utilizzando le coordinate.
</p>
</div>
<div class="row mt-4">
<div class="col-sm-6">
<div class="p-3 mb-2 bg-white rounded mt-2 shad">
<!-- Regression management -->
<form>
<div class="form-group">
<div class="row">
<div class="col-sm-8">
<label for="regressor_select">Seleziona il tipo di regressore</label>
<select class="form-control" id="regression_type_select" onclick="changeRegressionMethod(getRegressionMethodFromSelect())">
<option value="linear">lineare</option>
<option value="polynomial">polinomiale</option>
<option value="exponential">esponenziale</option>
<option value="logarithmic">logaritmica</option>
<option value="power">power law</option>
</select>
</div>
<div class="col-sm-4">
<label for="polynomial_order" id="polynomial_order_label">Ordine polinomio</label>
<input type="number" class="form-control" id="polynomial_order" onchange="changeRegressionMethod('polynomial')" disabled>
</div>
</div>
</div>
<div class="form-group mt-2">
<div class="row">
<div class="col-sm-4">
<label for="cov">Covarianza</label>
<input class="form-control" type="number" id="cov" readonly>
</div>
<div class="col-sm-4">
<label for="cov">Correlazione</label>
<input class="form-control" type="text" id="cov_text" readonly>
</div>
<div class="col-sm-4">
<label for="pearson">Coefficiente di Pearson</label>
<input class="form-control" type="number" id="pearson" readonly>
</div>
</div>
</div>
<div class="form-group mt-2">
<div class="row">
<div class="col-sm-12">
<label for="string_function">Funzione di regressione</label>
<input type="text" class="form-control" id="string_function" readonly>
</div>
</div>
</div>
</form>
<!-- Predictions -->
<form class="mt-4 mb-4">
<div class="input-group">
<span class="input-group-text">Inferenza</span>
<input type="number" id="x_in" aria-label="x_in" placeholder="x" class="form-control">
<input type="number" id="y_pr" aria-label="y_pr" placeholder="y predetta" class="form-control" readonly>
<button class="btn btn-primary" type="button" onclick="predict()">effettua predizione</button>
</div>
</form>
<!-- Point insertion -->
<form class="mt-4">
<p>
Inserisci i punti cliccando sul diagramma cartesiano o
tramite coordinate inserendo i valori nel form sottostante
</p>
<div class="row">
<div class="col-sm-3">
<div class="form-group mt-2">
<input type="number" step="0.01" class="form-control" id="new_point_x_cord" placeholder="x">
</div>
<div class="form-group mt-2">
<input type="number" step="0.01" class="form-control" id="new_point_y_cord" placeholder="y">
</div>
</div>
<div class="col-sm-9">
<div class="form-group mt-2">
<div class="form-floating">
<textarea class="form-control" id="new_points_textarea" placeholder="oppure scrivi una coppia di coordinate per riga (es. x, y)" style="height: 100px"></textarea>
</div>
</div>
</div>
</div>
<div class="form-group mt-4">
<button type="button" id="new_point_trigger" onclick="addPointUsingForm()" class="btn btn-primary align-self-start" >inserisci</button>
<button type="button" id="reset_point_set" onclick="resetPointset()" class="btn btn-danger align-self-end">Svuota l'insieme di punti</button>
</div>
<div style="float:none"></div>
</form>
</div>
</div>
<div class="col-sm-6">
<div class="p-3 mb-3 bg-white rounded mt-2 shad">
<form class="row">
<div class="col-sm-4">
<label for="point-size" class="form-label">Diametro punti</label>
</div>
<div class="col-sm-8">
<input type="range" min="1" max="20" step="0.5" class="form-range" id="point-size" onchange="updatePointSize()">
</div>
<div class="col-sm-4">
<label for="point-size" class="form-label">Larghezza funzione</label>
</div>
<div class="col-sm-8">
<input type="range" min="1" max="20" step="0.5" class="form-range" id="function-size" onchange="updateFunctionSize()">
</div>
</form>
</div>
<div class="row">
<div class="col-sm-12" style="text-align: center;">
<div style="display: inline-flex; padding: 10px; " class="shad">
<div id="regression" class=""></div>
</div>
</div>
</div>
</div>
</div>
<div class="row mt-4">
<div class="col-sm-12">
<div class="p-3 mb-5 w-100 bg-white rounded mt-3 shad">
<h4>Crediti</h4>
<ul class="lead">
<li><a href="https://p5js.org/">p5.js</a> - flexible sofware sketchbook</li>
<li><a href="https://github.com/Tom-Alexander/regression-js">regression.js</a> - linear least-squares fitting methods library</li>
<li><a href="https://getbootstrap.com/">bootstrap</a> - CSS framework</li>
</ul>
<p> Author: Lemuel Puglisi @ UniCT, DMI</p>
</div>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-b5kHyXgcpbZJO/tY9Ul7kGkf1S0CWuKcCD38l8YkeH8z8QjE0GmW1gYU5S9FOnJ0" crossorigin="anonymous"></script>
</body>
</html>