本文整理匯總了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);
}
示例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);
}
示例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);
}
示例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));
}