You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/progpy/predictors/monte_carlo.py
+59-18Lines changed: 59 additions & 18 deletions
Original file line number
Diff line number
Diff line change
@@ -19,27 +19,56 @@ class MonteCarlo(Predictor):
19
19
20
20
Configuration Parameters
21
21
------------------------------
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).
36
26
"""
37
27
28
+
__DEFAULT_N_SAMPLES=100# Default number of samples to use, if none specified and not UncertainData
29
+
38
30
default_parameters= {
39
-
'n_samples': 100# Default number of samples to use, if none specified
Distribution representing current state of the system
42
+
future_loading_eqn : function (t, x=None) -> z, optional
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)
Any additional configuration values. Note: These parameters can also be specified in the predictor constructor. The following configuration parameters are supported: \n
# self.assertAlmostEqual(mc_results.times[-1], 9, 1) # Saving every second, last time should be around the 1s after impact event (because one of the sigma points fails afterwards)
0 commit comments