14
14
15
15
from adaptive .learner .learner1D import Learner1D , _get_intervals
16
16
from adaptive .notebook_integration import ensure_holoviews
17
- from adaptive .types import Real
17
+ from adaptive .types import Int , Real
18
18
from adaptive .utils import assign_defaults , partial_function_from_dataframe
19
19
20
20
try :
@@ -183,7 +183,10 @@ def load_dataframe(
183
183
x_name : str = "x" ,
184
184
y_name : str = "y" ,
185
185
):
186
- self .tell_many (df [[seed_name , x_name ]].values , df [y_name ].values )
186
+ # Were using zip instead of df[[seed_name, x_name]].values because that will
187
+ # make the seeds into floats
188
+ seed_x = list (zip (df [seed_name ].values .tolist (), df [x_name ].values .tolist ()))
189
+ self .tell_many (seed_x , df [y_name ].values )
187
190
if with_default_function_args :
188
191
self .function = partial_function_from_dataframe (
189
192
self .function , df , function_prefix
@@ -424,7 +427,9 @@ def _calc_error_in_mean(self, ys: Iterable[Real], y_avg: Real, n: int) -> float:
424
427
t_student = scipy .stats .t .ppf (1 - self .alpha , df = n - 1 )
425
428
return t_student * (variance_in_mean / n ) ** 0.5
426
429
427
- def tell_many (self , xs : Points , ys : Sequence [Real ]) -> None :
430
+ def tell_many (
431
+ self , xs : Points | np .ndarray , ys : Sequence [Real ] | np .ndarray
432
+ ) -> None :
428
433
# Check that all x are within the bounds
429
434
# TODO: remove this requirement, all other learners add the data
430
435
# but ignore it going forward.
@@ -435,7 +440,7 @@ def tell_many(self, xs: Points, ys: Sequence[Real]) -> None:
435
440
)
436
441
437
442
# Create a mapping of points to a list of samples
438
- mapping : DefaultDict [Real , DefaultDict [int , Real ]] = defaultdict (
443
+ mapping : DefaultDict [Real , DefaultDict [Int , Real ]] = defaultdict (
439
444
lambda : defaultdict (dict )
440
445
)
441
446
for (seed , x ), y in zip (xs , ys ):
0 commit comments