|
a |
|
b/bin/metrics/README.md |
|
|
1 |
Torch metrics package |
|
|
2 |
==================== |
|
|
3 |
|
|
|
4 |
This package provides utility functions to evaluate your machine learning models. |
|
|
5 |
|
|
|
6 |
#### Disclaimer: |
|
|
7 |
|
|
|
8 |
Use at your own risk. The code is not extensively tested, therefore it might contain bugs. |
|
|
9 |
If you find any, please let me know and I will try to fix it. |
|
|
10 |
|
|
|
11 |
#### Installation: |
|
|
12 |
|
|
|
13 |
```sh |
|
|
14 |
git clone https://github.com/hpenedones/metrics.git |
|
|
15 |
cd metrics |
|
|
16 |
luarocks make |
|
|
17 |
``` |
|
|
18 |
|
|
|
19 |
#### Receiver Operator Curves (ROC) |
|
|
20 |
|
|
|
21 |
Used to evalute performance of binary classifiers, and their trade-offs in terms of false-positive and false-negative rates. |
|
|
22 |
|
|
|
23 |
```lua |
|
|
24 |
require 'torch' |
|
|
25 |
metrics = require 'metrics' |
|
|
26 |
gfx = require 'gfx.js' |
|
|
27 |
|
|
|
28 |
resp = torch.DoubleTensor { -0.9, -0.8, -0.8, -0.5, -0.1, 0.0, 0.2, 0.2, 0.51, 0.74, 0.89} |
|
|
29 |
labels = torch.IntTensor { -1, -1, 1, -1, -1, 1, 1, -1, -1, 1, 1} |
|
|
30 |
|
|
|
31 |
roc_points, thresholds = metrics.roc.points(resp, labels) |
|
|
32 |
area = metrics.roc.area(roc_points) |
|
|
33 |
|
|
|
34 |
print(roc_points) |
|
|
35 |
print(thresholds) |
|
|
36 |
print(area) |
|
|
37 |
|
|
|
38 |
gfx.chart(roc_points) |
|
|
39 |
|
|
|
40 |
``` |
|
|
41 |
|
|
|
42 |
 |
|
|
43 |
|
|
|
44 |
#### Confusion matrix (TODO) |
|
|
45 |
|
|
|
46 |
Used to evaluate performance of multi-class classifiers. |