8000 README: Fixed paths in code examples · georgedeath/egreedy@1ff8b1e · GitHub
[go: up one dir, main page]

Skip to content

Commit

Permalink
README: Fixed paths in code examples
Browse files Browse the repository at this point in the history
Included exact paths in examples to ensure no ambiguity in where files are located.
  • Loading branch information
georgedeath authored Feb 3, 2020
1 parent 87fd032 commit 1ff8b1e
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ Finally, compile the pressure calculation function and check that the test probl
> cd /egreedy/egreedy/test_problems/Exeter_CFD_Problems/data/PitzDaily/solvers/
> wmake calcPressureDifference
> # test the PitzDaily solver
> cd /egreedy
> python -m egreedy.test_problems.pitzdaily
PitzDaily successfully instantiated..
Generated valid solution, evaluating..
Expand All @@ -93,21 +94,21 @@ Please ignore errors like `Getting LinuxMem: [Errno 2] No such file or directory
### Training data
The initial training locations for each of the 51 sets of [Latin hypercube](https://www.jstor.org/stable/1268522) samples are located in the `training_data` directory in this repository with the filename structure `ProblemName_number`, e.g. the first set of training locations for the Branin problem is stored in `Branin_1.npz`. Each of these files is a compressed numpy file created with [numpy.savez](https://docs.scipy.org/doc/numpy/reference/generated/numpy.savez.html). It has two [numpy.ndarrays](https://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html) containing the 2*D initial locations and their corresponding fitness values. To load and inspect these values use the following instructions:
```python
> cd training_data
> cd /egreedy
> python
>>> import numpy as np
>>> with np.load('Branin_1.npz') as data:
>>> with np.load('training_data/Branin_1.npz') as data:
Xtr = data['arr_0']
Ytr = data['arr_1']
>>> Xtr.shape, Ytr.shape
((4, 2), (4, 1))
```
The robot pushing test problems (push4 and push8) have a third array `'arr_2'` that contains their instance-specific parameters:
```python
> cd training_data
> cd /egreedy
> python
>>> import numpy as np
>>> with np.load('push4_1.npz', allow_pickle=True) as data:
>>> with np.load('training_data/push4_1.npz', allow_pickle=True) as data:
Xtr = data['arr_0']
Ytr = data['arr_1']
instance_params = data['arr_2']
Expand All @@ -121,11 +122,11 @@ The results of all optimisation runs can be found in the `results` directory. Th

The following example loads the first optimisation run on the Branin test problem with the ε-PF method using ε = 0.1:
```python
> cd results
> cd /egreedy
> python
>>> import numpy as np
>>> # load the
>>> with np.load('Branin_1_250_eFront_eps0.1.npz', allow_pickle=True) as data:
>>> with np.load('results/Branin_1_250_eFront_eps0.1.npz', allow_pickle=True) as data:
Xtr = data['Xtr']
Ytr = data['Ytr']
>>> Xtr.shape, Ytr.shape
Expand Down

0 comments on commit 1ff8b1e

Please sign in to comment.
0