应用了归一化的预测

本文介绍了一种利用归一化技术进行预测的方法,并通过premnmx和postmnmx函数实现了数据预处理与反归一化的过程。通过创建神经网络并对训练数据进行归一化处理,使得输入和目标值范围限定在[-1,1]之间,从而提高了模型的预测精度。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

应用了归一化的预测,在归一化的过程中使用了premnmx和postmnmx,并在最后给出了这两个函数的应用情况。

%应用了归一化的预测 clc; clear; originalData=rands(20,14); inputSampledata=originalData'; outputData=rands(20,1); outputSampledata=outputData'; % creating neural network and setting trainging parameters gwwnet=newff(minmax(inputSampledata),[4,1],{'tansig','purelin'},'traingdm'); gwwnet.trainParam.show = 50; gwwnet.trainParam.lr = 0.05; gwwnet.trainParam.epochs = 5000; gwwnet.trainParam.goal = 1e-3; [input,mininput,maxinput,output,minoutput,maxoutput] = premnmx(inputSampledata,outputSampledata); % Preprocess data so that minimum is -1 and maximum is 1 % % Examples % % Here is the code to normalize a given data set so that the inputs % and targets will fall in the range [-1,1]. % p = [-10 -7.5 -5 -2.5 0 2.5 5 7.5 10]; % t = [0 7.07 -10 -7.07 0 7.07 10 7.07 0]; % [pn,minp,maxp,tn,mint,maxt] = premnmx(p,t); % % If you just want to normalize the input, [pn,minp,maxp] = premnmx(p); % % Algorithm % pn = 2*(p-minp)/(maxp-minp) - 1; [gwwnet,tr]=train(gwwnet,input,output); y=sim(gwwnet,input); %data offset (converting the network output data to it original unit) nnoutput = postmnmx(y,minoutput,maxoutput); % % Postprocess data that has been preprocessed by premnmx % Syntax % % [P,T] = postmnmx(PN,minp,maxp,TN,mint,maxt) % [p] = postmnmx(PN,minp,maxp) % Description % % postmnmx postprocesses the network training set % that was preprocessed by premnmx. It converts the data % back into unnormalized units. % postmnmx takes these inputs, % PN -- R x Q matrix of normalized input vectors % minp -- R x 1 vector containing minimums for each P % maxp -- R x 1 vector containing maximums for each P % TN -- S x Q matrix of normalized target vectors % mint -- S x 1 vector containing minimums for each T % maxt -- S x 1 vector containing maximums for each T % and returns, % P -- R x Q matrix of input (column) vectors % T -- R x Q matrix of target vectors % Examples % % In this example we normalize a set of training data with premnmx, % create and train a network using the normalized data, simulate the network, % unnormalize the output of the network using postmnmx, % and perform a linear regression between % the network outputs (unnormalized) and the targets % to check the quality of the network training. % p = [-0.92 0.73 -0.47 0.74 0.29; -0.08 0.86 -0.67 -0.52 0.93]; % t = [-0.08 3.4 -0.82 0.69 3.1]; % [pn,minp,maxp,tn,mint,maxt] = premnmx(p,t); % net = newff(minmax(pn),[5 1],{'tansig' 'purelin'},'trainlm'); % net = train(net,pn,tn); % an = sim(net,pn); % [a] = postmnmx(an,mint,maxt); % [m,b,r] = postreg(a,t); % % Algorithm % p = 0.5(pn+1)*(maxp-minp) + minp; %plot time=1:1:20; plot(time,outputSampledata,'-v',time,nnoutput,'o'); legend('actual output','NN output'); xlabel('time');ylabel('Learning fitting curve'); %scenario1 forecasting process column=10; for i=1:column; SceInput(1,i)=inputSampledata(1,20)*(1.0464^i); SceInput(2,i)=inputSampledata(2,20)*(1.0631^i); SceInput(3,i)=inputSampledata(3,20)*(1.0872^i); SceInput(4,i)=inputSampledata(4,20)*(1.2044^i); SceInput(5,i)=inputSampledata(5,20)*(1.2326^i); SceInput(6,i)=inputSampledata(6,20)*(1.0605^i); SceInput(7,i)=2*(1.01^i); SceInput(8,i)=42*(1.02^i); SceInput(9,i)=inputSampledata(9,20)*(1.1426^i); SceInput(10,i)=inputSampledata(10,20)*(1.017^i); SceInput(11,i)=inputSampledata(11,20)*(1.0205^i); SceInput(12,i)=inputSampledata(12,20)*(1.1336^i); SceInput(13,i)=inputSampledata(13,20)*(1.1599^i); SceInput(14,i)=inputSampledata(14,20)*(1.1783^i); end for j=1:20; for i=1:14; recalldata(i,j)=inputSampledata(i,j); end end for j=21:30; for i=1:14; recalldata(i,j)=SceInput(i,j-20) end end [alterinput,mininput,maxinput] = premnmx(recalldata); %training fvalue=sim(gwwnet,alterinput); %data offset (converting the network output data to it original unit) forecastvalue = postmnmx(fvalue,minoutput,maxoutput); %plot % waitforbuttonpress; % % Wait for key or mouse button press % Syntax % k = waitforbuttonpress % % Description % % k = waitforbuttonpress blocks the caller's execution stream % until the function detects that the user has pressed a mouse button % or a key while the figure window is active. The function returns 0 % if it detects a mouse button press 1 if it detects a key press % % Example % % These statements display text in the Command Window % when the user either clicks a mouse button or % types a key in the figure window: % w = waitforbuttonpress; % if w == 0 % disp('Button press') % else % disp('Key press') % end % clf; figure; time1=1:1:30; time2=1:1:20; plot(time1,forecastvalue,'r-',time2,outputSampledata,'-'); legend('预测曲线','实际曲线'); title('曲线'); xlabel('时间');ylabel('量'); %%%%%%%premnmx及postmnmx使用说明 % clc; % clear; % p = [1 2 3 4; % 5 6 8 9 ]; % [p1 pmin pmax]=premnmx(p); % p2=postmnmx(p1,pmin,pmax); % p1 % pmin % pmax % p2 % % p1 = % % -1.0000 -0.3333 0.3333 1.0000 % -1.0000 -0.5000 0.5000 1.0000 % % % pmin = % % 1 % 5 % % % pmax = % % 4 % 9 % % % p2 = % % 1 2 3 4 % 5 6 8 9

<think>好的,用户想了解预测归一化的方法及应用。首先,我需要确认预测归一化的定义。可能涉及图数据预处理,比如节点特征或边权重的归一化。常见的归一化方法有Min-Max、Z-Score,但图数据可能有特殊性,比如考虑图结构信息。 然后,考虑图神经网络中的归一化方法。比如图卷积网络(GCN)中的层归一化,或者Batch Normalization在图数据中的应用。需要区分不同归一化技术的适用场景,比如节点级别还是图级别。 应用场景方面,可能包括社交网络分析、推荐系统、生物信息学中的蛋白质相互作用预测等。需要结合具体案例说明归一化的作用,比如提升模型训练稳定性或收敛速度。 还要注意用户提到的机器学习数据处理,可能需要涵盖传统方法和深度学习方法。比如,在传统图算法中,归一化如何影响相似性度量;在GNN中,归一化如何防止梯度爆炸或消失。 此外,用户提供的引用中提到了Dremel处理大规模数据集,可能涉及分布式系统中的归一化处理。另外,排名模型的评分函数可能归一化有关联,比如在推荐系统中对图特征进行归一化以提高排序效果。 需要确保回答结构清晰,分点说明方法和应用,并引用相关资料。例如,引用[^1]提到的大规模数据处理,可以关联到图数据归一化的分布式计算方法。引用[^3]的排名模型可能图节点排序的应用相关。 最后,生成相关问题,引导用户深入思考,如不同归一化方法的比较、具体应用中的挑战等。</think>### 预测归一化的方法及应用 预测归一化(Graph Normalization)是图数据处理和机器学习中的关键技术,主要用于解决图结构数据的异质性问题(如节点特征尺度差异、图规模不一致等),以提高模型的训练稳定性和泛化能力。以下是其核心方法典型应用场景: --- #### **一、方法** 1. **节点特征归一化** - **Min-Max归一化**:将节点特征缩放到固定区间(如$[0,1]$),公式为: $$ x_{\text{norm}} = \frac{x - x_{\min}}{x_{\max} - x_{\min}} $$ 适用于消除特征量纲差异[^1]。 - **Z-Score标准化**:对节点特征进行均值-方差标准化,公式为: $$ x_{\text{norm}} = \frac{x - \mu}{\sigma} $$ 适用于特征分布近似高斯的情况。 2. **图结构归一化** - **邻接矩阵归一化**:在图卷积网络(GCN)中,常对邻接矩阵$A$进行对称归一化,例如: $$ \tilde{A} = D^{-\frac{1}{2}} (A + I) D^{-\frac{1}{2}} $$ 其中$D$为度矩阵,$I$为单位矩阵,用于平衡节点度数的影响[^3]。 - **边权重归一化**:对边权重进行归一化(如softmax),使其总和为1,常用于注意力机制(如Graph Attention Networks)。 3. **层级归一化技术** - **图批次归一化(Graph BatchNorm)**:将传统BatchNorm扩展到图数据,对每个图或子图的特征进行归一化。 - **图实例归一化(Graph InstanceNorm)**:针对单个图的特征进行归一化,适用于小批量或动态图场景。 --- #### **二、应用场景** 1. **社交网络分析** - 在用户行为预测中,归一化节点特征(如活跃度、好友数)可提升图神经网络的收敛速度。 2. **推荐系统** - 对用户-物品交互图的边权重归一化,可增强协同过滤算法的鲁棒性,例如在评分预测中平衡不同用户的评分偏好。 3. **生物信息学** - 在蛋白质相互作用预测中,通过归一化节点(蛋白质)的生化属性,减少实验测量误差对模型的影响。 4. **知识图谱嵌入** - 归一化实体和关系的嵌入向量,可提升TransE等模型的训练稳定性,避免梯度爆炸[^2]。 --- #### **三、关键技术挑战** - **动态图处理**:动态变化的图结构需要实时归一化策略。 - **异构图表征**:不同类型的节点/边需设计差异化的归一化方法。 - **大规模图计算**:分布式环境下如何高效实现归一化(如基于Dremel框架的并行处理)。 ---
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值