필터 지우기
필터 지우기

Stacking implementation of 2 neural nets

조회 수: 5 (최근 30일)
yogini prabhu
yogini prabhu 2022년 7월 8일
답변: Akshat 2023년 9월 1일
  • Stacking is an ensemble machine learning algorithm that learns how to best combine the predictions from multiple well-performing machine learning models.
so if I use patternnet or lvqnet to create 2 separate net models in the following case : 2 factors of one being ( eg 1: - heart rate and blood profile : which are to be utilised into 1 single decision to decide cholesterol profile of patient, eg 2:- leaf spectra and bark spectra of a single tree : which are to be utilised for its stress diagnosis) .
so then how to stack the 2 nets as per ensemble modeling using Matlab?

답변 (1개)

Akshat
Akshat 2023년 9월 1일
Hi Yogini,
As per what I understand, stacking can be done with two or more machine learning models to make one ensemble model, which outperforms (usually) the models constituting it.
The catch here is, those models are trained on the same training set, but as you mentioned in the question, you will train one neural net on heart rate and the other on blood profile. I am not exactly sure if this will work, as the data used to train isn’t consistent for both the models (even when the dimensions are consistent).
In case you want to stack two models trained on the same dataset, you can follow the steps mentioned in this documentation page:
This is where the documentation made the base models:
% SVM with Gaussian kernel
rng('default') % For reproducibility
mdls{1} = fitcsvm(adultdata,'salary','KernelFunction','gaussian', ...
'Standardize',true,'KernelScale','auto');
% SVM with polynomial kernel
rng('default')
mdls{2} = fitcsvm(adultdata,'salary','KernelFunction','polynomial', ...
'Standardize',true,'KernelScale','auto');
% Decision tree
rng('default')
mdls{3} = fitctree(adultdata,'salary');
% Naive Bayes
rng('default')
mdls{4} = fitcnb(adultdata,'salary');
% Ensemble of decision trees
rng('default')
mdls{5} = fitcensemble(adultdata,'salary');
Following is how you stack the models:
rng('default') % For reproducibility
N = numel(mdls);
Scores = zeros(size(adultdata,1),N);
cv = cvpartition(adultdata.salary,"KFold",5);
for ii = 1:N
m = crossval(mdls{ii},'cvpartition',cv);
[~,s] = kfoldPredict(m);
Scores(:,ii) = s(:,m.ClassNames=='<=50K');
end

카테고리

Help CenterFile Exchange에서 Classification에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by