Ha! Just tested it; turns out on say 20 items of data (taken from google finance) its got an average accuracy of 60% but for larger data sets its down at 35%... Also; any ideas on improving it but keeping the idea the same would be much appreciated! Cheers
Predicting change in data using a probabilistic method...
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Ok guys / girls - Very coarse way of predicting a change in data; the idea of the algorithm is to register a counter value when it thinks there will be a change in the direction of data. The code is below;
function [output] = analyseTrends(data,threshold)
%%Check for a threshold
if (isempty(threshold) == 1)
threshold = 0.3;
end
%%Generate information about the data
L = length(data);
dfdt = gradient(data);
dd = sign(dfdt);
%%Initialie Variables
store = [];
test = 'true';
i = 1;
succession_count = 0;
probability = 0;
%%Calculate a probability of change in the direction of data
for i = 2 : L;
if (dd(i) ~= dd(i-1))
probability = 0;
succession_count = 0;
else
succession_count = succession_count + 1;
if (succession_count == 1);
probability = 0.25;
elseif (succession_count == 2);
probability = 0.85;
elseif (succession_count == 3);
probability = 0.95;
elseif (succession_count == 4);
probability = 0.20;
else
...
end
end
if (rand(1) <= probability)
store = [store;i];
probability = 0;
succession_count = 0;
else
...
end
end
output{1} = store;
output{2} = dd;
end
If you then look at output{1} and output{2} we can see output{1} is the point at which the counter is registered, and output{2} is the sign of the gradients between each point. Okay my question is this: is the value being stored in output{1} the index before the change in sign of the gradients e.g:
output{1} = [3 5]
output{2} = [1 1 1 -1 -1 1]
I hope you understand the question!
Respuestas (0)
Ver también
Categorías
Más información sobre Descriptive Statistics and Visualization en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!