chemicalchecker.tool.siamese.siamese.Siamese

class Siamese(model_dir, traintest_file=None, evaluate=False, **kwargs)[source]

Bases: object

Siamese class.

This class implements a simple siamese neural network based on Keras that allows metric learning.

Initialize the Siamese class.

Parameters:
  • model_dir (str) – Directorty where models will be stored.

  • traintest_file (str) – Path to the traintest file.

  • evaluate (bool) – Whether to run evaluation.

Methods

build_model

Compile Keras model

fit

Fit the model.

predict

Do predictions.

set_predict_scaler

build_model(input_shape, load=False)[source]

Compile Keras model

input_shape(tuple): X dimensions (only nr feat is needed) load(bool): Whether to load the pretrained model.

fit(monitor='val_accuracy')[source]

Fit the model.

monitor(str): variable to monitor for early stopping.

predict(input_mat)[source]

Do predictions.

prediction_file(str): Path to input file containing Xs. split(str): which split to predict. batch_size(int): batch size for prediction.