【LSTM預測】基於matlab貝葉斯網路改進LSTM預測【含Matlab原始碼 1158期】
阿新 • • 發佈:2021-07-25
一、簡介
基於matlab貝葉斯網路改進LSTM預測
二、原始碼
%%%%%%%%%% Gaussian Process Regression (GPR) %%%%%%%%% % Demo: prediction using GPR % ---------------------------------------------------------------------% clc close all clear all addpath(genpath(pwd)) % load data %{ x : training inputs y : training targets xt: testing inputs yt: testing targets %} % multiple input-single output load('./data/data_1.mat') % Set the mean function, covariance function and likelihood function % Take meanConst, covRQiso and likGauss as examples % Initialization of hyperparameters hyp = struct('mean', 3, 'cov', [0 0 0], 'lik', -1); % meanfunc = []; % covfunc = @covSEiso; % likfunc = @likGauss; % % Initialization of hyperparameters % hyp = struct('mean', [], 'cov', [0 0], 'lik', -1); % Optimization of hyperparameters hyp2 = minimize(hyp, @gp, -20, @infGaussLik, meanfunc, covfunc, likfunc,x, y); % Regression using GPR % yfit is the predicted mean, and ys is the predicted variance % Visualization of prediction results plotResult(yt, yfit) % load data %{ x : training inputs y : training targets xt: testing inputs yt: testing targets %} % multiple input-multiple output load('./data/data_2.mat') % Set the mean function, covariance function and likelihood function % Take meanConst, covRQiso and likGauss as examples meanfunc = @meanConst; covfunc = @covRQiso; likfunc = @likGauss; % Initialization of hyperparameters hyp = struct('mean', 3, 'cov', [2 2 2], 'lik', -1); % meanfunc = []; % covfunc = @covSEiso; % likfunc = @likGauss; % % hyp = struct('mean', [], 'cov', [0 0], 'lik', -1); % Optimization of hyperparameters % Regression using GPR % yfit is the predicted mean, and ys is the predicted variance
三、執行結果
四、備註
版本:2014a
完整程式碼或代寫加QQ912100926