pommedeterresautee / spmf

Association rules library + wrapper to call it from R
http://www.philippe-fournier-viger.com/spmf/index.php
GNU General Public License v3.0
22 stars 11 forks source link

Link FP-Growth-with-string algorithm with R #1

Open Manal4 opened 7 years ago

Manal4 commented 7 years ago

I use rJava to call a java code from R, trying to call an algorithm from SPMF tool. I tried to use a wrapper function, but this did not work with the SPMF code.

this is my R code:

       library(rJava)
      .jinit()
      .jaddClassPath ( "C:/mydrive/eclipse-workspace/myfile/src")
      print(.jclassPath())
      obj <- .jnew("AlgoFPGrowth_Strings")
      s <- .jcall(obj, returnSig= "V", method="runAlgorithm", 
      "input.csv","output.txt") ,  0.4 ) 

it gives me an error ,method runAlgorithm with signature (D)V not found

this is the main in java:

       public static void main(String[] args) throws Exception {
       AlgoFPGrowth_Strings fpwindow=new AlgoFPGrowth_Strings();
      String input="input.csv";
      String output="output.txt";
      double minsupp = 0.4; 
      fpwindow.runAlgorithm( input,  output,  minsupp);
      fpwindow.printStats();
       }

I tried to change returnSig value into S and Ljava/lang/String; but I got the same error, could not find the method

when I apply the code on different java code with simple method it works. Some one advised me to look at this R interface but I could not understand how can I use it.

Is there any explanation to this interface please?

Manal4 commented 7 years ago

I applied AnalyseFP which proposed as wrapper function, but the problem it does not work probably with FPGrowth with Strings , it does not extract any pattern while the original FPGrowth_with string in SPMF tool can extract these patterns