Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]: estimator gives a tuple ? #3988

Closed
3 tasks done
celestinoxp opened this issue May 10, 2024 · 2 comments
Closed
3 tasks done

[BUG]: estimator gives a tuple ? #3988

celestinoxp opened this issue May 10, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@celestinoxp
Copy link
Contributor

pycaret version checks

Issue Description

using this code

modelo_final = finalize_model(modelo_tunado)
modelo_treinado = save_model(modelo_final, './modelos/n1_maior_igual_9')
predict_model(modelo_treinado, data=dados_teste)

shows error about a tuple?

Reproducible Example

modelo_final = finalize_model(modelo_tunado)
modelo_treinado = save_model(modelo_final, './modelos/n1_maior_igual_9')
predict_model(modelo_treinado, data=dados_teste)

Expected Behavior

maybe a list?

Actual Results

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[83], line 2
      1 # Prever com o modelo
----> 2 predict_model(modelo_treinado, data=dados_teste)

File ~\anaconda3\Lib\site-packages\pycaret\classification\functional.py:2172, in predict_model(estimator, data, probability_threshold, encoded_labels, raw_score, round, verbose)
   2169 if experiment is None:
   2170     experiment = _EXPERIMENT_CLASS()
-> 2172 return experiment.predict_model(
   2173     estimator=estimator,
   2174     data=data,
   2175     probability_threshold=probability_threshold,
   2176     encoded_labels=encoded_labels,
   2177     raw_score=raw_score,
   2178     round=round,
   2179     verbose=verbose,
   2180 )

File ~\anaconda3\Lib\site-packages\pycaret\classification\oop.py:2824, in ClassificationExperiment.predict_model(self, estimator, data, probability_threshold, encoded_labels, raw_score, round, verbose)
   2752 def predict_model(
   2753     self,
   2754     estimator,
   (...)
   2760     verbose: bool = True,
   2761 ) -> pd.DataFrame:
   2762     """
   2763     This function predicts ``Label`` and ``Score`` (probability of predicted
   2764     class) using a trained model. When ``data`` is None, it predicts label and
   (...)
   2821 
   2822     """
-> 2824     return super().predict_model(
   2825         estimator=estimator,
   2826         data=data,
   2827         probability_threshold=probability_threshold,
   2828         encoded_labels=encoded_labels,
   2829         raw_score=raw_score,
   2830         round=round,
   2831         verbose=verbose,
   2832     )

File ~\anaconda3\Lib\site-packages\pycaret\internal\pycaret_experiment\supervised_experiment.py:4992, in _SupervisedExperiment.predict_model(self, estimator, data, probability_threshold, encoded_labels, raw_score, round, verbose, ml_usecase, preprocess)
   4989         probability_threshold = estimator.probability_threshold
   4990     estimator = get_estimator_from_meta_estimator(estimator)
-> 4992 pred = np.nan_to_num(estimator.predict(X_test_))
   4993 pred = pipeline.inverse_transform(pred)
   4994 # Need to convert labels back to numbers
   4995 # TODO optimize

AttributeError: 'tuple' object has no attribute 'predict'

Installed Versions

pycaret 3.3.2 python 3.11 windows 11
@celestinoxp celestinoxp added the bug Something isn't working label May 10, 2024
@celestinoxp
Copy link
Contributor Author

more context:
model created (a tuple):
image

@celestinoxp
Copy link
Contributor Author

solved! a package created conflicts... i don't know what package...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant