Grammarviz GUI data Motif Discovery

27 views
Skip to first unread message

somil miglani

unread,
Mar 5, 2015, 12:58:16 PM3/5/15
to jmotif-...@googlegroups.com
Hi all,

I came across this tool recently which I want to use in my research. I am trying to find typical patters in a cloud cover time series.

I was successful to run the GUI of grammarviz and see the patterns and their frequency. I want to get the locations (range from start point to end point) so that I can extract that motif from the original time series.

Is there is way to do this?

If not how can I do it in JAVA, using the jar file generated. I saw the wiki on motif discovery but it uses some dependencies which i cannot find anywhere. for instance readTSdata() function.

Any help is appreciated.

Cheers
Somil

Pavel Senin

unread,
Mar 5, 2015, 1:09:53 PM3/5/15
to jmotif-discuss

Hi Somil, did you get the code from github? If not, you shall use of that one. If github code doesn't work for you, shoot me an email, we'll figure that out.

Thanks!

--
You received this message because you are subscribed to the Google Groups "jmotif-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jmotif-discus...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

somil miglani

unread,
Mar 6, 2015, 8:27:41 AM3/6/15
to jmotif-...@googlegroups.com
Hi 

Thanks for your response! I downloaded the code from github https://github.com/GrammarViz2/grammarviz2_src

Does the GUI yield any data or is it only for visualisation purposes? Can you tell me a way to do it using the jar file? I went through the jar file but could not find the classes used in the wiki tutorial. 


Thanks a lot 
Somil 

Pavel Senin

unread,
Mar 6, 2015, 9:57:15 AM3/6/15
to jmotif-discuss
Nice!

So there is no API at the moment there. Sorry! You would need to instrument few classes to get the data you need printed out or saved into a file. 

Fork and checkout the repo, make sure you can build it, then there is a class <https://github.com/GrammarViz2/grammarviz2_src/blob/master/src/edu/hawaii/jmotif/discord/GrammarVizDiscord.java> and method called findSaxSequitur  which you can use as a template for your code. Once you do something nice, make a pull request, so others can use it too!

Here is a code piece which I copy/pasted into here, to illustrate the idea. So you get the rules calling SequiturFactory  and then iterate over their corresponding intervals (for (RuleInterval ri : rule.getRuleIntervals())) printing their locations:

GrammarRules rules = SequiturFactory.series2SequiturRules(ts, windowSize, paaSize,
        alphabetSize, NumerosityReductionStrategy.EXACT, 0.05D);

    ArrayList<RuleInterval> intervals = new ArrayList<RuleInterval>();

    // populate all intervals with their frequency
    //
    for (GrammarRuleRecord rule : rules) {
      //
      // TODO: do we care about long rules?
      //
      // if (0 == rule.ruleNumber() || rule.getRuleYield() > 2) {
      if (0 == rule.ruleNumber()) {
        continue;
      }
      for (RuleInterval ri : rule.getRuleIntervals()) {
        ri.setCoverage(rule.getRuleIntervals().size());
        ri.setId(rule.ruleNumber());
        intervals.add(ri);
      }
    }





--
Mahalo, Pavel.
Reply all
Reply to author
Forward
0 new messages