Good morning , I'm trying to import an external model KNIME . The model to be imported is generated by an external software KNIME and my goal is to import the node (thus indicate somehow the path where is the model) and write the model in another node. So I have to create a Learner node that take the model input and send it to a Predictor. I am attaching the code used , but the model is not imported it read . Forgive me if my English is wrong .
public class PROVA_MODELNodeModel extends NodeModel {
private FISModel m_model;
protected PROVA_MODELNodeModel() {
// TODO: Specify the amount of input and output ports needed.
super(new PortType[] { BufferedDataTable.TYPE }, new PortType[] { PMMLPortObject.TYPE });
}
protected PortObject[] execute(final PortObject[] inData,
final ExecutionContext exec) throws Exception {
// logger.info("Node Model Stub... this is not yet implemented !");
return new PortObject[] {(PortObject) m_model};
}
@Override
protected PortObjectSpec[] configure(final PortObjectSpec[] inSpecs)
throws InvalidSettingsException {
return new PortObjectSpec[] { null };
}
/**
* Solo il metodo saveModelContent deve essere sovrascritto, poiché non vi è
* Solo ModelOutport.
*
* @see De.unikn.knime.core.node.NodeModel # saveModelContent (int,
* De.unikn.knime.core.node.ModelContentWO)
*/
protected void saveModelContent(final int index,
final ModelContentWO modelContent) throws InvalidSettingsException {
m_model.saveTo(modelContent);
}
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
import org.knime.core.node.ModelContentWO;
public class FISModel {
public void saveTo(final ModelContentWO modelContent)
{
modelContent.addModelContent("C:/Users/Antonio/Desktop/WM_PERF615/Learner/LearnerFis.txtwm.fis");
}
}