Model¶
-
class
tupa.model.
Model
(filename, config=None, *args, **kwargs)[source]¶ Bases:
object
Attributes Summary
actions
classifier_properties
formats
is_neural_network
is_retrainable
Methods Summary
all_params
()finalize
(finished_epoch)Copy model, finalizing features (new values will not be added during subsequent use) and classifier (update it) :param finished_epoch: whether this is the end of an epoch (or just intermediate checkpoint), for bookkeeping :return: a copy of this model with a new feature extractor and classifier (actually classifier may be the same) init_actions
()init_features
(state, train)init_model
([axis, lang, init_params])init_node_labels
()init_param
(key)load
([is_finalized])Load the feature and classifier parameters from files :param is_finalized: whether loaded model should be finalized, or allow feature values to be added subsequently load_labels
()Copy classifier’s labels to create new Actions/Labels objects Restoring from a model that was just loaded from file, or called by restore() node_label_param_def
([args])param_defs
([args, only_node_labels])restore
(model[, feature_extractor, …])Set all attributes to a reference to existing model, except labels, which will be copied. save
([save_init])Save feature and classifier parameters to files score
(state, axis)set_axis
(axis, lang)Attributes Documentation
-
actions
¶
-
classifier_properties
¶
-
formats
¶
-
is_neural_network
¶
-
is_retrainable
¶
Methods Documentation
-
finalize
(finished_epoch)[source]¶ Copy model, finalizing features (new values will not be added during subsequent use) and classifier (update it) :param finished_epoch: whether this is the end of an epoch (or just intermediate checkpoint), for bookkeeping :return: a copy of this model with a new feature extractor and classifier (actually classifier may be the same)
-
load
(is_finalized=True)[source]¶ Load the feature and classifier parameters from files :param is_finalized: whether loaded model should be finalized, or allow feature values to be added subsequently
-
load_labels
()[source]¶ Copy classifier’s labels to create new Actions/Labels objects Restoring from a model that was just loaded from file, or called by restore()
-
restore
(model, feature_extractor=None, classifier=None, is_finalized=None)[source]¶ Set all attributes to a reference to existing model, except labels, which will be copied. :param model: Model to restore :param feature_extractor: optional FeatureExtractor to restore instead of model’s :param classifier: optional Classifier to restore instead of model’s :param is_finalized: whether the restored model is finalized
-