Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


Adding a new model to the Python Bridge only requiresThe implementation between each model can be entire different, we are not going to go into details about each particular model, each model implementation in Python Bridge is a set of expected functions focus in functionality

Implementation Class

Code Block
languagepy
themeRDark
def initialize(self, model_dir, **kwargs):

Receive the path to the model type and the configuration for the path


Code Block
languagepy
themeRDark
def load(self, model_dir, name, version):

Receive the path to the model type, the name of the model and the version of it, in this section the loading of the model is expected


Code Block
languagepy
themeRDark
def save(self):

Save the current loaded model


Code Block
languagepy
themeRDark
def clear(self):

Remove the current loaded model, and any training data in memory


Code Block
languagepy
themeRDark
def feed(self, data):

Receives a list of string tokens tokens to be added to the training data


Code Block
languagepy
themeRDark
def train(self, **kwargs):

Trains model with the fed documents, the model can be either kept in memory or saved


Code Block
languagepy
themeRDark
def predict(self, data: list):

Retrieves a vector or an array of vectors, from processing the data with the loaded mode, which is return inside a JSON { 'vector': [ ] }, the value of the vector key must be always be an array.


Code Block
languagepy
themeRDark
def regress(self, data):

?? 


Code Block
languagepy
themeRDark
def classify(self, data) -> (str, float):

Retrieves a label or multiple labels, using the loaded model, from the data. We recommend returning the label along with its confidence.

Models Location