最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

【BP預(yù)測】基于BP神經(jīng)網(wǎng)絡(luò)實現(xiàn)數(shù)據(jù)預(yù)測含Matlab源碼

2022-04-06 22:45 作者:Matlab工程師  | 我要投稿

1 簡介


BP神經(jīng)網(wǎng)絡(luò)模型是目前應(yīng)用最為廣泛神經(jīng)網(wǎng)絡(luò)之一。它的本質(zhì)是通過對歷史數(shù)據(jù)的學(xué)習(xí)找出數(shù)據(jù)變化趨勢之間的非線性關(guān)系,并通過輸出量與預(yù)期值之間的誤差不斷調(diào)整網(wǎng)絡(luò)中各個單元的權(quán)重,使整個網(wǎng)絡(luò)的誤差最小。因此,為達(dá)到較好的預(yù)測精度,需要對網(wǎng)絡(luò)預(yù)測模型自身的結(jié)構(gòu)進(jìn)行確定。

1)網(wǎng)絡(luò)層數(shù)的設(shè)計。本文需要構(gòu)建的預(yù)測模型,主要是用于研究在短時間交通流走勢。在這種情況下,不需選擇增加網(wǎng)絡(luò)層數(shù)的辦法而是選擇增加隱含層神經(jīng)元節(jié)點的數(shù)目來提高輸出結(jié)果的精度。因此,本文選用單一隱層的 BP神經(jīng)網(wǎng)絡(luò)模型。

2)輸入層神經(jīng)節(jié)點的設(shè)計。在單因素預(yù)測中僅使用交通流作為原始數(shù)據(jù).

3)傳遞函數(shù)和學(xué)習(xí)函數(shù)的設(shè)計。本文所設(shè)計的模型均采用了相同的隱含層傳遞函數(shù)tansig、輸出層傳遞函數(shù)logsig和學(xué)習(xí)函數(shù)learngdm。

4)性能函數(shù)的確定。網(wǎng)絡(luò)誤差能直觀的反映預(yù)測效果的好壞程度,是預(yù)測精度的具體反映。本文在構(gòu)建 BP神經(jīng)網(wǎng)絡(luò)模型時選擇均方誤差來確定網(wǎng)絡(luò)的誤差情況。

5)隱含層神經(jīng)節(jié)點的設(shè)計。在模型中其它參數(shù)值保持不變的情況下,本文通過調(diào)整隱含層神經(jīng)節(jié)點的數(shù)目進(jìn)行重復(fù)實驗,通過對比輸出誤差,確定最佳隱含層神經(jīng)元節(jié)點的數(shù)目。對于單因素 BP神經(jīng)網(wǎng)絡(luò),當(dāng)隱含層神經(jīng)元節(jié)點的數(shù)目為24時,BP神經(jīng)網(wǎng)絡(luò)的均方誤差最小,即對函數(shù)的逼近效果最好,此時的均方誤差為1.1609;對于多因素 BP神經(jīng)網(wǎng)絡(luò),隱含層神經(jīng)元節(jié)點數(shù)目為5時,BP神經(jīng)網(wǎng)絡(luò)的均方誤差達(dá)到最小,最小值為0.0126。根據(jù)以上分析,單因素 BP神經(jīng)網(wǎng)絡(luò)預(yù)測模型的結(jié)構(gòu)為:單一隱含層和單一輸出層;輸入層神經(jīng)節(jié)點數(shù)目為5 ;隱含層神經(jīng)節(jié)點數(shù)目為24;輸出層神經(jīng)節(jié)點數(shù)目為1;隱含層傳遞函數(shù)、輸出層傳遞函數(shù)、學(xué)習(xí)函數(shù)分別為tansig、logsig和learngdm;性能函數(shù)為 mse。

2 部分代碼

function varargout = bp_demo(varargin)% BP_DEMO M-file for bp_demo.fig% ? ? ?BP_DEMO, by itself, creates a new BP_DEMO or raises the existing% ? ? ?singleton*.%% ? ? ?H = BP_DEMO returns the handle to a new BP_DEMO or the handle to% ? ? ?the existing singleton*.%% ? ? ?BP_DEMO('CALLBACK',hObject,eventData,handles,...) calls the local% ? ? ?function named CALLBACK in BP_DEMO.M with the given input arguments.%% ? ? ?BP_DEMO('Property','Value',...) creates a new BP_DEMO or raises the% ? ? ?existing singleton*. ?Starting from the left, property value pairs are% ? ? ?applied to the GUI before bp_demo_OpeningFcn gets called. ?An% ? ? ?unrecognized property name or invalid value makes property application% ? ? ?stop. ?All inputs are passed to bp_demo_OpeningFcn via varargin.%% ? ? ?*See GUI Options on GUIDE's Tools menu. ?Choose "GUI allows only one% ? ? ?instance to run (singleton)".%% See also: GUIDE, GUIDATA, GUIHANDLES% Edit the above text to modify the response to help bp_demo% Last Modified by GUIDE v2.5 19-May-2021 09:29:51% Begin initialization code - DO NOT EDITgui_Singleton = 1;gui_State = struct('gui_Name', ? ? ? mfilename, ... ? ? ? ? ? ? ? ? ? 'gui_Singleton', ?gui_Singleton, ... ? ? ? ? ? ? ? ? ? 'gui_OpeningFcn', @bp_demo_OpeningFcn, ... ? ? ? ? ? ? ? ? ? 'gui_OutputFcn', ?@bp_demo_OutputFcn, ... ? ? ? ? ? ? ? ? ? 'gui_LayoutFcn', ?[] , ... ? ? ? ? ? ? ? ? ? 'gui_Callback', ? []);if nargin && ischar(varargin{1}) ? ?gui_State.gui_Callback = str2func(varargin{1});endif nargout ? ?[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});else ? ?gui_mainfcn(gui_State, varargin{:});end% End initialization code - DO NOT EDIT% --- Executes just before bp_demo is made visible.function bp_demo_OpeningFcn(hObject, eventdata, handles, varargin)% This function has no output args, see OutputFcn.% hObject ? ?handle to figure% eventdata ?reserved - to be defined in a future version of MATLAB% handles ? ?structure with handles and user data (see GUIDATA)% varargin ? command line arguments to bp_demo (see VARARGIN)% Choose default command line output for bp_demohandles.output = hObject;% Update handles structureguidata(hObject, handles);% UIWAIT makes bp_demo wait for user response (see UIRESUME)% uiwait(handles.figure1);% --- Outputs from this function are returned to the command line.function varargout = bp_demo_OutputFcn(hObject, eventdata, handles) % varargout ?cell array for returning output args (see VARARGOUT);% hObject ? ?handle to figure% eventdata ?reserved - to be defined in a future version of MATLAB% handles ? ?structure with handles and user data (see GUIDATA)% Get default command line output from handles structurevarargout{1} = handles.output;function t_sim_Callback(hObject, eventdata, handles)% hObject ? ?handle to t_sim (see GCBO)% eventdata ?reserved - to be defined in a future version of MATLAB% handles ? ?structure with handles and user data (see GUIDATA)% Hints: get(hObject,'String') returns contents of t_sim as text% ? ? ? ?str2double(get(hObject,'String')) returns contents of t_sim as a double% --- Executes during object creation, after setting all properties.function t_sim_CreateFcn(hObject, eventdata, handles)% hObject ? ?handle to t_sim (see GCBO)% eventdata ?reserved - to be defined in a future version of MATLAB% handles ? ?empty - handles not created until after all CreateFcns called% Hint: edit controls usually have a white background on Windows.% ? ? ? See ISPC and COMPUTER.if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) ? ?set(hObject,'BackgroundColor','white');end% --- Executes on button press in train_button.function train_button_Callback(hObject, eventdata, handles)% hObject ? ?handle to train_button (see GCBO)% eventdata ?reserved - to be defined in a future version of MATLAB% handles ? ?structure with handles and user data (see GUIDATA)warning offglobal net P_train T_train N Epochs Show Goal Lr fcn_hidden fcn_output fcn_learn% default valueN=10;Epochs=1000;Show=10;Goal=1e-3;Lr=0.01;fcn_hidden='tansig';fcn_output='purelin';fcn_learn='trainlm';% create neural networknet=newff(minmax(P_train),[N size(T_train,1)],{fcn_hidden,fcn_output},fcn_learn);net.trainParam.epochs=Epochs;net.trainParam.show=Show;net.trainParam.goal=Goal;net.trainParam.lr=Lr;net.trainParam.showwindow=0;[net,tr]=train(net,P_train,T_train);% show waitbarperf=tr.perf;perf_t=abs(perf(2:end)-perf(1))/(perf(1)-perf(end));h=waitbar(0,'please wait.......');for i=1:length(perf_t) ? ?waitbar(perf_t(i));endclose(h);

3 運行結(jié)果

4 參考文獻(xiàn)

[1]高寧. 基于BP神經(jīng)網(wǎng)絡(luò)的農(nóng)作物蟲情預(yù)測預(yù)報及其MATLAB實現(xiàn). Diss. 安徽農(nóng)業(yè)大學(xué).

博主簡介:擅長智能優(yōu)化算法、神經(jīng)網(wǎng)絡(luò)預(yù)測、信號處理、元胞自動機、圖像處理、路徑規(guī)劃、無人機等多種領(lǐng)域的Matlab仿真,相關(guān)matlab代碼問題可私信交流。

部分理論引用網(wǎng)絡(luò)文獻(xiàn),若有侵權(quán)聯(lián)系博主刪除。




【BP預(yù)測】基于BP神經(jīng)網(wǎng)絡(luò)實現(xiàn)數(shù)據(jù)預(yù)測含Matlab源碼的評論 (共 條)

分享到微博請遵守國家法律
深水埗区| 岳阳县| 米脂县| 高淳县| 滦南县| 张家川| 淳化县| 平果县| 桐庐县| 游戏| 乌恰县| 延长县| 佛冈县| 泰和县| 土默特左旗| 呼伦贝尔市| 五原县| 聂拉木县| 新龙县| 西和县| 保康县| 东山县| 桑植县| 留坝县| 孟村| 安图县| 四川省| 宝兴县| 饶河县| 蛟河市| 合阳县| 收藏| 维西| 科尔| 博爱县| 广东省| 阜康市| 湘阴县| 合川市| 崇仁县| 铁岭市|