public final class AppPMMLUtils extends Object
Modifier and Type | Method and Description |
---|---|
static void |
addExtension(org.dmg.pmml.PMML pmml,
String key,
Object value) |
static void |
addExtensionContent(org.dmg.pmml.PMML pmml,
String key,
Collection<?> content) |
static CategoricalValueEncodings |
buildCategoricalValueEncodings(org.dmg.pmml.DataDictionary dictionary) |
static org.dmg.pmml.DataDictionary |
buildDataDictionary(InputSchema schema,
CategoricalValueEncodings categoricalValueEncodings) |
static org.dmg.pmml.MiningSchema |
buildMiningSchema(InputSchema schema) |
static org.dmg.pmml.MiningSchema |
buildMiningSchema(InputSchema schema,
double[] importances) |
static Integer |
findTargetIndex(org.dmg.pmml.MiningSchema miningSchema) |
static List<String> |
getExtensionContent(org.dmg.pmml.PMML pmml,
String name) |
static String |
getExtensionValue(org.dmg.pmml.PMML pmml,
String name) |
static List<String> |
getFeatureNames(org.dmg.pmml.DataDictionary dictionary) |
static List<String> |
getFeatureNames(org.dmg.pmml.MiningSchema miningSchema) |
static org.dmg.pmml.PMML |
readPMMLFromUpdateKeyMessage(String key,
String message,
org.apache.hadoop.conf.Configuration hadoopConf) |
static org.dmg.pmml.Array |
toArray(double... values) |
public static List<String> getExtensionContent(org.dmg.pmml.PMML pmml, String name)
pmml
- PMML model to query for extensionsname
- name of extension to queryArray
:
space-separated values, with PMML quoting rulespublic static void addExtension(org.dmg.pmml.PMML pmml, String key, Object value)
pmml
- PMML model to add extension to, with no content. It may possibly duplicate
existing extensions.key
- extension keyvalue
- extension valuepublic static void addExtensionContent(org.dmg.pmml.PMML pmml, String key, Collection<?> content)
pmml
- PMML model to add extension to, with a single String
content and no value.
The content is encoded as if they were being added to a PMML Array
and are
space-separated with PMML quoting ruleskey
- extension keycontent
- list of values to add as a String
public static org.dmg.pmml.Array toArray(double... values)
values
- double
value to make into a PMML Array
Array
representationpublic static org.dmg.pmml.MiningSchema buildMiningSchema(InputSchema schema)
schema
- InputSchema
whose information should be encoded in PMMLMiningSchema
representing the information contained in an
InputSchema
public static org.dmg.pmml.MiningSchema buildMiningSchema(InputSchema schema, double[] importances)
schema
- InputSchema
whose information should be encoded in PMMLimportances
- optional feature importances. May be null
, or else the size
of the array must match the number of predictors in the schema, which may be
less than the total number of features.MiningSchema
representing the information contained in an
InputSchema
public static List<String> getFeatureNames(org.dmg.pmml.MiningSchema miningSchema)
miningSchema
- MiningSchema
from a modelpublic static Integer findTargetIndex(org.dmg.pmml.MiningSchema miningSchema)
miningSchema
- MiningSchema
from a modelMiningField.UsageType#PREDICTED
featurepublic static org.dmg.pmml.DataDictionary buildDataDictionary(InputSchema schema, CategoricalValueEncodings categoricalValueEncodings)
public static List<String> getFeatureNames(org.dmg.pmml.DataDictionary dictionary)
dictionary
- DataDictionary
from modelpublic static CategoricalValueEncodings buildCategoricalValueEncodings(org.dmg.pmml.DataDictionary dictionary)
public static org.dmg.pmml.PMML readPMMLFromUpdateKeyMessage(String key, String message, org.apache.hadoop.conf.Configuration hadoopConf) throws IOException
IOException
Copyright © 2014–2018. All rights reserved.