pyconstruct.learners.BaseLearner

class pyconstruct.learners.BaseLearner(domain=None, model=None, **kwargs)

A basic learning model class.

A learner fits a model with some data over some given domain. If only the domain is given, a default model class (depending on the learner subclass) will be used. If a model is also given, the learner will make a copy and overwrite the domain of the copy with the one given to the learner. If no domain is given to the learner, the given model must be initialized with a domain.

The fitted model is accessible through the model_ attribute (not to be confused with the input parameter model which is copied if given).

Parameters:
  • domain (BaseDomain) – The domain of the data.
  • model (BaseModel) – The model the learner should fit.

Methods

decision_function(X, Y, **kwargs)
fit(X, Y[, Y_pred]) Fit a model with data (X, Y).
get_params([deep]) Get parameters for this estimator.
loss(X, Y, Y_pred, **kwargs)
partial_fit(X, Y[, Y_pred]) Updates the current model with a mini-batch (X, Y).
phi(X, Y, **kwargs) Computes the feature vector for the given input and output objects.
predict(X, *args, **kwargs) Computes the prediction of the current model for the given input.
score(X, Y[, Y_pred]) Compute the score as the average loss over the examples.
set_params(**params) Set the parameters of this estimator.