You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ML-For-Beginners/translations/ja/5-Clustering/1-Visualize/solution/R/lesson_14-R.ipynb

494 lines
30 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

{
"cells": [
{
"cell_type": "markdown",
"source": [
"## **Spotifyから取得したナイジェリア音楽の分析**\n",
"\n",
"クラスタリングは、[教師なし学習](https://wikipedia.org/wiki/Unsupervised_learning)の一種で、データセットがラベル付けされていない、または入力が事前定義された出力と一致していないと仮定します。この手法では、さまざまなアルゴリズムを使用してラベルのないデータを分類し、データ内で見つけたパターンに基づいてグループ化を行います。\n",
"\n",
"[**事前クイズ**](https://gray-sand-07a10f403.1.azurestaticapps.net/quiz/27/)\n",
"\n",
"### **はじめに**\n",
"\n",
"[クラスタリング](https://link.springer.com/referenceworkentry/10.1007%2F978-0-387-30164-8_124)は、データ探索に非常に役立ちます。ナイジェリアのオーディエンスが音楽を消費する方法におけるトレンドやパターンを発見できるか見てみましょう。\n",
"\n",
"> ✅ クラスタリングの用途について少し考えてみてください。日常生活では、洗濯物の山を家族ごとに仕分けるときにクラスタリングが行われます 🧦👕👖🩲。データサイエンスでは、ユーザーの好みを分析したり、ラベルのないデータセットの特性を特定したりするときにクラスタリングが行われます。クラスタリングは、いわば混沌を整理する手助けをしてくれるのです。例えば、靴下の引き出しのように。\n",
"\n",
"プロの現場では、クラスタリングは市場セグメンテーションや、どの年齢層がどの商品を購入するかを特定するのに使われます。また、クレジットカード取引のデータセットから不正を検出する異常検出にも利用されます。あるいは、医療スキャンのバッチから腫瘍を特定するのにも使えるでしょう。\n",
"\n",
"✅ 銀行業務、eコマース、ビジネスの場で、クラスタリングに出会った経験について考えてみてください。\n",
"\n",
"> 🎓 興味深いことに、クラスタリング分析は1930年代に人類学や心理学の分野で始まりました。それがどのように使われていたか想像できますか\n",
"\n",
"また、検索結果をグループ化するためにも使用できます。例えば、ショッピングリンク、画像、レビューなどです。クラスタリングは、大規模なデータセットを縮小し、より詳細な分析を行いたい場合に役立ちます。この技術を使用することで、他のモデルを構築する前にデータについて学ぶことができます。\n",
"\n",
"✅ データがクラスタに整理されたら、クラスタIDを割り当てます。この技術は、データセットのプライバシーを保護する際に役立ちます。クラスタ内の他の要素ではなく、クラスタIDでデータポイントを参照することができます。他の要素ではなくクラスタIDを使用してデータを識別する理由を考えてみてください。\n",
"\n",
"### クラスタリングの始め方\n",
"\n",
"> 🎓 クラスタを作成する方法は、データポイントをどのようにグループ化するかに大きく関係しています。いくつかの用語を解説しましょう:\n",
">\n",
"> 🎓 ['推論的' vs. '帰納的'](https://wikipedia.org/wiki/Transduction_(machine_learning))\n",
">\n",
"> 推論的推論は、特定のテストケースに対応する観測されたトレーニングケースから導き出されます。一方、帰納的推論は、一般的なルールをトレーニングケースから導き出し、それをテストケースに適用します。\n",
">\n",
"> 例部分的にラベル付けされたデータセットがあるとします。一部は「レコード」、一部は「CD」、一部は空白です。空白部分にラベルを付けるのがあなたの仕事です。帰納的アプローチを選ぶ場合、「レコード」と「CD」を探すモデルをトレーニングし、そのラベルを未ラベルのデータに適用します。このアプローチでは、実際には「カセット」であるものを分類するのが難しくなります。一方、推論的アプローチは、未知のデータをより効果的に処理します。似たアイテムをグループ化し、そのグループにラベルを付けるからです。この場合、クラスタは「丸い音楽アイテム」や「四角い音楽アイテム」を反映するかもしれません。\n",
">\n",
"> 🎓 ['平面' vs. '非平面'の幾何学](https://datascience.stackexchange.com/questions/52260/terminology-flat-geometry-in-the-context-of-clustering)\n",
">\n",
"> 数学用語に由来するこの概念は、クラスタ内の点間の距離を「平面的」([ユークリッド](https://wikipedia.org/wiki/Euclidean_geometry))または「非平面的」(非ユークリッド)な方法で測定することを指します。\n",
">\n",
"> この文脈での「平面」とはユークリッド幾何学(「平面幾何学」として教えられる部分)を指し、「非平面」とは非ユークリッド幾何学を指します。機械学習と幾何学がどう関係するのかと思うかもしれませんが、どちらも数学に根ざした分野であり、クラスタ内の点間の距離を測定する共通の方法が必要です。データが平面上に存在しないように見える場合、特別なアルゴリズムを使用する必要があるかもしれません。\n",
"\n",
"<p >\n",
" <img src=\"../../images/flat-nonflat.png\"\n",
" width=\"600\"/>\n",
" <figcaption>ダサニ・マディパリによるインフォグラフィック</figcaption>\n",
"\n",
"> 🎓 ['距離'](https://web.stanford.edu/class/cs345a/slides/12-clustering.pdf)\n",
">\n",
"> クラスタは距離行列、つまり点間の距離によって定義されます。この距離はさまざまな方法で測定できます。ユークリッドクラスタは点の値の平均によって定義され、「重心」または中心点を含みます。距離はその重心までの距離で測定されます。一方、非ユークリッド距離は「クラストロイド」、つまり他の点に最も近い点によって定義されます。クラストロイドはさまざまな方法で定義できます。\n",
">\n",
"> 🎓 ['制約付き'](https://wikipedia.org/wiki/Constrained_clustering)\n",
">\n",
"> [制約付きクラスタリング](https://web.cs.ucdavis.edu/~davidson/Publications/ICDMTutorial.pdf)は、この教師なし手法に「半教師あり学習」を導入します。点間の関係が「リンク不可」または「リンク必須」としてフラグ付けされ、データセットにいくつかのルールが適用されます。\n",
">\n",
"> 例:アルゴリズムがラベルなしまたは半ラベル付きデータのバッチに自由に適用される場合、生成されるクラスタの品質が低い可能性があります。上記の例では、クラスタが「丸い音楽アイテム」「四角い音楽アイテム」「三角形のアイテム」「クッキー」をグループ化するかもしれません。いくつかの制約やルール(「アイテムはプラスチック製でなければならない」「アイテムは音楽を再生できる必要がある」など)が与えられると、アルゴリズムがより良い選択をするのに役立ちます。\n",
">\n",
"> 🎓 '密度'\n",
">\n",
"> 「ノイズの多い」データは「密度が高い」と見なされます。各クラスタ内の点間の距離を調べると、密度が高い、または低い、つまり「混み合っている」ことがわかるかもしれません。このようなデータは、適切なクラスタリング手法で分析する必要があります。[この記事](https://www.kdnuggets.com/2020/02/understanding-density-based-clustering.html)では、K-MeansクラスタリングとHDBSCANアルゴリズムを使用して、クラスタ密度が不均一なイズの多いデータセットを探索する違いを示しています。\n",
"\n",
"クラスタリング技術を深く理解するには、この[学習モジュール](https://docs.microsoft.com/learn/modules/train-evaluate-cluster-models?WT.mc_id=academic-77952-leestott)を参照してください。\n",
"\n",
"### **クラスタリングアルゴリズム**\n",
"\n",
"クラスタリングアルゴリズムは100種類以上あり、その使用はデータの性質に依存します。主要なものをいくつか紹介します\n",
"\n",
"- **階層型クラスタリング**。オブジェクトが近くのオブジェクトとの近接性によって分類される場合、クラスタは他のオブジェクトとの距離に基づいて形成されます。階層型クラスタリングは、2つのクラスタを繰り返し結合することで特徴付けられます。\n",
"\n",
"<p >\n",
" <img src=\"../../images/hierarchical.png\"\n",
" width=\"600\"/>\n",
" <figcaption>ダサニ・マディパリによるインフォグラフィック</figcaption>\n",
"\n",
"- **重心型クラスタリング**。この人気のあるアルゴリズムでは、「k」、つまり形成するクラスタの数を選択した後、アルゴリズムがクラスタの中心点を決定し、その点の周りにデータを集めます。[K-meansクラスタリング](https://wikipedia.org/wiki/K-means_clustering)は、重心型クラスタリングの人気バージョンで、データセットを事前定義されたKグループに分離します。中心点は最も近い平均によって決定されるため、この名前が付けられています。クラスタからの二乗距離が最小化されます。\n",
"\n",
"<p >\n",
" <img src=\"../../images/centroid.png\"\n",
" width=\"600\"/>\n",
" <figcaption>ダサニ・マディパリによるインフォグラフィック</figcaption>\n",
"\n",
"- **分布型クラスタリング**。統計モデリングに基づいており、データポイントがクラスタに属する確率を決定し、それに応じて割り当てます。ガウス混合モデルはこのタイプに属します。\n",
"\n",
"- **密度型クラスタリング**。データポイントは、その密度、つまり互いに集まる程度に基づいてクラスタに割り当てられます。グループから遠く離れたデータポイントは、外れ値またはイズと見なされます。DBSCAN、Mean-shift、OPTICSはこのタイプのクラスタリングに属します。\n",
"\n",
"- **グリッド型クラスタリング**。多次元データセットの場合、グリッドが作成され、データがそのグリッドのセルに分割されることでクラスタが形成されます。\n",
"\n",
"クラスタリングを学ぶ最良の方法は、自分で試してみることです。この演習でそれを行います。\n",
"\n",
"このモジュールを進めるためにいくつかのパッケージが必要です。以下のコマンドでインストールできます: \n",
"`install.packages(c('tidyverse', 'tidymodels', 'DataExplorer', 'summarytools', 'plotly', 'paletteer', 'corrplot', 'patchwork'))`\n",
"\n",
"または、以下のスクリプトを使用して、必要なパッケージがインストールされているか確認し、欠けている場合はインストールします。\n"
],
"metadata": {}
},
{
"cell_type": "code",
"execution_count": null,
"source": [
"suppressWarnings(if(!require(\"pacman\")) install.packages(\"pacman\"))\r\n",
"\r\n",
"pacman::p_load('tidyverse', 'tidymodels', 'DataExplorer', 'summarytools', 'plotly', 'paletteer', 'corrplot', 'patchwork')\r\n"
],
"outputs": [],
"metadata": {}
},
{
"cell_type": "markdown",
"source": [
"## 演習 - データをクラスタリングする\n",
"\n",
"クラスタリングという手法は、適切な可視化によって大いに助けられます。では、音楽データを可視化するところから始めましょう。この演習では、このデータの性質に最も効果的なクラスタリング手法を決定するのに役立ちます。\n",
"\n",
"まずはデータをインポートするところから始めましょう。\n"
],
"metadata": {}
},
{
"cell_type": "code",
"execution_count": null,
"source": [
"# Load the core tidyverse and make it available in your current R session\r\n",
"library(tidyverse)\r\n",
"\r\n",
"# Import the data into a tibble\r\n",
"df <- read_csv(file = \"https://raw.githubusercontent.com/microsoft/ML-For-Beginners/main/5-Clustering/data/nigerian-songs.csv\")\r\n",
"\r\n",
"# View the first 5 rows of the data set\r\n",
"df %>% \r\n",
" slice_head(n = 5)\r\n"
],
"outputs": [],
"metadata": {}
},
{
"cell_type": "markdown",
"source": [
"時々、データについてもう少し詳しい情報が欲しい場合があります。そのようなときは、[*glimpse()*](https://pillar.r-lib.org/reference/glimpse.html) 関数を使って、`データ`や`その構造`を確認することができます。\n"
],
"metadata": {}
},
{
"cell_type": "code",
"execution_count": null,
"source": [
"# Glimpse into the data set\r\n",
"df %>% \r\n",
" glimpse()\r\n"
],
"outputs": [],
"metadata": {}
},
{
"cell_type": "markdown",
"source": [
"よくやった!💪\n",
"\n",
"`glimpse()`を使用すると、行(観測値)と列(変数)の総数が表示され、さらに変数名の後に各変数の最初のいくつかのエントリが行ごとに表示されます。加えて、変数の*データ型*が各変数名のすぐ後に`< >`内に示されます。\n",
"\n",
"`DataExplorer::introduce()`を使うと、この情報を簡潔にまとめることができます:\n"
],
"metadata": {}
},
{
"cell_type": "code",
"execution_count": null,
"source": [
"# Describe basic information for our data\r\n",
"df %>% \r\n",
" introduce()\r\n",
"\r\n",
"# A visual display of the same\r\n",
"df %>% \r\n",
" plot_intro()\r\n"
],
"outputs": [],
"metadata": {}
},
{
"cell_type": "markdown",
"source": [
"素晴らしいですね!データに欠損値がないことがわかりました。\n",
"\n",
"この機会に、代表的な集中傾向の統計量(例:[平均](https://en.wikipedia.org/wiki/Arithmetic_mean)や[中央値](https://en.wikipedia.org/wiki/Median))や、散布の指標(例:[標準偏差](https://en.wikipedia.org/wiki/Standard_deviation))を`summarytools::descr()`を使って調べてみましょう。\n"
],
"metadata": {}
},
{
"cell_type": "code",
"execution_count": null,
"source": [
"# Describe common statistics\r\n",
"df %>% \r\n",
" descr(stats = \"common\")\r\n"
],
"outputs": [],
"metadata": {}
},
{
"cell_type": "markdown",
"source": [
"データの一般的な値を見てみましょう。人気度が `0` になることがある点に注意してください。これはランキングがない曲を示しています。これらは後ほど削除します。\n",
"\n",
"> 🤔 クラスタリングを行う場合、ラベル付きデータを必要としない教師なし手法を使用しているのに、なぜラベル付きデータを表示しているのでしょうか?データ探索の段階では役立ちますが、クラスタリングアルゴリズムが動作するために必須ではありません。\n",
"\n",
"### 1. 人気のあるジャンルを探索する\n",
"\n",
"では、どのジャンルが最も人気があるのかを調べてみましょう 🎶。ジャンルが出現する回数をカウントしてみます。\n"
],
"metadata": {}
},
{
"cell_type": "code",
"execution_count": null,
"source": [
"# Popular genres\r\n",
"top_genres <- df %>% \r\n",
" count(artist_top_genre, sort = TRUE) %>% \r\n",
"# Encode to categorical and reorder the according to count\r\n",
" mutate(artist_top_genre = factor(artist_top_genre) %>% fct_inorder())\r\n",
"\r\n",
"# Print the top genres\r\n",
"top_genres\r\n"
],
"outputs": [],
"metadata": {}
},
{
"cell_type": "markdown",
"source": [
"うまくいきましたね!「写真はデータフレームの千行に値する」と言われることがあります(実際には誰もそんなこと言いませんが 😅)。でも、言いたいことは伝わりますよね?\n",
"\n",
"カテゴリカルデータ文字列や因子変数を視覚化する方法の一つは、棒グラフを使うことです。では、トップ10のジャンルの棒グラフを作ってみましょう\n"
],
"metadata": {}
},
{
"cell_type": "code",
"execution_count": null,
"source": [
"# Change the default gray theme\r\n",
"theme_set(theme_light())\r\n",
"\r\n",
"# Visualize popular genres\r\n",
"top_genres %>%\r\n",
" slice(1:10) %>% \r\n",
" ggplot(mapping = aes(x = artist_top_genre, y = n,\r\n",
" fill = artist_top_genre)) +\r\n",
" geom_col(alpha = 0.8) +\r\n",
" paletteer::scale_fill_paletteer_d(\"rcartocolor::Vivid\") +\r\n",
" ggtitle(\"Top genres\") +\r\n",
" theme(plot.title = element_text(hjust = 0.5),\r\n",
" # Rotates the X markers (so we can read them)\r\n",
" axis.text.x = element_text(angle = 90))\r\n"
],
"outputs": [],
"metadata": {}
},
{
"cell_type": "markdown",
"source": [
"これで、`missing` ジャンルがあることを簡単に見つけられるようになりました 🧐!\n",
"\n",
"> 良い可視化は、予想していなかったことを示したり、データに関する新たな疑問を提起したりします - ハドリー・ウィッカムとギャレット・グローレムンド, [R For Data Science](https://r4ds.had.co.nz/introduction.html)\n",
"\n",
"注意: トップジャンルが `Missing` と表示されている場合、それはSpotifyが分類していないことを意味します。では、それを取り除きましょう。\n"
],
"metadata": {}
},
{
"cell_type": "code",
"execution_count": null,
"source": [
"# Visualize popular genres\r\n",
"top_genres %>%\r\n",
" filter(artist_top_genre != \"Missing\") %>% \r\n",
" slice(1:10) %>% \r\n",
" ggplot(mapping = aes(x = artist_top_genre, y = n,\r\n",
" fill = artist_top_genre)) +\r\n",
" geom_col(alpha = 0.8) +\r\n",
" paletteer::scale_fill_paletteer_d(\"rcartocolor::Vivid\") +\r\n",
" ggtitle(\"Top genres\") +\r\n",
" theme(plot.title = element_text(hjust = 0.5),\r\n",
" # Rotates the X markers (so we can read them)\r\n",
" axis.text.x = element_text(angle = 90))\r\n"
],
"outputs": [],
"metadata": {}
},
{
"cell_type": "markdown",
"source": [
"データを少し探索した結果、上位3つのジャンルがこのデータセットを支配していることが分かりました。`afro dancehall`、`afropop`、`nigerian pop`に焦点を当て、さらに人気度が0のものを除外してデータセットをフィルタリングしましょう。これはデータセット内で人気度が分類されていないことを意味し、今回の目的ではイズと見なすことができます。\n"
],
"metadata": {}
},
{
"cell_type": "code",
"execution_count": null,
"source": [
"nigerian_songs <- df %>% \r\n",
" # Concentrate on top 3 genres\r\n",
" filter(artist_top_genre %in% c(\"afro dancehall\", \"afropop\",\"nigerian pop\")) %>% \r\n",
" # Remove unclassified observations\r\n",
" filter(popularity != 0)\r\n",
"\r\n",
"\r\n",
"\r\n",
"# Visualize popular genres\r\n",
"nigerian_songs %>%\r\n",
" count(artist_top_genre) %>%\r\n",
" ggplot(mapping = aes(x = artist_top_genre, y = n,\r\n",
" fill = artist_top_genre)) +\r\n",
" geom_col(alpha = 0.8) +\r\n",
" paletteer::scale_fill_paletteer_d(\"ggsci::category10_d3\") +\r\n",
" ggtitle(\"Top genres\") +\r\n",
" theme(plot.title = element_text(hjust = 0.5))\r\n"
],
"outputs": [],
"metadata": {}
},
{
"cell_type": "markdown",
"source": [
"データセット内の数値変数間に明らかな線形関係があるかどうかを確認してみましょう。この関係は、[相関統計量](https://en.wikipedia.org/wiki/Correlation)によって数学的に定量化されます。\n",
"\n",
"相関統計量は、-1から1の間の値で、関係の強さを示します。0より大きい値は*正の相関*一方の変数の値が高いと、もう一方の変数の値も高くなる傾向があるを示し、0より小さい値は*負の相関*(一方の変数の値が高いと、もう一方の変数の値が低くなる傾向がある)を示します。\n"
],
"metadata": {}
},
{
"cell_type": "code",
"execution_count": null,
"source": [
"# Narrow down to numeric variables and fid correlation\r\n",
"corr_mat <- nigerian_songs %>% \r\n",
" select(where(is.numeric)) %>% \r\n",
" cor()\r\n",
"\r\n",
"# Visualize correlation matrix\r\n",
"corrplot(corr_mat, order = 'AOE', col = c('white', 'black'), bg = 'gold2') \r\n"
],
"outputs": [],
"metadata": {}
},
{
"cell_type": "markdown",
"source": [
"データは「energy」と「loudness」の間で強い相関がある以外は、あまり強く関連していません。これは、音楽が大音量であるほど通常はエネルギッシュであることを考えると納得できます。「Popularity」は「release date」とも関連性があります。これも納得できることで、最近の曲の方が人気がある可能性が高いからです。また、曲の長さとエネルギーにも相関があるようです。\n",
"\n",
"このデータをクラスタリングアルゴリズムがどのように扱うのか、非常に興味深いですね!\n",
"\n",
"> 🎓 相関は因果関係を意味しないことに注意してください!相関の証拠はありますが、因果関係の証拠はありません。この点を強調する面白い[ウェブサイト](https://tylervigen.com/spurious-correlations)には、いくつかの視覚的な例があります。\n",
"\n",
"### 2. データ分布を探る\n",
"\n",
"もう少し微妙な質問をしてみましょう。ジャンルごとに人気度に基づいてダンス性の認識が大きく異なるのでしょうかトップ3のジャンルについて、人気度とダンス性のデータ分布を特定のx軸とy軸に沿って[密度プロット](https://www.khanacademy.org/math/ap-statistics/density-curves-normal-distribution-ap/density-curves/v/density-curves)を使って調べてみましょう。\n"
],
"metadata": {}
},
{
"cell_type": "code",
"execution_count": null,
"source": [
"# Perform 2D kernel density estimation\r\n",
"density_estimate_2d <- nigerian_songs %>% \r\n",
" ggplot(mapping = aes(x = popularity, y = danceability, color = artist_top_genre)) +\r\n",
" geom_density_2d(bins = 5, size = 1) +\r\n",
" paletteer::scale_color_paletteer_d(\"RSkittleBrewer::wildberry\") +\r\n",
" xlim(-20, 80) +\r\n",
" ylim(0, 1.2)\r\n",
"\r\n",
"# Density plot based on the popularity\r\n",
"density_estimate_pop <- nigerian_songs %>% \r\n",
" ggplot(mapping = aes(x = popularity, fill = artist_top_genre, color = artist_top_genre)) +\r\n",
" geom_density(size = 1, alpha = 0.5) +\r\n",
" paletteer::scale_fill_paletteer_d(\"RSkittleBrewer::wildberry\") +\r\n",
" paletteer::scale_color_paletteer_d(\"RSkittleBrewer::wildberry\") +\r\n",
" theme(legend.position = \"none\")\r\n",
"\r\n",
"# Density plot based on the danceability\r\n",
"density_estimate_dance <- nigerian_songs %>% \r\n",
" ggplot(mapping = aes(x = danceability, fill = artist_top_genre, color = artist_top_genre)) +\r\n",
" geom_density(size = 1, alpha = 0.5) +\r\n",
" paletteer::scale_fill_paletteer_d(\"RSkittleBrewer::wildberry\") +\r\n",
" paletteer::scale_color_paletteer_d(\"RSkittleBrewer::wildberry\")\r\n",
"\r\n",
"\r\n",
"# Patch everything together\r\n",
"library(patchwork)\r\n",
"density_estimate_2d / (density_estimate_pop + density_estimate_dance)\r\n"
],
"outputs": [],
"metadata": {}
},
{
"cell_type": "markdown",
"source": [
"私たちは、ジャンルに関係なく同心円が一致しているのを確認します。もしかすると、このジャンルにおいてナイジェリアの嗜好は、ある一定のダンサビリティのレベルで収束しているのではないでしょうか?\n",
"\n",
"一般的に、これら3つのジャンルは人気度とダンサビリティの点で一致しています。この緩やかに整列したデータの中でクラスターを特定するのは難しい課題となるでしょう。散布図がこれを裏付けるかどうか、試してみましょう。\n"
],
"metadata": {}
},
{
"cell_type": "code",
"execution_count": null,
"source": [
"# A scatter plot of popularity and danceability\r\n",
"scatter_plot <- nigerian_songs %>% \r\n",
" ggplot(mapping = aes(x = popularity, y = danceability, color = artist_top_genre, shape = artist_top_genre)) +\r\n",
" geom_point(size = 2, alpha = 0.8) +\r\n",
" paletteer::scale_color_paletteer_d(\"futurevisions::mars\")\r\n",
"\r\n",
"# Add a touch of interactivity\r\n",
"ggplotly(scatter_plot)\r\n"
],
"outputs": [],
"metadata": {}
},
{
"cell_type": "markdown",
"source": [
"同じ軸の散布図は、収束の類似したパターンを示しています。\n",
"\n",
"一般的に、クラスタリングでは散布図を使用してデータのクラスターを表示することができます。この種類の可視化を習得することは非常に有用です。次のレッスンでは、このフィルタリングされたデータを使用して、k-meansクラスタリングを適用し、興味深い形で重なり合うグループを発見します。\n",
"\n",
"## **🚀 チャレンジ**\n",
"\n",
"次のレッスンに備えて、実際の環境で使用する可能性のあるさまざまなクラスタリングアルゴリズムについてのチャートを作成してください。クラスタリングはどのような問題を解決しようとしているのでしょうか?\n",
"\n",
"## [**講義後のクイズ**](https://gray-sand-07a10f403.1.azurestaticapps.net/quiz/28/)\n",
"\n",
"## **復習と自主学習**\n",
"\n",
"クラスタリングアルゴリズムを適用する前に、学んだように、データセットの性質を理解することが重要です。このトピックについてさらに学ぶには、[こちら](https://www.kdnuggets.com/2019/10/right-clustering-algorithm.html)を参照してください。\n",
"\n",
"クラスタリング手法の理解を深めましょう:\n",
"\n",
"- [Tidymodelsとその関連ツールを使用してクラスタリングモデルを訓練・評価する](https://rpubs.com/eR_ic/clustering)\n",
"\n",
"- Bradley Boehmke & Brandon Greenwell, [*Hands-On Machine Learning with R*](https://bradleyboehmke.github.io/HOML/)*.*\n",
"\n",
"## **課題**\n",
"\n",
"[クラスタリングのための他の可視化手法を調査する](https://github.com/microsoft/ML-For-Beginners/blob/main/5-Clustering/1-Visualize/assignment.md)\n",
"\n",
"## 感謝の言葉:\n",
"\n",
"[Jen Looper](https://www.twitter.com/jenlooper) さん、Python版のオリジナルモジュールを作成していただきありがとうございます ♥️\n",
"\n",
"[`Dasani Madipalli`](https://twitter.com/dasani_decoded) さん、機械学習の概念をより理解しやすくする素晴らしいイラストを作成していただきありがとうございます。\n",
"\n",
"楽しい学びを!\n",
"\n",
"[Eric](https://twitter.com/ericntay), Gold Microsoft Learn Student Ambassador\n"
],
"metadata": {}
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n---\n\n**免責事項**: \nこの文書は、AI翻訳サービス [Co-op Translator](https://github.com/Azure/co-op-translator) を使用して翻訳されています。正確性を追求しておりますが、自動翻訳には誤りや不正確な表現が含まれる可能性があります。元の言語で記載された原文が正式な情報源と見なされるべきです。重要な情報については、専門の人間による翻訳を推奨します。この翻訳の利用に起因する誤解や誤認について、当社は一切の責任を負いません。\n"
]
}
],
"metadata": {
"anaconda-cloud": "",
"kernelspec": {
"display_name": "R",
"language": "R",
"name": "ir"
},
"language_info": {
"codemirror_mode": "r",
"file_extension": ".r",
"mimetype": "text/x-r-source",
"name": "R",
"pygments_lexer": "r",
"version": "3.4.1"
},
"coopTranslator": {
"original_hash": "99c36449cad3708a435f6798cfa39972",
"translation_date": "2025-09-04T02:02:38+00:00",
"source_file": "5-Clustering/1-Visualize/solution/R/lesson_14-R.ipynb",
"language_code": "ja"
}
},
"nbformat": 4,
"nbformat_minor": 1
}