tflite_model_maker.text_classifier.AverageWordVecSpec

A specification of averaging word vector model.

Used in the notebooks

Used in the tutorials

num_words Number of words to generate the vocabulary from data.
seq_len Length of the sequence to feed into the model.
wordvec_dim Dimension of the word embedding.
lowercase Whether to convert all uppercase character to lowercase during preprocessing.
dropout_rate The rate for dropout.
name Name of the object.
default_training_epochs Default training epochs for training.
default_batch_size Default batch size for training.
model_dir The location of the model checkpoint files.
index_to_label List of labels in the training data. e.g. ['neg', 'pos'].

Methods

convert_examples_to_features

View source

Converts examples to features and write them into TFRecord file.

create_model

View source

Creates the keras model.

gen_vocab

View source

Generates vocabulary list in examples with maximum num_words words.

get_config

View source

Gets the configuration.

get_default_quantization_config

View source

Gets the default quantization configuration.

get_name_to_features

View source

Gets the dictionary describing the features.

load_vocab

View source

Loads vocabulary from vocab_filename.

preprocess

View source

Preprocess the text for text classification.

run_classifier

View source

Creates classifier and runs the classifier training.

save_vocab

View source

Saves the vocabulary in vocab_filename.

select_data_from_record

View source

Dispatches records to features and labels.

PAD '<PAD>'
START '<START>'
UNKNOWN '<UNKNOWN>'
compat_tf_versions [2]
convert_from_saved_model_tf2 False
need_gen_vocab True