"Java application not printing output for RapidMiner Process"

anikanik Member Posts: 2 Contributor I
edited June 12 in Help
I have created one association rule mining process in RapidMiner and calling it from JAVA application.. But, it's not printing any output..But, it's showing "Process finished successfully after 0 s"...

This is what showing in console:
Apr 27, 2015 11:01:56 PM com.rapidminer.tools.I18N <clinit>
INFO: Set locale to en.
Apr 27, 2015 11:01:56 PM com.rapidminer.tools.PlatformUtilities logInfo
INFO: rapidminer.home is 'C:\Program Files\RapidMiner\RapidMiner Studio'.
Apr 27, 2015 11:01:57 PM com.rapidminer.license.ProductConstraintManager initialize
INFO: Initializing license manager.
Apr 27, 2015 11:01:57 PM com.rapidminer.license.ProductConstraintManager initialize
INFO: Using default license location.
Apr 27, 2015 11:01:57 PM com.rapidminer.license.ProductConstraintManager initialize
INFO: Registering default product.
Apr 27, 2015 11:01:58 PM com.rapidminer.tools.plugin.Plugin registerPlugins
INFO: Register plugin: Cloud Connectivity
Apr 27, 2015 11:01:58 PM com.rapidminer.tools.plugin.Plugin registerPlugins
INFO: Register plugin: Cloud Execution
Apr 27, 2015 11:01:58 PM com.rapidminer.tools.plugin.Plugin registerPlugins
INFO: Register plugin: Data Editor
Apr 27, 2015 11:01:58 PM com.rapidminer.tools.plugin.Plugin registerPlugins
INFO: Register plugin: Operator Recommender
Apr 27, 2015 11:01:58 PM com.rapidminer.tools.plugin.Plugin registerPlugins
INFO: Register plugin: Process Scheduling
Apr 27, 2015 11:01:58 PM com.rapidminer.tools.plugin.Plugin registerPlugins
INFO: Register plugin: Social Media
Apr 27, 2015 11:01:58 PM com.rapidminer.tools.plugin.Plugin registerPlugins
INFO: Register plugin: Text Processing
Apr 27, 2015 11:01:58 PM com.rapidminer.tools.config.ConfigurationManager register
INFO: Registered configurator Salesforce Connection.
Apr 27, 2015 11:01:58 PM com.rapidminer.tools.config.ConfigurationManager register
INFO: Registered configurator Amazon S3 Connection.
Apr 27, 2015 11:01:58 PM com.rapidminer.tools.config.ConfigurationManager register
INFO: Registered configurator Dropbox Connection.
Apr 27, 2015 11:01:58 PM com.rapidminer.tools.config.ConfigurationManager register
INFO: Registered configurator Twitter Connection.
Apr 27, 2015 11:01:59 PM com.rapidminer.tools.expression.parser.ExpressionParserFactory <clinit>
INFO: Default version of expression parser registered successfully
Apr 27, 2015 11:02:02 PM com.rapidminer.tools.jdbc.JDBCProperties registerDrivers
INFO: JDBC driver com.mysql.jdbc.Driver not found. Probably the driver is not installed.
Apr 27, 2015 11:02:02 PM com.rapidminer.tools.jdbc.JDBCProperties registerDrivers
INFO: JDBC driver org.postgresql.Driver not found. Probably the driver is not installed.
Apr 27, 2015 11:02:02 PM com.rapidminer.tools.jdbc.JDBCProperties registerDrivers
INFO: JDBC driver net.sourceforge.jtds.jdbc.Driver not found. Probably the driver is not installed.
Apr 27, 2015 11:02:02 PM com.rapidminer.tools.jdbc.JDBCProperties registerDrivers
INFO: JDBC driver org.hsqldb.jdbcDriver not found. Probably the driver is not installed.
Apr 27, 2015 11:02:02 PM com.rapidminer.tools.jdbc.JDBCProperties <init>
WARNING: Missing database driver class name for ODBC Bridge (e.g. Access)
Apr 27, 2015 11:02:02 PM com.rapidminer.tools.jdbc.JDBCProperties registerDrivers
INFO: JDBC driver net.sourceforge.jtds.jdbc.Driver not found. Probably the driver is not installed.
Apr 27, 2015 11:02:02 PM com.rapidminer.tools.jdbc.JDBCProperties registerDrivers
INFO: JDBC driver com.ingres.jdbc.IngresDriver not found. Probably the driver is not installed.
Apr 27, 2015 11:02:02 PM com.rapidminer.tools.jdbc.JDBCProperties registerDrivers
INFO: JDBC driver ca.ingres.jdbc.IngresDriver not found. Probably the driver is not installed.
Apr 27, 2015 11:02:02 PM com.rapidminer.tools.jdbc.JDBCProperties registerDrivers
INFO: JDBC driver oracle.jdbc.driver.OracleDriver not found. Probably the driver is not installed.
Apr 27, 2015 11:02:02 PM com.rapidminer.tools.jdbc.JDBCProperties registerDrivers
INFO: JDBC driver com.microsoft.sqlserver.jdbc.SQLServerDriver not found. Probably the driver is not installed.
Apr 27, 2015 11:02:02 PM com.rapidminer.tools.config.ConfigurationManager loadConfiguration
INFO: Load configuration for Amazon S3 Connection.
Apr 27, 2015 11:02:02 PM com.rapidminer.tools.config.ClientConfigurationManager loadAllParameters
INFO: No configuration file found for Amazon S3 Connection
Apr 27, 2015 11:02:02 PM com.rapidminer.tools.config.ConfigurationManager loadConfiguration
INFO: Loaded configurations for 0 objects of type Amazon S3 Connection.
Apr 27, 2015 11:02:02 PM com.rapidminer.tools.config.ConfigurationManager loadConfiguration
INFO: Load configuration for Dropbox Connection.
Apr 27, 2015 11:02:02 PM com.rapidminer.tools.config.ClientConfigurationManager loadAllParameters
INFO: No configuration file found for Dropbox Connection
Apr 27, 2015 11:02:02 PM com.rapidminer.tools.config.ConfigurationManager loadConfiguration
INFO: Loaded configurations for 0 objects of type Dropbox Connection.
Apr 27, 2015 11:02:02 PM com.rapidminer.tools.config.ConfigurationManager loadConfiguration
INFO: Load configuration for Salesforce Connection.
Apr 27, 2015 11:02:02 PM com.rapidminer.tools.config.ClientConfigurationManager loadAllParameters
INFO: No configuration file found for Salesforce Connection
Apr 27, 2015 11:02:02 PM com.rapidminer.tools.config.ConfigurationManager loadConfiguration
INFO: Loaded configurations for 0 objects of type Salesforce Connection.
Apr 27, 2015 11:02:02 PM com.rapidminer.tools.config.ConfigurationManager loadConfiguration
INFO: Load configuration for Twitter Connection.
Apr 27, 2015 11:02:02 PM com.rapidminer.tools.config.ClientConfigurationManager loadAllParameters
INFO: No configuration file found for Twitter Connection
Apr 27, 2015 11:02:02 PM com.rapidminer.tools.config.ConfigurationManager loadConfiguration
INFO: Loaded configurations for 0 objects of type Twitter Connection.
Apr 27, 2015 11:02:02 PM com.rapidminer.tools.WrapperLoggingHandler log
INFO: No filename given for result file, using stdout for logging results!
Apr 27, 2015 11:02:02 PM com.rapidminer.Process run
INFO: Process C:\Users\anik1\.RapidMiner\repositories\NewLocalRepository\R.rmp starts
Apr 27, 2015 11:02:02 PM com.rapidminer.Process run
INFO: Process C:\Users\anik1\.RapidMiner\repositories\NewLocalRepository\R.rmp finished successfully after 0 s
Apr 27, 2015 11:02:02 PM com.rapidminer.tools.WrapperLoggingHandler log
INFO: No filename given for result file, using stdout for logging results!
Apr 27, 2015 11:02:02 PM com.rapidminer.Process run
INFO: Process C:\Users\anik1\.RapidMiner\repositories\NewLocalRepository\R.rmp starts
Apr 27, 2015 11:02:02 PM com.rapidminer.Process run
INFO: Process C:\Users\anik1\.RapidMiner\repositories\NewLocalRepository\R.rmp finished successfully after 0 s

And my java code looks like this:
import com.rapidminer.Process;
import com.rapidminer.RapidMiner;
import com.rapidminer.RepositoryProcessLocation;
import com.rapidminer.operator.Operator;
import com.rapidminer.operator.OperatorException;
import com.rapidminer.operator.io.ExcelExampleSource;
import com.rapidminer.repository.RepositoryLocation;
import com.rapidminer.tools.XMLException;
import com.rapidminer.example.Attribute;
import com.rapidminer.RapidMiner;
import com.rapidminer.Process;
import com.rapidminer.example.Attribute;
import com.rapidminer.example.Example;
import com.rapidminer.example.ExampleSet;
import com.rapidminer.operator.IOContainer;
import com.rapidminer.operator.Operator;
import com.rapidminer.operator.OperatorException;



import java.io.File;
import java.io.IOException;
import java.util.Iterator;
import com.rapidminer.operator.io.ExcelExampleSource;
import com.rapidminer.tools.XMLException;
import java.io.File;
import java.io.IOException;
import java.lang.Object;
import java.io.File;

import com.rapidminer.RapidMiner.ExecutionMode;
import com.rapidminer.example.Attributes;
import com.rapidminer.example.Example;
import com.rapidminer.example.ExampleSet;
import com.rapidminer.example.set.SimpleExampleSet;
import com.rapidminer.operator.IOContainer;
import com.rapidminer.operator.IOObject;
import com.rapidminer.repository.IOObjectEntry;
import com.rapidminer.operator.ModelApplier;
import com.rapidminer.operator.Operator;
import com.rapidminer.operator.io.ModelLoader;
import com.rapidminer.tools.OperatorService;

public class Classification {


      public static void main(String[] args) throws Exception {
      ExampleSet resultSet1 = null;
      //IOContainer ioInput = null;
      //IOContainer ioResult = null;
      try{
        // Init RapidMiner
        RapidMiner.setExecutionMode(ExecutionMode.COMMAND_LINE);
        RapidMiner.init();
       
        // Path to process-definition
        String pr = "C:\\Users\\anik1\\.RapidMiner\\repositories\\NewLocalRepository\\R.rmp";
        // Load process
        com.rapidminer.Process process = new com.rapidminer.Process(new File(pr));
        process.run();
       
        IOContainer ioResult = process.run();
        if (ioResult.getElementAt(0) instanceof ExampleSet) {
            ExampleSet resultSet = (ExampleSet) ioResult.getElementAt(0);

            for (Example example : resultSet) {
                Iterator<Attribute> allAtts = example.getAttributes().allAttributes();
                    while (allAtts.hasNext()) {
                        Attribute a = allAtts.next();
                        if (a.isNumerical()) {
                            double value = example.getValue(a);
                            System.out.print(value + " ");
                        } else {
                            String value = example.getNominalValue(a);
                            System.out.print(value + " ");
                        }
                    }
                    System.out.println("\n");
              }
        }
       
       
        //System.out.println(process.run());
      }catch (IOException | XMLException | OperatorException ex){
      ex.printStackTrace();
     
  }
}
}

Can anyone please solve this issue? ???
Help is highly appreciated....
Tagged:

Answers

  • Marco_BoeckMarco_Boeck Team Lead Software Engineering Moderator, Employee, Member, University Professor Posts: 1,806   RM Engineering
    Hi,

    1) You are running the process twice, the first time you are ignoring the output ports. Doesn't break anything, just wanted to mention it.
    2) You have not posted the process XML, so I can only guess. Either you have not connected the last operator to the process output ports (top right corner of the process) or your output is NOT an ExampleSet.

    Regards,
    Marco
  • anikanik Member Posts: 2 Contributor I
    Hi Sir:

    But, I am getting output in RapidMiner..
    Actually I am very new in RapidMiner.. First time I am using this..
    As developing all the algorithms in time consuming and tough in JAVA.. That's why I am creating process in RM and calling it in JAVA..

    I am attaching the XML code below..
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <process version="6.1.000">
      <context>
        <input/>
        <output/>
        <macros/>
      </context>
      <operator activated="true" class="process" compatibility="6.1.000" expanded="true" name="Process">
        <process expanded="true">
          <operator activated="true" class="retrieve" compatibility="6.1.000" expanded="true" height="60" name="Retrieve dd" width="90" x="112" y="75">
            <parameter key="repository_entry" value="//NewLocalRepository/dd"/>
          </operator>
          <operator activated="true" class="nominal_to_binominal" compatibility="6.1.000" expanded="true" height="94" name="Nominal to Binominal" width="90" x="246" y="75"/>
          <operator activated="true" class="fp_growth" compatibility="6.1.000" expanded="true" height="76" name="FP-Growth" width="90" x="514" y="75">
            <parameter key="min_support" value="0.8"/>
          </operator>
          <operator activated="true" class="create_association_rules" compatibility="6.1.000" expanded="true" height="76" name="Create Association Rules" width="90" x="648" y="75"/>
          <connect from_op="Retrieve dd" from_port="output" to_op="Nominal to Binominal" to_port="example set input"/>
          <connect from_op="Nominal to Binominal" from_port="example set output" to_op="FP-Growth" to_port="example set"/>
          <connect from_op="FP-Growth" from_port="frequent sets" to_op="Create Association Rules" to_port="item sets"/>
          <connect from_op="Create Association Rules" from_port="rules" to_port="result 1"/>
          <portSpacing port="source_input 1" spacing="0"/>
          <portSpacing port="sink_result 1" spacing="0"/>
          <portSpacing port="sink_result 2" spacing="0"/>
        </process>
      </operator>
    </process>
    Could you please help me now?
  • Marco_BoeckMarco_Boeck Team Lead Software Engineering Moderator, Employee, Member, University Professor Posts: 1,806   RM Engineering
    Hi,

    you are returning association rules, not an example set. As you can see in your code, only if the returned result matches an ExampleSet something is done.

    Have a look at the package "com.rapidminer.gui.viewer". There are various GUI classes which display different IOObjects in RapidMiner Studio. For example, an AssociationRuleTableVieweris in there. Have a look at where the constructors are called for these GUI objects, then you will find the actual IOObject implementations. Then you can cast your IOObject results of your process to the appropriate classes and work with them. By looking at the GUI classes you can get a first impression of what information you can display.

    Regards,
    Marco
  • mhmdSharimhmdShari Member Posts: 1 Contributor I
    Hi,

    You can try the below code to print out the association rules  :)

      com.rapidminer.Process process = new com.rapidminer.Process(new File("FPGrowth.rmp"));

    IOContainer ioResult = process.run();
    AssociationRules arules = (AssociationRules) ioResult.getElementAt(0);


    for (AssociationRule ar : arules) {

    System.out.println(ar.toString());

    }
         

    Cheers  :)
Sign In or Register to comment.