Search in sources :

Example 11 with Config

use of org.knime.core.node.config.Config in project knime-core by knime.

the class AttributeModel method saveModel.

/**
 * @param config the <code>Config</code> object to write to
 */
void saveModel(final Config config) {
    config.addString(ATTRIBUTE_NAME, getAttributeName());
    config.addString(MODEL_TYPE, getType());
    config.addBoolean(SKIP_MISSING_VALUES, m_skipMissingVals);
    config.addInt(NO_OF_MISSING_VALUES, m_noOfMissingVals);
    config.addString(INVALID_CAUSE, getInvalidCause());
    final Config internalConfig = config.addConfig(MODEL_DATA_SECTION);
    saveModelInternal(internalConfig);
}
Also used : Config(org.knime.core.node.config.Config)

Example 12 with Config

use of org.knime.core.node.config.Config in project knime-core by knime.

the class NominalAttributeModel method saveModelInternal.

/**
 * {@inheritDoc}
 */
@Override
void saveModelInternal(final Config config) {
    config.addInt(MAX_NO_OF_ATTRS, m_maxNoOfAttrVals);
    config.addInt(CLASS_VALUE_COUNTER, m_classValues.size());
    final String[] attrVals = m_attributeVals.toArray(new String[] {});
    config.addStringArray(ATTRIBUTE_VALUES, attrVals);
    int i = 0;
    for (final NominalClassValue classVal : m_classValues.values()) {
        final Config classConfig = config.addConfig(CLASS_VALUE_SECTION + i);
        classVal.saveModel(classConfig);
        i++;
    }
}
Also used : Config(org.knime.core.node.config.Config)

Example 13 with Config

use of org.knime.core.node.config.Config in project knime-core by knime.

the class NumericalAttributeModel method saveModelInternal.

/**
 * {@inheritDoc}
 */
@Override
void saveModelInternal(final Config config) {
    config.addInt(CLASS_VALUE_COUNTER, m_classValues.size());
    int i = 0;
    for (final NumericalClassValue classVal : m_classValues.values()) {
        final Config classConfig = config.addConfig(CLASS_VALUE_SECTION + i);
        classVal.saveModel(classConfig);
        i++;
    }
}
Also used : Config(org.knime.core.node.config.Config)

Example 14 with Config

use of org.knime.core.node.config.Config in project knime-core by knime.

the class NaiveBayesPortObjectSpec method save.

/**
 * {@inheritDoc}
 */
@Override
protected void save(final ModelContentWO model) {
    final Config specModel = model.addConfig(CNFG_SPEC);
    m_tableSpec.save(specModel);
    final ModelContentWO classColModel = model.addModelContent(CNFG_CLASS_COL);
    m_classColumn.save(classColModel);
}
Also used : Config(org.knime.core.node.config.Config) ModelContentWO(org.knime.core.node.ModelContentWO)

Example 15 with Config

use of org.knime.core.node.config.Config in project knime-core by knime.

the class NaiveBayesPortObject method save.

/**
 * {@inheritDoc}
 */
@Override
protected void save(final ModelContentWO model, final ExecutionMonitor exec) {
    final Config modelConfig = model.addConfig(CNFG_MODEL);
    m_model.savePredictorParams(modelConfig);
}
Also used : Config(org.knime.core.node.config.Config)

Aggregations

Config (org.knime.core.node.config.Config)84 InvalidSettingsException (org.knime.core.node.InvalidSettingsException)25 Color (java.awt.Color)10 File (java.io.File)10 FileOutputStream (java.io.FileOutputStream)8 NodeSettings (org.knime.core.node.NodeSettings)8 ArrayList (java.util.ArrayList)7 DataColumnSpec (org.knime.core.data.DataColumnSpec)7 ConfigRO (org.knime.core.node.config.ConfigRO)7 HashMap (java.util.HashMap)6 GZIPOutputStream (java.util.zip.GZIPOutputStream)6 LinkedHashMap (java.util.LinkedHashMap)5 DataColumnSpecCreator (org.knime.core.data.DataColumnSpecCreator)5 DataTableSpec (org.knime.core.data.DataTableSpec)5 SimpleStreamableOperatorInternals (org.knime.core.node.streamable.simple.SimpleStreamableOperatorInternals)5 FileInputStream (java.io.FileInputStream)4 IOException (java.io.IOException)4 HashSet (java.util.HashSet)4 GZIPInputStream (java.util.zip.GZIPInputStream)4 DataCell (org.knime.core.data.DataCell)4