Loading...

verticapy.machine_learning.vertica.preprocessing.CountVectorizer

class verticapy.machine_learning.vertica.preprocessing.CountVectorizer(name: str = None, overwrite_model: bool = False, 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.

Deprecated since version version: 1.0.0.

This feature is deprecated and it will be removed on VerticaPy version 1.1.0. Please use: TfidfVectorizer instead.

Parameters

name: str, optional

Name of the model.

overwrite_model: bool, optional

If set to True, training a model with the same name as an existing model overwrites the existing model.

lowercase: bool, optional

Converts all the elements to lowercase before processing.

max_df: float, optional

Keeps the words that represent less than this float in the total dictionary distribution.

min_df: float, optional

Keeps the words that represent more than this float in the total dictionary distribution.

max_features: int, optional

Keeps only the top words of the dictionary.

ignore_special: bool, optional

Ignores all the special characters when building the dictionary.

max_text_size: int, optional

The maximum size of the column that concatenates all of the text columns during fitting.

Attributes

Many attributes are created during the fitting phase.

vocabulary_: numpy.array

Model’s final vocabulary.

stop_words_: numpy.array

Model’s stop words. It corresponds to the words ignored by the model.

n_errors_: int

Number of errors during the model’s computation.

Note

All attributes can be accessed using the get_attributes() method.

__init__(name: str = None, overwrite_model: bool = False, 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) None

Must be overridden in the child class

Methods

__init__([name, overwrite_model, lowercase, ...])

Must be overridden in the child class

contour([nbins, chart])

Draws the model's contour plot.

deploySQL([_return_main_table])

Returns the SQL code needed to deploy the model.

does_model_exists(name[, raise_error, ...])

Checks whether the model is stored in the Vertica database.

drop()

Drops the model from the Vertica database.

export_models(name, path[, kind])

Exports machine learning models.

fit(input_relation[, X, return_report])

Trains the model.

get_attributes([attr_name])

Returns the model attributes.

get_match_index(x, col_list[, str_check])

Returns the matching index.

get_params()

Returns the parameters of the model.

get_plotting_lib([class_name, chart, ...])

Returns the first available library (Plotly, Matplotlib, or Highcharts) to draw a specific graphic.

get_vertica_attributes([attr_name])

Returns the model Vertica attributes.

import_models(path[, schema, kind])

Imports machine learning models.

register(registered_name[, raise_error])

Registers the model and adds it to in-DB Model versioning environment with a status of 'under_review'.

set_params([parameters])

Sets the parameters of the model.

summarize()

Summarizes the model.

to_binary(path)

Exports the model to the Vertica Binary format.

to_pmml(path)

Exports the model to PMML.

to_python([return_proba, ...])

Returns the Python function needed for in-memory scoring without using built-in Vertica functions.

to_sql([X, return_proba, ...])

Returns the SQL code needed to deploy the model without using built-in Vertica functions.

to_tf(path)

Exports the model to the Frozen Graph format (TensorFlow).

transform()

Creates a vDataFrame of the model.

Attributes