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 …

Methods

method

truncated documentation

__init__

fit

The function does nothing. Parameters ———- X: unused y: unused sample_weight: …

transform

Runs the predictions. Parameters ———- X : numpy array or sparse matrix of shape [n_samples,n_features] …

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)[source]

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

source on GitHub

__init__(estimator, method=None, copy_estimator=True)[source]
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

source on GitHub

fit(X=None, y=None, sample_weight=None)[source]

The function does nothing.

Parameters
  • X (unused) –

  • y (unused) –

  • sample_weight (unused) –

Returns

self

Return type

returns an instance of self.

estimator_
Type

already trained estimator

source on GitHub

transform(X)[source]

Runs the predictions.

Parameters

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

Returns

Return type

tranformed X

source on GitHub