Pca Dimensionality Reduction logo

Pca Dimensionality Reduction

OrganizationPopular
aipoch
pca-dimensionality-reduction

Use when performing PCA principal component dimensionality reduction on tabular numeric data. Supports command-line parameter input, automatic numeric feature selection, parameter validation, result directory creation, and CSV or TXT format result export.

Overview

Publisheraipoch
Repositorymedical-research-skills
Skill namepca-dimensionality-reduction
Stars
1.9K
Forks
175
Bundled files
11
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 11 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by aipoch on GitHub. Read the source before you install it.

Installation

Install the Pca Dimensionality Reduction AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.

Use it in TypingMind

Enable Pca Dimensionality Reduction in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Pca Dimensionality Reduction on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Pca Dimensionality Reduction is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Source: https://github.com/aipoch/medical-research-skills

PCA Dimensionality Reduction Analysis

Use this skill to run principal component analysis on a tabular dataset and export explained variance, sample scores, feature loadings, and diagnostic figures.

Use This Skill When

  • You need to reduce multiple numeric variables into a smaller set of principal components.
  • You need a command-line PCA workflow with parameter validation.
  • You need standardized output files for downstream analysis.

Primary Command

bash
Rscript scripts/main.R \
  --data_file <input_file> \
  --output_dir <output_dir> \
  --feature_columns <comma_separated_numeric_columns>

Prerequisites

  • Rscript is available in the shell.
  • Required R packages: optparse, data.table.
  • Install missing packages with Rscript -e 'install.packages(c("optparse", "data.table"), repos="https://cloud.r-project.org")'.

Core Arguments

ArgumentRequiredDescription
--data_fileYesInput data file in CSV, TXT, or TSV format
--output_dirNoOutput directory, default ./PCA_Results
--feature_columnsNoComma-separated numeric feature columns. Default uses all numeric columns except ID/group columns
--sample_id_columnNoOptional sample ID column. If omitted and the first column is non-numeric with unique values, it is used automatically
--group_columnNoOptional grouping column to carry into score output and score plot
--n_componentsNoMaximum number of principal components to export, default 5
--center_dataNotrue or false, default true
--scale_dataNotrue or false, default true
--top_loadingsNoNumber of top absolute loadings to export per component, default 10
--output_formatNocsv or txt, default csv
--output_prefixNoOutput filename prefix, default pca

Input Requirements

  • The input file must contain at least 2 usable numeric feature columns.
  • PCA is run on rows as samples and columns as features.
  • Missing or non-finite values in selected feature columns are removed row-wise before analysis.
  • At least 2 complete samples must remain after filtering.
  • Selected feature columns must have non-zero variance after filtering.

Example input:

csv
SampleID,Group,GeneA,GeneB,GeneC,GeneD
S01,Control,2.1,1.9,8.2,4.3
S02,Control,2.4,2.2,8.0,4.6
S03,Treated,6.1,5.7,2.8,8.1

Minimal Workflow

  1. Confirm the input file exists and identify the numeric feature columns for PCA.
  2. Run scripts/main.R with the requested output directory and optional feature, ID, or group columns.
  3. Check the output directory for result files under table/, data/, and figure/.

If you omit --data_file, the script exits with SKILL_MISSING_INPUT.

Outputs

Expected output structure:

text
<output_dir>/
├── table/
├── figure/
└── data/

Primary result files:

  • table/<output_prefix>_summary.csv
  • table/<output_prefix>_scores.csv
  • table/<output_prefix>_loadings.csv
  • table/<output_prefix>_top_loadings.csv

Figure files:

  • figure/<output_prefix>_scree_plot.png
  • figure/<output_prefix>_score_plot.png

Key fields include:

  • component
  • standard_deviation
  • variance
  • proportion_variance
  • cumulative_variance
  • sample_id
  • feature
  • loading

Interpretation Guide

  • Use proportion_variance and cumulative_variance to decide how many components to retain.
  • Use the score table to inspect sample separation in PC space.
  • Use the loading tables to identify which original variables drive each component.

Read These Files When Needed

NeedFile
PCA method details and interpretationreferences/algorithm.md
More CLI examplesreferences/cli-guide.md
Error diagnosisreferences/troubleshooting.md
Main execution entry pointscripts/main.R
Sample test datatests/data/

Quick Examples

Basic PCA with explicit feature columns:

bash
Rscript scripts/main.R \
  --data_file tests/data/sample_pca_1.csv \
  --sample_id_column SampleID \
  --group_column Group \
  --feature_columns GeneA,GeneB,GeneC,GeneD,GeneE \
  --output_dir tests/output_basic

Auto-detect all numeric columns:

bash
Rscript scripts/main.R \
  --data_file tests/data/sample_pca_2.csv \
  --n_components 3 \
  --output_dir tests/output_numeric_only

Disable scaling:

bash
Rscript scripts/main.R \
  --data_file tests/data/sample_pca_1.csv \
  --sample_id_column SampleID \
  --group_column Group \
  --scale_data false \
  --output_dir tests/output_unscaled

Validation

bash
Rscript scripts/main.R --help
bash
Rscript scripts/main.R \
  --data_file tests/data/sample_pca_1.csv \
  --sample_id_column SampleID \
  --group_column Group \
  --feature_columns GeneA,GeneB,GeneC,GeneD,GeneE \
  --output_dir tests/validation_output

After running analysis, verify that tests/validation_output/table/pca_summary.csv exists.

Common Errors

  • SKILL_FILE_NOT_FOUND: Input file path is wrong or inaccessible.
  • SKILL_MISSING_COLUMNS: A requested feature, sample ID, or group column is missing.
  • SKILL_INVALID_DATA: Input data is malformed or unsuitable for PCA.
  • SKILL_INVALID_PARAMETER: An argument value is invalid.
  • SKILL_INSUFFICIENT_DATA: Too few complete samples or features remain for PCA.
  • SKILL_DEPENDENCY_MISSING: A required R package such as optparse or data.table is unavailable.

If the issue is not obvious, read references/troubleshooting.md.

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Pca Dimensionality Reduction AI skill do?

Use when performing PCA principal component dimensionality reduction on tabular numeric data. Supports command-line parameter input, automatic numeric feature selection, parameter validation, result directory creation, and CSV or TXT format result export.

Why use Pca Dimensionality Reduction on TypingMind?

Because you install it once and use it with any model. Pca Dimensionality Reduction is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Pca Dimensionality Reduction in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/aipoch/medical-research-skills/tree/main/awesome-med-research-skills/Data%20Analysis/pca-dimensionality-reduction. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Pca Dimensionality Reduction?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Pca Dimensionality Reduction?

As many as you like. As long as a model supports skills, you can use Pca Dimensionality Reduction with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Pca Dimensionality Reduction AI skill free?

Yes. It is published on GitHub by aipoch under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇