direpack.sudire.sudire.sudire
- class sudire(sudiremeth='dcov-sdr', n_components=2, trimming=0, optimizer_options={'max_iter': 1000}, optimizer_constraints=None, optimizer_arguments=None, optimizer_start=None, center_data=True, center='mean', scale_data=True, whiten_data=False, compression=False, n_slices=6, dmetric='euclidean', fit_ols=True, copy=True, response_type='continuous', verbose=True, return_scaling_object=True)[source]
SUDIRE Sufficient Dimension Reduction
The class allows for Sufficient Dimension Reduction using a variety of methods. If the method requires optimization of a function, This optimization is done through the Interior Point Optimizer (IPOPT) algorithm.
- Parameters
sudiremeth (function or class. sudiremeth in this package can also be used,) –
are (but user defined functions can be processed. Built in options) –
save : Sliced Average Variance Estimation
sir : Slices Inverse Regression
dr : Directional Regression
iht : Iterative Hessian Transformations
dcov-sdr : SDR via Distance Covariance
mdd-sdr : SDR via Martingale Difference Divergence.
bcov-sdr : SDR via ball covariance
n_components (int) – dimension of the central subspace.
trimming (float) – trimming percentage to be entered as pct/100
optimizer_options (dict) – with options to pass on to the optimizer.Includes:
max_iter (int) – Maximal number of iterations.
tol (float) – relative convergence tolerance
constr_viol_tol (float) – Desired threshold for the constraint violation.
optimizer_constraints (dict or list of dicts) – further constraints to be passed on to the optimizer function.
optimizer_arguments (dict) – extra arguments to be passed to the sudiremeth function during optimization.
optimizer_start (numpy array) – starting value for the optimization.
center (str) – how to center the data. options accepted are options from sprm.preprocessing
center_data (bool) – If True, the data will be centered before the dimension reduction
scale_data (bool) – if set to False, convergence to correct optimum is not a given. Will throw a warning.
compression (bool) – Use internal data compresion step for flat data.
n_slices (int) – The number of slices for SAVE, SIR, DR
is_distance_mat (bool) – if the inputed matrices for x and y are distance matrices.
dmetric (str) – distance metric used internally. Defaults to ‘euclidean’
fit_ols (bool) – if True, an OLS model is fitted after the dimension reduction.
copy (bool) – Whether to make a deep copy of the input data or not.
verbose (bool) – Set to True prints the iteration number.
return_scaling_object (bool.) – If True, the scaling object will be return after the dimension reduction.
- Attributes always provided
x_loadings_: Estimated basis of the central subspace
x_scores_: The projected X data.
x_loc_: location estimate for X
x_sca_: scale estimate for X
` ols_obj` : fitted OLS objected
y_loc_: y location estimate
y_sca_: y scale estimate
- Attributes created only when corresponding input flags are `True`
whitening_: whitened data matrix (usually denoted K)
scaling_object_: scaling object from VersatileScaler
- __init__(sudiremeth='dcov-sdr', n_components=2, trimming=0, optimizer_options={'max_iter': 1000}, optimizer_constraints=None, optimizer_arguments=None, optimizer_start=None, center_data=True, center='mean', scale_data=True, whiten_data=False, compression=False, n_slices=6, dmetric='euclidean', fit_ols=True, copy=True, response_type='continuous', verbose=True, return_scaling_object=True)[source]
Methods
__init__([sudiremeth, n_components, ...])fit(X, y, *args, **kwargs)Fit a Sufficient Dimension Reduction Model.
fit_transform(X[, y])Fit to data, then transform it.
get_params([deep])Get parameters for this estimator. :param deep: If True, will return the parameters for this estimator and contained subobjects that are estimators. :type deep: boolean, optional.
predict(Xn[, is_distance_mat])predicts the response on new data Xn
score(X, y[, sample_weight])Return the coefficient of determination of the prediction.
set_params(**params)Set the parameters of this estimator.
transform(Xn[, distance_mat])Computes the dimension reduction of the data Xn based on the fitted sudire model.
Attributes