我有一个需要集群的演示数据。该实用程序应该将数据发送到快速矿工算法,然后检索结果。我使用 Rapid Miner API 来使用 Rapid Miner 现有的算法。但是我在使用这个 API 时遇到了问题。
Java 类:
package rajeev.rapidminer.main;
import java.io.File;
import java.io.IOException;
import com.rapidminer.Process;
import com.rapidminer.RapidMiner;
import com.rapidminer.RapidMiner.ExecutionMode;
import com.rapidminer.operator.IOObject;
import com.rapidminer.operator.OperatorException;
import com.rapidminer.repository.IOObjectEntry;
import com.rapidminer.repository.MalformedRepositoryLocationException;
import com.rapidminer.repository.RepositoryException;
import com.rapidminer.repository.RepositoryLocation;
import com.rapidminer.tools.XMLException;
public class Main {
public static void main(String a[]) throws IOException, XMLException, RepositoryException, OperatorException
{
String rmpPath="C:/Users/rajeev-s/.RapidMiner5/repositories/Local Repository/DemoClustering.rmp";
RapidMiner.setExecutionMode(ExecutionMode.COMMAND_LINE);
RapidMiner.init();
Process process=new Process(new File(rmpPath));
RepositoryLocation modelLocation=new RepositoryLocation("//C:/Users/rajeev-s/.RapidMiner5/repositories/Local Repository/ClusterDemoOutput");
IOObject model=((IOObjectEntry)modelLocation.locateEntry()).retrieveData(null);
RepositoryLocation testDataLocation=new RepositoryLocation("//LocalRepository/TestData.txt");
IOObject testData=((IOObjectEntry)testDataLocation.locateEntry()).retrieveData(null);
com.rapidminer.operator.IOContainer ioInput = new com.rapidminer.operator.IOContainer(new IOObject[] { model, testData });
process.run(ioInput);
process.run(ioInput);
final long start = System.currentTimeMillis();
final com.rapidminer.operator.IOContainer ioResult = process.run(ioInput);
final long end = System.currentTimeMillis();
System.out.println("T:" + (end - start));
}
}
错误堆栈跟踪是:
Oct 25, 2013 6:28:53 PM com.rapidminer.tools.ParameterService init
INFO: Reading configuration resource com/rapidminer/resources/rapidminerrc.
Oct 25, 2013 6:28:53 PM com.rapidminer.tools.I18N <clinit>
INFO: Set locale to en.
Oct 25, 2013 6:28:54 PM com.rapid_i.Launcher ensureRapidMinerHomeSet
INFO: Property rapidminer.home is not set. Guessing.
Oct 25, 2013 6:28:54 PM com.rapid_i.Launcher ensureRapidMinerHomeSet
INFO: Trying parent directory of 'C:\Program Files\Rapid- I\RapidMiner5\lib\launcher.jar'...gotcha!
Oct 25, 2013 6:28:54 PM com.rapid_i.Launcher ensureRapidMinerHomeSet
INFO: Trying parent directory of 'C:\Program Files\Rapid- I\RapidMiner5\lib\rapidminer.jar'...gotcha!
Oct 25, 2013 6:29:00 PM com.rapidminer.tools.expression.parser.ExpressionParserFactory <clinit>
INFO: Default version of expression parser registered successfully
Oct 25, 2013 6:29:06 PM com.rapidminer.parameter.ParameterTypePassword decryptPassword
WARNING: Password in XML file looks like unencrypted plain text.
Oct 25, 2013 6:29:10 PM com.rapidminer.tools.OperatorService init
INFO: Number of registered operator classes: 443; number of registered operator descriptions: 444; number of replacements: 403
Oct 25, 2013 6:29:10 PM com.rapidminer.tools.jdbc.JDBCProperties <init>
警告:缺少 ODBC 桥(例如 Access)的数据库驱动程序类名称 2013 年 10 月 25 日下午 6:29:10 com.rapidminer.tools.jdbc.JDBCProperties registerDrivers 信息:找不到 JDBC 驱动程序 ca.ingres.jdbc.IngresDriver。应该是驱动没有安装。[致命错误]:1:1:文件过早结束。线程“主”com.rapidminer.repository.RepositoryException 中的异常:请求的存储库 C:不存在。在 com.rapidminer.repository.RepositoryManager.getRepository(RepositoryManager.java:201) 在 com.rapidminer.repository.RepositoryLocation.getRepository(RepositoryLocation.java:139) 在 com.rapidminer.repository.RepositoryLocation.locateEntry(RepositoryLocation.java:162) ) 在 rajeev.rapidminer.main.Main.main(Main.java:29)
当我将“本地存储库”复制到我的类路径并将路径更改为:
//Local Repository/ClusterDemoOutput
然后生成以下堆栈跟踪:
Exception in thread "main" com.rapidminer.repository.RepositoryException: Requested repository LocalRepository does not exist.
at com.rapidminer.repository.RepositoryManager.getRepository(RepositoryManager.java:201)
at com.rapidminer.repository.RepositoryLocation.getRepository(RepositoryLocation.java:139)
at com.rapidminer.repository.RepositoryLocation.locateEntry(RepositoryLocation.java:162)
at rajeev.rapidminer.main.Main.main(Main.java:29)
请告诉我在哪里放置存储库。
还请建议任何适当的博客或教程,解释如何从 java 代码中使用 Rapid Miner 算法(我在谷歌上搜索的东西没有提到所有细节)
谢谢