陶陶mmmm 2022-11-30 10:50 采纳率: 28.6%
浏览 72
已结题

AttributeError: 'NoneType' object has no attribute 'split'要怎么解决

AttributeError: 'NoneType' object has no attribute 'split'
AttributeError Traceback (most recent call last)
Cell In [4], line 35
33 y_train1=y_train.loc[under_sample_indices,:]#把iloc改成loc
34 oversampler=SMOTE()#smote成5:5平衡数据
---> 35 X_train2,y_train2=oversampler.fit_resample(X_train1,y_train1)
38 #训练ngboost
39 model = ngb.NGBClassifier(Dist=k_categorical(3), n_estimators=100000, learning_rate=0.1)

File D:\py\Anaconda3\lib\site-packages\imblearn\base.py:83, in SamplerMixin.fit_resample(self, X, y)
77 X, y, binarize_y = self.check_X_y(X, y)
79 self.sampling_strategy
= check_sampling_strategy(
80 self.sampling_strategy, y, self.sampling_type
81 )
---> 83 output = self.fit_resample(X, y)
85 y
= (
86 label_binarize(output[1], classes=np.unique(y)) if binarize_y else output[1]
87 )
89 X
, y_ = arrays_transformer.transform(output[0], y_)

File D:\py\Anaconda3\lib\site-packages\imblearn\over_sampling_smote\base.py:324, in SMOTE.fit_resample(self, X, y)
321 X_class = safe_indexing(X, target_class_indices)
323 self.nn_k
.fit(X_class)
--> 324 nns = self.nn_k
.kneighbors(X_class, return_distance=False)[:, 1:]
325 X_new, y_new = self._make_samples(
326 X_class, y.dtype, class_sample, X_class, nns, n_samples, 1.0
327 )
328 X_resampled.append(X_new)

File D:\py\Anaconda3\lib\site-packages\sklearn\neighbors_base.py:763, in KNeighborsMixin.kneighbors(self, X, n_neighbors, return_distance)
756 use_pairwise_distances_reductions = (
757 self._fit_method == "brute"
758 and PairwiseDistancesArgKmin.is_usable_for(
759 X if X is not None else self.fit_X, self.fit_X, self.effective_metric
760 )
761 )
762 if use_pairwise_distances_reductions:
--> 763 results = PairwiseDistancesArgKmin.compute(
764 X=X,
765 Y=self.fit_X,
766 k=n_neighbors,
767 metric=self.effective_metric
,
768 metric_kwargs=self.effective_metric_params
,
769 strategy="auto",
770 return_distance=return_distance,
771 )
773 elif (
774 self._fit_method == "brute" and self.metric == "precomputed" and issparse(X)
775 ):
776 results = _kneighbors_from_graph(
777 X, n_neighbors=n_neighbors, return_distance=return_distance
778 )

File sklearn\metrics_pairwise_distances_reduction.pyx:698, in sklearn.metrics._pairwise_distances_reduction.PairwiseDistancesArgKmin.compute()

File D:\py\Anaconda3\lib\site-packages\sklearn\utils\fixes.py:151, in threadpool_limits(limits, user_api)
149 return controller.limit(limits=limits, user_api=user_api)
150 else:
--> 151 return threadpoolctl.threadpool_limits(limits=limits, user_api=user_api)

File D:\py\Anaconda3\lib\site-packages\threadpoolctl.py:171, in threadpool_limits.init(self, limits, user_api)
167 def init(self, limits=None, user_api=None):
168 self._limits, self._user_api, self._prefixes =
169 self._check_params(limits, user_api)
--> 171 self._original_info = self._set_threadpool_limits()

File D:\py\Anaconda3\lib\site-packages\threadpoolctl.py:268, in threadpool_limits._set_threadpool_limits(self)
265 if self._limits is None:
266 return None
--> 268 modules = _ThreadpoolInfo(prefixes=self._prefixes,
269 user_api=self._user_api)
270 for module in modules:
271 # self._limits is a dict {key: num_threads} where key is either
272 # a prefix or a user_api. If a module matches both, the limit
273 # corresponding to the prefix is chosed.
274 if module.prefix in self._limits:

File D:\py\Anaconda3\lib\site-packages\threadpoolctl.py:340, in _ThreadpoolInfo.init(self, user_api, prefixes, modules)
337 self.user_api = [] if user_api is None else user_api
339 self.modules = []
--> 340 self._load_modules()
341 self._warn_if_incompatible_openmp()
342 else:

File D:\py\Anaconda3\lib\site-packages\threadpoolctl.py:373, in _ThreadpoolInfo._load_modules(self)
371 self._find_modules_with_dyld()
372 elif sys.platform == "win32":
--> 373 self._find_modules_with_enum_process_module_ex()
374 else:
375 self._find_modules_with_dl_iterate_phdr()

File D:\py\Anaconda3\lib\site-packages\threadpoolctl.py:485, in _ThreadpoolInfo._find_modules_with_enum_process_module_ex(self)
482 filepath = buf.value
484 # Store the module if it is supported and selected
--> 485 self._make_module_from_path(filepath)
486 finally:
487 kernel_32.CloseHandle(h_process)

File D:\py\Anaconda3\lib\site-packages\threadpoolctl.py:515, in _ThreadpoolInfo._make_module_from_path(self, filepath)
513 if prefix in self.prefixes or user_api in self.user_api:
514 module_class = globals()[module_class]
--> 515 module = module_class(filepath, prefix, user_api, internal_api)
516 self.modules.append(module)

File D:\py\Anaconda3\lib\site-packages\threadpoolctl.py:606, in _Module.init(self, filepath, prefix, user_api, internal_api)
604 self.internal_api = internal_api
605 self._dynlib = ctypes.CDLL(filepath, mode=_RTLD_NOLOAD)
--> 606 self.version = self.get_version()
607 self.num_threads = self.get_num_threads()
608 self._get_extra_info()

File D:\py\Anaconda3\lib\site-packages\threadpoolctl.py:646, in _OpenBLASModule.get_version(self)
643 get_config = getattr(self._dynlib, "openblas_get_config",
644 lambda: None)
645 get_config.restype = ctypes.c_char_p
--> 646 config = get_config().split()
647 if config[0] == b"OpenBLAS":
648 return config[1].decode("utf-8")

AttributeError: 'NoneType' object has no attribute 'split'

  • 写回答

2条回答 默认 最新

  • 於黾 2022-11-30 10:55
    关注

    get_config()的返回值是None
    跟进去看,看到底是忘记写return了还是config文件里是个空的

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论 编辑记录
查看更多回答(1条)

报告相同问题?

问题事件

  • 系统已结题 12月8日
  • 已采纳回答 11月30日
  • 创建了问题 11月30日

悬赏问题

  • ¥15 防火墙的混合模式配置
  • ¥15 Ubuntu不小心注销了要怎么恢复啊
  • ¥15 win10电脑安装完plcsim advanced4.0运行时为什么会提示找不到虚拟网卡
  • ¥15 安装powerbuilder10卡在安装程序正在运行这个页面 没有下一步任何指令
  • ¥15 关于mpi的问题:请问遇到这种情况需要怎么解决,出现这个问题后电脑不能进行mpi多核运行只能进行单核运行
  • ¥50 微信聊天记录备份到电脑提示成功了,但还是没同步到电脑微信
  • ¥15 python怎么在已有视频文件后添加新帧
  • ¥20 虚幻UE引擎如何让多个同一个蓝图的NPC执行一样的动画,
  • ¥15 fluent里模拟降膜反应的UDF编写
  • ¥15 MYSQL 多表拼接link