<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>「ランダムフォレスト」タグの記事一覧Python Tech</title>
	<atom:link href="https://tech.nkhn37.net/tag/%E3%83%A9%E3%83%B3%E3%83%80%E3%83%A0%E3%83%95%E3%82%A9%E3%83%AC%E3%82%B9%E3%83%88/feed/" rel="self" type="application/rss+xml" />
	<link>https://tech.nkhn37.net</link>
	<description>Python学習サイト</description>
	<lastBuildDate>Sun, 11 Jan 2026 07:34:50 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://tech.nkhn37.net/wp-content/uploads/2021/01/cropped-lion-normal-clear-1-32x32.png</url>
	<title>「ランダムフォレスト」タグの記事一覧Python Tech</title>
	<link>https://tech.nkhn37.net</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>【scikit-learn】決定木（DecisionTree）とランダムフォレスト（RandomForest）の使用方法</title>
		<link>https://tech.nkhn37.net/scikit-learn-decision-tree-random-forest/</link>
					<comments>https://tech.nkhn37.net/scikit-learn-decision-tree-random-forest/#respond</comments>
		
		<dc:creator><![CDATA[naoki-hn]]></dc:creator>
		<pubDate>Thu, 14 Jul 2022 20:00:00 +0000</pubDate>
				<category><![CDATA[scikit-learn]]></category>
		<category><![CDATA[DecisionTreeClassifier]]></category>
		<category><![CDATA[max_depth]]></category>
		<category><![CDATA[n_estimators]]></category>
		<category><![CDATA[RandomForestClassifier]]></category>
		<category><![CDATA[アンサンブル]]></category>
		<category><![CDATA[ランダムフォレスト]]></category>
		<category><![CDATA[決定木]]></category>
		<guid isPermaLink="false">https://tech.nkhn37.net/?p=4040</guid>

					<description><![CDATA[Pythonの機械学習ライブラリであるscikit-learnを使って決定木（DecisionTree）とランダムフォレスト（RandomForest）を使用する方法について解説します。 決定木（Decision Tre [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>Pythonの機械学習ライブラリである<span class="marker"><strong>scikit-learn</strong></span>を使って<span class="marker"><strong>決定木（DecisionTree）</strong></span>と<span class="marker"><strong>ランダムフォレスト（RandomForest）</strong></span>を使用する方法について解説します。</p>



<h2 class="wp-block-heading jinr-heading d--bold">決定木（Decision Tree）</h2>



<h3 class="wp-block-heading jinr-heading d--bold">決定木（Decision Tree）とは</h3>



<p><span class="marker"><strong>決定木（DecisionTree）</strong></span>は、分析対象データの要素の一つ一つに着目して、要素をある値に基づいて分割していくことでデータが属するクラスを決めていく手法です。</p>



<p>木と言っているのは、以下のようにある値によって対象のデータを分割していくのが木構造になっているためです。以下図のx1は、例えば「ある日の気温」等のようなデータを説明する要素で対象データにより様々考えられます。</p>



<p>決定木のモデルで重要なハイパーパラメーターは<span class="marker"><strong>深さ(depth)</strong></span>です。深さをいくつにするかで結果が変わり、必ずしも深くすればよいというものでもありません。</p>


<div class="wp-block-image">
<figure class="aligncenter size-full is-resized"><img fetchpriority="high" decoding="async" width="1204" height="539" src="https://tech.nkhn37.net/wp-content/uploads/2022/07/image-26.png" alt="決定木のイメージ" class="wp-image-4144" style="aspect-ratio:2.22962962962963;width:684px;height:auto" srcset="https://tech.nkhn37.net/wp-content/uploads/2022/07/image-26.png 1204w, https://tech.nkhn37.net/wp-content/uploads/2022/07/image-26-300x134.png 300w, https://tech.nkhn37.net/wp-content/uploads/2022/07/image-26-1024x458.png 1024w, https://tech.nkhn37.net/wp-content/uploads/2022/07/image-26-768x344.png 768w" sizes="(max-width: 1204px) 100vw, 1204px" /></figure>
</div>


<p>本記事では、Pythonのscikit-learnを用いて決定木を実装する方法例について紹介していきます。</p>



<section class="wp-block-jinr-blocks-iconbox b--jinr-block b--jinr-iconbox"><div class="d--simple-iconbox5 ">
			<i class="jif jin-ifont-v2speaker" aria-hidden="true"></i>
			<div class="a--jinr-iconbox">
<p>ハイパーパラメーターとは、機械学習のモデルが持つパラメーターで使用者が調整しなければならないパラメータのことです。ハイパーパラメーターを調整することをチューニングと言います。</p>
</div>
		</div></section>



<h3 class="wp-block-heading jinr-heading d--bold">scikit-learnの決定木（DecisionTreeClassifier）の使用方法</h3>



<p>scikit-learnの決定木（<span class="marker"><strong>DecisionTreeClassifier</strong></span>）の使用方法を簡単な2次元データを使った例で紹介していきます。</p>



<pre class="EnlighterJSRAW" data-enlighter-language="python" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">import matplotlib.pyplot as plt
import numpy as np
from sklearn.datasets import make_blobs
from sklearn.model_selection import train_test_split
from sklearn.tree import DecisionTreeClassifier


def main():
    """メイン関数"""
    np.random.seed(0)

    # 決定木の深さ設定
    max_depth = 2

    # テスト用の分類用データセットの作成
    data, target = make_blobs(n_samples=100, centers=3, cluster_std=1.0)
    plt.scatter(data[:, 0], data[:, 1], c=target, cmap="cividis")

    # 訓練データとテストデータの分離
    train_data, test_data, train_target, test_target = train_test_split(data, target)

    # 決定木の作成
    model = DecisionTreeClassifier(max_depth=max_depth)

    # モデルの学習
    model.fit(train_data, train_target)

    # 正解率の計算
    print(model.score(test_data, test_target))

    # モデルの予測結果を表示
    # 描画領域を計算(x1:横軸、x2:縦軸)
    min_x1, max_x1 = data[:, 0].min() - 1, data[:, 0].max() + 1
    min_x2, max_x2 = data[:, 1].min() - 1, data[:, 1].max() + 1
    xx1, xx2 = np.meshgrid(
        np.arange(min_x1, max_x1, 0.01), np.arange(min_x2, max_x2, 0.01)
    )
    input_data = np.array([xx1.ravel(), xx2.ravel()]).T

    # 学習したモデルで予測
    pred = model.predict(input_data)
    plt.contourf(xx1, xx2, pred.reshape(xx1.shape), alpha=0.3)

    plt.show()


if __name__ == "__main__":
    main()</pre>



<pre class="EnlighterJSRAW" data-enlighter-language="raw" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="false" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">【実行結果】
0.92</pre>



<p>【表示結果（max_depth=2）】</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img decoding="async" width="545" height="408" src="https://tech.nkhn37.net/wp-content/uploads/2022/07/image-28.png" alt="決定木（DecisionTreeClassifier）" class="wp-image-4147" srcset="https://tech.nkhn37.net/wp-content/uploads/2022/07/image-28.png 545w, https://tech.nkhn37.net/wp-content/uploads/2022/07/image-28-300x225.png 300w" sizes="(max-width: 545px) 100vw, 545px" /></figure>
</div>


<p>以降でプログラムの細部について部分ごとに説明をしていきます。</p>



<p>決定木を使用するには、<span class="marker"><strong>sklearn.tree</strong></span>から<span class="marker"><strong>DecisionTreeClassifier</strong></span>をimportします。他にも分析データ操作や可視化のためにnumpyやmatplotlib、サンプルデータ生成用にmake_blobs、学習用データと検証データの分割のためにtrain_test_splitといったものもimportしています。</p>



<pre class="EnlighterJSRAW" data-enlighter-language="python" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="false" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">import matplotlib.pyplot as plt
import numpy as np
from sklearn.datasets import make_blobs
from sklearn.model_selection import train_test_split
from sklearn.tree import DecisionTreeClassifier</pre>



<p>以下の部分では、ハイパーパラメータとなる情報を定義しています。乱数は実行毎に結果が変わらないように状態を固定しています。また、max_depthは決定木の重要な深さパラメータで、この値を変えると結果は変わります。</p>



<pre class="EnlighterJSRAW" data-enlighter-language="python" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="false" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">    np.random.seed(0)

    # 決定木の深さ設定
    max_depth = 2</pre>



<p>以下の部分は分類用のデータセットを作成している部分です。今回は、サンプル数(n_samples) が100で、データ集合の中心(centers)が3つ、各データ集合の標準偏差(cluster_std)が1.0のデータを生成しています。</p>



<p>また、訓練用のデータとテスト用のデータとしてtrain_test_splitでデータを分離しています。</p>



<pre class="EnlighterJSRAW" data-enlighter-language="python" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="false" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">    # テスト用の分類用データセットの作成
    data, target = make_blobs(n_samples=100, centers=3, cluster_std=1.0)
    plt.scatter(data[:, 0], data[:, 1], c=target, cmap="cividis")

    # 訓練データとテストデータの分離
    train_data, test_data, train_target, test_target = train_test_split(data, target)</pre>



<p>さて、本題の決定木の作成や学習をしている部分は以下の部分になります。</p>



<pre class="EnlighterJSRAW" data-enlighter-language="python" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="false" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">    # 決定木の作成
    model = DecisionTreeClassifier(max_depth=max_depth)

    # モデルの学習
    model.fit(train_data, train_target)

    # 正解率の計算
    print(model.score(test_data, test_target))</pre>



<p>決定木の作成は簡単で<span class="marker"><strong>DecisionTreeClassifier</strong></span>にハイパーパラメータとして用意した引数（<span class="marker"><strong>max_depth</strong></span>)を渡すだけです。</p>



<p>モデルの学習では<span class="marker"><strong>fit</strong></span>メソッドを使用します。また、正解率の計算は<span class="marker"><strong>score</strong></span>メソッドにテスト用データを渡すことで計算することができます。今回の例では0.92という正解率でした。</p>



<p>以下の部分は決定木の予測結果を可視化するための部分です。 </p>



<pre class="EnlighterJSRAW" data-enlighter-language="python" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="false" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">    # モデルの予測結果を表示
    # 描画領域を計算(x1:横軸、x2:縦軸)
    min_x1, max_x1 = data[:, 0].min() - 1, data[:, 0].max() + 1
    min_x2, max_x2 = data[:, 1].min() - 1, data[:, 1].max() + 1
    xx1, xx2 = np.meshgrid(
        np.arange(min_x1, max_x1, 0.01), np.arange(min_x2, max_x2, 0.01)
    )
    input_data = np.array([xx1.ravel(), xx2.ravel()]).T

    # 学習したモデルで予測
    pred = model.predict(input_data)
    plt.contourf(xx1, xx2, pred.reshape(xx1.shape), alpha=0.3)

    plt.show()</pre>



<p>meshgridでデータ点を作成し各点の分類結果を<span class="marker"><strong>predict</strong></span>メソッド予測して表示しています。このように決定木でモデルを学習しておけば新しいデータに対してどういった結果となるかを予測することができます。</p>



<p>【表示結果（再掲）】</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img decoding="async" width="545" height="408" src="https://tech.nkhn37.net/wp-content/uploads/2022/07/image-28.png" alt="決定木（DecisionTreeClassifier）" class="wp-image-4147" srcset="https://tech.nkhn37.net/wp-content/uploads/2022/07/image-28.png 545w, https://tech.nkhn37.net/wp-content/uploads/2022/07/image-28-300x225.png 300w" sizes="(max-width: 545px) 100vw, 545px" /></figure>
</div>


<p>実行結果を見てみると、それぞれのデータ点のエリアに分類できる決定木モデルが作成できています。上記のようにデータを分割していくため境界線はまっすぐに分けられることも決定木の特徴です。</p>



<h4 class="wp-block-heading jinr-heading d--bold">ハイパーパラメータ max_depthの変更</h4>



<p>決定木のハイパーパラメータとしてmax_depthがありますが、この値を変えたときにどのようになるか少し見てみましょう。</p>



<p>【max_depth=1の場合】</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img decoding="async" width="544" height="406" src="https://tech.nkhn37.net/wp-content/uploads/2022/07/image-29.png" alt="決定木（DecisionTreeClassifier）" class="wp-image-4148" srcset="https://tech.nkhn37.net/wp-content/uploads/2022/07/image-29.png 544w, https://tech.nkhn37.net/wp-content/uploads/2022/07/image-29-300x224.png 300w" sizes="(max-width: 544px) 100vw, 544px" /></figure>
</div>


<p>【max_depth=4の場合】</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img decoding="async" width="542" height="407" src="https://tech.nkhn37.net/wp-content/uploads/2022/07/image-30.png" alt="決定木（DecisionTreeClassifier）" class="wp-image-4149" srcset="https://tech.nkhn37.net/wp-content/uploads/2022/07/image-30.png 542w, https://tech.nkhn37.net/wp-content/uploads/2022/07/image-30-300x225.png 300w" sizes="(max-width: 542px) 100vw, 542px" /></figure>
</div>


<p>max_depth=1にするとただの2分割であるため、データ点をうまく分割することができません。一方で、max_depth=4まであげると黄色の細い領域ができてしまっています。この部分は本来濃い青のデータ領域と考えられるため、この領域のデータを黄色と予測するのには違和感があり、モデルがデータに過剰に適合してしまっている状況と見ることができます。</p>



<p>こういったハイパーパラメータのチューニングは手作業で実施するのは大変です。パラメータを実行しながら精度の高いハイパーパラメータセットを見つける方法としてグリッドサーチやランダムサーチといった方法があります。</p>



<p>グリッドサーチとランダムサーチについては、「<a href="https://tech.nkhn37.net/scikit-learn-gridsearchcv-randomizedsearchcv/" target="_blank" rel="noreferrer noopener">グリッドサーチとランダムサーチでハイパーパラメータをチューニングする方法（GridSearchCV, RandomizedSearchCV）</a>」でまとめていますので興味があれば参考にしてください。</p>



<section class="wp-block-jinr-blocks-iconbox b--jinr-block b--jinr-iconbox"><div class="d--simple-iconbox6 ">
			<i class="jif jin-ifont-v2books" aria-hidden="true"></i>
			<div class="a--jinr-iconbox">
<p><code>sklearn.tree.DecisionTreeClassifier</code> の公式ドキュメントは<a href="https://scikit-learn.org/stable/modules/generated/sklearn.tree.DecisionTreeClassifier.html" target="_blank" rel="noreferrer noopener">こちら</a>を参考にしてください。</p>
</div>
		</div></section>



<h2 class="wp-block-heading jinr-heading d--bold">ランダムフォレスト</h2>



<h3 class="wp-block-heading jinr-heading d--bold">ランダムフォレストとは</h3>



<p><span class="marker"><strong>ランダムフォレスト（RandomForest）</strong></span>とは、上記で説明してきた決定木を複数作り、分類結果をモデルの多数決で決めていく手法です。学習したモデルを組み合わせて機械学習の汎化性能を向上させる方法のことを<span class="marker"><strong>アンサンブル学習</strong></span>と言います。</p>



<p>決定木では、すべての説明変数を使用するのに対して、ランダムフォレストでは、複数作成する決定木の一つ一つはランダムに決められる少ない説明変数だけを使用してデータの属するクラスを決めます。このようにして作成した複数の決定木モデルを使って予測されるクラスのうち多数決で最も多いクラスを結果として出力することになります。</p>



<p>ランダムフォレストは、線形分離可能ではないようなデータ集合にも使用することができるのが特徴です。</p>



<section class="wp-block-jinr-blocks-iconbox b--jinr-block b--jinr-iconbox"><div class="d--simple-iconbox5 ">
			<i class="jif jin-ifont-v2speaker" aria-hidden="true"></i>
			<div class="a--jinr-iconbox">
<p>アンサンブル学習としては「<strong>バギング</strong>」と「<strong>ブースティング</strong>」という方法があります。ランダムフォレストはバギングの手法の一種です。</p>



<p>バギングは複数のモデルを並列的に学習し、結果をまとめることで最終的な予測としますが、ブースティングは１つ前のモデルが予測を誤ったデータを優先的に改善するように直列的に学習します。</p>
</div>
		</div></section>



<h3 class="wp-block-heading jinr-heading d--bold">scikit-learnのランダムフォレスト（RandomForestClassifier）の使用方法</h3>



<p>scikit-learnのランダムフォレスト（<span class="marker"><strong>RandomForestClassifier</strong></span>）の使用方法を、決定木で見てきた例と同じ例を用いて紹介していきます。</p>



<pre class="EnlighterJSRAW" data-enlighter-language="python" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">import matplotlib.pyplot as plt
import numpy as np
from sklearn.datasets import make_blobs
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestClassifier


def main():
    """メイン関数"""
    np.random.seed(0)

    # 決定木の深さ設定
    max_depth = 2
    # 決定木の数
    n_estimators = 10

    # テスト用の分類用データセットの作成
    data, target = make_blobs(n_samples=100, centers=3, cluster_std=1.0)
    plt.scatter(data[:, 0], data[:, 1], c=target, cmap="cividis")

    # 訓練データとテストデータの分離
    train_data, test_data, train_target, test_target = train_test_split(data, target)

    # ランダムフォレストの構築
    model = RandomForestClassifier(n_estimators=n_estimators, max_depth=max_depth)

    # モデルの学習
    model.fit(train_data, train_target)

    # 正解率の検出
    print(model.score(test_data, test_target))

    # モデルの予測結果を表示
    # 描画領域を計算(x1:横軸、x2:縦軸)
    min_x1, max_x1 = data[:, 0].min() - 1, data[:, 0].max() + 1
    min_x2, max_x2 = data[:, 1].min() - 1, data[:, 1].max() + 1
    xx1, xx2 = np.meshgrid(
        np.arange(min_x1, max_x1, 0.01), np.arange(min_x2, max_x2, 0.01)
    )
    input_data = np.array([xx1.ravel(), xx2.ravel()]).T

    # 学習したモデルで予測
    pred = model.predict(input_data)
    plt.contourf(xx1, xx2, pred.reshape(xx1.shape), alpha=0.3)

    plt.show()


if __name__ == "__main__":
    main()</pre>



<pre class="EnlighterJSRAW" data-enlighter-language="raw" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="false" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">【実行結果】
0.96</pre>



<p>【表示結果（max_depth=2, n_estimators=10）】</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img decoding="async" width="545" height="407" src="https://tech.nkhn37.net/wp-content/uploads/2022/07/image-31.png" alt="ランダムフォレスト" class="wp-image-4150" srcset="https://tech.nkhn37.net/wp-content/uploads/2022/07/image-31.png 545w, https://tech.nkhn37.net/wp-content/uploads/2022/07/image-31-300x224.png 300w" sizes="(max-width: 545px) 100vw, 545px" /></figure>
</div>


<p>以降でプログラムの細部について部分ごとに説明をしていきますが、決定木の説明と重複する部分は割愛しますので、決定木の説明をご確認ください。</p>



<p>ランダムフォレストを使用するには、<span class="marker"><strong>sklearn.ensemble</strong></span>から<span class="marker"><strong>RandomForestClassifier</strong></span>をimportします。</p>



<pre class="EnlighterJSRAW" data-enlighter-language="python" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="false" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">from sklearn.ensemble import RandomForestClassifier</pre>



<p>まず、ハイパーパラメータとして決定木より増えている項目があります。ランダムフォレストは複数の決定木の多数決で結果が決定されます。この決定木の数を決めるのが、<span class="marker"><strong>n_estimators</strong></span>です。今回の例では10としてみています。</p>



<pre class="EnlighterJSRAW" data-enlighter-language="python" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="false" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">    np.random.seed(0)

    # 決定木の深さ設定
    max_depth = 2
    # 決定木の数
    n_estimators = 10</pre>



<p>ランダムフォレストモデルの使い方も決定木とほとんど同じです。</p>



<pre class="EnlighterJSRAW" data-enlighter-language="python" data-enlighter-theme="" data-enlighter-highlight="" data-enlighter-linenumbers="false" data-enlighter-lineoffset="" data-enlighter-title="" data-enlighter-group="">    # ランダムフォレストの構築
    model = RandomForestClassifier(n_estimators=n_estimators, max_depth=max_depth)

    # モデルの学習
    model.fit(train_data, train_target)

    # 正解率の検出
    print(model.score(test_data, test_target))</pre>



<p><span class="marker"><strong>RandomForestClassifier</strong></span>には、ハイパーパラメータとして決定木の時のパラメータ（max_depth）に加えて<span class="marker"><strong>n_estimators</strong></span>を渡します。</p>



<p>モデルの学習では同様に<span class="marker"><strong>fit</strong></span>メソッドを使用し、また、正解率の計算は<span class="marker"><strong>score</strong></span>メソッドにテスト用データを渡すことで計算することができます。</p>



<p>今回の例では0.96という正解率でした。決定木では同様のmax_depth=2で0.92という正解率でしたが、ランダムフォレストで正解率が向上していることが分かります。</p>



<p>predictを用いた予測の表示結果を見ると境界面についても決定木よりも複雑な境界面を表現できていることが分かります。</p>



<section class="wp-block-jinr-blocks-iconbox b--jinr-block b--jinr-iconbox"><div class="d--simple-iconbox6 ">
			<i class="jif jin-ifont-v2books" aria-hidden="true"></i>
			<div class="a--jinr-iconbox">
<p><code>sklearn.ensemble.RandomForestClassifier</code> の公式ドキュメントは<a href="https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.RandomForestClassifier.html" target="_blank" rel="noreferrer noopener">こちら</a>を参考にしてください。</p>
</div>
		</div></section>



<section class="wp-block-jinr-blocks-simplebox b--jinr-block-container"><div class="b--jinr-block b--jinr-box d--heading-box8  "><div class="a--simple-box-title d--bold">ソースコード</div><div class="c--simple-box-inner">
<p>上記で紹介しているソースコードについては <a href="https://github.com/nkhn37/python-tech-sample-source/tree/main/python-data-analysis/scikit-learn/decisiontree_randomforest" target="_blank" rel="noreferrer noopener">GitHub</a> にて公開しています。参考にしていただければと思います。</p>
</div></div></section>


<section class="b--jinr-block b--jinr-blogcard d--blogcard-hover-up d--blogcard-style1 d--blogcard-mysite t--round "><div class="a--blogcard-label ef">あわせて読みたい</div><a class="o--blogcard-link t--round" href="https://tech.nkhn37.net/python-tech-summary-page/"><div class="c--blogcard-image"><img decoding="async" class="a--blogcard-img-src" width="128" height="72" src="https://tech.nkhn37.net/wp-content/uploads/2024/08/Python-Tech-Pythonプログラミングガイド_new1-640x360.jpg" alt="【Python Tech】プログラミングガイド" /></div><div class="a--blogcard-title d--bold">【Python Tech】プログラミングガイド</div></a></section>]]></content:encoded>
					
					<wfw:commentRss>https://tech.nkhn37.net/scikit-learn-decision-tree-random-forest/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>

<!--
Performance optimized by W3 Total Cache. Learn more: https://www.boldgrid.com/w3-total-cache/?utm_source=w3tc&utm_medium=footer_comment&utm_campaign=free_plugin

Disk: Enhanced  を使用したページ キャッシュ

Served from: tech.nkhn37.net @ 2026-05-17 08:04:09 by W3 Total Cache
-->