Skip to content

Commit

Permalink
docs: fixing quickstart
Browse files Browse the repository at this point in the history
  • Loading branch information
eckelsjd committed Dec 13, 2023
1 parent 8c57ff1 commit 42c871c
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,31 @@ pdm sync # reads pdm.lock and sets up an identical venv
```

## Quickstart
```python title="amisc.examples.tutorial.py"
--8<-- "amisc/examples/tutorial.py:simple"
```python
import numpy as np

from amisc.system import SystemSurrogate, ComponentSpec
from amisc.utils import UniformRV

def fun1(x):
return dict(y=x * np.sin(np.pi * x))

def fun2(x):
return dict(y=1 / (1 + 25 * x ** 2))

x = UniformRV(0, 1, 'x')
y = UniformRV(0, 1, 'y')
z = UniformRV(0, 1, 'z')
model1 = ComponentSpec(fun1, exo_in=x, coupling_out=y)
model2 = ComponentSpec(fun2, coupling_in=y, coupling_out=z)

inputs = x
outputs = [y, z]
system = SystemSurrogate([model1, model2], inputs, outputs)
system.fit()

x_test = system.sample_inputs(10)
y_test = system.predict(x_test)
```

## Contributing
Expand Down

0 comments on commit 42c871c

Please sign in to comment.