You don't need JLink for this, because MINE program (Java version) seems to not be able to transmit the results by any data transfer protocol. Rather, you launch it from the command line, as a Java executable (jar file). It takes the name of the input data file as one of the command line parameters, and it writes its output into another file.
I will illustrate the steps needed to run it from Mathematica on Win7, but they should be similar on other systems.
1.Download MINE.jar and an example file (say Spellman.csv), and save them in some directory. I saved them in a directory C:\Temp\MINE
2.Find out the location of the Java runtime coming with Mathematica. One way to do this is to run
Needs["JLink`"]
InstallJava[]
(*
-->
LinkObject["C:\Program Files\Wolfram Research\Mathematica\8.0\SystemFiles\Java\
Windows-x86- 64\bin\javaw" -classpath ..."]
*)
3.Define these directories:
$MINEDir = "C:\\Temp\\MINE";
$JavaDir = "C:\\Program Files\\Wolfram Research\\Mathematica\\8.0\\SystemFiles
\\Java\\Windows-x86-64\\bin";
4.Set the current directory to be the one with Java installation:
SetDirectory[$JavaDir]
5.Run this command (for example - this corresponds to an example they show):
stringify[s__String] := StringJoin["\"", s, "\""]
Run@StringJoin[
"javaw -jar ",
stringify@FileNameJoin[{$MINEDir, "MINE.jar"}],
" ",
stringify@FileNameJoin[{$MINEDir, "Spellman.csv"}],
" 0 cv=0.7"
]
In practice, the string with parameters you will build dynamically, from the parameter values, of course. Since I don't have a good grasp on possible parameters and their values, I refrained from implementing this, but this is straightforward to do. Note that stringify
is only needed for Windows (probably), to prevent the Windows shell from mis-interpreting spaces. It should return 0 if executed correctly, and you should also see a command-line window popping up and floating for a second or two, that it takes to compute.
6.This shows the data files:
In[8]:= (dataFiles = FileNames["*.csv",{$MINEDir}])//InputForm
Out[8]//InputForm=
{"C:\\Temp\\MINE\\Spellman.csv",
"C:\\Temp\\MINE\\Spellman.csv,mv=0,cv=0.7,B=n^0.6,Results.csv"}
The first one is the original data set. The last one contains the results. It should be possible to automate the identification of which is which.
7.Import the results:
In[9]:= Import["C:\\Temp\\MINE\\Spellman.csv,mv=0,cv=0.7,B=n^0.6,Results.csv"]//Short[#,3]&
Out[9]//Short= {{X var,Y var,MIC (strength),MIC-p^2 (nonlinearity),MAS (non-monotonicity),
MEV (functionality),MCN (complexity),Linear regression (p)},<<4380>>,{time,<<6>>,0.00775905}}
It should be possible to automate all that, this is just to show the basic steps. I must add that the program does not contain an awful lot of documentation, so figuring out the parameters etc may be not completely trivial.