Due to recent updates, all users are required to create an Altair One account to login to the RapidMiner community. Click the Register button to create your account using the same email that you have previously used to login to the RapidMiner community. This will ensure that any previously created content will be synced to your Altair One account. Once you login, you will be asked to provide a username that identifies you to other Community users. Email us at Community with questions.

"How using NumericalMatrix in groovy"

sjasja Member Posts: 2 Contributor I
edited May 2019 in Help
Hello,

I've written a groovy script to calculate a new matix from an exampleSet.

import com.rapidminer.operator.visualization.dependencies.NumericalMatrix;
import Jama.Matrix;

ExampleSet exampleSet = operator.getInput(ExampleSet.class);

double[][] data = new double[exampleSet.size()][exampleSet.getAttributes().size()];
int r = 0;
numberOfColumns = exampleSet.getAttributes().size();

String[] columnNames = new String[numberOfColumns];
operator.logNote("nb col"+numberOfColumns);

for (Example example : exampleSet) {
int c = 0;
for (Attribute attribute : exampleSet.getAttributes()) {
columnNames = attribute.getName();
data = example.getValue(attribute);
c++;
}
r++;
}
double[][] cooccMatrixEntries = new double[numberOfColumns][numberOfColumns];

for (int i = 0; i < cooccMatrixEntries.length; i++) {
for (int j = i; j < cooccMatrixEntries.length; j++) {
double cooc = getCooc(data, i, j);
cooccMatrixEntries = cooc;
cooccMatrixEntries = cooc;
}
}

Matrix mcooc = new Matrix(cooccMatrixEntries);
NumericalMatrix nummat = NumericalMatrix("Cooc matrix",columnNames, mcooc, false);

return nummat;
and I've got the following error :
Process failed: The scripting engine Groovy reported an error in the script: groovy.lang.MissingMethodException: No signature of method: Script1.NumericalMatrix() is applicable for argument types: (java.lang.String, [Ljava.lang.String;, Jama.Matrix, java.lang.Boolean).

I don't understand why because I've included
import com.rapidminer.operator.visualization.dependencies.NumericalMatrix;

Thanks for your help.

Steph

Tagged:

Answers

  • steffensteffen Member Posts: 347 Maven
    Hello Steph

    Finally a meaningful precise problem description  ;D

    My attempt to run the script failed because the method getCooc(...) was not available. So here is only a guess regarding your error:
    The word "new" is missing in the third-last line, hence the interpreter "thinks" that NumericalMatrix is the name of a method instead of a constructor.

    hope this was helpful,

    steffen
  • sjasja Member Posts: 2 Contributor I
    Hello,

    thanks for your help,

    It works now and it was a very stupid error.

    Steph.
Sign In or Register to comment.