How To Call Rapidminer Process In Eclipse

ShivangiShivangi Member Posts: 6 Contributor II
edited November 2018 in Help
I am MCA 5th sem student and doing my project
i connect rapidminer with eclipse so can you help me for how to call rapidminer processes into eclipse
Tagged:

Answers

  • Marco_BoeckMarco_Boeck Administrator, Moderator, Employee, Member, University Professor Posts: 1,993 RM Engineering
    Hi,

    please have a look at the development FAQ: http://rapid-i.com/rapidforum/index.php/topic,5807.0.html

    Regards,
    Marco
  • ShivangiShivangi Member Posts: 6 Contributor II
    Thank You Sir For Replaying

    Bt sir i did't get it  ,can you  give me specific example ? :(
  • Marco_BoeckMarco_Boeck Administrator, Moderator, Employee, Member, University Professor Posts: 1,993 RM Engineering
    Hi,

    please be a bit more specific. The FAQ contains information and examples from making Studio available in Eclipse (and your project) to executing processes and inspecting the results.
    What exactly is it you're having problems with?

    Regards,
    Marco
  • ShivangiShivangi Member Posts: 6 Contributor II
    Sir, i tried following code for calling replace missing operator of rapid miner from the eclipse Juno...... 

    /************************************************************************/

    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.IOObject;
    import com.rapidminer.operator.Operator;
    import com.rapidminer.operator.OperatorException;

    import java.io.File;
    import java.io.IOException;
    import java.util.Iterator;

    import org.freehep.graphicsio.swf.DefineBits;

    import com.rapidminer.operator.io.ExcelExampleSource;
    import com.rapidminer.repository.IOObjectEntry;
    import com.rapidminer.repository.ProcessEntry;
    import com.rapidminer.repository.RepositoryLocation;
    import com.rapidminer.tools.XMLException;

    public class listattribute {

        public static void main(String args[]) throws Exception {
           
        // this initializes RapidMiner with your repositories available
           
        RapidMiner.setExecutionMode(RapidMiner.ExecutionMode.COMMAND_LINE);
     
        RapidMiner.init();
     
        // loads the process from the repository
        Process location = new Process(new File("C:\\Users\\Dimpal\\.RapidMiner5\\repositories\\Local Repository\\processes\\test.rmp"));
        //Entry entry = location.locateEntry();
        //if (entry instanceof ProcessEntry) {
            //Process process = new RepositoryProcessLocation(location).load(null);
      Operator op = location.getOperator("Read Excel");
     
      op.setParameter(ExcelExampleSource.PARAMETER_EXCEL_FILE, "C:\\Users\\Dimpal\\.RapidMiner5\\repositories\\Local Repository\\processes\\sample.xlsx");
      Operator op1=location.getOperator("Replace Missing Values");
      op1.setParameter("attribute","city");
      op1.setParameter("default", "average");
      //op1.setParameter("replenishment Value","Y");
     
     
        Operator outp = location.getOperator("Write Excel");
      outp.setParameter(ExcelExampleSource.PARAMETER_EXCEL_FILE, "C:\\Users\\Dimpal\\.RapidMiner5\\repositories\\Local Repository\\processes\\data2.xlsx");
     
      //RapidMiner.setExecutionMode(RapidMiner.ExecutionMode.COMMAND_LINE);
      // RapidMiner.init();
      // Process location1 = new Process(new File("D:\\rm\\replacemiss.rmp"));
      // Operator opa = location.getOperator("Read Excel");
     
      //opa.setParameter(ExcelExampleSource.PARAMETER_EXCEL_FILE, "D:\\rm\\data2.xlsx");
      // Operator opa1=location.getOperator("Replace Missing Values");
      // opa1.setParameter("attribute","");
      // opa1.setParameter("default", "average");
     
     
        IOContainer ioResult = location.run();
            IOObject result = ioResult.getElementAt(0);
        // use the result(s) as needed, for example if your process just returns one ExampleSet, use this:
        if (ioResult.getElementAt(0) instanceof ExampleSet) {
            ExampleSet resultSet = (ExampleSet)ioResult.getElementAt(0);
            System.out.println(result);
            int i=0;
            for (Example example : resultSet) {
                Iterator<Attribute> allAtts = example.getAttributes().allAttributes();
             
               
                while(allAtts.hasNext()) {
                    Attribute a = allAtts.next();
                  if(i<=3)
                    System.out.print(a.getName()+ "  ");
                 
                    i++;
                }
            }
            System.out.println("\n");
        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+ " " );
                                //System.out.println("\n");

                        } else {
                                String value = example.getValueAsString(a);
                                System.out.print(value+ " ");
                                //System.out.println("\n");
                        }
                  }
            System.out.println("\n");
     

     
              }
       
          }
      }
    }

    /***********************************************************************/



    And i got the Following exception ...


    /********************************************************************************************/

    Apr 30, 2015 6:55:07 PM com.rapidminer.RapidMiner performFirstInitialization
    INFO: Performing upgrade  from version 5.3.013 to version 5.3.015
    Apr 30, 2015 6:55:08 PM com.rapidminer.tools.ParameterService init
    INFO: Reading configuration resource com/rapidminer/resources/rapidminerrc.
    Apr 30, 2015 6:55:08 PM com.rapidminer.tools.I18N <clinit>
    INFO: Set locale to en.
    Apr 30, 2015 6:55:09 PM com.rapid_i.Launcher ensureRapidMinerHomeSet
    INFO: Property rapidminer.home is not set. Guessing.
    Apr 30, 2015 6:55:09 PM com.rapid_i.Launcher ensureRapidMinerHomeSet
    INFO: Trying base directory of classes (build) 'D:\SHIVU\Project\Git'...gotcha!
    Apr 30, 2015 6:55:26 PM com.rapidminer.tools.expression.parser.ExpressionParserFactory <clinit>
    INFO: Default version of expression parser registered successfully
    Apr 30, 2015 6:55:30 PM com.rapidminer.parameter.ParameterTypePassword decryptPassword
    WARNING: Password in XML file looks like unencrypted plain text.
    Apr 30, 2015 6:55:39 PM com.rapidminer.tools.OperatorService init
    INFO: Number of registered operator classes: 443; number of registered operator descriptions: 444; number of replacements: 403
    Apr 30, 2015 6:55:40 PM com.rapidminer.tools.jdbc.JDBCProperties <init>
    WARNING: Missing database driver class name for ODBC Bridge (e.g. Access)
    Apr 30, 2015 6:55:40 PM com.rapidminer.tools.jdbc.JDBCProperties registerDrivers
    INFO: JDBC driver ca.ingres.jdbc.IngresDriver not found. Probably the driver is not installed.
    Apr 30, 2015 6:55:40 PM com.rapidminer.tools.jdbc.JDBCProperties registerDrivers
    INFO: JDBC driver oracle.jdbc.driver.OracleDriver not found. Probably the driver is not installed.


    Exception in thread "main" java.lang.NullPointerException
    at listattribute.main(listattribute.java:44)

    /********************************************************************************************/
  • Marco_BoeckMarco_Boeck Administrator, Moderator, Employee, Member, University Professor Posts: 1,993 RM Engineering
    Hi,

    you're trying to access an operator which cannot be found under the specified name it seems. Debug your process and see what operators it contains and how they are called. Probably you misspelled its name.

    Regards,
    Marco
  • ShivangiShivangi Member Posts: 6 Contributor II
    Thank you sir

    Sir i also try for clustering but i  got same NullPointerException.
    For calling rapidminer process in eclipse XML file is required??
  • Marco_BoeckMarco_Boeck Administrator, Moderator, Employee, Member, University Professor Posts: 1,993 RM Engineering
    Hi,

    to create a simply process, all you really need is a String which equals the contents of a .rmp file in your repository, aka a process. The content is XML, but you don't need any files for that.

    Regards,
    Marco
  • ShivangiShivangi Member Posts: 6 Contributor II
    Hello

    Sir .rmp file is ok but i get nullpointerexception with following line:


     
    op.setParameter(ExcelExampleSource.PARAMETER_EXCEL_FILE, "C:\\Users\\Dimpal\\.RapidMiner5\\repositories\\Local Repository\\processes\\sample.xlsx");

    please reply me
  • Marco_BoeckMarco_Boeck Administrator, Moderator, Employee, Member, University Professor Posts: 1,993 RM Engineering
    Hi,

    you can use your regular debugging tools for figuring out what's wrong. It's Java, after all :)
    As I already said, in that line you can only get an NPE if the operator you retrieved was null. And that is the case when you try to get an Operator from a Process via a non-existent name.

    Regards,
    Marco
  • dataj1993dataj1993 Member Posts: 3 Contributor I

    hello  sir  

    about the page which  explain how to  call  rapid miner  process in eclipse  it doesnt working 

      can you help  me please 

Sign In or Register to comment.