File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change 1+ import numpy as np
2+
3+ import pysindy as ps
4+
5+
6+ class InferenceBM :
7+ """
8+ An example benchmark that times the performance of various kinds
9+ of iterating over dictionaries in Python.
10+ """
11+
12+ def setup (self ):
13+ t = np .linspace (0 , 1 , 100 )
14+ x = 3 * np .exp (- 2 * t )
15+ y = 0.5 * np .exp (t )
16+ X = np .stack ((x , y ), axis = - 1 ) # First column is x, second is y
17+
18+ self .model = ps .SINDy ()
19+ self .model .fit (X , t = t , feature_names = ["x" , "y" ])
20+ rng = np .random .default_rng (42 )
21+ self .inputs = rng .random ((1000 , 2 ))
22+
23+ def time_a_predict (self ):
24+ self .model .predict (self .inputs [:1 ])
25+
26+ def peakmem_a_predict (self ):
27+ self .model .predict (self .inputs [:1 ])
28+
29+ def time_batch_predict (self ):
30+ self .model .predict (self .inputs )
31+
32+ def peakmem_batch_predict (self ):
33+ self .model .predict (self .inputs )
You can’t perform that action at this time.
0 commit comments