vastorbit.machine_learning.vast.feature_extraction.text.TfidfVectorizer.transform¶
- TfidfVectorizer.transform(vdf: Annotated[str | VastFrame, ''], index: str, x: str, pivot: bool = False) VastFrame¶
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) xis 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 (bool) – 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
pivotto False, filter the output as needed, and then manually perform the pivot operation.
- Returns:
object result of the model transformation with columns: row_id, word, tf, idf, tfidf
- Return type: