Main Content

アンサンブル回帰に学習をさせる

この例では、アンサンブル回帰を作成し、carsmall のデータで学習させ、馬力と重量に基づいて自動車の燃費効率を予測する方法を示します。

carsmall データ セットを読み込みます。

load carsmall

予測子データを準備します。

X = [Horsepower Weight];

応答データは MPG です。ブースティング回帰アンサンブル タイプとして使用できるのは LSBoost だけです。この例では、100 個のツリーから構成されるアンサンブルを任意に選択し、既定のツリー オプションを使用します。

回帰木のアンサンブルに学習をさせます。

Mdl = fitrensemble(X,MPG,'Method','LSBoost','NumLearningCycles',100)
Mdl = 
  RegressionEnsemble
             ResponseName: 'Y'
    CategoricalPredictors: []
        ResponseTransform: 'none'
          NumObservations: 94
               NumTrained: 100
                   Method: 'LSBoost'
             LearnerNames: {'Tree'}
     ReasonForTermination: 'Terminated normally after completing the requested number of training cycles.'
                  FitInfo: [100x1 double]
       FitInfoDescription: {2x1 cell}
           Regularization: []


アンサンブル内の 1 番目の学習済み回帰木のグラフをプロットします。

view(Mdl.Trained{1},'Mode','graph');

Figure Regression tree viewer contains an axes object and other objects of type uimenu, uicontrol. The axes object contains 36 objects of type line, text. One or more of the lines displays its values using only markers

既定では、fitrensemble は LSBoost について浅い木を成長させます。

150 馬力で重量が 2750 ポンドの自動車について燃費効率を予測します。

mileage = predict(Mdl,[150 2750])
mileage = 23.6713

参考

|

関連するトピック