Examples of NumericTransformer


Examples of eu.scape_project.planning.model.transform.NumericTransformer

                for (String s : o.getList()) {
                    map.put(s, new TargetValueObject());
                }
            }
        } else {
            NumericTransformer t = new NumericTransformer();
            this.setTransformer(t);
        }
    }
View Full Code Here

Examples of eu.scape_project.planning.model.transform.NumericTransformer

                scaleLowerBound = s.getLowerBound();
                scaleUpperBound = s.getUpperBound();
            }

            // get Transformer thresholds
            NumericTransformer nt = (NumericTransformer) transformer;
            double transformerT1 = nt.getThreshold1();
            double transformerT2 = nt.getThreshold2();
            double transformerT3 = nt.getThreshold3();
            double transformerT4 = nt.getThreshold4();
            double transformerT5 = nt.getThreshold5();

            // calculate output bounds
            if (nt.hasIncreasingOrder()) {
                // increasing thresholds
                // lower bound
                if (scaleLowerBound < transformerT1) {
                    outputLowerBound = 0;
                } else if (scaleLowerBound < transformerT2) {
View Full Code Here

Examples of eu.scape_project.planning.model.transform.NumericTransformer

                }
            }

            // do numeric transformation
            if (transformer instanceof NumericTransformer) {
                NumericTransformer numericTrans = (NumericTransformer) transformer;

                if (val instanceof INumericValue) {
                    targetValue = numericTrans.transform((INumericValue) val);
                    transformedValues.add(targetValue.getValue());
                } else {
                    log.warn("getActualOutputRange(): IOrdinalValue value passed to NumericTransformer - ignore value");
                }
            }
View Full Code Here

Examples of eu.scape_project.planning.model.transform.NumericTransformer

    private VPlanLeaf createLeafWithNumericTransformer(SampleAggregationMode aggregationMode) {
        VPlanLeaf leaf = new VPlanLeaf();

        // create simple transformer
        NumericTransformer numericTrans = new NumericTransformer();
        numericTrans.setThreshold1(1d);
        numericTrans.setThreshold2(2d);
        numericTrans.setThreshold3(3d);
        numericTrans.setThreshold4(4d);
        numericTrans.setThreshold5(5d);
        leaf.setTransformer(numericTrans);

        // set scale
        PositiveFloatScale scale = new PositiveFloatScale();
        leaf.setScale(scale);
View Full Code Here

Examples of eu.scape_project.planning.model.transform.NumericTransformer

            return;
        }
        StringBuffer sb = new StringBuffer();
        sb.append(sessionID).append(":").append(leafName);
        if (t instanceof NumericTransformer) {
            NumericTransformer nt = (NumericTransformer) t;
            sb.append("::NUMERICTRANSFORMER:: ");
            sb.append(nt.getThreshold1()).append(" ").append(nt.getThreshold2()).append(" ").append(nt.getThreshold3())
                .append(" ").append(nt.getThreshold4()).append(" ").append(nt.getThreshold5());
            log.debug(sb.toString());
        }
    }
View Full Code Here

Examples of eu.scape_project.planning.model.transform.NumericTransformer

        for (Leaf leaf : tree.getRoot().getAllLeaves()) {
            Transformer t = leaf.getTransformer();
            if (t instanceof NumericTransformer) {
                // calculate min, max
                // set min,max
                NumericTransformer nt = (NumericTransformer) t;

                // A very specific assumption: the lower the better (!)
                // obviously often not true, e.g. for format/numberOfTools

                double min = Long.MAX_VALUE;
                double max = Long.MIN_VALUE;

                for (Alternative a : alternativesDefinition.getConsideredAlternatives()) {
                    for (Value v : leaf.getValues(a.getName()).getList()) {
                        INumericValue value = (INumericValue) v;
                        if (value.value() > max) {
                            max = value.value();
                        }
                        if (value.value() < min) {
                            min = value.value();
                        }
                    }
                }
                nt.defaults(min, max);
                nt.setMode(TransformationMode.LINEAR);
            } else {
                OrdinalTransformer ot = (OrdinalTransformer) t;
                if (leaf.getScale() instanceof BooleanScale) {

                    ot.getMapping().put("Yes", new TargetValueObject(5));
View Full Code Here

Examples of eu.scape_project.planning.model.transform.NumericTransformer

                assertEl.addAttribute("test", test);
                assertEl.setText(explanation);
            }
          
        } else if (leaf.getTransformer() instanceof NumericTransformer){
            NumericTransformer numericT = (NumericTransformer)leaf.getTransformer();
            String explanation = leaf.getMeasure().getName() + " must be ";
            String operator;
            if (numericT.hasIncreasingOrder()) {
                explanation = explanation + " greater than or equal to " + numericT.getThreshold1();
                operator = " >= ";
            } else {
                explanation = explanation + " less than or equal to " + numericT.getThreshold1();
                operator = " <= ";               
            }
            String test = " . " + operator + " " + numericT.getThreshold1();

            Element rule = parent.addElement("rule");
            rule.addAttribute("context", CONTEXT_MEASURE.replace("${MEASURE}", leaf.getMeasure().getUri()));
            Element assertEl = rule.addElement("assert");
            assertEl.addAttribute("test", test);
View Full Code Here

Examples of eu.scape_project.planning.model.transform.NumericTransformer

                    // CHECK NUMERIC TRANSFORMER THRESHOLDS
                    for (Leaf l : plan.getTree().getRoot().getAllLeaves()) {
                        eu.scape_project.planning.model.transform.Transformer t = l.getTransformer();
                        if (t != null && t instanceof NumericTransformer) {
                            NumericTransformer nt = (NumericTransformer) t;
                            if (!nt.checkOrder()) {
                                StringBuffer sb = new StringBuffer("NUMERICTRANSFORMER THRESHOLD ERROR ");
                                sb.append(l.getName()).append("::NUMERICTRANSFORMER:: ");
                                sb.append(nt.getThreshold1()).append(" ").append(nt.getThreshold2()).append(" ")
                                    .append(nt.getThreshold3()).append(" ").append(nt.getThreshold4()).append(" ")
                                    .append(nt.getThreshold5());
                                log.error(sb.toString());
                            }
                        }
                    }
View Full Code Here

Examples of eu.scape_project.planning.model.transform.NumericTransformer

                table.addTargetValue(2.0);
                table.addTargetValue(3.0);
                table.addTargetValue(4.0);
                table.addTargetValue(5.0);

                NumericTransformer nTrans = (NumericTransformer) trans;
                Map<Double, String> tableMapping = new HashMap<Double, String>();
                tableMapping.put(1.0, nTrans.getThreshold1().toString());
                tableMapping.put(2.0, nTrans.getThreshold2().toString());
                tableMapping.put(3.0, nTrans.getThreshold3().toString());
                tableMapping.put(4.0, nTrans.getThreshold4().toString());
                tableMapping.put(5.0, nTrans.getThreshold5().toString());

                TransformationMode tMode = nTrans.getMode();
                table.addTransformerMapping(tableMapping, "thresholds (" + tMode.getName().toLowerCase() + ")");
            }
        }

        return table;
View Full Code Here

Examples of eu.scape_project.planning.model.transform.NumericTransformer

                log.info(prefix + "1st " + planInfo.getWinningAlternative() + ", 2nd : " + sndAlternative
                    + " in plan: " + planInfo.getId());
                // this criterion could be a game changer - map it back to the
                // measurement scale
                if (pLeaf.getTransformer() instanceof NumericTransformer) {
                    NumericTransformer numTransformer = (NumericTransformer) pLeaf.getTransformer();
                    // For numeric values: The percentage that we can change the
                    // value on the (overally!) winning candidate
                    // without the output range changing so much as to make the
                    // winning candidate lose its winning rank

                    // TODO: CHECK: Do we have a problem here? the values of an
                    // alternative are first transformed, then aggregated
                    // therefore we have to transform this winning value also
                    // back ...
                    double winnerMeasuredValue = numTransformer.transformBack(winnerTargetValue);
                    double minMeasuredValue = numTransformer.transformBack(minTargetValue);

                    // TODO: what if the measured value was 0.0?
                    if (winnerMeasuredValue != 0.0) {
                        leafFactor = (winnerMeasuredValue - minMeasuredValue) / winnerMeasuredValue;
                        if (!numTransformer.hasIncreasingOrder()) {
                            leafFactor *= -1.0;
                        }
                    }
                    log.info(prefix + " - numeric = " + leafFactor + intermediaryResults + ";  winnerMeasuredValue = "
                        + winnerMeasuredValue + "; minMeasuredValue = " + minMeasuredValue + "; plan id "
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.