ImportError: 无法从’sklearn.neighbors._base’导入’_check_weights’

huangapple go评论158阅读模式
英文:

ImportError: cannot import name '_check_weights' from 'sklearn.neighbors._base'

问题

I am trying to do Missforest as a method for handling missing values in table data.

我正在尝试使用Missforest作为处理表格数据中缺失值的方法。

import sklearn
print(sklearn.__version__)
# ->1.2.1

import sklearn.neighbors._base
import sys
sys.modules['sklearn.neighbors.base'] = sklearn.neighbors._base

!pip install missingpy
from missingpy import MissForest

It was working fine until now, but since yesterday, the following error message has appeared.

迄今为止它一直正常工作,但从昨天开始,出现了以下错误信息。

ImportError: cannot import name 'check_weights' from 'sklearn.neighbors._base'

I would like to know how to deal with this error.

我想知道如何处理这个错误。

英文:

I am trying to do Missforest as a method for handling missing values in table data.

import sklearn
print(sklearn.__version__)
->1.2.1

import sklearn.neighbors._base
import sys
sys.modules['sklearn.neighbors.base'] = sklearn.neighbors._base

!pip install missingpy
from missingpy import MissForest

It was working fine until now, but since yesterday, the following error message has appeared.

ImportError: cannot import name '_check_weights' from 'sklearn.neighbors._base'

I would like to know how to deal with this error.

答案1

得分: 2

相同的事情发生在我身上,我更改了包的版本。我有以下设置,它对我有效:scikit-learn = 1.1.2,scipy = 1.9.1,missingpy = 0.2.0。

英文:

the same thing happened to me, I changed the versions of the packages. I have the following setting and it works for me: scikit-learn = 1.1.2, scipy = 1.9.1, missingpy = 0.2.0.

答案2

得分: 0

你可以使用 pipwin 来安装适合你的操作系统和特定Python版本的构建:

步骤:

  1. 卸载当前版本的sklearn:

    pip uninstall scikit-learn -y

  2. 安装pipwin:

    pip install pipwin

  3. 使用pipwin安装sklearn:

    pipwin install scikit-learn

英文:

You could use pipwin to install the appropriate build for your operating system and specific Python version:

Steps:

  1. Uninstall current version of sklearn:

    pip uninstall scikit-learn -y

  2. Install pipwin:

    pip install pipwin

  3. Install sklearn using pipwin:

    pipwin install scikit-learn

huangapple
  • 本文由 发表于 2023年3月4日 09:48:43
  • 转载请务必保留本文链接:https://go.coder-hub.com/75633185.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定