Agent skill

Elastic Net Feature Selection

by aipoch in aipoch/medical-research-skills

A skill your agent uses when selecting predictive genes or other molecular features from bulk expression matrices for binary case-vs-control classification with elastic net logistic regression…

MITAuto-check passedData & Analytics

Install Elastic Net Feature Selection

skills CLI
$ npx skills add aipoch/medical-research-skills --skill elastic-net-feature-selection -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install aipoch/medical-research-skills elastic-net-feature-selection --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/aipoch/medical-research-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/'awesome-med-research-skills/Data Analysis/elastic-net-feature-selection' .claude/skills/elastic-net-feature-selection && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
elastic-net-feature-selection
GitHub stars
2k
Token cost
~2.9k tokens
SKILL.md length
1,051 words
Files
22 (incl. scripts, references)
Skills in repo
578
Repo updated
First seen
Licence
MIT

At a glance

A skill your agent uses when selecting predictive genes or other molecular features from bulk expression matrices for binary case-vs-control classification with elastic net logistic regression…

  • Works in 4 steps: Validate Input → Prepare Modeling Matrix → Run Elastic Net → …
  • Selecting predictive genes
  • SKILL.md covers When to Use, Out of Scope, When to Read External Files and Usage, plus 8 more sections
  • Runs R scripts from its folder

What it does

Elastic Net Feature Selection is an agent skill from aipoch/medical-research-skills. Use when selecting predictive genes or other molecular features from bulk expression matrices for binary case-vs-control classification with elastic net logistic regression, including coefficient path and cross-validation plots. Trigger keywords: elastic net, glmnet, feature selection, binary classification, lambda.min, lambda.1se. NOT for: survival/Cox modeling, multiclass outcomes, single-cell data, or non-expression tables.

Its SKILL.md is about 2.9k tokens, which your agent loads only when the skill is triggered. The skill folder holds 25 other files, including scripts and reference files (for example `eval_report_elastic-net-feature-selection_result.json`, `references/algorithm.md` and `references/cli-guide.md`).

It sits in Data & Analytics, covering Machine learning. The repository describes itself as: Hundreds of agent skills for medical research, including protocol design, data analysis, evidence insights, and academic writing. The licence is MIT.

When your agent uses it

  • Selecting predictive genes
  • Other molecular features from bulk expression matrices for binary case-vs-control classification with elastic net logistic regression
  • Including coefficient path and cross-validation plots
  • Keywords: elastic net

Example prompts

  • “/elastic-net-feature-selection”

Workflow steps

4 steps, taken from the step headings in SKILL.md.

  1. Validate Input
  2. Prepare Modeling Matrix
  3. Run Elastic Net
  4. Export Results

What it can do on your machine

Read from SKILL.md and the folder at commit 686e09d. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 8 files in scripts/ (R, from the files we listed), which the agent can run.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Elastic Net Feature Selection loads about 2.9k tokens when it runs, and up to ~6.2k if it reads all its reference files. Until then it costs about 115 tokens; SKILL.md has 1,051 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~115
When it runs · the whole SKILL.md, loaded when a task matches
~2.9k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~6.2k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.

SKILL.md

The full file from aipoch/medical-research-skills at commit 686e09d, republished under its MIT licence (© aipoch). 1,051 words, ~2,854 tokens.

Download SKILL.mdSave it as .claude/skills/elastic-net-feature-selection/SKILL.md (or your agent's skills folder). This skill also uses 21 other files; get the full folder from GitHub.
name
elastic-net-feature-selection
description
Use when selecting predictive genes or other molecular features from bulk expression matrices for binary case-vs-control classification with elastic net logistic regression, including coefficient path and cross-validation plots. Trigger keywords: elastic net, glmnet, feature selection, binary classification, lambda.min, lambda.1se. NOT for: survival/Cox modeling, multiclass outcomes, single-cell data, or non-expression tables.

Elastic Net Feature Selection

When to Use

  • Use this skill for binary case-vs-control classification on bulk expression matrices.
  • Use it when you need elastic net logistic regression feature selection, coefficient paths, and cv.glmnet-based lambda selection.
  • Use custom labels such as Tumor and Normal only when the group file still contains exactly two outcome levels.

Out of Scope

  • Survival or Cox modeling
  • Multiclass outcomes
  • Single-cell data
  • Non-expression tables

Out-of-scope enforcement:

  • If the group file contains any label outside the requested case_group and control_group, the command stops with SKILL_INVALID_DATA instead of silently dropping samples.
  • If either requested class is missing after validation, the command stops with SKILL_INVALID_DATA.

When to Read External Files

SituationFile to ReadPurpose
Need to understand alpha, lambda choice, or feature-selection behaviorreferences/algorithm.mdElastic net logistic regression, penalty mixing, cross-validation, and coefficient selection assumptions
Need the authoritative executable entrypointscripts/main.RRun: Rscript scripts/main.R --input_file ... --group_file ... --output_dir ...
Need parameter examples, smoke-test commands, or recorded local runsreferences/cli-guide.mdVerified CLI examples for normal runs, conservative runs, and test-data runs
Need bundled sample inputs for a first run or regression testtests/data/Sample expression matrix, group file, and feature list
Encounter errors, warnings, or timeout issuesreferences/troubleshooting.mdCommon failures, console warning interpretation, and recovery steps

Usage

bash
Rscript scripts/main.R \
  --input_file ./expression_matrix.csv \
  --group_file ./groups.csv \
  --feature_file ./genes.csv \
  --case_group case \
  --control_group control \
  --alpha auto \
  --alpha_grid 0,0.25,0.5,0.75,1 \
  --nfolds 5 \
  --lambda_choice lambda.min \
  --standardize TRUE \
  --timeout_seconds 600 \
  --output_dir ./output/ \
  --seed 42

Arguments

ShortLongTypeDefaultDescription
-i--input_filecharacterrequiredExpression matrix file (genes as rows, samples as columns)
-g--group_filecharacterrequiredGroup information file with sample and group columns
-f--feature_filecharacterNULLOptional feature list file; if omitted, all matrix rows are used
-c--case_groupcharactercasePositive class label in the group file
-d--control_groupcharactercontrolNegative class label in the group file
-a--alphacharacter0.5Elastic net mixing parameter: numeric 0-1, or auto for CV-based selection
--alpha_gridcharacter0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1Comma-separated alpha candidates evaluated when alpha=auto
-n--nfoldsinteger5Cross-validation fold count; automatically reduced if a class has fewer samples
-l--lambda_choicecharacterlambda.minCoefficient extraction rule: lambda.min or lambda.1se
-z--standardizelogicalTRUEStandardize features inside glmnet
-t--timeout_secondsinteger600Elapsed timeout limit in seconds
-o--output_dircharacter./output/Output directory
-s--seedinteger42Random seed for reproducibility

Input Format

Expression Matrix (input_file)

Genes as rows, samples as columns, CSV format with gene IDs in the first column.

csv
,Sample01,Sample02,Sample03
TNMD,0.0349,0.0533,1.3889
DPM1,4.8627,5.4208,5.6370
Group File (group_file)

CSV with sample IDs and binary group labels.

csv
sample,group
Sample01,case
Sample02,control
Sample03,case
Feature File (feature_file)

Optional plain text or single-column CSV file with one feature per line.

csv
TNMD
DPM1
SCYL3

Output Files

FileDescription
alpha_tuning.csvCross-validated performance summary for each alpha candidate
model_coefficients.csvCoefficients at the selected lambda, including intercept
selected_features.csvSparse selected features sorted by absolute effect size; written empty when the chosen alpha is 0 (ridge)
feature_matrix.csvSample-by-feature analysis matrix used for model fitting
coefficient_path.pdfCoefficient trajectory plot across lambda values
cv_curve.pdfCross-validation error curve with lambda.min and lambda.1se
session_info.txtR session and package version info

Workflow

Step 1: Validate Input
  • WHEN preparing input files for a first run or regression test, READ: tests/data/
  • Check file existence
  • Reject empty input files
  • Detect sample and group columns in the group file
  • Reject group files that contain labels outside the requested binary comparison
  • Validate sample matching between expression matrix and group file
Step 2: Prepare Modeling Matrix
  • Restrict samples to the requested case and control groups
  • Intersect the optional feature list with matrix row names
  • Build a sample-by-feature numeric matrix for glmnet
  • Drop zero-variance features before modeling
Step 3: Run Elastic Net
  • WHEN deciding between alpha, lambda.min, and lambda.1se, READ: references/algorithm.md
  • If alpha=auto, evaluate the candidate alpha_grid with the same cross-validation folds
  • Fit the regularization path with glmnet
  • Run cv.glmnet to estimate the optimal lambda
  • Extract coefficients at lambda.min or lambda.1se
  • Apply runtime timeout and capture non-fatal warnings
Step 4: Export Results
  • WHEN you need exact invocation patterns or output inspection commands, READ: references/cli-guide.md
  • Save tuning tables and selected features
  • Generate coefficient path and cross-validation plots
  • Record session information for reproducibility

Show full SKILL.md (411 more words)Show less

Methods

Elastic Net Logistic Regression

Elastic net combines lasso (L1) and ridge (L2) penalties through alpha, enabling sparse feature selection while stabilizing correlated predictors.

Cross-Validation

cv.glmnet evaluates the lambda path and reports both lambda.min and the more conservative lambda.1se.

Automatic Alpha Selection

When alpha=auto, the skill reuses the same cross-validation folds across all values in alpha_grid, compares the minimum cross-validated error for each candidate, and selects the best alpha before reporting coefficients and lambda-based outputs.

If the chosen alpha is 0, the model is ridge rather than sparse elastic net. In that case, selected_features.csv is written empty to avoid mislabeling dense ridge coefficients as selected features; use model_coefficients.csv for coefficient ranking instead.

Feature Selection Rule

Selected features are the coefficients whose absolute value exceeds a small numerical tolerance at the chosen lambda, excluding the intercept term.

If the chosen alpha is 0, the workflow writes an empty selected_features.csv because ridge coefficients are dense by design and should not be mislabeled as sparse selected features.


Examples

bash
Rscript scripts/main.R \
  -i expression_matrix.csv \
  -g groups.csv \
  -f genes.csv \
  -a auto \
  --alpha_grid 0,0.25,0.5,0.75,1 \
  -o output/first_run
Fixed-Alpha Baseline
bash
Rscript scripts/main.R \
  -i expression_matrix.csv \
  -g groups.csv \
  -f genes.csv \
  -a 0.5 \
  -o output/fixed_alpha
More Conservative Selection
bash
Rscript scripts/main.R \
  -i expression_matrix.csv \
  -g groups.csv \
  -l lambda.1se \
  -o output/lambda_1se

Error Handling

Common Errors
ErrorCauseSolutionRead More
SKILL_FILE_NOT_FOUNDInput file does not existCheck file path and permissionsreferences/troubleshooting.md#skill_file_not_found
SKILL_EMPTY_DATAInput file exists but is emptyRe-export the input file with data rowsreferences/troubleshooting.md#skill_empty_data
SKILL_MISSING_COLUMNSGroup file lacks sample/group columnsVerify the group file structurereferences/troubleshooting.md#skill_missing_columns
SKILL_SAMPLE_MISMATCHSample IDs do not overlap between filesEnsure matrix column names match the group filereferences/troubleshooting.md#skill_sample_mismatch
SKILL_INVALID_PARAMETERCLI parameter is invalidCheck allowed values and rangesreferences/troubleshooting.md#skill_invalid_parameter
SKILL_INVALID_DATAToo few samples or usable features remainReview filtering choices and input datareferences/troubleshooting.md#skill_invalid_data
SKILL_DEPENDENCY_MISSINGRequired R package is not installedInstall missing packages before rerunningreferences/troubleshooting.md#skill_dependency_missing
SKILL_PKG_VERSIONInstalled package is too oldUpgrade the required packagereferences/troubleshooting.md#skill_pkg_version
SKILL_TIMEOUTRun exceeded the configured time limitIncrease timeout_seconds or reduce data sizereferences/troubleshooting.md#skill_timeout
SKILL_RUNTIME_ERRORAn unexpected runtime or output-write failure occurredCheck output path permissions, free space, and the last console messagereferences/troubleshooting.md#skill_runtime_error

IF error persists, READ: references/troubleshooting.md


Testing

Test with Sample Data
bash
# Check help
Rscript scripts/main.R --help

# Run with bundled test data
Rscript scripts/main.R \
  -i tests/data/expression_matrix.csv \
  -g tests/data/groups.csv \
  -f tests/data/genes.csv \
  -a auto \
  --alpha_grid 0,0.5,1 \
  -o tests/output \
  -n 5 \
  -t 600
Validation Commands
bash
# Inspect selected features (may be header-only if auto-alpha selects ridge)
cat tests/output/selected_features.csv

# Check plots exist
ls -la tests/output

Implementation Checklist

  • CLI parsing with optparse
  • set.seed() for reproducibility
  • requireNamespace() dependency checks
  • Runtime package loading with library()
  • Session info recording
  • Timeout control with setTimeLimit()
  • Console warning handling
  • Out-of-scope label enforcement
  • gc() snapshot reporting
  • File reading instructions in SKILL.md
  • Modular script structure
  • Test data provided
  • Error handling with SKILL_* codes
  • Scripts in scripts/ directory
  • References in references/ directory

Last updated: 2026-04-20 | Version: 1.0.0

© aipoch, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 21 other files (scripts, references) in awesome-med-research-skills/Data Analysis/elastic-net-feature-selection of aipoch/medical-research-skills.

  • SKILL.md
  • eval_report_elastic-net-feature-selection_result.json
  • references/algorithm.md
  • references/cli-guide.md
  • references/troubleshooting.md
  • scripts/functions.R
  • scripts/io.R
  • scripts/main.R
  • scripts/modeling.R
  • scripts/output.R
  • scripts/run_analysis.R
  • scripts/utils.R
  • scripts/validation.R
  • tests/data/expression_matrix.csv
  • tests/data/genes.csv
  • tests/data/groups.csv
  • tests/run_tests.R
  • … and 5 more

Open the folder on GitHubat commit 686e09d

Compare with similar skills

Elastic Net Feature Selection next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Elastic Net Feature Selection compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Elastic Net Feature Selection this skillaipoch/medical-research-skills2k—~2.9kAutomated safety check: PassMIT
Scikit LearnzLanqing/codex-claude-academic-skills4.7k16 repos~3.9kAutomated safety check: PassBSD-3-Clause
Agentic Kaggle WorkflowFrankS-IntelLab/agentic-kaggle-skill188—~4kAutomated safety check: PassMIT
Senior Data ScientistRaidriar7170/hermes-skilleval1255 repos~1.4kAutomated safety check: PassMIT
Geomlitalo-goncalves/geoML109—~4.6kAutomated safety check: PassGPL-3.0
QuantMind Training Config Generatorqusong0627/QuantMind1.7k—~1.5kAutomated safety check: PassAGPL-3.0

Similar skills

  • Scikit Learn

    zLanqing/codex-claude-academic-skills

    Machine learning in Python with scikit-learn. An agent skill from zLanqing/codex-claude-academic-skills.

    4.7k GitHub starsUsed in 16 repos~3.9k tokens
    Data & AnalyticsAuto-check passed
  • Agentic Kaggle Workflow

    FrankS-IntelLab/agentic-kaggle-skill

    Takes a Kaggle competition from rules and validation design through baselines, ensembling and notebook architecture to a scored submission.

    188 GitHub stars~4k tokensUpdated 3 mo ago
    Data & AnalyticsAuto-check passed
  • Senior Data Scientist

    Raidriar7170/hermes-skilleval

    World-class data science skill for statistical modeling, experimentation, causal inference, and advanced analytics.

    125 GitHub starsUsed in 5 repos~1.4k tokens
    Data & AnalyticsAuto-check passed
  • Geoml

    italo-goncalves/geoML

    Working knowledge of the geoML Python package (github.com/italo-goncalves/geoML): variational Gaussian processes for spatial data, implicit geological modelling, block models, drillhole data…

    109 GitHub stars~4.6k tokensUpdated today
    Data & AnalyticsAuto-check passed
  • Turns a plain-language model training request into a validated QuantMind training config file that can be imported from the Model Training page.

    1.7k GitHub stars~1.5k tokensUpdated today
    Data & AnalyticsAuto-check passed
  • Retention Analysis

    liangdabiao/claude-data-analysis-ultra-main

    Analyze user retention and churn using survival analysis, cohort analysis, and machine learning.

    290 GitHub stars~1.3k tokensUpdated 5 mo ago
    Data & AnalyticsAuto-check: notes

More from aipoch/medical-research-skills

All 578 skills in this repo
  • Academic Poster Generator

    aipoch/medical-research-skills

    Complete workflow for generating academic research posters from PDF literature; use when you need to extract paper content from PDFs and produce a LaTeX-based poster…

    2k GitHub stars~2.2k tokensUpdated 22 days ago
    Auto-check passed
  • Diagnostic Study Quality Assessment Quadas

    aipoch/medical-research-skills

    Analyzes clinical diagnostic accuracy studies for bias using the QUADAS-2 tool.

    2k GitHub stars~1.4k tokensUpdated 22 days ago
    Auto-check passed
  • Exploratory Data Analysis

    aipoch/medical-research-skills

    Perform comprehensive exploratory data analysis on scientific data files across 200+ file formats.

    2k GitHub stars~3.7k tokensUpdated 22 days ago
    Auto-check passed
  • Iso Certification

    aipoch/medical-research-skills

    A toolkit for preparing ISO 13485:2016 certification documentation for medical device QMS.

    2k GitHub stars~1.8k tokensUpdated 22 days ago
    Auto-check passed
  • Journal Skills

    aipoch/medical-research-skills

    Recommends target journals for manuscript submission by analyzing the paper topic/abstract and the journal distribution of similar PubMed literature; use when users ask for journal…

    2k GitHub stars~1.7k tokensUpdated 22 days ago
    Auto-check passed
  • Latex Posters

    aipoch/medical-research-skills

    Creates academic-poster writing packages for LaTeX using beamerposter, tikzposter, or baposter.

    2k GitHub stars~1.3k tokensUpdated 22 days ago
    Auto-check passed

Questions about Elastic Net Feature Selection

What does Elastic Net Feature Selection do?

A skill your agent uses when selecting predictive genes or other molecular features from bulk expression matrices for binary case-vs-control classification with elastic net logistic regression…. Elastic Net Feature Selection is an agent skill from aipoch/medical-research-skills. Use when selecting predictive genes or other molecular features from bulk expression matrices for binary case-vs-control classification with elastic net logistic regression, including coefficient path and cross-validation plots.

When should I use Elastic Net Feature Selection?

Elastic Net Feature Selection fits situations like: selecting predictive genes; other molecular features from bulk expression matrices for binary case-vs-control classification with elastic net logistic regression; including coefficient path and cross-validation plots; keywords: elastic net.

How do I install Elastic Net Feature Selection in Claude Code?

Run `npx skills add aipoch/medical-research-skills --skill elastic-net-feature-selection -a claude-code`. Or copy the skill folder (awesome-med-research-skills/Data Analysis/elastic-net-feature-selection in aipoch/medical-research-skills) into .claude/skills/elastic-net-feature-selection in your project. Claude Code loads it when a task matches its description.

How do I install Elastic Net Feature Selection in Codex?

Run `npx skills add aipoch/medical-research-skills --skill elastic-net-feature-selection -a codex`. Or copy the skill folder (awesome-med-research-skills/Data Analysis/elastic-net-feature-selection in aipoch/medical-research-skills) into .agents/skills/elastic-net-feature-selection in your project. Codex loads it when a task matches its description.

Can I use Elastic Net Feature Selection in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add aipoch/medical-research-skills --skill elastic-net-feature-selection -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/elastic-net-feature-selection, .gemini/skills/elastic-net-feature-selection, .github/skills/elastic-net-feature-selection and .opencode/skills/elastic-net-feature-selection in your project.

What does Elastic Net Feature Selection need to run?

Going by SKILL.md and its folder, Elastic Net Feature Selection needs R for the scripts in its folder.

Does Elastic Net Feature Selection access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Elastic Net Feature Selection safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does Elastic Net Feature Selection use?

Elastic Net Feature Selection is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Elastic Net Feature Selection use?

About 2.9k tokens (SKILL.md is roughly 11k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 3.3k tokens, read only when the agent opens those files.

What are the alternatives to Elastic Net Feature Selection?

Skills that share tags, products or a category with Elastic Net Feature Selection: Scikit Learn (zLanqing/codex-claude-academic-skills, 4.7k stars), Agentic Kaggle Workflow (FrankS-IntelLab/agentic-kaggle-skill, 188 stars), Senior Data Scientist (Raidriar7170/hermes-skilleval, 125 stars) and Geoml (italo-goncalves/geoML, 109 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Elastic Net Feature Selection?

aipoch (a GitHub organization) maintains it in aipoch/medical-research-skills, which has 1,978 GitHub stars. The repository holds 578 skills in this directory. The repository was last updated on September 17, 2026.

Source: aipoch/medical-research-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.