CountVectorizer

In [ ]:
CountVectorizer(name: str,
                lowercase: bool = True,
                max_df: float = 1.0,
                min_df: float = 0.0,
                max_features: int = -1,
                ignore_special: bool = True,
                max_text_size: int = 2000)

Creates a text index that counts the occurences of each word in the data.

Parameters

Name Type Optional Description
name
str
❌
Name of the model to be stored in the database.
lowercase
bool
✓
Converts all the elements to lowercase before processing.
max_df
float
✓
Keeps words less than max_df in the total dictionary distribution.
min_df
float
✓
Keeps words greater than min_df in the total dictionary distribution.
max_features
int
✓
Keeps only the top words of the dictionary.
ignore_special
bool
✓
Ignores all special characters when building the dictionary.
max_text_size
int
✓
The maximum size of the column, which itself is the concatenation of all the text columns during the fitting.

Attributes

After the object is created, all parameters become attributes. Additional attributes will be created when fitting the model:

Name Type Description
stop_words_
list
Words not added to the vocabulary.
vocabulary_
list
The final vocabulary.
input_relation
str
The training relation.
X
list
List of the predictors.

Methods

Name Description
deploySQL Returns the SQL code needed to deploy the model.
drop Drops the model from the Vertica database.
fit Trains the model.
get_attr Returns the model attribute.
get_params Returns the model parameters.
set_params Sets the parameters of the model.
transform Creates a vDataFrame of the model.

Example

In [38]:
from verticapy.learn.preprocessing import CountVectorizer
model = CountVectorizer(name = "public.vocabulary")
display(model)
<CountVectorizer>