The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here
"Questions abour RM DBScan arff in java source"
Hi guys, I'm a Weka User trying to learn how to use rapidminer clustering algorithms in a simple application java.
I want to do a simple process that reads a arff file and use the DBScan. After that, show the results in the console of netbeans.
My code:
Well, that's my questions:
1. How can I print the dbscan output in netbeans console?
2 When I executed the code, this error message was showed:
I want to do a simple process that reads a arff file and use the DBScan. After that, show the results in the console of netbeans.
My code:
package rapidminer;
import com.rapidminer.Process;
import com.rapidminer.RapidMiner;
import com.rapidminer.RapidMiner.ExecutionMode;
import com.rapidminer.operator.Operator;
import com.rapidminer.operator.OperatorCreationException;
import com.rapidminer.operator.OperatorException;
import com.rapidminer.operator.clustering.clusterer.DBScan;
import com.rapidminer.operator.io.ArffExampleSource;
import com.rapidminer.operator.ports.PortException;
import com.rapidminer.tools.OperatorService;
public class Rapidminer
{
public static Process createProcess() {
try
{
// invoke init before using the OperatorService
RapidMiner.setExecutionMode(ExecutionMode.COMMAND_LINE);
RapidMiner.init();
}
catch (Exception e)
{
e.printStackTrace(System.out);
}
// create process
Process process = new Process();
try
{
// create operator
Operator inputData = OperatorService.createOperator(ArffExampleSource.class);
// set parameters
inputData.setParameter("data_file", "C:/iris.arff");
// Clustering
Operator scan = OperatorService.createOperator(DBScan.class);
scan.setParameter("min_points", Double.toString(5));
scan.setParameter("epsilon", Double.toString(0.1));
// add operator to process
process.getRootOperator().getSubprocess(0).addOperator(inputData);
process.getRootOperator().getSubprocess(0).addOperator(scan);
inputData.getOutputPorts().getPortByName("output").connectTo(scan.getInputPorts().getPortByName("training set"));
}
catch (OperatorCreationException | PortException e)
{
e.printStackTrace(System.out);
}
return process;
}
public static void main(String[] argv)
{
// create process
Process process = createProcess();
// print process setup
System.out.println(process.getRootOperator().createProcessTree(0));
try
{
// perform process
process.run();
}
catch (OperatorException e)
{
e.printStackTrace(System.out);
}
}
}
Well, that's my questions:
1. How can I print the dbscan output in netbeans console?
2 When I executed the code, this error message was showed:
Well, that's newbie questions, but that's my doubts. ;D
com.rapidminer.operator.UserError: No data was delivered at port Clustering.example set (disconnected).
at com.rapidminer.operator.ports.impl.AbstractPort.getData(AbstractPort.java:99)
at com.rapidminer.operator.clustering.clusterer.AbstractClusterer.doWork(AbstractClusterer.java:94)
at com.rapidminer.operator.Operator.execute(Operator.java:855)
at com.rapidminer.operator.execution.SimpleUnitExecutor.execute(SimpleUnitExecutor.java:51)
at com.rapidminer.operator.ExecutionUnit.execute(ExecutionUnit.java:711)
at com.rapidminer.operator.OperatorChain.doWork(OperatorChain.java:379)
at com.rapidminer.operator.Operator.execute(Operator.java:855)
at com.rapidminer.Process.run(Process.java:949)
at com.rapidminer.Process.run(Process.java:873)
at com.rapidminer.Process.run(Process.java:832)
at com.rapidminer.Process.run(Process.java:827)
at com.rapidminer.Process.run(Process.java:817)
at rapidminer.Rapidminer.main(Rapidminer.java:75)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at com.javafx.main.Main.launchApp(Main.java:658)
at com.javafx.main.Main.main(Main.java:805)
0
Answers
Most probably you will need to iterate through the exampleset, here is an example.
Hope this helps, gabor
In my case, I want to read a .arff and use it in a DBScan. After I want to see the results in console. How can I do this?
Cheers, gabor
is there any particular reason why you are trying to create the process by hand instead of using a RapidMiner process you created via the RapidMiner GUI as shown in the READ BEFORE POSTING: Frequently Asked Questions (Development) thread?
Regards,
Marco