org.nd4j.shade.jackson.annotation.JsonProperty Java Examples

The following examples show how to use org.nd4j.shade.jackson.annotation.JsonProperty. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TimeMathOpTransform.java    From DataVec with Apache License 2.0 6 votes vote down vote up
public TimeMathOpTransform(@JsonProperty("columnName") String columnName, @JsonProperty("mathOp") MathOp mathOp,
                @JsonProperty("timeQuantity") long timeQuantity, @JsonProperty("timeUnit") TimeUnit timeUnit) {
    super(columnName);
    if (mathOp != MathOp.Add && mathOp != MathOp.Subtract && mathOp != MathOp.ScalarMin
                    && mathOp != MathOp.ScalarMax) {
        throw new IllegalArgumentException("Invalid MathOp: only Add/Subtract/ScalarMin/ScalarMax supported");
    }
    if ((mathOp == MathOp.ScalarMin || mathOp == MathOp.ScalarMax) && timeUnit != TimeUnit.MILLISECONDS) {
        throw new IllegalArgumentException(
                        "Only valid time unit for ScalarMin/Max is Milliseconds (i.e., timestamp format)");
    }

    this.mathOp = mathOp;
    this.timeQuantity = timeQuantity;
    this.timeUnit = timeUnit;
    this.asMilliseconds = TimeUnit.MILLISECONDS.convert(timeQuantity, timeUnit);
}
 
Example #2
Source File: FilterImageTransform.java    From DataVec with Apache License 2.0 6 votes vote down vote up
/**
 * Constructs a filtergraph out of the filter specification.
 *
 * @param filters  to use
 * @param width    of the input images
 * @param height   of the input images
 * @param channels of the input images
 */
public FilterImageTransform(@JsonProperty("filters") String filters, @JsonProperty("width") int width,
                @JsonProperty("height") int height, @JsonProperty("channels") int channels) {
    super(null);

    this.filters = filters;
    this.width = width;
    this.height = height;
    this.channels = channels;

    int pixelFormat = channels == 1 ? AV_PIX_FMT_GRAY8
                    : channels == 3 ? AV_PIX_FMT_BGR24 : channels == 4 ? AV_PIX_FMT_RGBA : AV_PIX_FMT_NONE;
    if (pixelFormat == AV_PIX_FMT_NONE) {
        throw new IllegalArgumentException("Unsupported number of channels: " + channels);
    }
    try {
        filter = new FFmpegFrameFilter(filters, width, height);
        filter.setPixelFormat(pixelFormat);
        filter.start();
    } catch (FrameFilter.Exception e) {
        throw new RuntimeException(e);
    }
}
 
Example #3
Source File: SequenceOffsetTransform.java    From DataVec with Apache License 2.0 6 votes vote down vote up
public SequenceOffsetTransform(@JsonProperty("columnsToOffset") List<String> columnsToOffset,
                @JsonProperty("offsetAmount") int offsetAmount,
                @JsonProperty("operationType") OperationType operationType,
                @JsonProperty("edgeHandling") EdgeHandling edgeHandling,
                @JsonProperty("edgeCaseValue") Writable edgeCaseValue) {
    if (edgeCaseValue != null && edgeHandling != EdgeHandling.SpecifiedValue) {
        throw new UnsupportedOperationException(
                        "edgeCaseValue was non-null, but EdgeHandling was not set to SpecifiedValue. "
                                        + "edgeCaseValue can only be used with SpecifiedValue mode");
    }

    this.columnsToOffset = columnsToOffset;
    this.offsetAmount = offsetAmount;
    this.operationType = operationType;
    this.edgeHandling = edgeHandling;
    this.edgeCaseValue = edgeCaseValue;

    this.columnsToOffsetSet = new HashSet<>(columnsToOffset);
}
 
Example #4
Source File: SequenceSplitTimeSeparation.java    From DataVec with Apache License 2.0 5 votes vote down vote up
/**
 * @param timeColumn      Time column to consider when splitting
 * @param timeQuantity    Value/amount (of the specified TimeUnit)
 * @param timeUnit        The unit of time
 */
public SequenceSplitTimeSeparation(@JsonProperty("timeColumn") String timeColumn,
                @JsonProperty("timeQuantity") long timeQuantity, @JsonProperty("timeUnit") TimeUnit timeUnit) {
    this.timeColumn = timeColumn;
    this.timeQuantity = timeQuantity;
    this.timeUnit = timeUnit;

    this.separationMilliseconds = TimeUnit.MILLISECONDS.convert(timeQuantity, timeUnit);
}
 
Example #5
Source File: CategoricalColumnCondition.java    From DataVec with Apache License 2.0 5 votes vote down vote up
private CategoricalColumnCondition(@JsonProperty("columnName") String columnName,
                @JsonProperty("op") ConditionOp op, @JsonProperty("value") String value,
                @JsonProperty("set") Set<String> set) {
    super(columnName, DEFAULT_SEQUENCE_CONDITION_MODE);
    this.op = op;
    this.value = value;
    this.set = set;
}
 
Example #6
Source File: TimeColumnCondition.java    From DataVec with Apache License 2.0 5 votes vote down vote up
private TimeColumnCondition(@JsonProperty("columnName") String columnName, @JsonProperty("op") ConditionOp op,
                @JsonProperty("value") long value, @JsonProperty("set") Set<Long> set) {
    super(columnName, DEFAULT_SEQUENCE_CONDITION_MODE);
    this.op = op;
    this.value = (set == null ? value : null);
    this.set = set;
}
 
Example #7
Source File: ImageCropStep.java    From konduit-serving with Apache License 2.0 5 votes vote down vote up
public ImageCropStep(@JsonProperty("inputNames") String imageName, @JsonProperty("cropName") String cropName,
                     @JsonProperty("cropPoints") List<Point> cropPoints, @JsonProperty("cropBox") BoundingBox cropBox,
                     @JsonProperty("coordsArePixels") boolean coordsArePixels) {
    this.imageName = imageName;
    this.cropName = cropName;
    this.cropPoints = cropPoints;
    this.cropBox = cropBox;
    this.coordsArePixels = coordsArePixels;
}
 
Example #8
Source File: VideoFrameCaptureStep.java    From konduit-serving with Apache License 2.0 5 votes vote down vote up
public VideoFrameCaptureStep(@JsonProperty("filePath") String filePath, @JsonProperty("outputKey") String outputKey,
                             @JsonProperty("loop") boolean loop, @JsonProperty("skipFrames") Integer skipFrames){
    this.filePath = filePath;
    this.outputKey = outputKey;
    this.loop = loop;
    this.skipFrames = skipFrames;
}
 
Example #9
Source File: CameraFrameCaptureStep.java    From konduit-serving with Apache License 2.0 5 votes vote down vote up
public CameraFrameCaptureStep(@JsonProperty("camera") int camera, @JsonProperty("width") int width,
                              @JsonProperty("height") int height, @JsonProperty("outputKey") String outputKey,
                              @JsonProperty("skipFrames") Integer skipFrames){
    this.camera = camera;
    this.width = width;
    this.height = height;
    this.outputKey = outputKey;
}
 
Example #10
Source File: UberJarDeployment.java    From konduit-serving with Apache License 2.0 5 votes vote down vote up
public UberJarDeployment(@JsonProperty("outputDir") String outputDir, @JsonProperty("jarName") String jarName,
                         @JsonProperty("groupId") String groupId, @JsonProperty("artifactId") String artifactId,
                         @JsonProperty("version") String version){
    this.outputDir = outputDir;
    this.jarName = jarName;
    this.groupId = groupId;
    this.artifactId = artifactId;
    this.version = version;
}
 
Example #11
Source File: ImageToNDArrayStep.java    From konduit-serving with Apache License 2.0 5 votes vote down vote up
public ImageToNDArrayStep(@JsonProperty("config") ImageToNDArrayConfig config, @JsonProperty("keys") List<String> keys,
                          @JsonProperty("outputNames") List<String> outputNames, @JsonProperty("keepOtherValues") boolean keepOtherValues,
                          @JsonProperty("metadata") boolean metadata, @JsonProperty("metadataKey") String metadataKey){
    this.config = config;
    this.keys = keys;
    this.outputNames = outputNames;
    this.keepOtherValues = keepOtherValues;
    this.metadata = metadata;
    this.metadataKey = metadataKey;
}
 
Example #12
Source File: TimeMetaData.java    From DataVec with Apache License 2.0 5 votes vote down vote up
/**
 * @param timeZone     Timezone for this column. Typically used for parsing and some transforms
 * @param minValidTime Minimum valid time, in milliseconds (timestamp format). If null: no restriction
 * @param maxValidTime Maximum valid time, in milliseconds (timestamp format). If null: no restriction
 */
public TimeMetaData(@JsonProperty("name") String name, @JsonProperty("timeZone") DateTimeZone timeZone,
                @JsonProperty("minValidTime") Long minValidTime, @JsonProperty("maxValidTime") Long maxValidTime) {
    super(name);
    this.timeZone = timeZone;
    this.minValidTime = minValidTime;
    this.maxValidTime = maxValidTime;
}
 
Example #13
Source File: CalculateSortedRank.java    From DataVec with Apache License 2.0 5 votes vote down vote up
/**
 *
 * @param newColumnName    Name of the new column (will contain the rank for each example)
 * @param sortOnColumn     Name of the column to sort on
 * @param comparator       Comparator used to sort examples
 * @param ascending        Whether examples should be ascending or descending, using the comparator
 */
public CalculateSortedRank(@JsonProperty("newColumnName") String newColumnName,
                @JsonProperty("sortOnColumn") String sortOnColumn,
                @JsonProperty("comparator") WritableComparator comparator,
                @JsonProperty("ascending") boolean ascending) {
    this.newColumnName = newColumnName;
    this.sortOnColumn = sortOnColumn;
    this.comparator = comparator;
    this.ascending = ascending;
}
 
Example #14
Source File: SequenceMovingWindowReduceTransform.java    From DataVec with Apache License 2.0 5 votes vote down vote up
/**
 * @param columnName       Column name to perform windowing on
 * @param newColumnName    Name of the new output column (with results)
 * @param lookback         Look back period for windowing
 * @param op               Reduction operation to perform on each window
 * @param edgeCaseHandling How the 1st steps should be handled (positions in sequence with indices less then the look-back period)
 * @param edgeCaseValue    Used only with EdgeCaseHandling.SpecifiedValue, maybe null otherwise
 */
public SequenceMovingWindowReduceTransform(@JsonProperty("columnName") String columnName,
                @JsonProperty("newColumnName") String newColumnName, @JsonProperty("lookback") int lookback,
                @JsonProperty("op") ReduceOp op,
                @JsonProperty("edgeCaseHandling") EdgeCaseHandling edgeCaseHandling,
                @JsonProperty("edgeCaseValue") Writable edgeCaseValue) {
    this.columnName = columnName;
    this.newColumnName = newColumnName;
    this.lookback = lookback;
    this.op = op;
    this.edgeCaseHandling = edgeCaseHandling;
    this.edgeCaseValue = edgeCaseValue;
}
 
Example #15
Source File: DataStringSwitchFn.java    From konduit-serving with Apache License 2.0 5 votes vote down vote up
public DataStringSwitchFn(@JsonProperty("numOutputs") int numOutputs, @JsonProperty("fieldName") String fieldName,
                          @JsonProperty("map") Map<String, Integer> map) {
    Preconditions.checkState(numOutputs > 0, "Number of outputs must be positive, got %s", numOutputs);
    this.numOutputs = numOutputs;
    this.fieldName = fieldName;
    this.map = map;
}
 
Example #16
Source File: ConditionalReplaceValueTransform.java    From DataVec with Apache License 2.0 5 votes vote down vote up
/**
 * @param columnToReplace Name of the column in which to replace the old value with 'newValue', if the condition holds
 * @param newValue        New value to use
 * @param condition       Condition
 */
public ConditionalReplaceValueTransform(@JsonProperty("columnToReplace") String columnToReplace,
                @JsonProperty("newValue") Writable newValue, @JsonProperty("condition") Condition condition) {
    this.columnToReplace = columnToReplace;
    this.newValue = newValue;
    this.condition = condition;
}
 
Example #17
Source File: StringMetaData.java    From DataVec with Apache License 2.0 5 votes vote down vote up
/**
 * @param mustMatchRegex Nullable. If not null: this is a regex that each string must match in order for the entry
 *                       to be considered valid.
 * @param minLength      Min allowable String length. If null: no restriction on min String length
 * @param maxLength      Max allowable String length. If null: no restriction on max String length
 */
public StringMetaData(@JsonProperty("name") String name, @JsonProperty("regex") String mustMatchRegex,
                @JsonProperty("minLength") Integer minLength, @JsonProperty("maxLength") Integer maxLength) {
    super(name);
    this.regex = mustMatchRegex;
    this.minLength = minLength;
    this.maxLength = maxLength;
}
 
Example #18
Source File: OverlappingTimeWindowFunction.java    From DataVec with Apache License 2.0 5 votes vote down vote up
/**
 * Constructor with optional offset, ability to add window start/end time columns
 *
 * @param timeColumn               Name of the column that contains the time values (must be a time column)
 * @param windowSize               Numerical quantity for the size of the time window (used in conjunction with windowSizeUnit)
 * @param windowSizeUnit           Unit of the time window
 * @param windowSeparation         The separation between consecutive window start times (used in conjunction with WindowSeparationUnit)
 * @param windowSeparationUnit     Unit for the separation between windows
 * @param offset                   Optional offset amount, to shift start/end of the time window forward or back
 * @param offsetUnit               Optional offset unit for the offset amount.
 * @param addWindowStartTimeColumn If true: add a time column (name: "windowStartTime") that contains the start time
 *                                 of the window
 * @param addWindowEndTimeColumn   If true: add a time column (name: "windowEndTime") that contains the end time
 *                                 of the window
 * @param excludeEmptyWindows      If true: exclude any windows that don't have any values in them
 */
public OverlappingTimeWindowFunction(@JsonProperty("timeColumn") String timeColumn,
                @JsonProperty("windowSize") long windowSize,
                @JsonProperty("windowSizeUnit") TimeUnit windowSizeUnit,
                @JsonProperty("windowSeparation") long windowSeparation,
                @JsonProperty("windowSeparationUnit") TimeUnit windowSeparationUnit,
                @JsonProperty("offset") long offset, @JsonProperty("offsetUnit") TimeUnit offsetUnit,
                @JsonProperty("addWindowStartTimeColumn") boolean addWindowStartTimeColumn,
                @JsonProperty("addWindowEndTimeColumn") boolean addWindowEndTimeColumn,
                @JsonProperty("excludeEmptyWindows") boolean excludeEmptyWindows) {
    this.timeColumn = timeColumn;
    this.windowSize = windowSize;
    this.windowSizeUnit = windowSizeUnit;
    this.windowSeparation = windowSeparation;
    this.windowSeparationUnit = windowSeparationUnit;
    this.offsetAmount = offset;
    this.offsetUnit = offsetUnit;
    this.addWindowStartTimeColumn = addWindowStartTimeColumn;
    this.addWindowEndTimeColumn = addWindowEndTimeColumn;
    this.excludeEmptyWindows = excludeEmptyWindows;

    if (offsetAmount == 0 || offsetUnit == null)
        this.offsetAmountMilliseconds = 0;
    else {
        this.offsetAmountMilliseconds = TimeUnit.MILLISECONDS.convert(offset, offsetUnit);
    }

    this.windowSizeMilliseconds = TimeUnit.MILLISECONDS.convert(windowSize, windowSizeUnit);
    this.windowSeparationMilliseconds = TimeUnit.MILLISECONDS.convert(windowSeparation, windowSeparationUnit);
}
 
Example #19
Source File: DeriveColumnsFromTimeTransform.java    From DataVec with Apache License 2.0 5 votes vote down vote up
public DeriveColumnsFromTimeTransform(@JsonProperty("columnName") String columnName,
                @JsonProperty("insertAfter") String insertAfter,
                @JsonProperty("inputTimeZone") DateTimeZone inputTimeZone,
                @JsonProperty("derivedColumns") List<DerivedColumn> derivedColumns) {
    this.columnName = columnName;
    this.insertAfter = insertAfter;
    this.inputTimeZone = inputTimeZone;
    this.derivedColumns = derivedColumns;
}
 
Example #20
Source File: StringToCategoricalTransform.java    From DataVec with Apache License 2.0 5 votes vote down vote up
public StringToCategoricalTransform(@JsonProperty("columnName") String columnName,
                @JsonProperty("stateNames") List<String> stateNames) {
    super(columnName);
    if(stateNames == null || stateNames.isEmpty()) {
        throw new IllegalArgumentException("State names must not be null or empty");
    }

    this.stateNames = stateNames;
}
 
Example #21
Source File: Module.java    From konduit-serving with Apache License 2.0 5 votes vote down vote up
public Module(@JsonProperty("name") String name, @JsonProperty("dependency") Dependency dependency,
              @JsonProperty("dependencyRequirements") ModuleRequirements dependencyRequirements,
              @JsonProperty("dependencyOptional") ModuleRequirements dependencyOptional) {
    this.name = name;
    this.dependency = dependency;
    this.dependencyRequirements = dependencyRequirements;
    this.dependencyOptional = dependencyOptional;
}
 
Example #22
Source File: WarpImageTransform.java    From DataVec with Apache License 2.0 5 votes vote down vote up
/** Calls {@code this(null, dx1, dy1, dx2, dy2, dx3, dy3, dx4, dy4)}. */
public WarpImageTransform(@JsonProperty("deltas[0]") float dx1, @JsonProperty("deltas[1]") float dy1,
                @JsonProperty("deltas[2]") float dx2, @JsonProperty("deltas[3]") float dy2,
                @JsonProperty("deltas[4]") float dx3, @JsonProperty("deltas[5]") float dy3,
                @JsonProperty("deltas[6]") float dx4, @JsonProperty("deltas[7]") float dy4) {
    this(null, dx1, dy1, dx2, dy2, dx3, dy3, dx4, dy4);
}
 
Example #23
Source File: TextToCharacterIndexTransform.java    From DataVec with Apache License 2.0 5 votes vote down vote up
/**
 *
 * @param columnName         Name of the text column
 * @param newColumnName      Name of the column after expansion
 * @param characterIndexMap  Character to integer index map
 * @param exceptionOnUnknown If true: throw an exception on unknown characters. False: skip unknown characters.
 */
public TextToCharacterIndexTransform(@JsonProperty("columnName") String columnName,
                                     @JsonProperty("newColumnName") String newColumnName,
                                     @JsonProperty("characterIndexMap") Map<Character,Integer> characterIndexMap,
                                     @JsonProperty("exceptionOnUnknown") boolean exceptionOnUnknown){
    super(Collections.singletonList(columnName), Collections.singletonList(newColumnName));
    this.characterIndexMap = characterIndexMap;
    this.exceptionOnUnknown = exceptionOnUnknown;
}
 
Example #24
Source File: StringReducer.java    From DataVec with Apache License 2.0 5 votes vote down vote up
public StringReducer(@JsonProperty("inputColumns") List<String> inputColumns,
                @JsonProperty("op") StringReduceOp stringReduceOp,
                @JsonProperty("customReductions") Map<String, ColumnReduction> customReductions,
                @JsonProperty("outputColumnName") String outputColumnName) {
    this.inputColumns = inputColumns;
    this.inputColumnsSet = (inputColumns == null ? null : new HashSet<>(inputColumns));
    this.stringReduceOp = stringReduceOp;
    this.customReductions = customReductions;
    this.outputColumnName = outputColumnName;
}
 
Example #25
Source File: NDArrayScalarOpTransform.java    From DataVec with Apache License 2.0 5 votes vote down vote up
/**
 *
 * @param columnName Name of the column to perform the operation on
 * @param mathOp     Operation to perform
 * @param scalar     Scalar value for the operation
 */
public NDArrayScalarOpTransform(@JsonProperty("columnName") String columnName,
                @JsonProperty("mathOp") MathOp mathOp, @JsonProperty("scalar") double scalar) {
    super(columnName);
    this.mathOp = mathOp;
    this.scalar = scalar;
}
 
Example #26
Source File: CoordinatesDistanceTransform.java    From DataVec with Apache License 2.0 5 votes vote down vote up
public CoordinatesDistanceTransform(@JsonProperty("newColumnName") String newColumnName,
                @JsonProperty("firstColumn") String firstColumn, @JsonProperty("secondColumn") String secondColumn,
                @JsonProperty("stdevColumn") String stdevColumn, @JsonProperty("delimiter") String delimiter) {
    super(newColumnName, MathOp.Add /* dummy op */,
                    stdevColumn != null ? new String[] {firstColumn, secondColumn, stdevColumn}
                                    : new String[] {firstColumn, secondColumn});
    this.delimiter = delimiter;
}
 
Example #27
Source File: IntegerColumnCondition.java    From DataVec with Apache License 2.0 5 votes vote down vote up
private IntegerColumnCondition(@JsonProperty("columnName") String columnName, @JsonProperty("op") ConditionOp op,
                @JsonProperty("value") Integer value, @JsonProperty("set") Set<Integer> set) {
    super(columnName, DEFAULT_SEQUENCE_CONDITION_MODE);
    this.op = op;
    this.value = (set == null ? value : null);
    this.set = set;
}
 
Example #28
Source File: NDArrayDistanceTransform.java    From DataVec with Apache License 2.0 5 votes vote down vote up
public NDArrayDistanceTransform(@JsonProperty("newColumnName") @NonNull String newColumnName,
                @JsonProperty("distance") @NonNull Distance distance,
                @JsonProperty("firstCol") @NonNull String firstCol,
                @JsonProperty("secondCol") @NonNull String secondCol) {
    this.newColumnName = newColumnName;
    this.distance = distance;
    this.firstCol = firstCol;
    this.secondCol = secondCol;
}
 
Example #29
Source File: ConditionalReplaceValueTransformWithDefault.java    From DataVec with Apache License 2.0 5 votes vote down vote up
public ConditionalReplaceValueTransformWithDefault(@JsonProperty("columnToReplace") String columnToReplace,
                            @JsonProperty("yesVal") Writable yesVal,
                            @JsonProperty("noVal") Writable noVal,
                            @JsonProperty("condiiton") Condition condition) {
    this.columnToReplace = columnToReplace;
    this.yesVal = yesVal;
    this.noVal = noVal;
    this.condition = condition;
}
 
Example #30
Source File: SequenceLengthCondition.java    From DataVec with Apache License 2.0 5 votes vote down vote up
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;
}