Search in sources :

Example 11 with ModelContent

use of org.knime.core.node.ModelContent in project knime-core by knime.

the class SizeHandlerPortObject method getViews.

/**
 * {@inheritDoc}
 */
@Override
public JComponent[] getViews() {
    ModelContent model = new ModelContent("Size");
    getSpec().getColumnSpec(0).getSizeHandler().save(model);
    return new JComponent[] { new ModelContentOutPortView(model) };
}
Also used : ModelContent(org.knime.core.node.ModelContent) JComponent(javax.swing.JComponent) ModelContentOutPortView(org.knime.core.node.workflow.ModelContentOutPortView)

Example 12 with ModelContent

use of org.knime.core.node.ModelContent in project knime-core by knime.

the class ShapeHandlerPortObject method getViews.

/**
 * {@inheritDoc}
 */
@Override
public JComponent[] getViews() {
    ModelContent model = new ModelContent("Shape");
    getSpec().getColumnSpec(0).getShapeHandler().save(model);
    return new JComponent[] { new ModelContentOutPortView(model) };
}
Also used : ModelContent(org.knime.core.node.ModelContent) JComponent(javax.swing.JComponent) ModelContentOutPortView(org.knime.core.node.workflow.ModelContentOutPortView)

Example 13 with ModelContent

use of org.knime.core.node.ModelContent in project knime-core by knime.

the class TreeEnsembleModelPortObject method save.

private void save(final PortObjectZipOutputStream out, final ExecutionMonitor exec) throws IOException, CanceledExecutionException {
    ModelContent mc = new ModelContent(CFG_MODELCONTENT);
    mc.addInt(CFG_NRATTRIBUTES, m_nrAttributes);
    mc.addInt(CFG_NRMODELS, m_nrModels);
    mc.saveToXML(out);
}
Also used : ModelContent(org.knime.core.node.ModelContent)

Example 14 with ModelContent

use of org.knime.core.node.ModelContent in project knime-core by knime.

the class RandomForestDistanceConfig method saveInternals.

/**
 * {@inheritDoc}
 */
@Override
protected void saveInternals(final String prefix, final PortObjectZipOutputStream outputStream, final ExecutionMonitor exec) throws CanceledExecutionException, IOException {
    outputStream.putNextEntry(new ZipEntry("model.zip"));
    m_ensembleModel.save(outputStream, exec);
    outputStream.closeEntry();
    outputStream.putNextEntry(new ZipEntry("spec.zip"));
    ModelContent mc = new ModelContent(CFG_MODELCONTENT);
    m_learnTableSpec.save(mc.addModelContent(CFG_TABLESPEC));
    mc.saveToXML(outputStream);
}
Also used : ModelContent(org.knime.core.node.ModelContent) ZipEntry(java.util.zip.ZipEntry)

Example 15 with ModelContent

use of org.knime.core.node.ModelContent in project knime-core by knime.

the class LogRegLearnerNodeModel 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_LOGREG_CONTENT);
    m_content.save(parContent);
    File outFile = new File(internDir, FILE_SAVE);
    content.saveToXML(new BufferedOutputStream(new GZIPOutputStream(new FileOutputStream(outFile))));
}
Also used : GZIPOutputStream(java.util.zip.GZIPOutputStream) ModelContent(org.knime.core.node.ModelContent) ModelContentWO(org.knime.core.node.ModelContentWO) FileOutputStream(java.io.FileOutputStream) File(java.io.File) BufferedOutputStream(java.io.BufferedOutputStream)

Aggregations

ModelContent (org.knime.core.node.ModelContent)29 File (java.io.File)15 FileOutputStream (java.io.FileOutputStream)15 BufferedOutputStream (java.io.BufferedOutputStream)12 GZIPOutputStream (java.util.zip.GZIPOutputStream)11 ModelContentWO (org.knime.core.node.ModelContentWO)7 JComponent (javax.swing.JComponent)6 ModelContentOutPortView (org.knime.core.node.workflow.ModelContentOutPortView)6 DataTableSpec (org.knime.core.data.DataTableSpec)3 ZipEntry (java.util.zip.ZipEntry)2 CanceledExecutionException (org.knime.core.node.CanceledExecutionException)2 ExecutionMonitor (org.knime.core.node.ExecutionMonitor)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 ObjectOutputStream (java.io.ObjectOutputStream)1 OutputStream (java.io.OutputStream)1 LinkedHashSet (java.util.LinkedHashSet)1 ZipOutputStream (java.util.zip.ZipOutputStream)1 DataColumnSpec (org.knime.core.data.DataColumnSpec)1 DataColumnSpecCreator (org.knime.core.data.DataColumnSpecCreator)1 ColumnRearranger (org.knime.core.data.container.ColumnRearranger)1