当前位置: 首页>>代码示例>>Java>>正文


Java ConditionOp类代码示例

本文整理汇总了Java中org.datavec.api.transform.condition.ConditionOp的典型用法代码示例。如果您正苦于以下问题:Java ConditionOp类的具体用法?Java ConditionOp怎么用?Java ConditionOp使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ConditionOp类属于org.datavec.api.transform.condition包,在下文中一共展示了ConditionOp类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testConditionalReplaceValueTransform

import org.datavec.api.transform.condition.ConditionOp; //导入依赖的package包/类
@Test
public void testConditionalReplaceValueTransform() {
    Schema schema = getSchema(ColumnType.Integer);

    Condition condition = new IntegerColumnCondition("column", ConditionOp.LessThan, 0);
    condition.setInputSchema(schema);

    Transform transform = new ConditionalReplaceValueTransform("column", new IntWritable(0), condition);
    transform.setInputSchema(schema);

    assertEquals(Collections.singletonList((Writable) new IntWritable(10)),
                    transform.map(Collections.singletonList((Writable) new IntWritable(10))));
    assertEquals(Collections.singletonList((Writable) new IntWritable(1)),
                    transform.map(Collections.singletonList((Writable) new IntWritable(1))));
    assertEquals(Collections.singletonList((Writable) new IntWritable(0)),
                    transform.map(Collections.singletonList((Writable) new IntWritable(0))));
    assertEquals(Collections.singletonList((Writable) new IntWritable(0)),
                    transform.map(Collections.singletonList((Writable) new IntWritable(-1))));
    assertEquals(Collections.singletonList((Writable) new IntWritable(0)),
                    transform.map(Collections.singletonList((Writable) new IntWritable(-10))));
}
 
开发者ID:deeplearning4j,项目名称:DataVec,代码行数:22,代码来源:TestTransforms.java

示例2: testConditionalReplaceValueTransformWithDefault

import org.datavec.api.transform.condition.ConditionOp; //导入依赖的package包/类
@Test
public void testConditionalReplaceValueTransformWithDefault() {
    Schema schema = getSchema(ColumnType.Integer);

    Condition condition = new IntegerColumnCondition("column", ConditionOp.LessThan, 0);
    condition.setInputSchema(schema);

    Transform transform = new ConditionalReplaceValueTransformWithDefault("column", new IntWritable(0), new IntWritable(1), condition);
    transform.setInputSchema(schema);

    assertEquals(Collections.singletonList((Writable) new IntWritable(1)),
            transform.map(Collections.singletonList((Writable) new IntWritable(10))));
    assertEquals(Collections.singletonList((Writable) new IntWritable(1)),
            transform.map(Collections.singletonList((Writable) new IntWritable(1))));
    assertEquals(Collections.singletonList((Writable) new IntWritable(1)),
            transform.map(Collections.singletonList((Writable) new IntWritable(0))));
    assertEquals(Collections.singletonList((Writable) new IntWritable(0)),
            transform.map(Collections.singletonList((Writable) new IntWritable(-1))));
    assertEquals(Collections.singletonList((Writable) new IntWritable(0)),
            transform.map(Collections.singletonList((Writable) new IntWritable(-10))));
}
 
开发者ID:deeplearning4j,项目名称:DataVec,代码行数:22,代码来源:TestTransforms.java

示例3: IntegerColumnCondition

import org.datavec.api.transform.condition.ConditionOp; //导入依赖的package包/类
/**
 * Constructor for operations such as less than, equal to, greater than, etc.
 *
 * @param column                Column to check for the condition
 * @param sequenceConditionMode Mode for handling sequence data
 * @param op                    Operation (<, >=, !=, etc)
 * @param value                 Value to use in the condition
 */
public IntegerColumnCondition(String column, SequenceConditionMode sequenceConditionMode, ConditionOp op,
                int value) {
    super(column, sequenceConditionMode);
    if (op == ConditionOp.InSet || op == ConditionOp.NotInSet) {
        throw new IllegalArgumentException(
                        "Invalid condition op: cannot use this constructor with InSet or NotInSet ops");
    }
    this.op = op;
    this.value = value;
    this.set = null;
}
 
开发者ID:deeplearning4j,项目名称:DataVec,代码行数:20,代码来源:IntegerColumnCondition.java

示例4: TimeColumnCondition

import org.datavec.api.transform.condition.ConditionOp; //导入依赖的package包/类
/**
 * Constructor for operations such as less than, equal to, greater than, etc.
 *
 * @param column                Column to check for the condition
 * @param sequenceConditionMode Mode for handling sequence data
 * @param op                    Operation (<, >=, !=, etc)
 * @param value                 Time value (in epoch millisecond format) to use in the condition
 */
public TimeColumnCondition(String column, SequenceConditionMode sequenceConditionMode, ConditionOp op, long value) {
    super(column, sequenceConditionMode);
    if (op == ConditionOp.InSet || op == ConditionOp.NotInSet) {
        throw new IllegalArgumentException(
                        "Invalid condition op: cannot use this constructor with InSet or NotInSet ops");
    }
    this.op = op;
    this.value = value;
    this.set = null;
}
 
开发者ID:deeplearning4j,项目名称:DataVec,代码行数:19,代码来源:TimeColumnCondition.java

示例5: LongColumnCondition

import org.datavec.api.transform.condition.ConditionOp; //导入依赖的package包/类
/**
 * Constructor for operations such as less than, equal to, greater than, etc.
 *
 * @param column                Column to check for the condition
 * @param sequenceConditionMode Mode for handling sequence data
 * @param op                    Operation (<, >=, !=, etc)
 * @param value                 Value to use in the condition
 */
public LongColumnCondition(String column, SequenceConditionMode sequenceConditionMode, ConditionOp op, long value) {
    super(column, sequenceConditionMode);
    if (op == ConditionOp.InSet || op == ConditionOp.NotInSet) {
        throw new IllegalArgumentException(
                        "Invalid condition op: cannot use this constructor with InSet or NotInSet ops");
    }
    this.op = op;
    this.value = value;
    this.set = null;
}
 
开发者ID:deeplearning4j,项目名称:DataVec,代码行数:19,代码来源:LongColumnCondition.java

示例6: CategoricalColumnCondition

import org.datavec.api.transform.condition.ConditionOp; //导入依赖的package包/类
/**
 * Constructor for conditions equal or not equal
 *
 * @param columnName            Column to check for the condition
 * @param sequenceConditionMode Mode for handling sequence data
 * @param op                    Operation (== or != only)
 * @param value                 Value to use in the condition
 */
public CategoricalColumnCondition(String columnName, SequenceConditionMode sequenceConditionMode, ConditionOp op,
                String value) {
    super(columnName, sequenceConditionMode);
    if (op != ConditionOp.Equal && op != ConditionOp.NotEqual) {
        throw new IllegalArgumentException(
                        "Invalid condition op: can only use this constructor with Equal or NotEqual conditions");
    }
    this.op = op;
    this.value = value;
    this.set = null;
}
 
开发者ID:deeplearning4j,项目名称:DataVec,代码行数:20,代码来源:CategoricalColumnCondition.java

示例7: StringColumnCondition

import org.datavec.api.transform.condition.ConditionOp; //导入依赖的package包/类
/**
 * Constructor for conditions equal or not equal
 *
 * @param column                Column to check for the condition
 * @param sequenceConditionMode Mode for handling sequence data
 * @param op                    Operation (== or != only)
 * @param value                 Value to use in the condition
 */
public StringColumnCondition(String column, SequenceConditionMode sequenceConditionMode, ConditionOp op,
                String value) {
    super(column, sequenceConditionMode);
    if (op != ConditionOp.Equal && op != ConditionOp.NotEqual) {
        throw new IllegalArgumentException(
                        "Invalid condition op: can only use this constructor with Equal or NotEqual conditions");
    }
    this.op = op;
    this.value = value;
    this.set = null;
}
 
开发者ID:deeplearning4j,项目名称:DataVec,代码行数:20,代码来源:StringColumnCondition.java

示例8: DoubleColumnCondition

import org.datavec.api.transform.condition.ConditionOp; //导入依赖的package包/类
/**
 * Constructor for operations such as less than, equal to, greater than, etc.
 *
 * @param column                Column to check for the condition
 * @param sequenceConditionMode Mode for handling sequence data
 * @param op                    Operation (<, >=, !=, etc)
 * @param value                 Value to use in the condition
 */
public DoubleColumnCondition(String column, SequenceConditionMode sequenceConditionMode, ConditionOp op,
                double value) {
    super(column, sequenceConditionMode);
    if (op == ConditionOp.InSet || op == ConditionOp.NotInSet) {
        throw new IllegalArgumentException(
                        "Invalid condition op: cannot use this constructor with InSet or NotInSet ops");
    }
    this.op = op;
    this.value = value;
    this.set = null;
}
 
开发者ID:deeplearning4j,项目名称:DataVec,代码行数:20,代码来源:DoubleColumnCondition.java

示例9: SequenceLengthCondition

import org.datavec.api.transform.condition.ConditionOp; //导入依赖的package包/类
private SequenceLengthCondition(@JsonProperty("op") ConditionOp op, @JsonProperty("length") Integer length,
                @JsonProperty("set") Set<Integer> set) {
    if (set != null & op != ConditionOp.InSet && op != ConditionOp.NotInSet) {
        throw new IllegalArgumentException(
                        "Invalid condition op: can only use this constructor with InSet or NotInSet ops");
    }
    this.op = op;
    this.length = length;
    this.set = set;
}
 
开发者ID:deeplearning4j,项目名称:DataVec,代码行数:11,代码来源:SequenceLengthCondition.java

示例10: testConditionalCopyValueTransform

import org.datavec.api.transform.condition.ConditionOp; //导入依赖的package包/类
@Test
public void testConditionalCopyValueTransform() {
    Schema schema = new Schema.Builder().addColumnsString("first", "second", "third").build();

    Condition condition = new StringColumnCondition("third", ConditionOp.Equal, "");
    Transform transform = new ConditionalCopyValueTransform("third", "second", condition);
    transform.setInputSchema(schema);

    List<Writable> list = Arrays.asList((Writable) new Text("first"), new Text("second"), new Text("third"));
    assertEquals(list, transform.map(list));

    list = Arrays.asList((Writable) new Text("first"), new Text("second"), new Text(""));
    List<Writable> exp = Arrays.asList((Writable) new Text("first"), new Text("second"), new Text("second"));
    assertEquals(exp, transform.map(list));
}
 
开发者ID:deeplearning4j,项目名称:DataVec,代码行数:16,代码来源:TestTransforms.java

示例11: testConditionFilter

import org.datavec.api.transform.condition.ConditionOp; //导入依赖的package包/类
@Test
public void testConditionFilter() {
    Schema schema = new Schema.Builder().addColumnInteger("column").build();

    Condition condition = new IntegerColumnCondition("column", ConditionOp.LessThan, 0);
    condition.setInputSchema(schema);

    Filter filter = new ConditionFilter(condition);

    assertFalse(filter.removeExample(Collections.singletonList((Writable) new IntWritable(10))));
    assertFalse(filter.removeExample(Collections.singletonList((Writable) new IntWritable(1))));
    assertFalse(filter.removeExample(Collections.singletonList((Writable) new IntWritable(0))));
    assertTrue(filter.removeExample(Collections.singletonList((Writable) new IntWritable(-1))));
    assertTrue(filter.removeExample(Collections.singletonList((Writable) new IntWritable(-10))));
}
 
开发者ID:deeplearning4j,项目名称:DataVec,代码行数:16,代码来源:TestFilters.java

示例12: testFilters

import org.datavec.api.transform.condition.ConditionOp; //导入依赖的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

示例13: testDataAction

import org.datavec.api.transform.condition.ConditionOp; //导入依赖的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

示例14: toString

import org.datavec.api.transform.condition.ConditionOp; //导入依赖的package包/类
@Override
public String toString() {
    return "IntegerColumnCondition(columnName=\"" + columnName + "\"," + op + ","
                    + (op == ConditionOp.NotInSet || op == ConditionOp.InSet ? set : value) + ")";
}
 
开发者ID:deeplearning4j,项目名称:DataVec,代码行数:6,代码来源:IntegerColumnCondition.java

示例15: toString

import org.datavec.api.transform.condition.ConditionOp; //导入依赖的package包/类
@Override
public String toString() {
    return "TimeColumnCondition(columnName=\"" + columnName + "\"," + op + ","
                    + (op == ConditionOp.NotInSet || op == ConditionOp.InSet ? set : value) + ")";
}
 
开发者ID:deeplearning4j,项目名称:DataVec,代码行数:6,代码来源:TimeColumnCondition.java


注:本文中的org.datavec.api.transform.condition.ConditionOp类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。