I'm quite weak in math so I hope you don't mind that I'll try to fully describe how I think when solving this (I think easy) problem. Please tell me if I made some totally invalid assumptions.
I have some data - a slope of a linear regression curve of a price of a particular commodity in stock exchange.
This is the data plot.
data = importdata('E:\data.txt'); plot(data);
These data are used as the training data for a neural network. And since the NN uses tanh as the activation function, I need to rescale these data to the range -1 to 1. I've managed to do that.
dmin = min(data); dmax = max(data); dataScaled = ((data-dmin)./(dmax-dmin) - 0.5 ) *2;
And the plot of the scaled data:
This plot is wrong though, the linear regression slope by nature oscilates around 0, scaling by the maximum and minimum shifted the oscilation center down because the maximum and minimum values were different.
So I looked at the maximum and minimum and saw this.
dmax = 3.7348 dmin = -1.8465
I told myself that I cannot rescale by asymetric minimum and maximum...so I thought I'll take the one furthest away from zero and use that with opposite sign for the second value.
Since |dmax| > |dmin| then
dmin = -dmax;
Now that both values are the same distance from zero, I'm going to rescale by that and hopefuly the rescaled values will oscillate around zero.
dataScaled = ((data-dmin)./(dmax-dmin) - 0.5 ) *2; plot(dataScaled);
And now the problem.
The standard deviation of the scaled data is 0.0553 - that's very wrong (I discovered that in my previous question here). My neural network is not learning anything becuase the standard values are pushed near zero. Well, I guess the NN is learning something but on a scale so small that it makes working with the neural network difficult (at least difficult for me).
So I thought I have to ...somehow rescale it, logarithmically, in a way that the logarithm is going from 0 to positive values the same way it goes from 0 to negative values.
The standard deviation is 0.0553 ... so most values oscillate between -0.0553 to 0.0553.
I'd like to convert the vector in a way that the oscillation from -0.0553 to 0.0553 stretches to the range, say, -0.8 to 0.8 - I'd like to test more ranges to see which one I like the most - and values above or below the standard deviation are compressed. How do I do that in matlab?
Does my question make sense? Just tell me and I'll be hopefully able to rephrase it.
Just read from "And now the problem".