Learn R Programming

GeneSelectR (version 1.0.1)

define_sklearn_modules: Define Python modules and scikit-learn submodules

Description

Define Python modules and scikit-learn submodules

Usage

define_sklearn_modules(python_modules)

Value

A list containing the initialized Python modules and scikit-learn submodules, each as a separate list element. The list includes:

  • @field preprocessing: Module for data preprocessing.

  • @field model_selection: Module for model selection and evaluation.

  • @field feature_selection: Module for feature selection methods.

  • @field ensemble: Module for ensemble methods.

  • @field pipeline: scikit-learn pipeline object.

  • @field forest: Random Forest classifier for feature selection.

  • @field randomized_grid: Randomized grid search for hyperparameter tuning.

  • @field grid: Grid search for hyperparameter tuning.

  • @field bayesianCV: Bayesian optimization using cross-validation.

  • @field lasso: Lasso method for feature selection.

  • @field univariate: Univariate feature selection method.

  • @field select_model: Model-based feature selection method.

  • @field GradBoost: Gradient Boosting classifier.

Arguments

python_modules

A list containing imported Python modules.

Examples

Run this code
# \donttest{
required_modules <- c("sklearn", "boruta")
modules_available <- sapply(required_modules, reticulate::py_module_available)

if (all(modules_available)) {
  # All required Python modules are available
  # Define scikit-learn modules and submodules
  sklearn_modules <- define_sklearn_modules()

  # Access different modules and submodules
  preprocessing_module <- sklearn_modules$preprocessing
  model_selection_module <- sklearn_modules$model_selection
  feature_selection_module <- sklearn_modules$feature_selection
  ensemble_module <- sklearn_modules$ensemble
  # Additional code to explore each module as needed in your analysis
} else {
  unavailable_modules <- names(modules_available[!modules_available])
  message(paste(
  "Required Python modules not available:",
  paste(unavailable_modules, collapse=', '), ". Skipping example."))
}
# }

Run the code above in your browser using DataLab