DataVec
Konduit Serving supports data transformations defined by the DataVec vectorization and ETL library.
Last updated
Was this helpful?
Konduit Serving supports data transformations defined by the DataVec vectorization and ETL library.
Last updated
Was this helpful?
DataVec transformations can be defined in Python using the package, which can be installed from PyPi:
Using PyDataVec requires . For Windows 10 Home edition users, note that Docker Toolbox is not supported.
Run the following cell to check that your Docker installation is successful:
A Schema
specifies the structure of your data. In DataVec, a TransformProcess
requires the Schema
of the data to be specified.
Schema
objects have a number of methods that define different data types for columns: add_string_column()
, add_integer_column()
, add_long_column()
, add_float_column()
, add_double_column()
and add_categorical_column()
.
TransformProcess
provides a number of methods to manipulate your data. The following methods are available in the Python API:
Reduce the number of rows: filter()
General data transformations: replace()
,
Type casting: string_to_time()
, derive_column_from_time()
, categorical_to_integer()
,
Combining/reducing the values in each column: reduce()
String operations: append_string()
, lower()
, upper()
, concat()
, remove_white_spaces()
, replace_empty_string()
, replace_string()
, map_string()
Column selection/renaming: remove()
, remove_columns_except()
, rename_column()
One-hot encoding: one_hot()
In this short example, we append the string two
to the end of values in the string column first
.
The TransformProcess
configuration has to be converted into JSON format to be passed to Konduit Serving.
The TransformProcess
can now be defined in the Konduit Serving configuration with a TransformProcessStep
. Here, we
configure the inputs and outputs: the schema, column names and data types should be defined here.
declare the TransformProcess
using the .transform_process()
method.
NDArray
String
Boolean
Categorical
Float
Double
Integer
Long
Bytes
You should define the Schema data types in TransformProcessStep()
as strings.
Configure the Server using ServingConfig
to define the port using the http_port
argument and data formats using the input_data_type
and output_data_type
arguments.
The complete configuration is as follows:
Create a Client
object and specify the port number as an argument:
Finally, we run the Konduit Serving instance. Recall that the TransformProcessStep()
appends a string two
to strings in the column first
:
Note that Schema
data types are not defined in the same way as PythonStep
data types. See the for a complete list of supported Schema data types: