Hello,
I’m trying to set my data to an out of sample set and get the following error:
Error
---------------------------------------------------------------------------
NotImplementedError Traceback (most recent call last)
/opt/conda/lib/python3.7/site-packages/aesara/link/basic.py in __set__(self, value)
111 self.storage[0] = self.type.filter_inplace(
--> 112 value, self.storage[0], **kwargs
113 )
/opt/conda/lib/python3.7/site-packages/aesara/graph/type.py in filter_inplace(self, value, storage, strict, allow_downcast)
129 """
--> 130 raise NotImplementedError()
131
NotImplementedError:
During handling of the above exception, another exception occurred:
TypeError Traceback (most recent call last)
/tmp/ipykernel_34196/1650750725.py in <module>
46 'pvbv': test_promo_pvbv_idx,
47 'giftset': test_giftset_idx,
---> 48 'month': test_month_idx})
49 print("sampling test ppc...")
50 test_ppc = pm.sample_posterior_predictive(idata)
/opt/conda/lib/python3.7/site-packages/pymc/model.py in set_data(new_data, model, coords)
1877
1878 for variable_name, new_value in new_data.items():
-> 1879 model.set_data(variable_name, new_value, coords=coords)
1880
1881
/opt/conda/lib/python3.7/site-packages/pymc/model.py in set_data(self, name, values, coords)
1319 self._coords[dname] = tuple(new_coords)
1320
-> 1321 shared_object.set_value(values)
1322
1323 def register_rv(
/opt/conda/lib/python3.7/site-packages/aesara/compile/sharedvalue.py in set_value(self, new_value, borrow)
143 self.container.value = new_value
144 else:
--> 145 self.container.value = copy.deepcopy(new_value)
146
147 def get_test_value(self):
/opt/conda/lib/python3.7/site-packages/aesara/link/basic.py in __set__(self, value)
113 )
114 except NotImplementedError:
--> 115 self.storage[0] = self.type.filter(value, **kwargs)
116
117 except Exception as e:
/opt/conda/lib/python3.7/site-packages/aesara/tensor/type.py in filter(self, data, strict, allow_downcast)
187 f'"function". Value: "{repr(data)}"'
188 )
--> 189 raise TypeError(err_msg)
190 elif (
191 allow_downcast is None
TypeError: ('TensorType(int32, (None,)) cannot store a value of dtype float64 without risking loss of precision. If you do not mind this loss, you can: 1) explicitly cast your data to int32, or 2) set "allow_input_downcast=True" when calling "function". Value: "array([1. , 1.02083333, 1.04166667, 1.0625 , 1.08333333,\n 1.10416667, 1.125 , 1.14583333, 1.16666667, 1.1875 ,\n 1.20833333, 1.22916667])"', 'Container name "t"')
Code:
t_test = np.arange(1, 1+12/T, 1/T)
print(t_test)
#get test data
#bring in new data
with constant_model:
test_time_idx, test_times = pd.factorize(df_test.index.get_level_values(0))
test_month_idx, test_month = pd.factorize(df_test['month'])
test_item_idx, test_items = pd.factorize(df_test.index.get_level_values(1))
test_location_idx, test_locations = pd.factorize(df_test.index.get_level_values(2))
test_promo_idx, test_promo = pd.factorize(df_test['promo_status_metric_measure'])
test_cann_idx, test_cannibalization = pd.factorize(df_test['cannibalized'])
test_dc_idx, test_dc_discount = pd.factorize(df_test['promo_desc_dcdiscount'])
test_free_fin_idx, test_free_fin = pd.factorize(df_test['promo_desc_freefinancing'])
test_giftset_idx, test_giftset = pd.factorize(df_test['promo_desc_giftset'])
test_promo_pvbv_idx, test_promo_pvbv = pd.factorize(df_test['promo_desc_pvbv'])
pm.set_data({'loc_idx': test_location_idx,
'item_idx': test_item_idx,
'time_idx': test_time_idx,
'observed_eaches': df_test['residual'],
't': t_test,
'promotion': test_promo_idx,
'cannibalization': test_cann_idx,
'dc_discount':test_dc_idx,
'free_fin': test_free_fin_idx,
'pvbv': test_promo_pvbv_idx,
'giftset': test_giftset_idx,
'month': test_month_idx})
print("sampling test ppc...")
test_ppc = pm.sample_posterior_predictive(idata)
I’ve ran this time series problem before and have not seen this issue. I’m not sure why my t_test
would be a problem as an array of floats when the original data this model was fit on had an array of floats for t
.
Has anyone ran into this issue?