Responder a: Keras não funcionou

#45403
Samuel Mendes
Participante

    Resolvido pessoal, a solução foi usar:
    from scikeras.wrappers import KerasClassifier

     

    porém surgiu um outro problema, quando tento executar o grid_search:

    ValueError Traceback (most recent call last) Cell In[111], line 5 1 grid_search = GridSearchCV(estimator = classificador, 2 param_grid = parametros, 3 scoring = 'accuracy', 4 cv = 5) ----> 5 grid_search = grid_search.fit(previsores, classe) 6 melhores_parametros = grid_search.best_params_ 7 melhor_precisao = grid_search.best_score_ File c:\Users\samue\AppData\Local\Programs\Python\Python312\Lib\site-packages\sklearn\base.py:1473, in _fit_context.<locals>.decorator.<locals>.wrapper(estimator, *args, **kwargs) 1466 estimator._validate_params() 1468 with config_context( 1469 skip_parameter_validation=( 1470 prefer_skip_nested_validation or global_skip_validation 1471 ) 1472 ): -> 1473 return fit_method(estimator, *args, **kwargs) File c:\Users\samue\AppData\Local\Programs\Python\Python312\Lib\site-packages\sklearn\model_selection\_search.py:968, in BaseSearchCV.fit(self, X, y, **params) 962 results = self._format_results( 963 all_candidate_params, n_splits, all_out, all_more_results 964 ) 966 return results