Skip to content

Commit 1765416

Browse files
committed
Update documentation
1 parent e7d36e7 commit 1765416

File tree

1 file changed

+41
-14
lines changed

1 file changed

+41
-14
lines changed

src/progpy/predictors/monte_carlo.py

Lines changed: 41 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,10 @@ class MonteCarlo(Predictor):
1919
2020
Configuration Parameters
2121
------------------------------
22-
t0 : float
23-
Initial time at which prediction begins, e.g., 0
24-
dt : float
25-
Simulation step size (s), e.g., 0.1
26-
events : list[str]
27-
Events to predict (subset of model.events) e.g., ['event1', 'event2']
28-
horizon : float
29-
Prediction horizon (s)
30-
n_samples : int
31-
Number of samples to use. If not specified, a default value is used. If state is type UnweightedSamples and n_samples is not provided, the provided unweighted samples will be used directly.
32-
save_freq : float
33-
Frequency at which results are saved (s)
34-
save_pts : list[float]
35-
Any additional savepoints (s) e.g., [10.1, 22.5]
22+
n_samples : int, optional
23+
Default number of samples to use. If not specified, a default value is used. If state is type UnweightedSamples and n_samples is not provided, the provided unweighted samples will be used directly.
24+
save_freq : float, optional
25+
Default frequency at which results are saved (s).
3626
"""
3727

3828
__DEFAULT_N_SAMPLES = 100 # Default number of samples to use, if none specified and not UncertainData
@@ -42,6 +32,43 @@ class MonteCarlo(Predictor):
4232
}
4333

4434
def predict(self, state: UncertainData, future_loading_eqn: Callable, **kwargs) -> PredictionResults:
35+
"""
36+
Perform a single prediction
37+
38+
Parameters
39+
----------
40+
state : UncertainData
41+
Distribution representing current state of the system
42+
future_loading_eqn : function (t, x) -> z
43+
Function to generate an estimate of loading at future time t, and state x
44+
45+
Keyword Arguments
46+
------------------
47+
t0 : float, optional
48+
Initial time at which prediction begins, e.g., 0
49+
dt : float, optional
50+
Simulation step size (s), e.g., 0.1
51+
events : list[str], optional
52+
Events to predict (subset of model.events) e.g., ['event1', 'event2']
53+
horizon : float, optional
54+
Prediction horizon (s)
55+
n_samples : int, optional
56+
Number of samples to use. If not specified, a default value is used. If state is type UnweightedSamples and n_samples is not provided, the provided unweighted samples will be used directly.
57+
save_freq : float, optional
58+
Frequency at which results are saved (s)
59+
save_pts : list[float], optional
60+
Any additional savepoints (s) e.g., [10.1, 22.5]
61+
62+
Return
63+
----------
64+
result from prediction, including: NameTuple
65+
* times (List[float]): Times for each savepoint such that inputs.snapshot(i), states.snapshot(i), outputs.snapshot(i), and event_states.snapshot(i) are all at times[i]
66+
* inputs (Prediction): Inputs at each savepoint such that inputs.snapshot(i) is the input distribution (type UncertainData) at times[i]
67+
* states (Prediction): States at each savepoint such that states.snapshot(i) is the state distribution (type UncertainData) at times[i]
68+
* outputs (Prediction): Outputs at each savepoint such that outputs.snapshot(i) is the output distribution (type UncertainData) at times[i]
69+
* event_states (Prediction): Event states at each savepoint such that event_states.snapshot(i) is the event state distribution (type UncertainData) at times[i]
70+
* time_of_event (UncertainData): Distribution of predicted Time of Event (ToE) for each predicted event, represented by some subclass of UncertaintData (e.g., MultivariateNormalDist)
71+
"""
4572
if isinstance(state, dict) or isinstance(state, self.model.StateContainer):
4673
from progpy.uncertain_data import ScalarData
4774
state = ScalarData(state, _type = self.model.StateContainer)

0 commit comments

Comments
 (0)