use of org.kie.pmml.pmml_4_2.PMML4Model in project drools by kiegroup.
the class PMML4UnitImpl method initModelsMap.
/**
* Initializes the internal map of models. This map includes all models that are
* defined within the PMML, including child models (i.e. models contained within models)
*/
private void initModelsMap() {
modelsMap = new HashMap<>();
List<PMML4Model> rootModels = modelFactory.getModels(this);
if (rootModels != null && !rootModels.isEmpty()) {
for (PMML4Model model : rootModels) {
modelsMap.put(model.getModelId(), model);
addChildModelsToMap(model);
}
} else {
throw new IllegalStateException("BRMS-PMML requires at least one model of the model types that are recognized");
}
}
use of org.kie.pmml.pmml_4_2.PMML4Model in project drools by kiegroup.
the class PMML4UnitImpl method getChildModels.
/**
* Retrieves a Map whose entries consist of
* key -> a model identifier
* value -> the PMML4Model object that the key refers to
* where the PMML4Model indicates that it
* @param parentModelId
* @return
*/
public Map<String, PMML4Model> getChildModels(String parentModelId) {
PMML4Model parent = modelsMap.get(parentModelId);
Map<String, PMML4Model> childMap = parent.getChildModels();
return (childMap != null && !childMap.isEmpty()) ? new HashMap<>(childMap) : new HashMap<>();
}
use of org.kie.pmml.pmml_4_2.PMML4Model in project drools by kiegroup.
the class PMML4UnitImpl method getMiningFields.
/**
* Retrieves a Map with entries that consist of
* key -> a model identifier
* value -> the List of raw MiningField objects belonging to the model referenced by the key
* @return The Map of model identifiers and their corresponding list of raw MiningField objects
*/
public Map<String, List<MiningField>> getMiningFields() {
Map<String, List<MiningField>> miningFieldsMap = new HashMap<>();
for (PMML4Model model : getModels()) {
List<MiningField> miningFields = model.getRawMiningFields();
miningFieldsMap.put(model.getModelId(), miningFields);
model.getChildModels();
}
return miningFieldsMap;
}
Aggregations