Closed Maryam0101 closed 3 years ago
Hi,
'CrossValidation' is used only if 'SVM' is used as a classification and the hyper-parameters of SVM is specificed for grid search. For instance:
tscu(trn,tst,'CrossValidation',2,'Classifier','SVM','SVMKernel','gaussian','SVMGamma',[3,4])
Here the two alternative values for 'SVMGamma' are specified: 3 and 4. TSCU uses a grid-search strategy and this means that it tries 3 and 4. For each trial, it uses svmtrain to calculate the performance of the parameters. At this point 'CrossValidation' parameter is fed into svmtrain. And svmtrain gives an average accuracy of all folds. In some sense, it provides a generalization capability of the model.
Now your question:
If you want to use leave-one-out strategy, then you should set 'CrossValidation' == number of training samples.
P.S. I made some minor modifications to tscu.m regarding CrossValidation. Can you refresh your working copy?
Best
Dear Sir, The codes run perfectly, Sir! A million thanks for your super fast response. I do appreciate it. :-)
To set 'CrossValidation' == number of training samples, in which part have I set it?
Warm Regards
Hello Dear Sir, if I want to modify DTW in order to reduce the a point in time series X links many times to a point in time series Y (Pathological alignment) by defined a constraint as bellow:
a. if the minimum cost come from left or up, we add the distance (dis(X([i], Y[j]) with a positive value C=min(i,j)/2*max(i,j). as a result, cost[k] will bigger than the real cost, then, this point will be abandoned to reused again via minimization. thus, this adaptive cost DTW controls the extreme situation of many-to-one or one-to many.
so, to do that, i change line 83-91 tscu_dtw.c / Classic DTW calculation / cost[k] = min( min( x, y) , z) + dist(A[i], B[j]); / Let's store the path information / if (x <= min(y, z)) trace[i][k]= 2; / up / else if (y <= min(x, z)) trace[i][k]=0; / left / else trace[i][k]=1; / diag /
become this
if (cost[k-1]==min(min(cost[k-1],cost_prev[k+1]), cost_prev[k]))
cost[k] = cost[k-1]+ sqrt((min(i,j)/(2*max(i,j)))*(dist(A[i], B[j])));
trace[i][k]=0; /* left */
if (cost_prev[k+1]==min(min(cost[k-1],cost_prev[k+1]), cost_prev[k]))
cost[k] = cost_prev[k+1]+ sqrt((min(i,j)/(2*max(i,j)))*(dist(A[i], B[j])));
trace[i][k]= 2; /* up */
if (cost_prev[k]==min(min(cost[k-1],cost_prev[k+1]), cost_prev[k]))
cost[k] = cost_prev[k]; + dist(A[i], B[j]);
trace[i][k]=1; /* diag */
after i compile the modif file using comand mex tscu_mdtw.c (i change the name dtw ->mdtw) i got an error
mex tscu_mdtw.c Building with 'MinGW64 Compiler (C)'. Error using mex E:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot export mexFunction: symbol not defined collect2.exe: error: ld returned 1 exit status
would you please sir correct me!! your correction means so important to me
warm regards maryam
I couldn't understand your algorithm but it is not important. Someshow you want to modify tscu_dtw.c and derive a new method. Ok. First of all, you should rule out MEX related problems. Can you compile tscu_dtw.c (unmodified version) with "mex tscu_dtw.c"? If not then you have a problem in your MEX environment. You should first solve this. If you can compile tscu_dtw.c but not tscu_mdtw.c then your additions somehow ruin the compile process. When I look at your if statements, I see that you don't use curly braces "{ }" So your if statements may not work as you planned.
On Thu, Nov 26, 2020 at 12:03 PM Maryam0101 notifications@github.com wrote:
Hello Dear Sir, if I want to modify DTW in order to reduce the a point in time series X links many times to a point in time series Y (Pathological alignment) by defined a constraint as bellow:
a. if the minimum cost come from left or up, we add the distance (dis(X([i], Y[j]) with a positive value C=min(i,j)/2*max(i,j). as a result, cost[k] will bigger than the real cost, then, this point will be abandoned to reused again via minimization. thus, this adaptive cost DTW controls the extreme situation of many-to-one or one-to many.
so, to do that, i change line 83-91 tscu_dtw.c /* Classic DTW calculation
/ cost[k] = min( min( x, y) , z) + dist(A[i], B[j]); / Let's store the path information
/ if (x <= min(y, z)) trace[i][k]= 2; / up
/ else if (y <= min(x, z)) trace[i][k]=0; / left
/ else trace[i][k]=1; / diag */
become this
if (cost[k-1]==min(min(cost[k-1],cost_prev[k+1]), cost_prev[k])) cost[k] = cost[k-1]+ sqrt((min(i,j)/(2*max(i,j)))*(dist(A[i], B[j]))); trace[i][k]=0; /* left */ if (cost_prev[k+1]==min(min(cost[k-1],cost_prev[k+1]), cost_prev[k])) cost[k] = cost_prev[k+1]+ sqrt((min(i,j)/(2*max(i,j)))*(dist(A[i], B[j]))); trace[i][k]= 2; /* up */ if (cost_prev[k]==min(min(cost[k-1],cost_prev[k+1]), cost_prev[k])) cost[k] = cost_prev[k]; + dist(A[i], B[j]); trace[i][k]=1; /* diag */
after i compile the modif file using comand mex tscu_mdtw.c (i change the name dtw ->mdtw) i got an error
mex tscu_mdtw.c Building with 'MinGW64 Compiler (C)'. Error using mex
E:/TDM-GCC-64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot export mexFunction: symbol not defined collect2.exe: error: ld returned 1 exit status
would you please sir correct me!! your correction means so important to me
warm regards maryam
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/hkayabilisim/TSCU/issues/9#issuecomment-734168944, or unsubscribe https://github.com/notifications/unsubscribe-auth/AATGBY34KUVRUP5YJL2RCGTSRYKXRANCNFSM4UBSF4TQ .
Thank you Dear Sir.
Hello Dear Sir! I was so lucky when i found your github page and found awesome TSCU. It is very help me to understand how time series classification goes through. When i tried to run tscu(Trn,Tst, 'DTW', 'KNN') i got this Size of training set.....................: 30 Size of testing set......................: 30 Time series length.......................: 570 Classification method....................: K-NN Alignment method.........................: DTW Displaying input data....................: no No cross-validation is chosen............: 0
anyway Sir, if i want to apply LOOV, what command I should type on command window?
Warm Regards Me