compact
クラス: TreeBagger
決定木のコンパクトなアンサンブル
説明
は、CMdl
= compact(Mdl
)TreeBagger
モデル オブジェクト Mdl
のコンパクトなバージョンを作成します。Mdl
を使用する場合と同じように、CMdl
を使用しても正確に回帰を予測できます。ただし、CMdl
には学習データが含まれていないので、oobPredict
を使用する out-of-bag 予測など一部の処理を実行することはできません。
入力引数
|
|
出力引数
|
コンパクトなアンサンブル回帰。 |
例
bag of trees のサイズの縮小
新しいデータの予測を効率的にするため、コンパクトな bag of trees を作成します。
ionosphere
データセットを読み込みます。
load ionosphere
すべての測定値と AdaBoostM1
メソッドを使用して、100 本の分類の bag of trees に学習をさせます。
Mdl = TreeBagger(100,X,Y,'Method','classification')
Mdl = TreeBagger Ensemble with 100 bagged decision trees: Training X: [351x34] Training Y: [351x1] Method: classification NumPredictors: 34 NumPredictorsToSample: 6 MinLeafSize: 1 InBagFraction: 1 SampleWithReplacement: 1 ComputeOOBPrediction: 0 ComputeOOBPredictorImportance: 0 Proximity: [] ClassNames: 'b' 'g' Properties, Methods
Mdl
は、学習データも含まれている TreeBagger
モデル オブジェクトです。
コンパクトなバージョンの Mdl
を作成します。
CMdl = compact(Mdl)
CMdl = CompactTreeBagger Ensemble with 100 bagged decision trees: Method: classification NumPredictors: 34 ClassNames: 'b' 'g' Properties, Methods
CMdl
は CompactTreeBagger
モデル オブジェクトです。CMdl
は Mdl
とほとんど同じです。1 つ違うことは、学習データが格納されていないことです。
Mdl
と CMdl
の領域消費量を比較します。
mdlInfo = whos('Mdl'); cMdlInfo = whos('CMdl'); [mdlInfo.bytes cMdlInfo.bytes]
ans = 1×2
1115742 976936
Mdl
は CMdl
より多くの領域を消費します。
CMdl.Trees
には、Mdl
を構成する学習済み分類木 (CompactClassificationTree
モデル オブジェクト) が格納されています。
コンパクトなモデルの 1 番目の木のグラフを表示します。
view(CMdl.Trees{1},'Mode','graph');
既定の設定では、TreeBagger
は木を深く成長させます。
コンパクトなアンサンブルを使用して、X
の平均のラベルを予測します。
predMeanX = predict(CMdl,mean(X))
predMeanX = 1x1 cell array
{'g'}
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)