Search in sources :

Example 1 with FilterClassifier

use of org.apache.apex.malhar.lib.testbench.FilterClassifier in project apex-malhar by apache.

the class FilterClassifierApp method populateDAG.

@Override
public void populateDAG(DAG dag, Configuration conf) {
    FilterClassifier filter = dag.addOperator("filter", new FilterClassifier());
    HashMap<String, Double> kmap = new HashMap<String, Double>(3);
    kmap.put("a", 1.0);
    kmap.put("b", 4.0);
    kmap.put("c", 5.0);
    ArrayList<Integer> list = new ArrayList<Integer>(3);
    HashMap<String, ArrayList<Integer>> wmap = new HashMap<String, ArrayList<Integer>>(4);
    list.add(60);
    list.add(10);
    list.add(35);
    wmap.put("ia", list);
    list = new ArrayList<Integer>(3);
    list.add(10);
    list.add(75);
    list.add(15);
    wmap.put("ib", list);
    list = new ArrayList<Integer>(3);
    list.add(20);
    list.add(10);
    list.add(70);
    wmap.put("ic", list);
    list = new ArrayList<Integer>(3);
    list.add(50);
    list.add(15);
    list.add(35);
    wmap.put("id", list);
    filter.setKeyMap(kmap);
    filter.setKeyWeights(wmap);
    filter.setPassFilter(10);
    filter.setTotalFilter(100);
    HashMapOperator hmapOper = dag.addOperator("hmapOper", new HashMapOperator());
    DevNull<HashMap<String, Double>> dev = dag.addOperator("dev", new DevNull());
    dag.addStream("filter1", hmapOper.hmap_data, filter.data).setLocality(locality);
    dag.addStream("filer2", filter.filter, dev.data).setLocality(locality);
}
Also used : FilterClassifier(org.apache.apex.malhar.lib.testbench.FilterClassifier) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) DevNull(org.apache.apex.malhar.lib.stream.DevNull)

Aggregations

ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 DevNull (org.apache.apex.malhar.lib.stream.DevNull)1 FilterClassifier (org.apache.apex.malhar.lib.testbench.FilterClassifier)1