ZBLOG

2023-06-01 16:16:28.864381: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX AV...

这个错误发生在使用sklearnRandomizedSearchCV()函数时,它要求所传递的模型必须是一个scikit-learn estimator对象。根据错误信息,你提供了一个Keras模型作为参数而不是scikit-learn estimator对象。

为了解决这个问题,你需要将Keras模型转换成scikit-learn estimator对象。可以通过使用KerasClassifier或者KerasRegressor来完成这个任务。

例如:

from keras.wrappers.scikit_learn import KerasClassifier

def create_model():
    # define your Keras model here
    
model = KerasClassifier(build_fn=create_model)

# Now you can use this 'model' as a parameter in the RandomizedSearchCV() function.

其中,create_model() 函数定义了你的Keras模型,并且返回该模型。然后使用 KerasClassifier 将其转换成一个可用于 RandomizedSearchCV() 的 scikit-learn estimator 对象。

注意:如果你正在进行回归任务,则应该使用 KerasRegressor 代替 KerasClassifier

本站部分文章来源于网络,版权归原作者所有,如有侵权请联系站长删除。
转载请注明出处:https://golang.0voice.com/?id=3918

分享:
扫描分享到社交APP
上一篇
下一篇
发表列表
游客 游客
此处应有掌声~
评论列表

还没有评论,快来说点什么吧~

联系我们

在线咨询: 点击这里给我发消息

微信号:3007537140

上班时间: 10:30-22:30

关注我们
x

注册

已经有帐号?