Pages: [1]
  Print  
Author Topic: NominalTo Numeric  (Read 3170 times)
Jorge
Newbie
*
Posts: 19


« on: December 15, 2008, 12:49:05 PM »

Hi,

I'm trying to do in Java the same that I do in the interface.
But...I don't know how to create and apply the NominalToNumeric preprocessing.

I've a exampleSet and I want to convert it in another exampleSet modified.

Can anyone help me?

Thanks in advance,
Jorge
Logged
Sebastian Land
Administrator
Hero Member
*****
Posts: 2426


« Reply #1 on: December 15, 2008, 01:00:05 PM »

Hi Jorge,
  • use the static method Operator operator = OperatorService.createOperator(..)
  • set the parameters using operator.setParameter(..)
  • create an IOContainer with the exampleSet
  • use the apply method to apply the operator onto the IOContainer

Greetings,
  Sebastian
Logged
Jorge
Newbie
*
Posts: 19


« Reply #2 on: December 15, 2008, 01:14:35 PM »

Hi Sebastian,

but the problem is that...

When I execute this line of my code...

Operator n2n = OperatorService.createOperator(NominalToNumeric.class);

The result is that...

Exception in thread "main" java.lang.NullPointerException
   at com.rapidminer.operator.OperatorCreationException.createMessage(OperatorCreationException.java:69)
   at com.rapidminer.operator.OperatorCreationException.<init>(OperatorCreationException.java:53)
   at com.rapidminer.tools.OperatorService.createOperator(OperatorService.java:567)
   at ProcessCreator.main(ProcessCreator.java:45)

Where's the problem?

Greetings,
Jorge
Logged
Sebastian Land
Administrator
Hero Member
*****
Posts: 2426


« Reply #3 on: December 15, 2008, 03:14:11 PM »

Hi,
did you call RapidMiner.init(..) before?

Greetings,
  Sebastian
Logged
Jorge
Newbie
*
Posts: 19


« Reply #4 on: December 16, 2008, 11:17:07 AM »

Yes,

All works ok except that step


That's my code:

Code:
RapidMiner.init();

Process process = new Process();

try {
Operator inputOperator = OperatorService.createOperator(ArffExampleSource.class);
inputOperator.setParameter("data_file","C:\\provincias.arff");
process.getRootOperator().addOperator(inputOperator);
IOContainer container;
try {
container = inputOperator.apply(new IOContainer());
ExampleSet exampleSet = container.get(ExampleSet.class);


System.out.println("///////////////////////////////////////");
System.out.println("NOW TO NUMERIC");
System.out.println("///////////////////////////////////////");

Operator n2n = OperatorService.createOperator(NominalToNumeric.class);

...
...
...(THE REST OF THE CODE)


Greetings,
Jorge
Logged
Sebastian Land
Administrator
Hero Member
*****
Posts: 2426


« Reply #5 on: December 16, 2008, 02:08:58 PM »

Hi,
could you please post the log message of the rapid miner initialization?

Greetings,
  Sebastian
Logged
Jorge
Newbie
*
Posts: 19


« Reply #6 on: December 16, 2008, 02:14:27 PM »

Hi,
Here you have it...
Code:
G Dec 16, 2008 2:11:13 PM: rapidminer.home is 'C:\eclipse_gan\Workspace\yale'.
G Dec 16, 2008 2:11:13 PM: ----------------------------------------------------
G Dec 16, 2008 2:11:13 PM: Initialization Settings
G Dec 16, 2008 2:11:13 PM: ----------------------------------------------------
G Dec 16, 2008 2:11:13 PM: Default system encoding for IO: windows-1252
G Dec 16, 2008 2:11:13 PM: Load core operators...
G Dec 16, 2008 2:11:13 PM: Load Weka operators: true
G Dec 16, 2008 2:11:13 PM: Load JDBC drivers from lib directory: true
G Dec 16, 2008 2:11:13 PM: Load JDBC drivers from classpath: false
G Dec 16, 2008 2:11:13 PM: Load plugins: true
G Dec 16, 2008 2:11:13 PM: Load plugins from 'C:\eclipse_gan\Workspace\yale\lib\plugins'
G Dec 16, 2008 2:11:13 PM: ----------------------------------------------------
G Dec 16, 2008 2:11:13 PM: Read rcfile 'C:\eclipse_gan\Workspace\yale\etc\rapidminerrc'.
G Dec 16, 2008 2:11:13 PM: Trying rcfile 'C:\eclipse_gan\Workspace\yale\etc\rapidminerrc.Windows XP'...skipped
G Dec 16, 2008 2:11:13 PM: Trying rcfile 'C:\Documents and Settings\jorge.palacio\.rapidminer\4_3_0_rapidminerrc'...skipped
G Dec 16, 2008 2:11:13 PM: Read rcfile 'C:\Documents and Settings\jorge.palacio\.rapidminer\4_3_0_rapidminerrc.Windows XP'.
G Dec 16, 2008 2:11:13 PM: Trying rcfile 'C:\eclipse_gan\Workspace\Reputacion\rapidminerrc'...skipped
G Dec 16, 2008 2:11:13 PM: Trying rcfile 'C:\eclipse_gan\Workspace\Reputacion\rapidminerrc.Windows XP'...skipped
G Dec 16, 2008 2:11:13 PM: Trying rapidminer.rcfile. Property not specified...skipped
G Dec 16, 2008 2:11:13 PM: Loading operators from 'operators.xml'.
G Dec 16, 2008 2:11:19 PM: Loading JDBC driver information from 'etc:jdbc_properties.xml'.
///////////////////////////////////////
NOW TO NUMERIC
///////////////////////////////////////
Exception in thread "main" java.lang.NullPointerException
at com.rapidminer.operator.OperatorCreationException.createMessage(OperatorCreationException.java:69)
at com.rapidminer.operator.OperatorCreationException.<init>(OperatorCreationException.java:53)
at com.rapidminer.tools.OperatorService.createOperator(OperatorService.java:567)
at ProcessCreator.main(ProcessCreator.java:53)

Greetings,
Jorge
Logged
Sebastian Land
Administrator
Hero Member
*****
Posts: 2426


« Reply #7 on: December 16, 2008, 02:36:52 PM »

Hi Jorge,
thank you for this detailed informations. It now was easy to track down the bug occuring only while trying to construct renamed operators. Because of the renaming there is more than one descriptions available. We will remove the bug, but this will last more than a minute.
So I will give you a hint, how to prevent this.
In the ressources directory is a file named operators.xml. Delete the following token:
Code:
  <operator
     name        = "Nominal2Numeric"     
     class       = "com.rapidminer.operator.preprocessing.filter.NominalToNumeric"
     description = "Maps all values to real values (usually simply using the internal indices)."
     deprecation = "Please use the operator 'Nominal2Numerical' instead"
     group       = "Preprocessing.Attributes.Filter.Converter"/>
After saving and probably performing Ant target "Copy-Ressources" your problem should be solved, since the second description isn't present any more.

Greetings,
  Sebastian
Logged
Jorge
Newbie
*
Posts: 19


« Reply #8 on: December 17, 2008, 11:53:49 AM »

Hi Sebastian,

I deleted that token and the error persists...

I tried to redefine the path of the operators.xml and I configured another time the project in eclipse, but the problem doesn't want to go out xD

Another idea?

Thanks for your time,
Jorge
Logged
Sebastian Land
Administrator
Hero Member
*****
Posts: 2426


« Reply #9 on: December 17, 2008, 12:02:50 PM »

Hi,
probably you deleted it in the wrong version. This is always a little bit confusing: There is one version in <eclipseProjectDir>/ressources and one in <eclipseProjectDir>/<buildDir>/ressources. You have to edit the first one and then perform the Ant Target "Copy-Ressources"
Another way around would be to create the Operator using its name, not its class name.

Greetings,
  Sebastian
Logged
Jorge
Newbie
*
Posts: 19


« Reply #10 on: December 18, 2008, 05:31:59 PM »

Thanks for all Sebastian,

The problem was in the "Copy-Resources" target  Wink

It works perfectly now  Grin

Greetings,
Jorge
Logged
Pages: [1]
  Print  
 
Jump to: