{"data":{"slug":"github-aipoch-medical-research-skills-awesome-med-research-skills-data-analysis-svm-model-importance-analysis-0ef0b869f3cd","title":"SVM Model Importance Analysis","summary":"Run a standardized R CLI workflow for two-class SVM-RFE feature ranking, cross-validated error selection, and reproducible plots using gene expression data with sample IDs and numeric features.","url":"https:\/\/skillshunter.net\/skills\/github-aipoch-medical-research-skills-awesome-med-research-skills-data-analysis-svm-model-importance-analysis-0ef0b869f3cd","json_url":"https:\/\/skillshunter.net\/api\/public\/v1\/skills\/github-aipoch-medical-research-skills-awesome-med-research-skills-data-analysis-svm-model-importance-analysis-0ef0b869f3cd","markdown_url":"https:\/\/skillshunter.net\/skills\/github-aipoch-medical-research-skills-awesome-med-research-skills-data-analysis-svm-model-importance-analysis-0ef0b869f3cd.md","download_url":"https:\/\/skillshunter.net\/skills\/github-aipoch-medical-research-skills-awesome-med-research-skills-data-analysis-svm-model-importance-analysis-0ef0b869f3cd\/download","category":{"slug":"data-research","name":"Data & Research"},"editor_note":"Ensure input files are in CSV or TSV format with samples as rows and numeric features as columns. The group file must contain exactly two groups (case and control) in a dedicated column. The analysis requires the `--input_file` and `--group_file` arguments unless `--plot_only` is set to `TRUE`.","instructions":"---\nname: svm-model-importance-analysis\ndescription: Use when you need a standardized R CLI workflow to run two-class SVM-RFE feature ranking on an expression-like matrix, choose an informative feature count from cross-validated error, and generate reproducible ranking and error plots. NOT for regression, multi-class classification, missing-value imputation, or remote data fetching.\nlicense: MIT\nauthor: AIPOCH\n---\n> **Source**: [https:\/\/github.com\/aipoch\/medical-research-skills](https:\/\/github.com\/aipoch\/medical-research-skills)\n\n# SVM Model Importance Analysis\n\n## When to Read External Files\n\n| Situation | File to Read | Purpose |\n|-----------|--------------|---------|\n| Need algorithm details | `references\/algorithm.md` | Explain SVM-RFE ranking, cross-validation logic, assumptions, and interpretation |\n| Need to execute the analysis | `scripts\/main.R` | Run the CLI entry point with a complete `Rscript` command |\n| Encounter an error | `references\/troubleshooting.md` | Map standardized error codes to causes and fixes |\n| Need CLI examples | `references\/cli-guide.md` | Review installation steps and runnable CLI examples |\n| Need a runnable smoke test | `tests\/data\/` | Use the bundled small dataset for verification |\n\n## Usage\n\n```bash\nRscript scripts\/main.R \\\n  --input_file .\/input\/expression_matrix.csv \\\n  --group_file .\/input\/group_info.csv \\\n  --case_group Case \\\n  --control_group Control \\\n  --output_dir output\/basic-run \\\n  --seed 42 \\\n  --timeout_seconds 600\n```\n\n## Arguments\n\n| Short | Long | Type | Default | Required | Description |\n|-------|------|------|---------|----------|-------------|\n| `-i` | `--input_file` | character | none | yes, unless `--plot_only TRUE` | Expression matrix file with samples in rows and features in columns |\n| `-g` | `--group_file` | character | none | yes, unless `--plot_only TRUE` | Group file with sample IDs in the first column |\n| `-c` | `--case_group` | character | none | yes, unless `--plot_only TRUE` | Case group label |\n| `-r` | `--control_group` | character | none | yes, unless `--plot_only TRUE` | Control group label |\n| `-o` | `--output_dir` | character | `output` | yes | Output directory inside the skill root |\n| `-p` | `--plot_only` | logical | `FALSE` | no | Reuse `output_dir\/data\/svm_result.rds` and regenerate plots without rerunning SVM-RFE |\n| `-s` | `--seed` | integer | `42` | no | Random seed for reproducibility |\n| `-t` | `--timeout_seconds` | integer | `600` | no | Elapsed time limit for the run |\n|  | `--svm_k` | integer | `10` | no | Number of stratified outer folds used for SVM-RFE and validation |\n|  | `--svm_halve_above` | integer | `50` | no | If surviving features exceed this count, remove half per iteration |\n|  | `--svm_max_features_cap` | integer | `30` | no | Maximum feature count evaluated on the error curve |\n|  | `--svm_select_rule` | character | `min` | no | Feature-count rule: `min` or `tolerance` |\n|  | `--svm_tol` | numeric | `0.01` | no | Tolerance used when `--svm_select_rule tolerance` is selected |\n|  | `--svm_error_height` | numeric | `5` | no | SVM error plot height in inches |\n|  | `--svm_error_width` | numeric | `6` | no | SVM error plot width in inches |\n|  | `--svm_error_xlab` | character | `Number of Features` | no | X-axis label for the SVM error plot |\n|  | `--svm_error_ylab` | character | `Classification Error Rate` | no | Y-axis label for the SVM error plot |\n|  | `--svm_error_main_line_color` | character | `black` | no | Main line color for the SVM error plot |\n|  | `--svm_error_second_line_color` | character | `#2BA2DE` | no | Baseline line color for the SVM error plot |\n|  | `--svm_error_best_point_color` | character | `red` | no | Highlight color for the best feature-count point |\n|  | `--svm_error_noinfo_lty` | integer | `3` | no | Line type for the no-information baseline |\n|  | `--svm_error_label_cex` | numeric | `0.75` | no | Label size for the best-point annotation |\n|  | `--svm_error_label_pos` | integer | `4` | no | Label position for the best-point annotation |\n|  | `--svm_rank_top_n` | integer | `20` | no | Maximum number of ranked features shown in the ranking plot |\n|  | `--svm_rank_width` | numeric | `7` | no | Ranking plot width in inches |\n|  | `--svm_rank_height` | numeric | `6` | no | Ranking plot height in inches |\n|  | `--svm_rank_color` | character | `#2BA2DE` | no | Bar color for the ranking plot |\n|  | `--svm_rank_title` | character | `SVM-RFE Feature Ranking` | no | Title for the ranking plot |\n\n## Input Format\n\n### Expression Matrix\n\n- CSV or TSV.\n- First column: sample IDs.\n- Remaining columns: numeric features.\n- Samples must be rows.\n- Missing or non-numeric feature values are not allowed.\n\nExample:\n\n```csv\nsample,HIF1A,NR4A1,SOCS1\nS1,6.21,-1.34,2.01\nS2,6.57,0.37,3.62\nS3,7.05,2.12,5.01\n```\n\n### Group File\n\n- CSV or TSV.\n- First column: sample IDs.\n- One additional column must contain both the case and control labels.\n- Exactly two groups are supported.\n\nExample:\n\n```csv\nsample,group\nS1,Case\nS2,Case\nS3,Control\n```\n\n## Output Files\n\n| File | Format | Description |\n|------|--------|-------------|\n| `data\/svm_result.rds` | RDS | Serialized SVM-RFE bundle with ranking results and metadata |\n| `table\/svm_rfe_features.csv` | CSV | Selected ranked features using the chosen feature-count rule |\n| `table\/svm_rfe_full_ranking.csv` | CSV | Full ranking table across all input features |\n| `plot\/svm_rfe_error_plot.pdf` | PDF | Cross-validated classification error across feature counts |\n| `plot\/svm_rfe_ranking_plot.pdf` | PDF | Bar plot of the highest-ranked SVM-RFE features |\n| `session_info.txt` | TXT | R version, platform, and package version information |\n\n## Error Handling\n\n- Successful runs exit with status code `0`.\n- Failed runs exit with status code `1`.\n- Error messages use standardized names such as `SKILL_FILE_NOT_FOUND` and `SKILL_INVALID_PARAMETER`.\n- Output paths are validated so that `--output_dir` cannot write outside the skill root.\n- The analysis never performs network requests and never executes user input through `eval()`, `exec()`, or `system()`.\n\nCommon codes:\n\n| Error Code | Meaning |\n|------------|---------|\n| `SKILL_FILE_NOT_FOUND` | An input file or required plot-only artifact does not exist |\n| `SKILL_MISSING_COLUMNS` | The input file does not contain the required columns |\n| `SKILL_EMPTY_DATA` | An input file is empty or a required ranking table is unavailable |\n| `SKILL_INVALID_PARAMETER` | A CLI argument, group setting, numeric constraint, or path is invalid |\n| `SKILL_SAMPLE_MISMATCH` | Sample IDs do not match between the expression matrix and group file |\n| `SKILL_PACKAGE_NOT_FOUND` | One or more required CRAN packages are missing |\n\nFor detailed fixes, READ: `references\/troubleshooting.md`\n\n## Testing\n\n### Help Check\n\n```bash\nRscript scripts\/main.R --help\n```\n\n### Full Test Run\n\n```bash\nRscript tests\/run_tests.R\n```\n\n### Direct Test Command\n\n```bash\nRscript scripts\/main.R \\\n  --input_file tests\/data\/expression_matrix.csv \\\n  --group_file tests\/data\/group_info.csv \\\n  --case_group AR \\\n  --control_group Control \\\n  --output_dir tests\/output\/manual-test \\\n  --seed 42 \\\n  --svm_k 4 \\\n  --svm_max_features_cap 6 \\\n  --svm_rank_top_n 6 \\\n  --timeout_seconds 300\n```\n","use_cases":["Identify biologically relevant features in gene expression data for medical research","Compare feature importance across experimental conditions in clinical datasets","Generate reproducible rankings for downstream analysis in genomic studies"],"limitations":[],"compatibility":[],"setup_tip":null,"sample_input":null,"sample_output":null,"source_url":"https:\/\/github.com\/aipoch\/medical-research-skills\/blob\/686e09dfdb45d9fa1a08664f06bb93769b3c9d91\/awesome-med-research-skills\/Data%20Analysis\/svm-model-importance-analysis\/SKILL.md","source_commit":"686e09dfdb45d9fa1a08664f06bb93769b3c9d91","license":"MIT","version":null,"listing_approved_at":"2026-11-24","created_at":"2026-11-23T07:33:46.000000Z","updated_at":"2026-11-24T07:13:22.000000Z","seo_title":"SVM Model Importance Analysis Tool","seo_description":"Run SVM-RFE feature ranking and cross-validated error plots for two-class classification tasks using gene expression data.","seo_keywords":["SVM feature ranking","two-class classification analysis","cross-validated error plots","gene expression analysis","biomarker discovery"]}}