module mlmodel.transfer_transformer
#
Short summary#
module mlinsights.mlmodel.transfer_transformer
Implements a transformer which wraps a predictor to do transfer learning.
Classes#
class |
truncated documentation |
---|---|
Wraps a predictor or a transformer in a transformer. This model is frozen: it cannot be trained and only computes … |
Properties#
property |
truncated documentation |
---|---|
|
HTML representation of estimator. This is redundant with the logic of _repr_mimebundle_. The latter should … |
Methods#
method |
truncated documentation |
---|---|
The function does nothing. |
|
Runs the predictions. |
Documentation#
Implements a transformer which wraps a predictor to do transfer learning.
- class mlinsights.mlmodel.transfer_transformer.TransferTransformer(estimator, method=None, copy_estimator=True, trainable=False)#
Bases:
BaseEstimator
,TransformerMixin
Wraps a predictor or a transformer in a transformer. This model is frozen: it cannot be trained and only computes the predictions.
- Parameters:
estimator – estimator to wrap in a transformer, it is cloned with the training data (deep copy) when fitted
method – if None, guess what method should be called, transform for a transformer, predict_proba for a classifier, decision_function if found, predict otherwiser
copy_estimator – copy the model instead of taking a reference
trainable – the transfered model must be trained
- __init__(estimator, method=None, copy_estimator=True, trainable=False)#
- Parameters:
estimator – estimator to wrap in a transformer, it is cloned with the training data (deep copy) when fitted
method – if None, guess what method should be called, transform for a transformer, predict_proba for a classifier, decision_function if found, predict otherwiser
copy_estimator – copy the model instead of taking a reference
trainable – the transfered model must be trained
- fit(X=None, y=None, sample_weight=None)#
The function does nothing.
- Parameters:
X – unused
y – unused
sample_weight – unused
- Returns:
self: returns an instance of self.
Fitted attributes:
estimator_: already trained estimator
- transform(X)#
Runs the predictions.
- Parameters:
X – numpy array or sparse matrix of shape [n_samples,n_features] Training data
- Returns:
tranformed X