Base
Base class : it is an abstract class integrated with the common Machine Learning tools of scikit-learn package and it provides the standart methods fit and predict. Note that the models are unsupervised and so the passed parameter will be just the data (without any label). Like other Machine Learning algorithms also the biolearn ones depend on many hyper-parameters, which have to be tuned according to the given problem.
- class biolearn.model._base.Base(inputs=None, outputs=100, num_epochs=100, batch_size=100, weights_init=<class 'biolearn.utils.weights.BaseWeights'>, activation=<class 'biolearn.utils.activations.Activations'>, optimizer=<class 'biolearn.utils.optimizer.Optimizer'>, precision=1e-30, epochs_for_convergency=None, convergency_atol=0.01, random_state=None, verbose=True)[source]
Bases:
BaseEstimator,TransformerMixin- Parameters
inputs (int (default=None)) – Number of input units
outputs (int (default=100)) – Number of hidden units
num_epochs (int (default=100)) – Maximum number of epochs for model convergency
batch_size (int (default=100)) – Size of the minibatch
weights_init (BaseWeights (default=BaseWeights)) – Weights initialization strategy object
activation (Activations (default=Activations)) – Activation function object
optimizer (Optimizer (default=Optimizer)) – Optimizer object
precision (float (default=1e-30)) – Parameter that controls numerical precision of the weight updates
epochs_for_convergency (int (default=None)) – Number of stable epochs requested for the convergency. If None the training proceeds up to the maximum number of epochs (num_epochs)
convergency_atol (float (default=0.01)) – Absolute tolerance requested for the convergency
random_state (int (default=None)) – Random seed for batch subdivisions
verbose (bool (default=True)) – Turn on/off the verbosity
- fit(X, y=None)[source]
Fit the biolearn model weights.
- Parameters
X (array-like of shape (n_samples, n_features)) – The training input samples
y (array-like, default=None) – The array of labels
- Returns
self – Return self
- Return type
object
- fit_transform(X, y=None)[source]
Fit the model model meta-transformer and apply the data encoding transformation.
- Parameters
X (array-like of shape (n_samples, n_features)) – The training input samples
y (array-like, shape (n_samples,)) – The target values
- Returns
Xnew – The data encoded according to the model weights.
- Return type
array-like of shape (n_samples, encoded_features)
- load_weights(filename)[source]
Load the weight matrix from a binary file.
- Parameters
filename (str) – Filename or path
- Returns
self – Return self
- Return type
object
- predict(X, y=None)[source]
Reduce X applying the biolearn encoding.
- Parameters
X (array of shape (n_samples, n_features)) – The input samples
y (array-like, default=None) – The array of labels
- Returns
Xnew – The encoded features
- Return type
array of shape (n_values, n_samples)
- save_weights(filename)[source]
Save the current weights to a binary file.
- Parameters
filename (str) – Filename or path
- Return type
True if everything is ok
- transform(X)[source]
Apply the data reduction according to the features in the best signature found.
- Parameters
X (array-like of shape (n_samples, n_features)) – The input samples
- Returns
Xnew – The data encoded according to the model weights.
- Return type
array-like of shape (n_samples, encoded_features)