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
As shown in the figure, the model can successfully predict X_valid. However, after loading the model, the model does not have the predict_proba function, and using the predict function for prediction also results in an error.
The error message for newmodel.predict(X_valid) is as follows:
File /opt/conda/lib/python3.10/site-packages/deeptables/utils/dataset_generator.py:44, in _TFDGForPandas.call(self, X, y, batch_size, shuffle, drop_remainder)
41 # add categorical data
42 if self.categorical_columns is not None and len(self.categorical_columns) > 0:
43 train_data['input_categorical_vars_all'] =
---> 44 X[[c.name for c in self.categorical_columns]].values.astype(consts.DATATYPE_TENSOR_FLOAT)
46 # add continuous data
47 if self.continuous_columns is not None and len(self.continuous_columns) > 0:
File /opt/conda/lib/python3.10/site-packages/pandas/core/frame.py:3899, in DataFrame.getitem(self, key)
3897 if is_iterator(key):
3898 key = list(key)
-> 3899 indexer = self.columns._get_indexer_strict(key, "columns")[1]
3901 # take() does not accept boolean indexers
3902 if getattr(indexer, "dtype", None) == bool:
File /opt/conda/lib/python3.10/site-packages/pandas/core/indexes/base.py:6114, in Index._get_indexer_strict(self, key, axis_name)
6111 else:
6112 keyarr, indexer, new_indexer = self._reindex_non_unique(keyarr)
-> 6114 self._raise_if_missing(keyarr, indexer, axis_name)
6116 keyarr = self.take(indexer)
6117 if isinstance(key, Index):
6118 # GH 42790 - Preserve name from an Index
File /opt/conda/lib/python3.10/site-packages/pandas/core/indexes/base.py:6178, in Index._raise_if_missing(self, key, indexer, axis_name)
6175 raise KeyError(f"None of [{key}] are in the [{axis_name}]")
6177 not_found = list(ensure_index(key)[missing_mask.nonzero()[0]].unique())
-> 6178 raise KeyError(f"{not_found} not in index")
KeyError: "
The text was updated successfully, but these errors were encountered:
As shown in the figure, the model can successfully predict X_valid. However, after loading the model, the model does not have the predict_proba function, and using the predict function for prediction also results in an error.
The error message for newmodel.predict(X_valid) is as follows:
KeyError Traceback (most recent call last)
Cell In[19], line 1
----> 1 newmodel.predict(X_valid)
File /opt/conda/lib/python3.10/site-packages/deeptables/models/deepmodel.py:127, in DeepModel.predict(self, X, batch_size, verbose)
126 def predict(self, X, batch_size=128, verbose=0):
--> 127 return self.__predict(self.model, X, batch_size=batch_size, verbose=verbose)
File /opt/conda/lib/python3.10/site-packages/deeptables/models/deepmodel.py:131, in DeepModel.__predict(self, model, X, batch_size, verbose)
129 def __predict(self, model, X, batch_size=128, verbose=0):
130 logger.info("Performing predictions...")
--> 131 ds = self.__get_prediction_data(X, batch_size=batch_size)
132 steps = math.ceil(len(X) / batch_size)
133 return model.predict(ds, steps=steps, verbose=verbose)
File /opt/conda/lib/python3.10/site-packages/deeptables/models/deepmodel.py:207, in DeepModel.__get_prediction_data(self, X, y, batch_size)
206 def __get_prediction_data(self, X, y=None, *, batch_size):
--> 207 ds = to_dataset(self.config, self.task, self.num_classes, X, y,
208 batch_size=batch_size, shuffle=False, drop_remainder=False,
209 categorical_columns=self.categorical_columns,
210 continuous_columns=self.continuous_columns,
211 var_len_categorical_columns=self.var_len_categorical_columns)
213 return ds
File /opt/conda/lib/python3.10/site-packages/deeptables/utils/dataset_generator.py:246, in to_dataset(config, task, num_classes, X, y, batch_size, shuffle, drop_remainder, categorical_columns, continuous_columns, var_len_categorical_columns)
240 logger.info(f'create dataset generator with {cls.name}, '
241 f'batch_size={batch_size}, shuffle={shuffle}, drop_remainder={drop_remainder}')
243 dg = cls(config, task, num_classes, categorical_columns=categorical_columns,
244 continuous_columns=continuous_columns,
245 var_len_categorical_columns=var_len_categorical_columns)
--> 246 ds = dg(X, y, batch_size=batch_size, shuffle=shuffle, drop_remainder=drop_remainder)
247 return ds
File /opt/conda/lib/python3.10/site-packages/deeptables/utils/dataset_generator.py:44, in _TFDGForPandas.call(self, X, y, batch_size, shuffle, drop_remainder)
41 # add categorical data
42 if self.categorical_columns is not None and len(self.categorical_columns) > 0:
43 train_data['input_categorical_vars_all'] =
---> 44 X[[c.name for c in self.categorical_columns]].values.astype(consts.DATATYPE_TENSOR_FLOAT)
46 # add continuous data
47 if self.continuous_columns is not None and len(self.continuous_columns) > 0:
File /opt/conda/lib/python3.10/site-packages/pandas/core/frame.py:3899, in DataFrame.getitem(self, key)
3897 if is_iterator(key):
3898 key = list(key)
-> 3899 indexer = self.columns._get_indexer_strict(key, "columns")[1]
3901 # take() does not accept boolean indexers
3902 if getattr(indexer, "dtype", None) == bool:
File /opt/conda/lib/python3.10/site-packages/pandas/core/indexes/base.py:6114, in Index._get_indexer_strict(self, key, axis_name)
6111 else:
6112 keyarr, indexer, new_indexer = self._reindex_non_unique(keyarr)
-> 6114 self._raise_if_missing(keyarr, indexer, axis_name)
6116 keyarr = self.take(indexer)
6117 if isinstance(key, Index):
6118 # GH 42790 - Preserve name from an Index
File /opt/conda/lib/python3.10/site-packages/pandas/core/indexes/base.py:6178, in Index._raise_if_missing(self, key, indexer, axis_name)
6175 raise KeyError(f"None of [{key}] are in the [{axis_name}]")
6177 not_found = list(ensure_index(key)[missing_mask.nonzero()[0]].unique())
-> 6178 raise KeyError(f"{not_found} not in index")
KeyError: "
The text was updated successfully, but these errors were encountered: