"Subodh Paudel" <firstname.lastname@example.org> wrote in message <email@example.com>... > Hai All, > I want to forecast the building energy demand: input parameters: outside temperature and solar radiation, and output parameter: energy consumption > > I am choosing 2 layered network. I have a 1826 samples. My R2 value is in negative and i am not finding the solution of it? Please, could you help me. > > The data size consists all inputs and targets in column vector.
[ I N ] = size( input ) % [ 2 1826 ] [ O N ] = size( target ) % [ 1 1826 ]
>I have used 70% samples for the generalization and 30% for prediction.
total = design + test design = train + validation
> The souce code is given: > > data=xlsread('z:\testdata.xlsx','Sheet1') > %Size of input and Target Layers I:Input Layer, O:Output Layer,
Official Terminology: 2 layers of Hidden and Output neurons. Input elements are fan-in units and NOT neurons. The unmodifed term 'layer' does not apply to inputs. The typical MLP is a 2-layer FFNN.
I don't like this at all. Therefore I only refer to (3) layers of nodes (NOT neurons!). Consequently, since the typical MLP always has a layer of input nodes and a layer of output nodes, I refer to the typical topology as a MLP or FFNN with one hidden layer (of nodes or neurons).
dN=size of > %the data > [dN I]=size(data);
Please remove the "d" it is unnecessary and confusing.
> dNt=round(0.7*dN); %70% of Data Used for the Training and Generalization
Not standard terminology or proceedure Design = Training and Validation Use Validation set iteratively to determine training parameters and choose best of multiple designs. Need a nondesign subset (Test) to predict generalization error. If results are unsatisfactory, need to repeat with a new trn/val/tst data split (i.e., Test set is only used ONCE!)
> input_sample= data((1:dNt),1:2)'; > target_sample=data((1:dNt),3)'; > validation_inputsample=data(((dNt+1):dN),1:2)'; > validation_targetsample=data(((dNt+1):dN),3)'; > > %DataProcessing of Training Sample (normalization with mean 0.1 and 0.9) > [pn,ps]=mapstd(input_sample,0.1,0.9); > [tn,ts]=mapstd(target_sample,0.1,0.9);
No! There is absolutely no good reason to do that! Standarization means zero-mean/unit-variance.
> %Apply Normalization to the Validation Input Sample > an=mapstd('apply',validation_inputsample,ps); > > %Iterative Optimization wrt to RMSE to determine Hidden Neurons:hidden_node,
Use dimensionless NMSE = MSE/MSE00 (MSE00 = mean(var(target',1)) ) instead of scale dependent RMSE. Then coefficient of determination (i.e., R^2) is given by R2 =1-NMSE.