survival.kernels.ClinicalKernelTransform¶
-
class
survival.kernels.
ClinicalKernelTransform
(fit_once=False, _numeric_ranges=None, _numeric_columns=None, _nominal_columns=None)¶ Transform data using a clinical Kernel
The clinical kernel distinguishes between continuous ordinal,and nominal variables.
Parameters: fit_once : bool, optional
If set to
True
, fit() does only transform the training data, but not update its internal state. You should call prepare() once before calling transform(). If set toFalse
, it behaves like a regular estimator, i.e., you need to call fit() before transform().References
[R12] Daemen, A., De Moor, B., “Development of a kernel function for clinical data”. Annual International Conference of the IEEE Engineering in Medicine and Biology Society, 5913-7, 2009 -
__init__
(fit_once=False, _numeric_ranges=None, _numeric_columns=None, _nominal_columns=None)¶
Methods
__init__
([fit_once, _numeric_ranges, ...])fit
(X[, y])Determine transformation parameters from data in X. fit_transform
(X[, y])Fit to data, then transform it. get_params
([deep])Get parameters for this estimator. pairwise_kernel
(X, Y)Function to use with sklearn.metrics.pairwise.pairwise_kernels()
prepare
(X)Determine transformation parameters from data in X. set_params
(**params)Set the parameters of this estimator. transform
(Y)Compute all pairwise distances between self.X_fit_ and Y. -
fit
(X, y=None, **kwargs)¶ Determine transformation parameters from data in X.
Subsequent calls to transform(Y) compute the pairwise distance to X. Parameters of the clinical kernel are only updated if fit_once is False, otherwise you have to explicitly call prepare() once.
Parameters: X: pandas.DataFrame, shape = [n_samples, n_features]
Data to estimate parameters from.
Returns: self : object
Returns the instance itself.
-
fit_transform
(X, y=None, **fit_params)¶ Fit to data, then transform it.
Fits transformer to X and y with optional parameters fit_params and returns a transformed version of X.
Parameters: X : numpy array of shape [n_samples, n_features]
Training set.
y : numpy array of shape [n_samples]
Target values.
Returns: X_new : numpy array of shape [n_samples, n_features_new]
Transformed array.
-
get_params
(deep=True)¶ Get parameters for this estimator.
Parameters: deep: boolean, optional
If True, will return the parameters for this estimator and contained subobjects that are estimators.
Returns: params : mapping of string to any
Parameter names mapped to their values.
-
pairwise_kernel
(X, Y)¶ Function to use with
sklearn.metrics.pairwise.pairwise_kernels()
Parameters: X : array, shape = [n_features]
Y : array, shape = [n_features]
Returns: similarity : float
Similarities are normalized to be within [0, 1]
-
prepare
(X)¶ Determine transformation parameters from data in X.
Use if fit_once is True, in which case fit() does not set the parameters of the clinical kernel.
Parameters: X: pandas.DataFrame, shape = [n_samples, n_features]
Data to estimate parameters from.
-
set_params
(**params)¶ Set the parameters of this estimator.
The method works on simple estimators as well as on nested objects (such as pipelines). The former have parameters of the form
<component>__<parameter>
so that it’s possible to update each component of a nested object.Returns: self
-
transform
(Y)¶ Compute all pairwise distances between self.X_fit_ and Y.
Parameters: y : array-like, shape = [n_samples_y, n_features]
Returns: kernel : array, shape = [n_samples_y, n_samples_X_fit_]
Kernel matrix. Values are normalized to lie within [0, 1].
-