Dynamically add input from database to RapidMiner through Java
arulganesanaras
MemberPosts:3Contributor I
HI,
private static IOObject myExampleSet;
public static void main(String[] args) throws Exception {
JFrame frame = new JFrame("Rapidminer");
框架。setLocation (0,0);
JLabel label = new JLabel();
框架。add(new JScrollPane(label));
final String processPath = "/C:/Users/Administrator/.RapidMiner/repositories/Local Repository/processes/clustermodel.rmp";
try {
// Init RapidMiner
RapidMiner.setExecutionMode(ExecutionMode.EMBEDDED_WITH_UI);
Plugin.setInitPlugins(true);
RapidMiner.init();
// Load process
final com.rapidminer.Process process = new com.rapidminer.Process(new File(processPath));
IOContainer ioResult = process.run();
IOObject result = ioResult.getElementAt(0); // or whatever index you
// need
String name = RendererService.getName(result.getClass());
List renderers = RendererService.getRenderers(name);
for (Renderer renderer : renderers) { // you don't really need to
// iterate over this, it's
// probably only one anyway
//
IOContainer dummy = new IOContainer();
// edit size of image here
int imgWidth = 1100;
int imgHeight = 1100;
Reportable reportable = renderer.createReportable(result, ioResult, imgWidth, imgHeight);
if (reportable instanceof Renderable) {
Renderable renderable = (Renderable) reportable;
renderable.prepareRendering();
int preferredWidth = renderable.getRenderWidth(1000);
int preferredHeight = renderable.getRenderHeight(1000);
final BufferedImage img = new BufferedImage(imgWidth, imgHeight, BufferedImage.TYPE_INT_RGB);
Graphics2D graphics = (Graphics2D) img.getGraphics();
graphics.setColor(Color.WHITE);
graphics.fillRect(0, 0, imgWidth, imgHeight);
// scale to whatever you need
graphics.scale(2, 2);
renderable.render(graphics, preferredWidth, preferredHeight);
label.setIcon(new ImageIcon(img));
}
}
框架。setVisible(true);
框架。pack();
框架。setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
System.out.println(ioResult);
} catch (Exception ex) {
}
This is what i have now its working fine and i want to add input from mysql or any database to rapidminer through java .
Anyone have idea about that please help me to find solution
Thank you,
private static IOObject myExampleSet;
public static void main(String[] args) throws Exception {
JFrame frame = new JFrame("Rapidminer");
框架。setLocation (0,0);
JLabel label = new JLabel();
框架。add(new JScrollPane(label));
final String processPath = "/C:/Users/Administrator/.RapidMiner/repositories/Local Repository/processes/clustermodel.rmp";
try {
// Init RapidMiner
RapidMiner.setExecutionMode(ExecutionMode.EMBEDDED_WITH_UI);
Plugin.setInitPlugins(true);
RapidMiner.init();
// Load process
final com.rapidminer.Process process = new com.rapidminer.Process(new File(processPath));
IOContainer ioResult = process.run();
IOObject result = ioResult.getElementAt(0); // or whatever index you
// need
String name = RendererService.getName(result.getClass());
List renderers = RendererService.getRenderers(name);
for (Renderer renderer : renderers) { // you don't really need to
// iterate over this, it's
// probably only one anyway
//
IOContainer dummy = new IOContainer();
// edit size of image here
int imgWidth = 1100;
int imgHeight = 1100;
Reportable reportable = renderer.createReportable(result, ioResult, imgWidth, imgHeight);
if (reportable instanceof Renderable) {
Renderable renderable = (Renderable) reportable;
renderable.prepareRendering();
int preferredWidth = renderable.getRenderWidth(1000);
int preferredHeight = renderable.getRenderHeight(1000);
final BufferedImage img = new BufferedImage(imgWidth, imgHeight, BufferedImage.TYPE_INT_RGB);
Graphics2D graphics = (Graphics2D) img.getGraphics();
graphics.setColor(Color.WHITE);
graphics.fillRect(0, 0, imgWidth, imgHeight);
// scale to whatever you need
graphics.scale(2, 2);
renderable.render(graphics, preferredWidth, preferredHeight);
label.setIcon(new ImageIcon(img));
}
}
框架。setVisible(true);
框架。pack();
框架。setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
System.out.println(ioResult);
} catch (Exception ex) {
}
This is what i have now its working fine and i want to add input from mysql or any database to rapidminer through java .
Anyone have idea about that please help me to find solution
Thank you,
0
Answers
I'm not sure I understand what you are asking. Would you please format your code using the > option in the format bar?
Hi, Thank you for valuable reply Here is my code
The above code is working fine.I want to add input from mysql or any other database instead of selecting *.rmp file.
please help me to find solution.