python - 在 DBSCAN 上运行网格搜索时引发值错误
问题描述
我正在研究管道并使用它在 DBSCAN 上运行网格搜索。这就是我的管道的样子:
pca = PCA()
db = DBSCAN()
classifier = pipeline.Pipeline([
("pca",pca),
("db",db)
])
param_grid = {
"pca__n_components": np.arange(2,5),
"db__eps": np.arange(0.01, 0.09),
"db__min_samples": np.arange(15,75)
}
model = model_selection.GridSearchCV(
estimator=classifier,
param_grid=param_grid,
scoring=silhouette_score(X, labels, metric='sqeuclidean'),
cv=5)
model.fit(X,labels)
引发的错误如下。有谁熟悉如何停止提出这个错误?我知道一些 siloette 分数会是负数,我想网格搜索继续运行。谢谢。
ValueError: scoring is invalid (got -0.10780103330375239). Refer to the scoring glossary for details: https://scikit-learn.org/stable/glossary.html#term-scoring
解决方案
推荐阅读
- javascript - Node.js 博客 - 添加帖子时,一切都在一行中
- python - 如何使用python显示正确大小的图像
- .net - 使用 ng build 而不是 ng serve 时的网关超时
- python - Pandas 每组只选择前 3 个 YYYYMM
- java - 如何在骨架实现(即类)中实现一个接口,其两个实例可以相互依赖,而不需要向下转换?
- firebase - 有没有办法在 Firebase 安全规则中验证用户的身份验证令牌?
- kotlin - IntelliJ IDEA 不断将“序列化”突出显示为错误
- postgresql - Postgresql,如何导入大的 bak.gz 文件?
- java - Java中的动态类
- c++ - 现代c ++中的变体,最好的方法是什么