use of org.knime.core.node.ModelContent in project knime-core by knime.
the class DecisionTreeLearnerNodeModel method saveInternals.
/**
* {@inheritDoc}
*/
@Override
protected void saveInternals(final File nodeInternDir, final ExecutionMonitor exec) throws IOException, CanceledExecutionException {
ModelContent decisionTreeModel = new ModelContent(SAVE_INTERNALS_FILE_NAME);
m_decisionTree.saveToPredictorParams(decisionTreeModel, true);
File internalsFile = new File(nodeInternDir, SAVE_INTERNALS_FILE_NAME);
BufferedOutputStream out = new BufferedOutputStream(new GZIPOutputStream(new FileOutputStream(internalsFile)));
decisionTreeModel.saveToXML(out);
}
use of org.knime.core.node.ModelContent in project knime-core by knime.
the class LinReg2LearnerNodeModel method saveInternals.
/**
* {@inheritDoc}
*/
@Override
protected void saveInternals(final File internDir, final ExecutionMonitor exec) throws IOException, CanceledExecutionException {
ModelContent content = new ModelContent(CFG_SETTINGS);
ModelContentWO specContent = content.addModelContent(CFG_SPEC);
m_content.getSpec().getDataTableSpec().save(specContent);
ModelContentWO parContent = content.addModelContent(CFG_LinReg2_CONTENT);
m_content.save(parContent);
File outFile = new File(internDir, FILE_SAVE);
content.saveToXML(new BufferedOutputStream(new GZIPOutputStream(new FileOutputStream(outFile))));
File dataFile = new File(internDir, FILE_DATA);
DataContainer.writeToZip(m_rowContainer, dataFile, exec);
}
use of org.knime.core.node.ModelContent in project knime-core by knime.
the class DecisionTreeLearnerNodeModel2 method saveInternals.
/**
* {@inheritDoc}
*/
@Override
protected void saveInternals(final File nodeInternDir, final ExecutionMonitor exec) throws IOException, CanceledExecutionException {
ModelContent decisionTreeModel = new ModelContent(SAVE_INTERNALS_FILE_NAME);
m_decisionTree.saveToPredictorParams(decisionTreeModel, true);
File internalsFile = new File(nodeInternDir, SAVE_INTERNALS_FILE_NAME);
BufferedOutputStream out = new BufferedOutputStream(new GZIPOutputStream(new FileOutputStream(internalsFile)));
decisionTreeModel.saveToXML(out);
}
use of org.knime.core.node.ModelContent in project knime-core by knime.
the class NaiveBayesLearnerNodeModel2 method saveInternals.
/**
* {@inheritDoc}
*/
@Override
protected void saveInternals(final File nodeInternDir, final ExecutionMonitor exec) throws IOException {
final File modelFile = new File(nodeInternDir, CFG_DATA);
final FileOutputStream modelOut = new FileOutputStream(modelFile);
final ModelContent myModel = new ModelContent(CFG_DATA_MODEL);
m_model.savePredictorParams(myModel);
myModel.saveToXML(modelOut);
}
use of org.knime.core.node.ModelContent in project knime-core by knime.
the class AbstractSimplePortObjectSpec method equals.
/**
* {@inheritDoc}
*/
@Override
public boolean equals(final Object ospec) {
if (ospec == this) {
return true;
}
if (ospec == null) {
return false;
}
if (!this.getClass().equals(ospec.getClass())) {
return false;
}
ModelContent tcont = new ModelContent("ignored");
ModelContent ocont = new ModelContent("ignored");
this.save(tcont);
((AbstractSimplePortObjectSpec) ospec).save(ocont);
return tcont.equals(ocont);
}
Aggregations