Skip to content

Instantly share code, notes, and snippets.

@travisbrady
Last active August 29, 2015 13:56
Show Gist options
  • Save travisbrady/8873587 to your computer and use it in GitHub Desktop.
Save travisbrady/8873587 to your computer and use it in GitHub Desktop.
ocaml_gpr
################################
# train
$ ocaml_gpr -verbose -cmd train -model foo.model < train.data
target variance: 53980.91115
iter 1: MSLL=20677.0739875 SMSE=0.6434589 MAD=144.2473817 MAXAD=395.0879824
iter 1: |gradient|=406648.85928
result: MSLL=0.0000006 SMSE=1.0000000 MAD=186.1172019 MAXAD=488.0434778
####################################################
# Now apply, all data is just the mean of the series
$ ocaml_gpr -cmd test -model foo.model < test.csv
1556.043478
1556.043477
1556.043477
1556.043477
#####
Training data
$ cat train.data
0.0,1767.0
1.0,1643.0
2.0,1605.0
3.0,1675.0
4.0,1717.0
5.0,1505.0
6.0,1746.0
7.0,1864.0
8.0,1619.0
9.0,1599.0
10.0,1593.0
11.0,1831.0
12.0,1825.0
13.0,1707.0
14.0,1562.0
15.0,1728.0
16.0,1433.0
17.0,1392.0
18.0,1194.0
19.0,1068.0
20.0,1482.0
21.0,1160.0
22.0,1074.0
#####
Test input - handful of out of sample data points
$ cat test.csv
23.0
24.0
25.0
26.0
###########
#####
### 'sta' is a little command line descriptive statistics app (https://github.com/simonccarter/sta)
$ cat train.data | cut -d',' -f2 | sta
N min max sum mean sd sderr
23 1068 1864 35789 1556.04 232.338 48.4458
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment