本文整理汇总了Java中org.dmg.pmml.LocalTransformations类的典型用法代码示例。如果您正苦于以下问题:Java LocalTransformations类的具体用法?Java LocalTransformations怎么用?Java LocalTransformations使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
LocalTransformations类属于org.dmg.pmml包,在下文中一共展示了LocalTransformations类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getActiveFields
import org.dmg.pmml.LocalTransformations; //导入依赖的package包/类
static
public Set<Field> getActiveFields(DeepFieldResolver resolver, Model model){
Set<Field> modelFields = getModelFields(resolver, model);
FieldReferenceFinder fieldReferenceFinder = new FieldReferenceFinder(){
@Override
public VisitorAction visit(LocalTransformations localTransformations){
return VisitorAction.SKIP;
}
};
fieldReferenceFinder.applyTo(model);
Set<Field> activeFields = FieldUtil.selectAll(modelFields, fieldReferenceFinder.getFieldNames());
Output output = model.getOutput();
if(output != null){
activeFields.removeAll(output.getOutputFields());
}
return activeFields;
}
示例2: visit
import org.dmg.pmml.LocalTransformations; //导入依赖的package包/类
@Override
public VisitorAction visit(Model model){
LocalTransformations localTransformations = model.getLocalTransformations();
if(localTransformations != null && localTransformations.hasDerivedFields()){
declare(model, localTransformations.getDerivedFields());
}
return VisitorAction.CONTINUE;
}
示例3: visit
import org.dmg.pmml.LocalTransformations; //导入依赖的package包/类
@Override
public VisitorAction visit(LocalTransformations localTransformations){
if(localTransformations.hasDerivedFields()){
this.localDerivedFields.addAll(localTransformations.getDerivedFields());
}
return super.visit(localTransformations);
}
示例4: expandDerivedFields
import org.dmg.pmml.LocalTransformations; //导入依赖的package包/类
private void expandDerivedFields(Model model, Set<Field> fields){
FieldDependencyResolver fieldDependencyResolver = getFieldDependencyResolver();
fieldDependencyResolver.expand(fields, fieldDependencyResolver.getGlobalDerivedFields());
LocalTransformations localTransformations = model.getLocalTransformations();
if(localTransformations != null && localTransformations.hasDerivedFields()){
fieldDependencyResolver.expand(fields, new HashSet<>(localTransformations.getDerivedFields()));
}
}
示例5: popParent
import org.dmg.pmml.LocalTransformations; //导入依赖的package包/类
@Override
public PMMLObject popParent(){
PMMLObject parent = super.popParent();
if(parent instanceof Model){
Model model = (Model)parent;
LocalTransformations localTransformations = model.getLocalTransformations();
if(localTransformations != null){
processLocalTransformations(localTransformations);
if(!localTransformations.hasDerivedFields()){
model.setLocalTransformations(null);
}
}
} else
if(parent instanceof PMML){
PMML pmml = (PMML)parent;
TransformationDictionary transformationDictionary = pmml.getTransformationDictionary();
if(transformationDictionary != null){
processTransformationDictionary(transformationDictionary);
if(!transformationDictionary.hasDefineFunctions() && !transformationDictionary.hasDerivedFields()){
pmml.setTransformationDictionary(null);
}
}
}
return parent;
}
示例6: isDictionary
import org.dmg.pmml.LocalTransformations; //导入依赖的package包/类
static
public boolean isDictionary(PMMLObject parent){
if((parent instanceof TransformationDictionary) || (parent instanceof LocalTransformations)){
return true;
}
return false;
}
示例7: visit
import org.dmg.pmml.LocalTransformations; //导入依赖的package包/类
@Override
public VisitorAction visit(Segmentation segmentation){
LocalTransformations localTransformations = segmentation.getLocalTransformations();
if(localTransformations != null){
report(new UnsupportedElementException(localTransformations));
}
return super.visit(segmentation);
}
示例8: MiningModelEvaluator
import org.dmg.pmml.LocalTransformations; //导入依赖的package包/类
public MiningModelEvaluator(PMML pmml, MiningModel miningModel){
super(pmml, miningModel);
if(miningModel.hasEmbeddedModels()){
List<EmbeddedModel> embeddedModels = miningModel.getEmbeddedModels();
EmbeddedModel embeddedModel = Iterables.getFirst(embeddedModels, null);
throw new UnsupportedElementException(embeddedModel);
}
Segmentation segmentation = miningModel.getSegmentation();
if(segmentation == null){
throw new MissingElementException(miningModel, PMMLElements.MININGMODEL_SEGMENTATION);
}
Segmentation.MultipleModelMethod multipleModelMethod = segmentation.getMultipleModelMethod();
if(multipleModelMethod == null){
throw new MissingAttributeException(segmentation, PMMLAttributes.SEGMENTATION_MULTIPLEMODELMETHOD);
} // End if
if(!segmentation.hasSegments()){
throw new MissingElementException(segmentation, PMMLElements.SEGMENTATION_SEGMENTS);
}
LocalTransformations localTransformations = segmentation.getLocalTransformations();
if(localTransformations != null){
throw new UnsupportedElementException(localTransformations);
}
}
示例9: ModelEvaluator
import org.dmg.pmml.LocalTransformations; //导入依赖的package包/类
protected ModelEvaluator(PMML pmml, M model){
setPMML(Objects.requireNonNull(pmml));
setModel(Objects.requireNonNull(model));
DataDictionary dataDictionary = pmml.getDataDictionary();
if(dataDictionary == null){
throw new MissingElementException(pmml, PMMLElements.PMML_DATADICTIONARY);
} // End if
if(dataDictionary.hasDataFields()){
this.dataFields = CacheUtil.getValue(dataDictionary, ModelEvaluator.dataFieldCache);
}
TransformationDictionary transformationDictionary = pmml.getTransformationDictionary();
if(transformationDictionary != null && transformationDictionary.hasDerivedFields()){
this.derivedFields = CacheUtil.getValue(transformationDictionary, ModelEvaluator.derivedFieldCache);
} // End if
if(transformationDictionary != null && transformationDictionary.hasDefineFunctions()){
this.defineFunctions = CacheUtil.getValue(transformationDictionary, ModelEvaluator.defineFunctionCache);
}
MiningFunction miningFunction = model.getMiningFunction();
if(miningFunction == null){
throw new MissingAttributeException(MissingAttributeException.formatMessage(XPathUtil.formatElement(model.getClass()) + "@miningFunction"), model);
}
MiningSchema miningSchema = model.getMiningSchema();
if(miningSchema == null){
throw new MissingElementException(MissingElementException.formatMessage(XPathUtil.formatElement(model.getClass()) + "/" + XPathUtil.formatElement(MiningSchema.class)), model);
} // End if
if(miningSchema.hasMiningFields()){
this.miningFields = CacheUtil.getValue(miningSchema, ModelEvaluator.miningFieldCache);
}
LocalTransformations localTransformations = model.getLocalTransformations();
if(localTransformations != null && localTransformations.hasDerivedFields()){
this.localDerivedFields = CacheUtil.getValue(localTransformations, ModelEvaluator.localDerivedFieldCache);
}
Targets targets = model.getTargets();
if(targets != null && targets.hasTargets()){
this.targets = CacheUtil.getValue(targets, ModelEvaluator.targetCache);
}
Output output = model.getOutput();
if(output != null && output.hasOutputFields()){
this.outputFields = CacheUtil.getValue(output, ModelEvaluator.outputFieldCache);
}
}
示例10: load
import org.dmg.pmml.LocalTransformations; //导入依赖的package包/类
@Override
public Map<FieldName, DerivedField> load(LocalTransformations localTransformations){
return IndexableUtil.buildMap(localTransformations.getDerivedFields());
}
示例11: getLocalTransformations
import org.dmg.pmml.LocalTransformations; //导入依赖的package包/类
@Override
public LocalTransformations getLocalTransformations(){
return this.localTransformations;
}
示例12: setLocalTransformations
import org.dmg.pmml.LocalTransformations; //导入依赖的package包/类
@Override
public JavaModel setLocalTransformations(@Property("localTransformations") LocalTransformations localTransformations){
this.localTransformations = localTransformations;
return this;
}
示例13: processLocalTransformations
import org.dmg.pmml.LocalTransformations; //导入依赖的package包/类
private void processLocalTransformations(LocalTransformations localTransformations){
if(localTransformations.hasDerivedFields()){
List<DerivedField> derivedFields = localTransformations.getDerivedFields();
Set<DerivedField> activeDerivedFields = getActiveDerivedFields(new HashSet<>(derivedFields));
derivedFields.retainAll(activeDerivedFields);
}
}