fab.learner.component package

Submodules

fab.learner.component.bspline_data module

class fab.learner.component.bspline_data.BSplineSupervisedData(X, Y, feature_ids, B_list, mandatory_feature_mask=None)

Bases: SupervisedData

A data object class for supervised learnings for B-spline components.

Parameters:
Xnp.ndarray, size = (num_samples, num_features)

Input feature data to be held.

Ynp.array, size = (num_samples)

Input target data to be held.

feature_idslist[int]

Feature ID number for each features.

B_listnp.ndarray, size = (num_features, num_samples, basis_dim)

Basis function value matrices, which is corresponding to X given here.

mandatory_feature_maskNone or np.array(bool), size = (num_features)

The mask of the mandatory relevant features for component. optional [default: None]

Attributes:
num_features

Returns the number of features.

num_samples

Returns the number of samples.

num_targets

Returns ——- num_targets : int Number of targets.

Methods

from_supervised_data(data, B_list)

Create an instance of this class from a instance of SupervisedData class.

classmethod from_supervised_data(data, B_list)

Create an instance of this class from a instance of SupervisedData class.

Parameters:
dataSupervisedData

An instance of SupervisedData class to be refered to.

B_listnp.ndarray, size = (num_features, num_samples, basis_dim)

Basis function value matrices.

Returns:
dataBSplineSupervisedData

Generated instance of this class.

fab.learner.component.check_foba_skip module

fab.learner.component.check_foba_skip.is_foba_skip(func_type, **kwargs)

Whether skipping FoBa (feature selection).

Parameters:
func_type{‘none’, ‘power_of_two’, ‘quarter_square’}

The function type for FoBa skip checking.

kwargsdict

The parameters for FoBa skip checking function.

Returns:
skip_fobabool

If True, FoBa (feature selection) will be skipped in the iteration.

fab.learner.component.fit_comps_with_sign_constraint module

fab.learner.component.fit_comps_with_sign_constraint.fit_logit_rg_comps_with_sign_constraint(comps, data, sample_weights, l2_regularize, num_iterations)

Fits logistic regression parameters using quadratic problem subject to the sign constraint.

This method does not carry out feature selection.

Parameters:
complist[LogisticRgComponent]

List of components whose parameters will be updated.

dataSupervisedData

Input data.

sample_weightsnp.ndarray, size = (num_samples, num_comps)

The weights for each sample.

l2_regularizefloat

L2-regularization hyper-parameter.

num_iterationsint

The number of iterations with the updating quadratic expansion point.

Returns:
None
fab.learner.component.fit_comps_with_sign_constraint.fit_lsqr_rg_comps_with_sign_constraint(comps, data, sample_weights, l2_regularize, two_stage_opt)

Fits least-squares regression parameters using quadratic problem subject to the sign constraint.

This method does not carry out feature selection. The variance will be re-calculated by the updated weights and bias in this method.

Parameters:
compslist[LeastSquaresRgComponent]

List of components whose parameters will be updated.

dataSupervisedData

Input data.

sample_weightsnp.ndarray, size = (num_samples, num_comps)

The weights for each sample.

l2_regularizefloat

L2-regularization hyper-parameter.

two_stage_optbool

Whether the two stage optimization is enabled.

Returns:
None
fab.learner.component.fit_comps_with_sign_constraint.solve_lsqr_sign_constraint(X, Y, sample_weights, sample_weights_adj, constraint_signs, l2_regularize=0.0, init_weights=None, solve_with_bias=True, const_value=0.0)

Solves a least-squares solution with sign constraint on weight values.

Parameters:
Xnp.ndarray, size = (num_samples, num_features)

Input feature data.

Ynp.array, size = (num_samples)

Input target data.

sample_weightsnp.array, size = (num_samples)

The weights for each sample.

sample_weights_adjnp.array, size = (num_samples)

The adjusted weights for each sample.

constraint_signsnp.array({1, 0, -1}), size = (num_dims)

Sign constraints for weight values. For instance, 1 means positive constraint. 0 means no-constraint.

l2_regularizefloat, optional [default: 0.0]

L2-regularization hyper-parameter.

init_weightsNone or np.array, size = (num_dims), optional

The initial weight values. [default: None]

solve_with_biasbool

Whether the first column of X is of bias term. L2-regularization is not applied to the bias term.

const_valuefloat, optional [default: 0.0]

The constant term value of the quadratic problem.

Returns:
weightsnp.array, size = (num_dims)

Optimized weight values.

fab.learner.component.fit_comps_with_sign_constraint.solve_proximal_method(A, B, c, t, constraint_signs, init_weights, max_iterations=100, stop_threshold=1e-05)

Proximal method for solving sign constraint on weight values.

argmin_w {1/2 * w^t * A * w + B * w + const_value} s.t. {constraint_signs}.

Note that the iteration index (i_step) starts from zero.

Parameters:
Anp.ndarray, size = (num_dims, num_dims)

Coefficient matrix for the quadratic term.

Bnp.array, size = (num_dims)

Transposed coefficient vector for the linear term.

cfloat

The constant term value of the quadratic problem. It affects not to gradient value but only to the objective value for stopping condition.

tfloat

Step-size coefficient as prox(w - t * grad(w)). For the accelerated gradient method a.k.a. FISTA, specify t = 1.0 / np.max(np.eigvals(A)).

constraint_signsnp.array({1, 0, -1}), size = (num_dims)

Sign constraints for weight values. For instance, 1 means positive constraint. 0 means no-constraint.

init_weightsnp.array, size = (num_dims)

Initial weight values.

max_iterationsint, optional [default: 100]

Max number of the iterations of proximal method.

stop_thresholdfloat, optional [default: 1.0e-5]

The threshold value of the stopping condition for judging convergence of the objective function.

Returns:
weightsnp.array, size = (num_dims)

Optimized weight values.

fab.learner.component.init_bspline_predict_comps module

class fab.learner.component.init_bspline_predict_comps.BSplineClComponentRandomInitializer(degree, basis_dim, weights_min_scale, weights_max_scale, bias_min_scale, bias_max_scale)

Bases: SupervisedComponentInitializer

Initializer for BSplineClComponent with random initialization.

Weights and bias parameters are randomly set by the input data and the specified scale parameters.

Parameters:
degreeint

Degree of B-spline function. Domain = [0, inf).

basis_dimint

The number of basis functions for each feature. Domain = [4, inf). The size of knot vector is calculated as {basis_dim + degree}.

weights_min_scale, weights_max_scalefloat

Scale parameter for initializing weight values. Domain = (-inf, inf).

bias_min_scale, bias_max_scalefloat

Scale parameter for initializing bias value. Domain = (-inf, inf).

Methods

init_comp(comp_id, data)

Create an initialized component.

init_comp(comp_id, data)

Create an initialized component.

Parameters:
comp_idint

Component ID number for the newly created component.

dataBSplineSupervisedData

Input data to be used for calculating initial parameter values.

Returns:
compBSplineClComponent

Initialized component instance.

class fab.learner.component.init_bspline_predict_comps.BSplineRgComponentRandomInitializer(degree, basis_dim, weights_min_scale, weights_max_scale, bias_min_scale, bias_max_scale, variance_min_scale, variance_max_scale)

Bases: SupervisedComponentInitializer

Initializer for BSplineRgComponent with random initialization.

Weights, bias and variance parameters are randomly set by the input data and the specified scale parameters.

Parameters:
degreeint

Degree of B-spline function. Domain = [0, inf).

basis_dimint

The number of basis functions for each feature. Domain = [4, inf). The size of knot vector is calculated as {basis_dim + degree}.

weights_min_scale, weights_max_scalefloat

Scale parameter for initializing weight values. Domain = (-inf, inf).

bias_min_scale, bias_max_scalefloat

Scale parameter for initializing bias value. Domain = (-inf, inf).

variance_min_scale, variance_max_scalefloat

Scale parameter for initializing variance value. Domain = (-inf, inf).

Methods

init_comp(comp_id, data)

Create an initialized component.

init_comp(comp_id, data)

Create an initialized component.

Parameters:
comp_idint

Component ID number for the newly created component.

dataBSplineSupervisedData

Input data to be used for calculating initial parameter values.

Returns:
compBSplineRgComponent

Initialized component instance.

fab.learner.component.init_bspline_predict_comps.calc_random_bspline_weights(data, weights_min_scale, weights_max_scale)

Generates random weight vector for all features in the range of specified input data and coefficients.

Base weight values for each feature are calculated as similar to that for linear regression components. Each weight value for basis function of the feature is calculated by {(base weight) x (random value)}.

Parameters:
dataBsplineSupervisedData

Input data.

weights_min_scale, weights_max_scalefloat

Scale values for initialization of weights. Domain = (-inf, inf).

Returns:
weightsnp.ndarray, size = (num_features, basis_dim)

Initialized weight vectors for a component.

fab.learner.component.init_bspline_predict_comps.generate_knot_vecs(X, degree, basis_dim)

Generates knot vectors for all features.

The ranges of X values, from min(X) to max(X), are split by equal width and a knot are put on each split point. As additional terminal points of the knot vector, ceil[0.5 * (degree + 1)] knots for each side are set on min(X) - r and max(X) + r, where r is the bin width for the other points.

Parameters:
Xnp.ndarray, size = (num_samples, num_features)

Feature data.

degreeint

Degree of the B-spline function. Domain = [0, inf).

basis_dimint

The number of basis functions for each feature. Domain = [4, inf).

Returns:
knot_vecsnp.ndarray, size = (num_features, num_knots)

Knot vectors for all features. The size of knot vector for each feature will be num_knots = {basis_dim + degree}.

fab.learner.component.init_comps module

class fab.learner.component.init_comps.SupervisedComponentInitializer

Bases: object

An abstract class of initializer for SupervisedComponent’s.

Concrete classes must implement the init_comp() method that creates a component instance using given data and parameters specified at __init__().

Methods

init_comp(comp_id, data)

Create an initialized component.

abstract init_comp(comp_id, data)

Create an initialized component.

Parameters:
comp_idint

Component ID number for the newly created component.

dataHMESupervisedData

Input data to be used for calculating initial parameter values.

Returns:
compSupervisedComponent

Initialized component instance.

fab.learner.component.init_linear_predict_comps module

class fab.learner.component.init_linear_predict_comps.LeastSquaresRgComponentRandomInitializer(weights_min_scale, weights_max_scale, bias_min_scale, bias_max_scale, variance_min_scale, variance_max_scale)

Bases: SupervisedComponentInitializer

Initializer for LeastSquaresRgComponent with random initialization.

Weights, bias and variance parameters are randomly set by the input data and the specified scale parameters.

Parameters:
weights_min_scale, weights_max_scalefloat

Scale parameter for initializing weight values.

bias_min_scale, bias_max_scalefloat

Scale parameter for initializing bias value.

variance_min_scale, variance_max_scalefloat

Scale parameter for initializing variance value.

Methods

init_comp(comp_id, data)

Create an initialized component.

init_comp(comp_id, data)

Create an initialized component.

Parameters:
comp_idint

Component ID number for the newly created component.

dataSupervisedData

Input data to be used for calculating initial parameter values.

Returns:
compLeastSquaresRgComponent

Initialized component instance.

class fab.learner.component.init_linear_predict_comps.LogisticRgComponentRandomInitializer(weights_min_scale, weights_max_scale, bias_min_scale, bias_max_scale)

Bases: SupervisedComponentInitializer

Initializer for LogisticRgComponent with random initialization.

Weights and bias parameters are randomly set by the input data and the specified scale parameters.

Parameters:
weights_min_scale, weights_max_scalefloat

Scale parameter for initializing weight values.

bias_min_scale, bias_max_scalefloat

Scale parameter for initializing bias value.

Methods

init_comp(comp_id, data)

Create an initialized component.

init_comp(comp_id, data)

Create an initialized component.

Parameters:
comp_idint

Component ID number for the newly created component.

dataSupervisedData

Input data to be used for calculating initial parameter values.

Returns:
compLogisticRgComponent

Initialized component instance.

fab.learner.component.init_softmax_cl_comps module

class fab.learner.component.init_softmax_cl_comps.SoftmaxClComponentRandomInitializer(weights_min_scale, weights_max_scale, bias_min_scale, bias_max_scale)

Bases: SupervisedComponentInitializer

Initializer for SoftmaxClComponent with random initialization.

Weights and bias parameters are randomly set by the input data and the specified scale parameters.

Parameters:
weights_min_scale, weights_max_scalefloat

Scale parameter for initializing weight values. Domain = (-inf, inf).

bias_min_scale, bias_max_scalefloat

Scale parameter for initializing bias value. Domain = (-inf, inf).

Methods

init_comp(comp_id, data)

Create an initialized component.

init_comp(comp_id, data)

Create an initialized component.

Parameters:
comp_idint

Component ID number for the newly created component.

dataSupervisedData

Input data to be used for calculating initial parameter values.

Returns:
compSoftmaxClComponent

Initialized component instance.

fab.learner.component.init_softmax_cl_comps.calc_random_softmax_bias(data, bias_min_scale, bias_max_scale)

Generates random bias vector in the range of specified input data and coefficients.

Base bias values for each target are calculated as similar to that for singletarget components. Each bias value for the target is calculated by {(base bias) x (random value)}.

Parameters:
dataSupervisedData

Input data.

bias_min_scale, bias_max_scalefloat

Scale values for initialization of bias. Domain = (-inf, inf).

Returns:
biasnp.array, size = (num_targets)

Initialized bias vector for a component.

fab.learner.component.init_softmax_cl_comps.calc_random_softmax_weights(data, weights_min_scale, weights_max_scale)

Generates random weight matrix for all features in the range of specified input data and coefficients.

Base weight values for each feature are calculated as similar to that for singletarget components. Each weight value for all targets of the feature is calculated by {(base weight) x (random value)}.

Parameters:
dataSupervisedData

Input data.

weights_min_scale, weights_max_scalefloat

Scale values for initialization of weights. Domain = (-inf, inf).

Returns:
weightsnp.ndarray, size = (num_features, num_targets)

Initialized weight matrix for a component.

fab.learner.component.opt_bspline_comps module

fab.learner.component.opt_bspline_comps.opt_bspline_cl_comps(comps, data, B_list, sample_weights, opt_mode, l2_regularize, pspline, max_relevant_features, fisher_coeffs, svd_threshold, num_threads)

Optimizes the component parameters for B-spline classification components.

Parameters:
compslist[BSplineClComponent]

Component objects in which weights and bias values will be updated.

dataHMESupervisedData

Feature and target data.

B_listnp.ndarray, size = (num_features, num_samples, basis_dim)

Basis function value matrices for all features.

sample_weightsnp.ndarray, size = (num_samples, num_comps)

Variational posterior matrix.

opt_mode{‘opt’, ‘refit’}

Mode of component parameter optimization:

  • ‘opt’: optimizing with all features (selecting and fitting the features).

  • ‘refit’: only fitting with relevant features.

l2_regularizefloat

L2-regularize hyper-parameter.

psplinefloat

L2-regularization coefficient value for penalized B-spline function (P-spline).

max_relevant_featuresint

Maximum number of FoBa-iterations.

fisher_coeffsNone, float or np.ndarray, size = (num_samples, num_comps)

If None, scaling is disabled which means the number of expected samples is simply utilized. Otherwise, specified scale coefficient is considered to the number of expected sampled in the L0-regularize term.

svd_thresholdfloat

Threshold value for singular-value decomposition. The singular- values less than this value are considered to be zeros.

num_threadsint

The number of threads to be used in the computation.

Returns:
None
fab.learner.component.opt_bspline_comps.opt_bspline_cl_comps_backfit(comps, data, B_list, sample_weights, l2_regularize, pspline, svd_threshold, num_iterations)

Optimizes the component parameters of relevant features by back-fitting for B-spline classification components.

Feature selection is not executed in this method.

Parameters:
compslist[BSplineRgComponent]

Component objects in which weights for relevant features, bias, and variance values will be updated.

dataHMESupervisedData

Feature and target data.

B_listnp.ndarray, size = (num_features, num_samples, basis_dim)

Basis function value matrices for all features.

sample_weightsnp.ndarray, size = (num_samples, num_comps)

Variational posterior matrix.

l2_regularizefloat

L2-regularize hyper-parameter.

psplinefloat

L2-regularization coefficient value for penalized B-spline function (P-spline).

svd_thresholdfloat

Threshold value for singular-value decomposition. The singular- values less than this value are considered to be zeros.

num_iterationsint

The number of iterations of back-fitting.

Returns:
None
fab.learner.component.opt_bspline_comps.opt_bspline_rg_comps(comps, data, B_list, sample_weights, opt_mode, l2_regularize, pspline, max_relevant_features, fisher_coeffs, svd_threshold, num_threads)

Optimizes the component parameters for B-spline regression components.

Parameters:
compslist[BSplineRgComponent]

Component objects in which weights, bias, and variance values will be updated.

dataHMESupervisedData

Feature and target data.

B_listnp.ndarray, size = (num_features, num_samples, basis_dim)

Basis function value matrices for all features.

sample_weightsnp.ndarray, size = (num_samples, num_comps)

Variational posterior matrix.

opt_mode{‘opt’, ‘refit’}
Mode of component parameter optimization;

‘opt’: optimizing with all features (selecting and fitting the features), ‘refit’: only fitting with relevant features.

l2_regularizefloat

L2-regularize hyper-parameter.

psplinefloat

L2-regularization coefficient value for penalized B-spline function (P-spline).

max_relevant_featuresint

Maximum number of FoBa-iterations.

fisher_coeffsNone, float or np.ndarray, size = (num_samples, num_comps)

If None, scaling is disabled which means the number of expected samples is simply utilized. Otherwise, specified scale coefficient is considered to the number of expected sampled in the L0-regularize term.

svd_thresholdfloat

Threshold value for singular-value decomposition. The singular- values less than this value are considered to be zeros.

num_threadsint

The number of threads to be used in the computation.

Returns:
None
fab.learner.component.opt_bspline_comps.opt_bspline_rg_comps_backfit(comps, data, B_list, sample_weights, l2_regularize, pspline, svd_threshold)

Optimizes the component parameters of relevant features by back-fitting for B-spline regression components.

Feature selection is not executed in this method.

Parameters:
compslist[BSplineRgComponent]

Component objects in which weights for relevant features, bias, and variance values will be updated.

dataHMESupervisedData

Feature and target data.

B_listnp.ndarray, size = (num_features, num_samples, basis_dim)

Basis function value matrices for all features.

sample_weightsnp.ndarray, size = (num_samples, num_comps)

Variational posterior matrix.

l2_regularizefloat

L2-regularize hyper-parameter.

psplinefloat

L2-regularization coefficient value for penalized B-spline function (P-spline).

svd_thresholdfloat

Threshold value for singular-value decomposition. The singular- values less than this value are considered to be zeros.

Returns:
None

fab.learner.component.opt_comps_util module

fab.learner.component.opt_comps_util.check_assigned_data_constant(target, sample_weights)

Checks whether the assigned data (samples having non-zero sample weights) values are constant or not, and returns the constant value.

Returned const_mask is equivalent to (t == t[0]).all(axis=0) where t = target[sample_weights != 0].

Parameters:
targetnp.array, size = (num_samples) or

np.ndarray, size = (num_samples, num_XXX)

Target matrix.

sample_weightsnp.array, size = (num_samples)

Sample weights of a component for all samples.

Returns:
const_masknp.array(bool), size = (num_XXX)

If True, all assigned target values are the same value (= constant).

const_valuesnp.array, size = (num_XXX)

The constant values. If not constant, the value is 0.0.

fab.learner.component.opt_comps_util.validate_comps_fic_increase(comps, num_expect_samples, prev_comps, prev_num_expect_samples, data, sample_weights, restore=True)

Validates the FIC increasing for each optimized component.

Parameters:
compsList[SupervisedComponent]

The list of component-objects after the optimization.

num_expect_samplesnp.array, size = (num_comps)

The number of expect samples on the component after the optimization.

prev_compsList[SupervisedComponent]

The list of component-objects before the optimization.

prev_num_expect_samplesnp.array, size = (num_comps)

The number of expect samples on the component before the optimization.

dataSupervisedData

Input data.

sample_weightsnp.array, size = (num_samples)

The weights for each sample.

restorebool

If True, the parameters before the optimization is restored when the FIC value decreases with the optimization. If False, only logging message of FIC value decreasing is output.

Returns:
None

fab.learner.component.opt_linear_predict_comps module

fab.learner.component.opt_linear_predict_comps.opt_logit_rg_comps_foba(comps, data, sample_weights, opt_mode, opt_type, l2_regularize, fisher_coeffs, max_foba_iterations, max_relevant_features, backward_step, svd_threshold, num_threads, is_skip, with_validation='correct')

Optimizes parameters of logistic regression components.

Parameters:
compslist[LogisticRgComponent]

List of component-objects.

dataSupervisedData

Input data.

sample_weightsnp.ndarray, size = (num_samples, num_comps)

The weights for each sample. For optimizing the i-th component, sample_weights[:, i] will be used.

opt_mode{‘opt’, ‘refit’}
Mode of component parameter optimization;

‘opt’: optimizing with all features (selecting and fitting the features), ‘refit’: only fitting with relevant features.

opt_type{‘standard’, ‘quadratic’}
Algorithm of component parameter optimization:

‘standard’: using liblinear, ‘quadratic’: using quadratic approximation with MIL.

l2_regularizefloat

L2-regularization hyper-parameter.

fisher_coeffsNone, float or np.ndarray, size = (num_samples, num_comps)

If None, scaling is disabled which means the number of expected samples is simply utilized. Otherwise, specified scale coefficient is considered to the number of expected sampled in the L0-regularize term.

max_foba_iterationsint

Maximum number of FoBa iterations.

max_relevant_featuresint

Maximum number of relevant features. If the number of relevant features exceeds the threshold, FoBa-iterations breaks before the forward-step.

backward_stepbool

Whether the backward-steps are enabled. If False, only forward-steps are carried out in the FoBa-iterations.

num_threadsint

Number of OpenMP threads to be set. If the number of components is less than num_threads, the former value is used as num_threads.

with_validation{‘ignore’, ‘correct’}, optional [default: ‘correct’]

Flag to indicate whether the following validation is enabled: If FIC of the component decrease with the optimization, previous parameter values are restored to the component. [default: ‘correct’]

Returns:
None
fab.learner.component.opt_linear_predict_comps.opt_lsqr_rg_comps_foba(comps, data, sample_weights, opt_mode, two_stage_opt, opt_type, l2_regularize, fisher_coeffs, max_foba_iterations, max_relevant_features, backward_step, svd_threshold, num_threads, is_skip, with_validation='correct')

Optimizes parameters of least-squares regression components.

Parameters:
compslist[LeastSquaresRgComponent]

List of component-objects.

dataSupervisedData

Input data.

sample_weightsnp.ndarray, size = (num_samples, num_comps)

The weights for each sample. For optimizing the i-th component, sample_weights[:, i] will be used.

opt_mode{‘opt’, ‘refit’}
Mode of component parameter optimization;

‘opt’: optimizing with all features (selecting and fitting the features), ‘refit’: only fitting with relevant features.

two_stage_optbool

Whether the two stage optimization is enabled.

opt_type{‘svd’, ‘mil’}
Algorithm of component parameter optimization.

‘svd’: using singular value decomposition, ‘mil’: using matrix inversion lemma.

l2_regularizefloat

L2-regularization hyper-parameter.

fisher_coeffsNone, float or np.ndarray, size = (num_samples, num_comps)

If None, scaling is disabled which means the number of expected samples is simply utilized. Otherwise, specified scale coefficient is considered to the number of expected sampled in the L0-regularize term.

max_foba_iterationsint

Maximum number of FoBa iterations.

max_relevant_featuresint

Maximum number of relevant features. If the number of relevant features exceeds the threshold, FoBa-iterations breaks before the forward-step.

backward_stepbool

Whether the backward-steps are enabled. If False, only forward-steps are carried out in the FoBa-iterations.

svd_thresholdfloat

Threshold value for singular-value decomposition. The singular- values less than this value are considered to be zeros.

num_threadsint

Number of OpenMP threads to be set. If the number of components is less than num_threads, the former value is used as num_threads.

with_validation{‘ignore’, ‘correct’}, optional

Flag to indicate whether the following validation is enabled: If FIC of the component decrease with the optimization, previous parameter values are restored to the component. [default: ‘correct’]

Returns:
None

fab.learner.component.opt_softmax_cl_comps module

fab.learner.component.opt_softmax_cl_comps.opt_softmax_cl_comps_foba(comps, data, sample_weights, opt_mode, l2_regularize, fisher_coeffs, max_foba_iterations, max_relevant_features, backward_step, svd_threshold, num_threads, is_skip, with_validation='correct')

Optimizes parameters of softmax classification components.

Parameters:
compslist[SoftmaxClComponent]

List of component-objects.

dataSupervisedData

Input data.

sample_weightsnp.ndarray, size = (num_samples, num_comps)

The weights for each sample. For optimizing the i-th component, sample_weights[:, i] will be used.

opt_mode{‘opt’, ‘refit’}

Mode of component parameter optimization:

  • ‘opt’: optimizing with all features (selecting and fitting the features).

  • ‘refit’: only fitting with relevant features.

l2_regularizefloat

L2-regularization hyper-parameter.

fisher_coeffsNone, float or np.ndarray,

size = (num_samples, num_comps, num_targets)

If None, scaling is disabled which means the number of expected samples is simply utilized. Otherwise, specified scale coefficient is considered to the number of expected sampled in the L0-regularize term.

max_foba_iterationsint

Maximum number of FoBa iterations.

max_relevant_featuresint

Maximum number of relevant features. If the number of relevant features exceeds the threshold, FoBa-iterations breaks before the forward-step.

backward_stepbool

Whether the backward-steps are enabled. If False, only forward-steps are carried out in the FoBa-iterations.

svd_thresholdfloat

Threshold value for singular-value decomposition. The singular- values less than this value are considered to be zeros.

num_threadsint

Number of OpenMP threads to be set. If the number of components is less than num_threads, the former value is used as num_threads.

with_validation{‘ignore’, ‘correct’}, optional [default: ‘correct’]

Flag to indicate whether the following validation is enabled: If FIC of the component decrease with the optimization, previous parameter values are restored to the component. [default: ‘correct’]

Returns:
None
fab.learner.component.opt_softmax_cl_comps.opt_softmax_cl_comps_postprocess(comps, data, sample_weights, l2_regularize, max_iterations, svd_threshold, num_threads)

Optimizes parameters of softmax components for postprocess.

Parameters:
compslist[SoftmaxClComponent]

List of component-objects.

dataSupervisedData

Input data.

sample_weightsnp.ndarray, size = (num_samples, num_comps)

The weights for each sample. For optimizing the i-th component, sample_weights[:, i] will be used.

l2_regularizefloat

L2-regularization hyper-parameter.

max_iterationsint

Maximum number of iterations.

svd_thresholdfloat

Threshold value for singular-value decomposition. The singular- values less than this value are considered to be zeros.

num_threadsint

Number of OpenMP threads to be set. If the number of components is less than num_threads, the former value is used as num_threads.

Returns:
None

Module contents