导包出现错误

from sklearn.impute import SimpleImputer
报错:
 

TypeError                                 Traceback (most recent call last)
Cell In[39], line 7
      5 import seaborn as sns
      6 # from sklearn.impute import SimpleImputer 
----> 7 from sklearn.neighbors import StrOptions
      8 import itertools

File E:\Anaconda\Lib\site-packages\sklearn\neighbors\__init__.py:7
      1 """
      2 The :mod:`sklearn.neighbors` module implements the k-nearest neighbors
      3 algorithm.
      4 """
      6 from ._ball_tree import BallTree
----> 7 from ._base import VALID_METRICS, VALID_METRICS_SPARSE, sort_graph_by_row_values
      8 from ._classification import KNeighborsClassifier, RadiusNeighborsClassifier
      9 from ._graph import (
     10     KNeighborsTransformer,
     11     RadiusNeighborsTransformer,
     12     kneighbors_graph,
     13     radius_neighbors_graph,
     14 )

File E:\Anaconda\Lib\site-packages\sklearn\neighbors\_base.py:378
    374     else:
    375         return neigh_ind
--> 378 class NeighborsBase(MultiOutputMixin, BaseEstimator, metaclass=ABCMeta):
    379     """Base class for nearest neighbors estimators."""
    381     _parameter_constraints: dict = {
    382         "n_neighbors": [Interval(Integral, 1, None, closed="left"), None],
    383         "radius": [Interval(Real, 0, None, closed="both"), None],
   (...)
    389         "n_jobs": [Integral, None],
    390     }

File E:\Anaconda\Lib\site-packages\sklearn\neighbors\_base.py:387, in NeighborsBase()
    378 class NeighborsBase(MultiOutputMixin, BaseEstimator, metaclass=ABCMeta):
    379     """Base class for nearest neighbors estimators."""
    381     _parameter_constraints: dict = {
    382         "n_neighbors": [Interval(Integral, 1, None, closed="left"), None],
    383         "radius": [Interval(Real, 0, None, closed="both"), None],
    384         "algorithm": [StrOptions({"auto", "ball_tree", "kd_tree", "brute"})],
    385         "leaf_size": [Interval(Integral, 1, None, closed="left")],
    386         "p": [Interval(Real, 0, None, closed="right"), None],
--> 387         "metric": [StrOptions(set(itertools.chain(*VALID_METRICS.values()))), callable],
    388         "metric_params": [dict, None],
    389         "n_jobs": [Integral, None],
    390     }
    392     @abstractmethod
    393     def __init__(
    394         self,
   (...)
    402         n_jobs=None,
    403     ):
    404         self.n_neighbors = n_neighbors

TypeError: 'builtin_function_or_method' object is not iterable
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值