public LocalTransformations addDerivedFields(DerivedField... derivedFields) { getDerivedFields().addAll(Arrays.asList(derivedFields)); return this; }
public LocalTransformations addDerivedFields(DerivedField... derivedFields) { getDerivedFields().addAll(Arrays.asList(derivedFields)); return this; }
public static Map<FieldName, DerivedField> getDerivedFieldMap(LocalTransformations localTransformations) { Map<FieldName, DerivedField> derivedFieldMap = new HashMap<FieldName, DerivedField>(); for(DerivedField derivedField: localTransformations.getDerivedFields()) { derivedFieldMap.put(derivedField.getName(), derivedField); } return derivedFieldMap; }
@Override public Map<FieldName, DerivedField> load(LocalTransformations localTransformations){ return IndexableUtil.buildMap(localTransformations.getDerivedFields()); } });
public static Map<FieldName, DerivedField> getDerivedFieldMap(LocalTransformations localTransformations) { Map<FieldName, DerivedField> derivedFieldMap = new HashMap<FieldName, DerivedField>(); for(DerivedField derivedField: localTransformations.getDerivedFields()) { derivedFieldMap.put(derivedField.getName(), derivedField); } return derivedFieldMap; }
private void processLocalTransformations(LocalTransformations localTransformations){ if(localTransformations.hasDerivedFields()){ List<DerivedField> derivedFields = localTransformations.getDerivedFields(); Set<DerivedField> activeDerivedFields = getActiveDerivedFields(new HashSet<>(derivedFields)); derivedFields.retainAll(activeDerivedFields); } }
private void processLocalTransformations(LocalTransformations localTransformations){ if(localTransformations.hasDerivedFields()){ List<DerivedField> derivedFields = localTransformations.getDerivedFields(); Set<DerivedField> activeDerivedFields = getActiveDerivedFields(new HashSet<>(derivedFields)); derivedFields.retainAll(activeDerivedFields); } }
@Override public VisitorAction visit(LocalTransformations localTransformations){ if(localTransformations.hasDerivedFields()){ this.localDerivedFields.addAll(localTransformations.getDerivedFields()); } return super.visit(localTransformations); }
@Override public VisitorAction visit(LocalTransformations localTransformations){ if(localTransformations.hasDerivedFields()){ this.localDerivedFields.addAll(localTransformations.getDerivedFields()); } return super.visit(localTransformations); }
@Override public VisitorAction visit(LocalTransformations localTransformations){ if(localTransformations.hasDerivedFields()){ suppress(localTransformations.getDerivedFields()); } return super.visit(localTransformations); }
@Override public VisitorAction visit(LocalTransformations localTransformations){ if(localTransformations.hasDerivedFields()){ suppress(localTransformations.getDerivedFields()); } return super.visit(localTransformations); }
@Override public VisitorAction visit(Model model){ LocalTransformations localTransformations = model.getLocalTransformations(); if(localTransformations != null && localTransformations.hasDerivedFields()){ declare(model, localTransformations.getDerivedFields()); } return super.visit(model); }
@Override public VisitorAction visit(Model model){ LocalTransformations localTransformations = model.getLocalTransformations(); if(localTransformations != null && localTransformations.hasDerivedFields()){ declare(model, localTransformations.getDerivedFields()); } return super.visit(model); }
private LocalTransformations getLocalTranformations(NeuralNetwork model) { // delete target List<DerivedField> derivedFields = model.getLocalTransformations().getDerivedFields(); // add bias DerivedField field = new DerivedField(OpType.CONTINUOUS, DataType.DOUBLE).withName(new FieldName( PluginConstants.biasValue)); field.withExpression(new Constant(String.valueOf(PluginConstants.bias))); derivedFields.add(field); return new LocalTransformations().withDerivedFields(derivedFields); }
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())); } }
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())); } }
@Override public VisitorAction visit(MiningModel miningModel){ LocalTransformations localTransformations = miningModel.getLocalTransformations(); String id; try { Segment segment = (Segment)getParent(); id = segment.getId(); } catch(ClassCastException cce){ id = null; } // End try if(id == null){ checkFields(FieldNameUtil.create("x12"), localTransformations.getDerivedFields()); } else if("first".equals(id)){ checkFields(FieldNameUtil.create("x123", "x1234", "x12345"), localTransformations.getDerivedFields()); } else if("second".equals(id)){ assertNull(localTransformations); } else { throw new AssertionError(); } return super.visit(miningModel); } };
@Override public VisitorAction visit(RegressionModel regressionModel){ LocalTransformations localTransformations = regressionModel.getLocalTransformations(); Segment segment = (Segment)getParent(); String id = segment.getId(); if("first".equals(id)){ assertNull(localTransformations); } else if("second".equals(id)){ checkFields(FieldNameUtil.create("x2_squared"), localTransformations.getDerivedFields()); } else if("third".equals(id)){ assertNull(localTransformations); } else if("sum".equals(id)){ assertNull(localTransformations); } else { throw new AssertionError(); } return super.visit(regressionModel); }
@Override public VisitorAction accept(Visitor visitor) { VisitorAction status = visitor.visit(this); if (status == VisitorAction.CONTINUE) { visitor.pushParent(this); if ((status == VisitorAction.CONTINUE)&&hasExtensions()) { status = org.dmg.pmml.PMMLObject.traverse(visitor, getExtensions()); } if ((status == VisitorAction.CONTINUE)&&hasDerivedFields()) { status = org.dmg.pmml.PMMLObject.traverse(visitor, getDerivedFields()); } visitor.popParent(); } if (status == VisitorAction.TERMINATE) { return VisitorAction.TERMINATE; } return VisitorAction.CONTINUE; }
@Override public VisitorAction accept(Visitor visitor) { VisitorAction status = visitor.visit(this); if (status == VisitorAction.CONTINUE) { visitor.pushParent(this); if ((status == VisitorAction.CONTINUE)&&hasExtensions()) { status = org.dmg.pmml.PMMLObject.traverse(visitor, getExtensions()); } if ((status == VisitorAction.CONTINUE)&&hasDerivedFields()) { status = org.dmg.pmml.PMMLObject.traverse(visitor, getDerivedFields()); } visitor.popParent(); } if (status == VisitorAction.TERMINATE) { return VisitorAction.TERMINATE; } return VisitorAction.CONTINUE; }