Skip to Content
実践 機械学習システム
book

実践 機械学習システム

by Willi Richert, Luis Pedro Coelho, 斎藤 康毅
October 2014
Intermediate to advanced
288 pages
6h 27m
Japanese
O'Reilly Japan, Inc.
Content preview from 実践 機械学習システム
180
9
章 クラス分類
III
:音楽ジャンル分類
9.4.3
 混同行列を用いて多クラス問題の正解率を計測する
多クラス問題を扱う場合、どれだけ正しく分類できたかということだけを興味の対象とすべきではあ
りません。正しく分類できたかということに加えて、どのジャンルにおいて誤分類が多いかを見ていく
べきでしょう。これを行うためには、いわゆる混合行列
confusion matrix
)というものを用いま
す。
>>> from sklearn.metrics import confusion_matrix
>>> cm = confusion_matrix(y_test, y_pred)
>>> print(cm)
[[26 1 2 0 0 2]
[ 4 7 5 0 5 3]
[ 1 2 14 2 8 3]
[ 5 4 7 3 7 5]
[0 0 10 2 10 12]
[1 0 4 0 13 12]]
上の結果は、テストデータに対して分類器が予測した結果であり、ラベルごとの分布を表していま
す。私たちはは6 つのジャンルを扱うため、6×6の行列が得られます。行列の最初の行が意味する内
容は、31曲(2612231)のクラシックがあり、その内
26
曲をクラシックと分類し、1曲を
ジャズ、2曲をカントリー、2曲をメタルと予測した、という結果を表します。行列の対角成分が正し
い分類結果を示します。最初の行では31曲のうち26曲を正しく分類することができ、5曲を誤った分
類をしたことがわかります。これはそれほど
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

実践 時系列解析 ―統計と機械学習による予測

実践 時系列解析 ―統計と機械学習による予測

Aileen Nielsen, 山崎 邦子, 山崎 康宏

Publisher Resources

ISBN: 9784873116983Other