Skip to content

VITAL Documentation

Sajjadur Rahman edited this page Dec 18, 2020 · 1 revision

We have developed VITAL, a python-based library for declaratively specifying VTA commands in Code Editor of Leam. We show several examples of VITAL here.

Generating References

Dataset: data = VTA(“dataset-name.csv”)

Column: col = data.get_column(“text”)

Model: model = data.get_model(“model.h5”)

Visualization: vis = data.get_vis(0)

Other Utils

Rename column: data.rename(“old_column”, “new_column”)

Replace values: data.replace(“column_name”, old_value, new_value)

Operator API References

We now outline how to write various VTA operators in VITAL.

Project

Project operation changes the dimensionality or cardinality of the input data.

Lowercase

Description: lowercases text in a column

Returns: None

Example: col.project().lowercase()

Mutate

Mutate operation generates a new representation of the input data.

Num Words

Description: creates a new column with # of words in column text

Returns: string name of new column

Example: col.mutate().num_words()

Sentiment

Description: creates a new column with sentiment values of column text

Returns: string name of new column

Example: col.mutate().sentiment()

Aggregate

Aggregate operation computes summary statistics of the input data.

Count

Description: creates a dictionary of counts for each unique label in a column, stores the dictionary as unstructured metadata in Leam that can be used to make an aggregated visualization like a barchart or histogram

Returns: None

Example: col.aggregate().count(“label_counts_dict”)

Visualize

Visualize operation creates a new visualization.

barchart

Description: creates a labeled barchart visualization from a dictionary of counts

Returns: None

Example: col.visualize(“barchart”, md_tag=“label_counts_dict”)

Note: md_tag means “metadata_tag” and is the name of the data that you store and can be used later to create a visualization, etc.

histogram

Description: creates a histogram visualization from columns

Returns: None

Example: data.visualize([“col1”, “col2”], “histogram”)

Generating custom UDFs

add_udf

Description: adds a UDF (User-Defined Function) to VTA which can be called later on to create a metadata value

Returns: None

Example: data.add_udf(my_python_func)

Apply_udf

Description: apply a UDF to create a new metadata value + store in Leam

Returns: None

Example: data.apply_udf(“my_python_func”, arg1, arg2, .., md_tag=”stored_value”)