Page 1 of 1

ClaSp

Posted: Thu Apr 21, 2022 12:22 pm
by wind121
hello,
I want to add a max gap constraint to the clasp algorithm implemented in SPMF to limit the distance between two items, but I don't know how to do it, or I haven't succeeded yet. could someone give me some ideas?

Re: ClaSp

Posted: Sun Apr 24, 2022 12:54 am
by admin
Good morning,

Sorry for the delay to answer. Been a bit busy.

I had a look at the code of ClaSP.

I think the main modifications would have to be done to the method dfsPruning() located in the file FrequentPatternEnumeration_ClaSP of the package
ca.pfv.spmf.algorithms.sequentialpatterns.clasp_AGP.

This method is the one who is doing the depth first search. So in this method, you could add the code to avoid doing an s-extension if the gap is too big.

In particular, after a quick look, I think this is the lines for the s-extension:

Code: Select all

     int sequenceExtensionSize = new_sequenceExtension.size();
        //For all the elements valuables as future s-extensions
        for (int i = 0; i < sequenceExtensionSize; i++) {
            //we get the new pattern and the nodeTrie associated with it
            Pattern newPattern = newPatterns.get(i);
            TrieNode nodeToExtend = newNodesToExtends.remove(0);

            Item last = newPattern.getIthElement(newPattern.size() - 1).getItem(); // PFV 2013

            /* And we make a recursive call to dfs_pruning with the new sequence 
             * extension. Besides we establish the same set as the set which we will
             * make the i-extensions, but beginning from the (i+1)-th element
             */
            exploreChildren(newPattern, nodeToExtend, new_sequenceExtension, new_sequenceExtension, i + 1, coocMapAfter, coocMapEquals, last);
        }
So you would probably have to add something around that place in the code.

Hope that this help you to get started.

Re: ClaSp

Posted: Sun Apr 24, 2022 2:10 pm
by wind121
Thank you for your reply in your busy schedule.

Re: ClaSp

Posted: Sat May 28, 2022 5:13 pm
by Lucy
Could we also apply the CLASP algorithm for the graph data mining?

Re: ClaSp

Posted: Fri Jun 03, 2022 10:07 am
by Ndrez
wind121 wrote: Thu Apr 21, 2022 12:22 pm hello,
I want to add a max gap constraint to the clasp algorithm implemented in SPMF to limit the distance between two items, but I don't know how to do it, or I haven't succeeded yet. could someone give me some ideas?
Hi,
since I am facing a similar problem, did you manage to modify the algorithm adding the max gap constraint?
Thanks.