Proyecto

General

Perfil

Integration » Histórico » Versión 5

Federico Vera, 2018-07-12 06:04

1 1 Federico Vera
# Integration
2
3 5 Federico Vera
{{>toc}}
4
5 1 Federico Vera
# What to do with the Data
6
Now that you have successfully trained your `MLP` you might want to integrate it with other things, or whatever.
7
## Evaluating from Java
8 4 Federico Vera
First of all you'll need to grab a copy of [`libai`](https://redmine.riddler.com.ar/projects/libai/roadmap) and add it to your classpath.
9 1 Federico Vera
10
Then here's a sample code that can be used as a guide:
11
~~~Java
12
import libai.nn.supervised.MLP;
13
import libai.common.Matrix;
14
15
...
16
//The rest of your code
17
...
18
19
public double f(double x) {
20
    MLP mlp = MLP.open("weights.dat"); //<- the weights you want to use
21
    Matrix m = new Matrix(1, 1);       //<- we only use single neuron inputs
22
    m.position(0, 0, x);               //<- set the value in the matrix
23
    return mlp.simulate(m).position(0, 0); //<- we only use single neuron output
24
}
25
~~~
26
27
## Evaluating from CLI
28
```
29
$ java -jar mrft-VERSION.jar FILENAME VALUES
30
```
31
So for instance if you train the MLP with `cos(x)`, it should output:
32
```
33 2 Federico Vera
$ java -jar mrft-VERSION.jar weights.dat 0 1.0
34 1 Federico Vera
```
35
You can also use the `-csv` or `-tsv` flags, so the output will be:
36
```
37 2 Federico Vera
$ java -jar mrft-VERSION.jar weights.dat -csv 0 0.0, 1.0
38 1 Federico Vera
```
39
The output will always be via `sdt::out` so you can use something like `tee` to create a file
40
```
41
$ java -jar mrft-VERSION.jar -csv FILENAME VALUES | tee OUT.csv
42
```
43
44
## GNU Octave
45
The current version of `libai` supports exporting matrices as `Octave-Level-1`  binary matrices, but it still doesn't do that for `MLP`, so if someone actually want's to collaborate with some code, or wait a bit till I have some spare time.
46 3 Federico Vera
47
### Exporting to Octave format
48
```
49
$ java -jar mrft-VERSION.jar -octave weights.dat
50
```
Volver al inicio