API Reference
Documentation for the OptimalFeatureSelection
public interface.
Index
IAI.Questionnaire
IAI.OptimalFeatureSelectionClassifier
IAI.OptimalFeatureSelectionLearner
IAI.OptimalFeatureSelectionRegressor
IAI.fit!
IAI.predict
IAI.score
IAI.show_questionnaire
IAI.variable_importance
IAI.write_questionnaire
IAI.get_num_fits
IAI.get_prediction_constant
IAI.get_prediction_weights
Types
IAI.OptimalFeatureSelectionLearner
— TypeAbstract type encompassing all optimal feature selection learners.
IAI.OptimalFeatureSelectionClassifier
— TypeLearner for conducting optimal feature selection on classification problems.
The following parameters are supported (refer to the documentation for each):
IAI.OptimalFeatureSelectionRegressor
— TypeLearner for conducting optimal feature selection on regression problems.
The following parameters are supported (refer to the documentation for each):
Model Details
These functions can be used to query the structure of a OptimalFeatureSelectionLearner
. The examples make use of the following learner:
Fitted OptimalFeatureSelectionClassifier:
Constant: -2.96637
Weights:
region=C: 2.89757
score2: 0.0580296
(Higher score indicates stronger prediction for class `true`)
IAI.get_prediction_constant
— Methodget_prediction_constant(lnr::OptimalFeatureSelectionLearner)
Return the constant term in the prediction in the trained lnr
.
Example
IAI.get_prediction_constant(lnr)
-2.9663706
get_prediction_constant(lnr::OptimalFeatureSelectionLearner;
fit_index::Integer)
Return the constant term in the prediction for cluster fit_index
in the trained lnr
.
IAI.get_prediction_weights
— Methodget_prediction_weights(lnr::OptimalFeatureSelectionLearner)
Return the weights for each feature in the prediction in the trained lnr
. The weights are returned as two Dict
s, one for numeric features and one for categoric features.
The numeric Dict
has key-value pairs of feature names and their corresponding weights in the prediction.
The categoric Dict
has key-value pairs of feature names and a corresponding Dict
that maps the categoric levels for that feature to their weights in the prediction.
Any feature not included in either Dict
has zero weight in the prediction, and similarly, any categoric levels that are not included have zero weight.
Example
numeric_weights, categoric_weights = IAI.get_prediction_weights(lnr)
numeric_weights
Dict{Symbol, Float64} with 1 entry:
:score2 => 0.0580296
categoric_weights
Dict{Symbol, Dict{Any, Float64}} with 1 entry:
:region => Dict("C"=>2.89757)
get_prediction_weights(lnr::OptimalFeatureSelectionLearner;
fit_index::Integer)
Return the weights for each feature in the prediction for cluster fit_index
in the trained lnr
.
Visualization
Interactive Visualizations
IAI.write_questionnaire
— Methodwrite_questionnaire(f, lnr::OptimalFeatureSelectionLearner; keyword_arguments...)
write_questionnaire(f, grid::GridSearch; keyword_arguments...)
Write interactive questionnaire based on lnr
or grid
to f
in HTML format.
IAI.show_questionnaire
— Methodshow_questionnaire(lnr::OptimalFeatureSelectionLearner; keyword_arguments...)
show_questionnaire(grid::GridSearch; keyword_arguments...)
Show interactive questionnaire based on lnr
or grid
in default browser.
IAI.Questionnaire
— MethodQuestionnaire(lnr::OptimalFeatureSelectionLearner; keyword_arguments...)
Specifies an interactive questionnaire based on lnr
.
Coordinated Sparsity
These functions are used as part of coordinated-sparsity fitting:
IAI.fit!
— Methodfit!(lnr::OptimalFeatureSelectionLearner, X::FeatureInput,
y::TargetInput...; keyword_arguments...)
Fit an OptimalFeatureSelection model using the parameters in lnr
and the data X
and y
. Supports the same keyword arguments as fit!
.
When the coordinated_sparsity
parameter of lnr
is true
, the following additional keyword argument is required:
cluster_inds
is aVector
where each element is aVector{Int}
that gives the indices of the points in the data that comprise each cluster. For more information, refer to the documentation on coordinated-sparsity fitting
IAI.get_num_fits
— Methodget_num_fits(lnr::OptimalFeatureSelectionLearner)
Returns the number of fits stored in lnr
. This will be be either:
- the number of clusters, if
lnr
was fit usingcluster_inds
1
, otherwise
IAI.predict
— Methodpredict(lnr::OptimalFeatureSelectionLearner, X::FeatureInput;
fit_index::Integer)
Returns the prediction made by the fit in cluster fit_index
of lnr
for each point in the data X
.
IAI.score
— Methodscore(lnr::OptimalFeatureSelectionLearner, X::FeatureInput,
y::TargetInput...; fit_index::Integer, keyword_arguments...)
Calculates the score for the fit in cluster fit_index
of lnr
on data X
and y
.
IAI.variable_importance
— Methodvariable_importance(lnr::OptimalFeatureSelectionLearner)
If coordinated_sparsity
is true
, the importance is determined by combining the importance over the models in each cluster of the trained lnr
.
variable_importance(lnr::OptimalFeatureSelectionLearner, fit_index::Integer)
Return the variable importance for cluster fit_index
in the trained lnr
.