Weights of Regression Partioned Model in Neural Network
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Hey there,
I have a regression neural network (1 hidden layer with 10 neurons) which is cross validated and now I wonder how I can get the weight matrix.
KFolds = observations; % LOOCV
rng("default") % For reproducibility of the partition
cvp = cvpartition(observations,"KFold",KFolds);
lambda = (0:0.005:0.015);
for i = 1:length(lambda)
cvMdl = fitrnet(data_table,"Output","Lambda",lambda(i), ...
"CVPartition",cvp,"LayerSizes",[10]);
cvloss(i) = kfoldLoss(cvMdl); % MSE for cross-validated models
end
plot(lambda,cvloss)
xlabel("Regularization Strength")
ylabel("Cross-Validation Loss")
[~,idx] = min(cvloss);
bestLambda = lambda(idx)
Mdl = fitrnet(data_table,"Output","Lambda",bestLambda, ...
"CVPartition",cvp,"LayerSizes",[10],"Verbose",0);
With Mdl.W I get the scaled weights, but all values are the same in this vector and the length of this vector equals the number of observations.
I don't understand the meaning of this vector and how I can get the 'normal' weight matrix.
Thanks for your answers.
0 Commenti
Risposte (0)
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!