Answer the question
In order to leave comments, you need to log in
How to write or in what direction to dig an algorithm in C ++?
There is a large array of data, and they can be stored in any form, both in a TXT file and in a MySQL database for speed. The data are minute-by-minute measurements and look like this:
02/15/2016/18:49 13
02/15/2016/18:48 10
02/15/2016/18:47 11
02/15/2016/18:46 9
02/15/2016/18:45 27
. ..and so on, sorted by recording date, in descending order.
It is necessary to find similar sequences from previously saved data, and in this case, the sequence is understood to be more than two records in a row, and the better the match, the better it is considered. The similarity should not be 100% match, but the similarity coefficient should be as large as possible.
Perhaps somewhat chaotically, written, ready to answer comments
Answer the question
In order to leave comments, you need to log in
Algorithm . In fact, the standard deviation is used there.
Only you have to write a loop like:
for count = минимальное количество данних для кореляции
to максимальное количество данних для кореляции
for i = 0 to length(DataArray) - count
correlationList.append(caclCorrelation(DataArray, i, count)
dataCountCoeficient = 0.001 // 0.1%
needAccuracy = 0.01 // 1%
oldResult = calcCorrelation(dataCountCoeficient / 2);
newResult = calcCorrelation(dataCountCoeficient)
while Abs(oldResult - newResult) / Max(Abs(OldResult), Abs(NewResult)) > needAccuracy do
dataCountCoeficient *= 2
oldResult = newResult
newResult = calcCorrelation(dataCoutCoeficient)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question