compact
クラス: RegressionTree
コンパクトな回帰木
構文
ctree = compact(tree)
入力引数
|
|
出力引数
|
コンパクトな回帰木。 |
例
回帰木モデルのメモリ消費量の削減
完全なモデルとコンパクト モデルの回帰木のサイズを比較します。
carsmall
データセットを読み込みます。Acceleration
、Displacement
、Horsepower
および Weight
は予測子変数であるとします。
load carsmall
X = [Acceleration Cylinders Displacement Horsepower Weight];
データセット全体を使用して回帰木を成長させます。
Mdl = fitrtree(X,MPG)
Mdl = RegressionTree ResponseName: 'Y' CategoricalPredictors: [] ResponseTransform: 'none' NumObservations: 94 Properties, Methods
Mdl
は RegressionTree
モデルです。これは完全なモデルです。つまり、fitrtree
で学習に使用した予測子データや応答データなどの情報が格納されています。完全なモデルの回帰木のプロパティの一覧については、RegressionTree
を参照してください。
完全な回帰木のコンパクトなバージョン、つまり予測を行うための情報のみが格納されている回帰木を作成します。
CMdl = compact(Mdl)
CMdl = CompactRegressionTree ResponseName: 'Y' CategoricalPredictors: [] ResponseTransform: 'none' Properties, Methods
CMdl
は CompactRegressionTree
モデルです。コンパクト モデルの回帰木のプロパティの一覧については、CompactRegressionTree
を参照してください。
完全なモデルおよびコンパクト モデルの回帰木で消費するメモリの量を調べます。
mdlInfo = whos('Mdl'); cMdlInfo = whos('CMdl'); [mdlInfo.bytes cMdlInfo.bytes]
ans = 1×2
12401 6898
cMdlInfo.bytes/mdlInfo.bytes
ans = 0.5562
この場合、コンパクト モデルの回帰木はメモリ使用量が完全なモデルの約半分になっています。
拡張機能
GPU 配列
Parallel Computing Toolbox™ を使用してグラフィックス処理装置 (GPU) 上で実行することにより、コードを高速化します。
この関数は、GPU 配列を完全にサポートします。詳細は、GPU での MATLAB 関数の実行 (Parallel Computing Toolbox)を参照してください。
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)