load_iris【sklearn】
アヤメのデータセット
code:p.py
from sklearn import datasets
dataset = datasets.load_iris()
print(type(dataset))
print(dataset.keys())
print(type(dataset.data))
print(dataset.data.shape)
print(type(dataset.target))
print(dataset.target.shape)
data と target に ndarray 型の学習データ(150, 4)と教師データ(150, )が格納されている。
code:res.sh
<class 'sklearn.utils._bunch.Bunch'>
<class 'numpy.ndarray'>
(150, 4)
<class 'numpy.ndarray'>
(150,)
return_X_y を指定すると、学習データと教師データを直接取り出される。それぞれ型は ndarray である。
code:p.py
X, y = datasets.load_iris(return_X_y=True)
as_frame を指定すると data と target はそれぞれ DataFrame、Series 型となる。
code:p.py
dataset = datasets.load_iris(as_frame=True)
print(dataset.data)
print(dataset.target)
as_frame と return_X_y を指定すると、data と target がそれぞれ DataFrame、Series 型で取り出される。
code:p.py
X, y = datasets.load_iris(return_X_y=True, as_frame=True)
データセットの特徴(Data Set Characteristics)
code:DSCER.txt
_iris_dataset:
Iris plants dataset
--------------------
**Data Set Characteristics:**
:Number of Instances: 150 (50 in each of three classes)
:Number of Attributes: 4 numeric, predictive attributes and the class
:Attribute Information:
- sepal length in cm
- sepal width in cm
- petal length in cm
- petal width in cm
- class:
- Iris-Setosa
- Iris-Versicolour
- Iris-Virginica
:Summary Statistics:
============== ==== ==== ======= ===== ====================
Min Max Mean SD Class Correlation
============== ==== ==== ======= ===== ====================
sepal length: 4.3 7.9 5.84 0.83 0.7826
sepal width: 2.0 4.4 3.05 0.43 -0.4194
petal length: 1.0 6.9 3.76 1.76 0.9490 (high!)
petal width: 0.1 2.5 1.20 0.76 0.9565 (high!)
============== ==== ==== ======= ===== ====================
:Missing Attribute Values: None
:Class Distribution: 33.3% for each of 3 classes.
:Creator: R.A. Fisher
:Donor: Michael Marshall (MARSHALL%PLU@io.arc.nasa.gov)
:Date: July, 1988
The famous Iris database, first used by Sir R.A. Fisher. The dataset is taken
from Fisher's paper. Note that it's the same as in R, but not as in the UCI
Machine Learning Repository, which has two wrong data points.
This is perhaps the best known database to be found in the
pattern recognition literature. Fisher's paper is a classic in the field and
is referenced frequently to this day. (See Duda & Hart, for example.) The
data set contains 3 classes of 50 instances each, where each class refers to a
type of iris plant. One class is linearly separable from the other 2; the
latter are NOT linearly separable from each other.
.. dropdown:: References
- Fisher, R.A. "The use of multiple measurements in taxonomic problems"
Annual Eugenics, 7, Part II, 179-188 (1936); also in "Contributions to
Mathematical Statistics" (John Wiley, NY, 1950).
- Duda, R.O., & Hart, P.E. (1973) Pattern Classification and Scene Analysis.
(Q327.D83) John Wiley & Sons. ISBN 0-471-22361-1. See page 218.
- Dasarathy, B.V. (1980) "Nosing Around the Neighborhood: A New System
Structure and Classification Rule for Recognition in Partially Exposed
Environments". IEEE Transactions on Pattern Analysis and Machine
Intelligence, Vol. PAMI-2, No. 1, 67-71.
- Gates, G.W. (1972) "The Reduced Nearest Neighbor Rule". IEEE Transactions
on Information Theory, May 1972, 431-433.
- See also: 1988 MLC Proceedings, 54-64. Cheeseman et al"s AUTOCLASS II
conceptual clustering system finds 3 classes in the data.
- Many, many more
code:DSCER.sh
アヤメ科植物のデータセット
データセットの特性:
:インスタンス数: 150 (3つのクラスそれぞれに50)
:属性数: 4つの数値予測属性とクラス
:属性情報:
萼片の長さ (cm)
萼片の幅 (cm)
花弁の長さ (cm)
花弁の幅 (cm)
クラス:
Iris-Setosa
Iris-Versicolour
Iris-Virginica
:概要統計:
=============== ==== ==== ====== ====== ======================
最小 最大 平均 SD クラス相関
================ ==== ==== ========= ===== =====================
萼片の長さ: 4.3 7.9 5.84 0.83 0.7826
萼片の幅: 2.0 4.4 3.05 0.43 -0.4194
花弁の長さ: 1.0 6.9 3.76 1.76 0.9490 (高い!)
花弁の幅: 0.1 2.5 1.20 0.76 0.9565 (高い!)
=============== ==== ===== ====== ======================
:欠損属性値: なし
:クラス分布: 3つのクラスそれぞれで33.3%。
:作成者: R.A. Fisher
:提供者: Michael Marshall (MARSHALL%PLU@io.arc.nasa.gov)
:日付: 1988年7月
R.A. Fisher卿が初めて使用した有名なアヤメデータベースです。このデータセットはFisherの論文から引用されています。R版と同じものですが、UCI機械学習リポジトリのものとは異なり、2つの誤ったデータポイントが含まれています。
これは、パターン認識の文献の中でおそらく最もよく知られているデータベースです。Fisherの論文はこの分野の古典であり、今日まで頻繁に参照されています(例えば、Duda & Hartの論文を参照)。このデータセットには、それぞれ50インスタンスの3つのクラスが含まれており、各クラスはアヤメの植物の種類に対応しています。1つのクラスは他の2つのクラスと線形分離可能ですが、後者のクラスは互いに線形分離できません。
.. ドロップダウン:: 参考文献
Fisher, R.A. 「分類問題における多重測定の利用」 Annual Eugenics, 7, Part II, 179-188 (1936); また、「Contributions to Mathematical Statistics」(John Wiley, NY, 1950) にも掲載。
Duda, R.O., & Hart, P.E. (1973) Pattern Classification and Scene Analysis. (Q327.D83) John Wiley & Sons. ISBN 0-471-22361-1. 218ページ参照。
Dasarathy, B.V. (1980) 「Nosing Around the Neighborhood: A New System Structure and Classification Rule for Recognition in Partially Exposed Environments」IEEE Transactions on Pattern Analysis and Machine Intelligence, Vol. PAMI-2, No. 1, 67-71.
Gates, G.W. (1972)「縮減最近傍則」IEEE Transactions on Information Theory, 1972年5月, 431-433. 参照:1988 MLC Proceedings, 54-64. CheesemanらのAUTOCLASS II
概念的クラスタリングシステムは、データから3つのクラスを検出します。
他にもたくさんあります…