Need of coercing array_like input data? #873
Replies: 3 comments 12 replies
-
Post a minimal, complete example that demonstrates what you are seeing, and be explicit about what you expected to see and what you actually see. Am I supposed to know what you think is wrong? I do not. Yes, some things changed with 1.2.0 for how data is coerced into numpy arrays. I think it is not correct that we change the data you passed in: that is, your Internally, data and weights for a model are converted to numpy arrays of type float64. Independent data is of type list, tuple, pandas.Series can easily be interpreted as "really meant to be a float64 array" and is converted. Independent data of other data types, especially data that is ndarrays of different precision, or dicts, are not converted. |
Beta Was this translation helpful? Give feedback.
-
I agree with your statement that data passed in should not be changed. My post here is to report my experience that they are modified and I would like to change this behavior. Let me simplify and be more explicit.
is a pandas.Series with multiple indices. If I run if I understand correctly, when I run
However, I get the following error with
This is just a complicated way to say that MVE:
|
Beta Was this translation helpful? Give feedback.
-
an update on this. I just merged #899 into the master branch which addresses this issue, I think in a better way. First data returned by an objective function is better coerced into Float64 or Complex128 1D-array, ready to send on to the solver code. That should make objective functions that do use "array-like" objects more guaranteed to work well. Second, for With #899, the default behavior is to "coerce early" data and independent data that is "array-like" (list, tuple, pandas Series, h5py Datasets, anything with an But: the user can pass Independent data can still be any complex object: if it is not "array-like", it is not converted to a float64 array. But that also implies the user intended to do this. I think that adding |
Beta Was this translation helpful? Give feedback.
-
Hello,
Input data (tuples, lists and pd.Series) is now transformed into numpy.array and returned back in their new type in
ModelResult.data
. Recastingpandas.Series
innumpy.array
results in a loss of convenient functionalities.This was not the case before since this commit when it was very convenient to use pandas functionalities directly on the fitted data.
What's the reason behind this? Is keeping this constraint mandatory?
Beta Was this translation helpful? Give feedback.
All reactions