oc_chat
Loading...
Searching...
No Matches
token_classifier.py File Reference

Go to the source code of this file.

Classes

class  token_classifier.Model

Namespaces

namespace  token_classifier

Functions

int token_classifier.feature_index (int size, str gram)
dict[int, float] token_classifier.features (str command)
Model token_classifier.train (list[dict[str, str]] rows, int epochs=DEFAULT_EPOCHS, int seed=DEFAULT_SEED, float learning_rate=DEFAULT_LEARNING_RATE, float l2=DEFAULT_L2, int batch=DEFAULT_BATCH)
list[dict[str, object]] token_classifier.evaluate (Model model, list[dict[str, str]] cases)
float token_classifier._accuracy (Model model, list[dict[str, str]] rows)
argparse.ArgumentParser token_classifier._build_parser ()
int token_classifier.main (list[str]|None argv=None)

Variables

tuple token_classifier.LABELS = ("allow", "confirm", "deny")
tuple token_classifier.NGRAM_SIZES = (1, 2, 3, 4)
int token_classifier.HASH_SPACE = 1 << 16
str token_classifier.START_SENTINEL = "\x02"
str token_classifier.END_SENTINEL = "\x03"
int token_classifier.DEFAULT_EPOCHS = 50
int token_classifier.DEFAULT_SEED = 7
float token_classifier.DEFAULT_LEARNING_RATE = 40.0
int token_classifier.DEFAULT_L2 = 1e-6
int token_classifier.DEFAULT_BATCH = 32