src.core.hmm package#

Submodules#

src.core.hmm.hmm module#

class src.core.hmm.hmm.HMM(config_dict)[source]#

Bases: object

A class to run HMM data preprocessing, training and inference

Parameters:

config_dict (dict) – Config Params Dictionary

evaluate(Y, YP)[source]#

Evaluation metrics

Parameters:
  • Y (list) – True Labels

  • YP (list) – Prediction labels

Returns:

Metrics Dictionary (clf_report, conf_matrix)

Return type:

dict

fit(X, y)[source]#

Fits HMM algo on preprocessed text

Parameters:
  • X (list) – List of sentences

  • y (list) – Labels

predict(X)[source]#

Predicts labels for text

Parameters:

X (list) – List of sentences

Returns:

Prediction labels

Return type:

list

preprocess()[source]#

Extracts POS words and tags

Returns:

Train, Test Worda nd POS tags

Return type:

tuple (list, list, list, list)

run()[source]#

Runs HMM Fit, Transform and saves output

save_output(data, metric_dict)[source]#

Saves Training and Inference results

Parameters:
  • data (tuple (list, list, list, list)) – Train and Test data

  • metric_dict (dict) – Classification metrics (clf_report, conf_matrix)

Module contents#