当前位置:网站首页>已解决(机器学习中查看数据信息报错)AttributeError: target_names
已解决(机器学习中查看数据信息报错)AttributeError: target_names
2022-07-03 12:34:00 【无 羡ღ】
成功解决(机器学习中查看数据信息报错):AttributeError: target_names
报错代码
我的代码:
from sklearn import datasets
diabetes = datasets.load_diabetes(return_X_y=False, as_frame=True)
print(diabetes.target_names)
报错内容:
Traceback (most recent call last):
File "D:\Python3.8\lib\site-packages\sklearn\utils\__init__.py", line 117, in __getattr__
return self[key]
KeyError: 'target_names'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "E:/Python/1.py", line 6, in <module>
print(diabetes.target_names)
File "D:\Python3.8\lib\site-packages\sklearn\utils\__init__.py", line 119, in __getattr__
raise AttributeError(key)
AttributeError: target_names
报错原因
target_names是标签名,sciket-learn数据集API中,回归数据集没有标签名,其他数据集才有
解决方法
查看其他内容如:特征名、新闻数据、手写数字
from sklearn import datasets
diabetes = datasets.load_diabetes(return_X_y=False, as_frame=True)
print(diabetes.feature_names)
运行结果:
['age', 'sex', 'bmi', 'bp', 's1', 's2', 's3', 's4', 's5', 's6']
边栏推荐
- Social community forum app ultra-high appearance UI interface
- context. Getexternalfilesdir() is compared with the returned path
- Ali & ant self developed IDE
- [comprehensive question] [Database Principle]
- C graphical tutorial (Fourth Edition)_ Chapter 18 enumerator and iterator: enumerator samplep340
- Logback log framework
- Kotlin - improved decorator mode
- My creation anniversary: the fifth anniversary
- [Database Principle and Application Tutorial (4th Edition | wechat Edition) Chen Zhibo] [Chapter IV exercises]
- Powerful avatar making artifact wechat applet
猜你喜欢
Analysis of a music player Login Protocol
【R】【密度聚类、层次聚类、期望最大化聚类】
剑指 Offer 14- II. 剪绳子 II
My creation anniversary: the fifth anniversary
Xctf mobile--app3 problem solving
2022-02-14 incluxdb cluster write data writetoshard parsing
【数据挖掘复习题】
[data mining review questions]
Some thoughts on business
【数据库原理及应用教程(第4版|微课版)陈志泊】【第六章习题】
随机推荐
Some thoughts on business
C graphical tutorial (Fourth Edition)_ Chapter 20 asynchronous programming: examples - using asynchronous
Dojo tutorials:getting started with deferrals source code and example execution summary
SQL learning notes (I)
Sword finger offer 15 Number of 1 in binary
2022-02-14 incluxdb cluster write data writetoshard parsing
Ali & ant self developed IDE
Fabric. JS three methods of changing pictures (including changing pictures in the group and caching)
Logback log framework
[colab] [7 methods of using external data]
解决 System has not been booted with systemd as init system (PID 1). Can‘t operate.
mysqlbetween实现选取介于两个值之间的数据范围
[exercise 5] [Database Principle]
Express abstract classes and methods
[Exercice 5] [principe de la base de données]
Application of ncnn Neural Network Computing Framework in Orange Pi 3 Lts Development Board
Glide question you cannot start a load for a destroyed activity
Node.js: express + MySQL的使用
2022-01-27 research on the minimum number of redis partitions
【习题七】【数据库原理】