🎉Community Raffle - Win $25

An exclusive raffle opportunity for active members like you! Complete your profile, answer questions and get your first accepted badge to enter the raffle.
Join and Win

"How using NumericalMatrix in groovy"

User: "sja"
New Altair Community Member
Updated by Jocelyn
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

Find more posts tagged with

Sort by:
1 - 2 of 21
    User: "steffen"
    New Altair Community Member
    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
    User: "sja"
    New Altair Community Member
    OP
    Hello,

    thanks for your help,

    It works now and it was a very stupid error.

    Steph.