module mlmodel.transfer_transformer#

Inheritance diagram of mlinsights.mlmodel.transfer_transformer

Short summary#

module mlinsights.mlmodel.transfer_transformer

Implements a transformer which wraps a predictor to do transfer learning.

source on GitHub

Classes#

class

truncated documentation

TransferTransformer

Wraps a predictor or a transformer in a transformer. This model is frozen: it cannot be trained and only computes …

Properties#

property

truncated documentation

_repr_html_

HTML representation of estimator. This is redundant with the logic of _repr_mimebundle_. The latter should …

Methods#

method

truncated documentation

__init__

fit

The function does nothing.

transform

Runs the predictions.

Documentation#

Implements a transformer which wraps a predictor to do transfer learning.

source on GitHub

class mlinsights.mlmodel.transfer_transformer.TransferTransformer(estimator, method=None, copy_estimator=True, trainable=False)#

Bases: sklearn.base.BaseEstimator, sklearn.base.TransformerMixin

Wraps a predictor or a transformer in a transformer. This model is frozen: it cannot be trained and only computes the predictions.

source on GitHub

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

source on GitHub

__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

source on GitHub

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

source on GitHub

transform(X)#

Runs the predictions.

Parameters

X – numpy array or sparse matrix of shape [n_samples,n_features] Training data

Returns

tranformed X

source on GitHub