當前位置: 首頁>>代碼示例>>Java>>正文


Java ConditionFilter類代碼示例

本文整理匯總了Java中org.datavec.api.transform.filter.ConditionFilter的典型用法代碼示例。如果您正苦於以下問題:Java ConditionFilter類的具體用法?Java ConditionFilter怎麽用?Java ConditionFilter使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ConditionFilter類屬於org.datavec.api.transform.filter包,在下文中一共展示了ConditionFilter類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testFilters

import org.datavec.api.transform.filter.ConditionFilter; //導入依賴的package包/類
@Test
public void testFilters() {
    Filter[] filters = new Filter[] {new FilterInvalidValues("A", "B"),
                    new ConditionFilter(new DoubleColumnCondition("Col", ConditionOp.GreaterOrEqual, 10.0))};

    for (Filter f : filters) {
        String yaml = y.serialize(f);
        String json = j.serialize(f);

        //            System.out.println(yaml);
        //            System.out.println(json);
        //            System.out.println();

        Filter t2 = y.deserializeFilter(yaml);
        Filter t3 = j.deserializeFilter(json);
        assertEquals(f, t2);
        assertEquals(f, t3);
    }

    String arrAsYaml = y.serialize(filters);
    String arrAsJson = j.serialize(filters);
    String listAsYaml = y.serializeFilterList(Arrays.asList(filters));
    String listAsJson = j.serializeFilterList(Arrays.asList(filters));

    //        System.out.println("\n\n\n\n");
    //        System.out.println(listAsYaml);

    List<Filter> lFromYaml = y.deserializeFilterList(listAsYaml);
    List<Filter> lFromJson = j.deserializeFilterList(listAsJson);

    assertEquals(Arrays.asList(filters), y.deserializeFilterList(arrAsYaml));
    assertEquals(Arrays.asList(filters), j.deserializeFilterList(arrAsJson));
    assertEquals(Arrays.asList(filters), lFromYaml);
    assertEquals(Arrays.asList(filters), lFromJson);
}
 
開發者ID:deeplearning4j,項目名稱:DataVec,代碼行數:36,代碼來源:TestYamlJsonSerde.java

示例2: testDataAction

import org.datavec.api.transform.filter.ConditionFilter; //導入依賴的package包/類
@Test
public void testDataAction() {
    DataAction[] dataActions = new DataAction[] {new DataAction(new CategoricalToIntegerTransform("Col")),
                    new DataAction(new ConditionFilter(new DoubleColumnCondition("Col", ConditionOp.Equal, 1))),
                    new DataAction(new ConvertToSequence("KeyCol", new NumericalColumnComparator("Col", true))),
                    new DataAction(new ConvertFromSequence()),
                    new DataAction(new SequenceSplitTimeSeparation("TimeCol", 1, TimeUnit.HOURS)),
                    new DataAction(new Reducer.Builder(ReduceOp.TakeFirst).build()),
                    new DataAction(new CalculateSortedRank("NewCol", "SortCol", new DoubleWritableComparator()))};

    for (DataAction f : dataActions) {
        String yaml = y.serialize(f);
        String json = j.serialize(f);

        //            System.out.println(yaml);
        //            System.out.println(json);
        //            System.out.println();

        DataAction t2 = y.deserializeDataAction(yaml);
        DataAction t3 = j.deserializeDataAction(json);
        assertEquals(f, t2);
        assertEquals(f, t3);
    }

    String arrAsYaml = y.serialize(dataActions);
    String arrAsJson = j.serialize(dataActions);
    String listAsYaml = y.serializeDataActionList(Arrays.asList(dataActions));
    String listAsJson = j.serializeDataActionList(Arrays.asList(dataActions));

    //        System.out.println("\n\n\n\n");
    //        System.out.println(listAsYaml);

    List<DataAction> lFromYaml = y.deserializeDataActionList(listAsYaml);
    List<DataAction> lFromJson = j.deserializeDataActionList(listAsJson);

    assertEquals(Arrays.asList(dataActions), y.deserializeDataActionList(arrAsYaml));
    assertEquals(Arrays.asList(dataActions), j.deserializeDataActionList(arrAsJson));
    assertEquals(Arrays.asList(dataActions), lFromYaml);
    assertEquals(Arrays.asList(dataActions), lFromJson);
}
 
開發者ID:deeplearning4j,項目名稱:DataVec,代碼行數:41,代碼來源:TestYamlJsonSerde.java

示例3: mapToFilter

import org.datavec.api.transform.filter.ConditionFilter; //導入依賴的package包/類
/**
 * Map a given filter
 * to a dataframe filter
 * @param toMap the filter to map
 * @return an apporiate {@link tech.tablesaw.filtering.Filter}
 * mapping from the datavec api
 */
public static tech.tablesaw.filtering.Filter mapToFilter(Filter toMap) {
    ConditionFilter conditionFilter = (ConditionFilter) toMap;
    Condition condition = conditionFilter.getCondition();
    Schema output = toMap.transform(toMap.getInputSchema());
    return mapFilterFromCondition(condition, toMap.columnName(), output);
}
 
開發者ID:deeplearning4j,項目名稱:DataVec,代碼行數:14,代碼來源:TableRecords.java

示例4: filter

import org.datavec.api.transform.filter.ConditionFilter; //導入依賴的package包/類
/**
 * Add a filter operation, based on the specified condition.
 *
 * If condition is satisfied (returns true): remove the example or sequence<br>
 * If condition is not satisfied (returns false): keep the example or sequence
 *
 * @param condition Condition to filter on
 */
public Builder filter(Condition condition) {
    return filter(new ConditionFilter(condition));
}
 
開發者ID:deeplearning4j,項目名稱:DataVec,代碼行數:12,代碼來源:TransformProcess.java


注:本文中的org.datavec.api.transform.filter.ConditionFilter類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。