このページの内容は最新ではありません。最新版の英語を参照するには、ここをクリックします。
prune
枝刈りによる回帰サブツリーのシーケンスの作成
説明
例
回帰木の枝刈り
carsmall
データセットを読み込みます。Horsepower
と Weight
は予測子変数であるとします。
load carsmall; X = [Weight Horsepower]; varNames = ["Weight" "Horsepower"];
データセット全体を使用して回帰木を成長させます。木を表示します。
Mdl = fitrtree(X,MPG,PredictorNames=varNames)
Mdl = RegressionTree PredictorNames: {'Weight' 'Horsepower'} ResponseName: 'Y' CategoricalPredictors: [] ResponseTransform: 'none' NumObservations: 94
view(Mdl,Mode="graph");
この回帰木には 16 個の枝刈りレベルがあります。
枝刈りレベル 10 まで回帰木を枝刈りします。枝刈りした木を表示します。
MdlPruned = prune(Mdl,Level=10);
view(MdlPruned,Mode="graph");
枝刈りされた木には 6 つの枝刈りレベルがあります。
入力引数
tree
— 回帰木
RegressionTree
オブジェクト
回帰木。関数 fitrtree
を使用して作成した RegressionTree
オブジェクトとして指定します。
名前と値の引数
オプションの引数のペアを Name1=Value1,...,NameN=ValueN
として指定します。ここで Name
は引数名、Value
は対応する値です。名前と値の引数は他の引数の後ろにする必要がありますが、ペアの順序は関係ありません。
例: tree1 = prune(tree,Level=10)
は、木をレベル 10 まで枝刈りします。
R2021a より前では、名前と値をそれぞれコンマを使って区切り、Name
を引用符で囲みます。
例: tree1 = prune(tree,"Level",10)
は、木をレベル 10 まで枝刈りします。
出力引数
tree1
— 枝刈りされた回帰木
RegressionTree
オブジェクト
枝刈りされた回帰木。RegressionTree
オブジェクトとして返されます。
ヒント
拡張機能
GPU 配列
Parallel Computing Toolbox™ を使用してグラフィックス処理装置 (GPU) 上で実行することにより、コードを高速化します。
使用上の注意事項および制限事項:
prune
は、GPU では枝刈り (枝刈りされた部分木の最適系列を推定) を実行しません。
詳細は、GPU での MATLAB 関数の実行 (Parallel Computing Toolbox)を参照してください。
バージョン履歴
R2011a で導入
参考
MATLAB コマンド
次の MATLAB コマンドに対応するリンクがクリックされました。
コマンドを MATLAB コマンド ウィンドウに入力して実行してください。Web ブラウザーは MATLAB コマンドをサポートしていません。
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)