Loading...

verticapy.machine_learning.vertica.feature_extraction.text.TfidfVectorizer.transform

TfidfVectorizer.transform(vdf: Annotated[str | vDataFrame, ''], index: str, x: str, pivot: bool = False) → vDataFrame

Transforms input data to tf-idf representation.

Parameters

vdf: SQLRelation

Object used to run the prediction. You can also specify a customized relation, but you must enclose it with an alias. For example, (SELECT 1) x is valid, whereas (SELECT 1) and “SELECT 1” are invalid.

index: str

Column name of the document id.

x: str

Column name which contains the text.

pivot: str

If set to True, the final table will be pivoted to have one row per document, resulting in a sparse matrix. It’s important to note that when dealing with a large dictionary, the pivot operation can be resource-intensive. In such cases, it might be more efficient to set pivot to False, filter the output as needed, and then manually perform the pivot operation.

Returns

vDataFrame

object result of the model transformation.