[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7C8JTA4XHZ7DEKEECSSMZRF":3,"skill-same:01M7C8JTA4XHZ7DEKEECSSMZRF":45},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":6,"ownerHtmlUrl":29,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":30,"install":31,"resources":44},"01M7C8JTA4XHZ7DEKEECSSMZRF","pca-decomposition",null,"Reduce dimensionality of multivariate data using PCA with varimax rotation. Use when you have many correlated variables and need to identify underlying factors or reduce collinearity.","linyouxue\u002Fskill-repair-benchmark","linyouxue","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F216151464?v=4","01M7BJEVCXKD74KH6FG9CBVSQB","林宥学","01M7BJEVE02NP217V93BKZFC0J",0,"MIT","https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fskillsbench_slice\u002Flake-warming-attribution\u002Fenvironment\u002Fskills\u002Fpca-decomposition\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: pca-decomposition\ndescription: Reduce dimensionality of multivariate data using PCA with varimax rotation. Use when you have many correlated variables and need to identify underlying factors or reduce collinearity.\nlicense: MIT\n---\n\n# PCA Decomposition Guide\n\n## Overview\n\nPrincipal Component Analysis (PCA) reduces many correlated variables into fewer uncorrelated components. Varimax rotation makes components more interpretable by maximizing variance.\n\n## When to Use PCA\n\n- Many correlated predictor variables\n- Need to identify underlying factor groups\n- Reduce multicollinearity before regression\n- Exploratory data analysis\n\n## Basic PCA with Varimax Rotation\n```python\nfrom sklearn.preprocessing import StandardScaler\nfrom factor_analyzer import FactorAnalyzer\n\n# Standardize data first\nscaler = StandardScaler()\nX_scaled = scaler.fit_transform(X)\n\n# PCA with varimax rotation\nfa = FactorAnalyzer(n_factors=4, rotation='varimax')\nfa.fit(X_scaled)\n\n# Get factor loadings\nloadings = fa.loadings_\n\n# Get component scores for each observation\nscores = fa.transform(X_scaled)\n```\n\n## Workflow for Attribution Analysis\n\nWhen using PCA for contribution analysis with predefined categories:\n\n1. **Combine ALL variables first**, then do PCA together:\n```python\n# Include all variables from all categories in one matrix\nall_vars = ['AirTemp', 'NetRadiation', 'Precip', 'Inflow', 'Outflow',\n            'WindSpeed', 'DevelopedArea', 'AgricultureArea']\nX = df[all_vars].values\n\nscaler = StandardScaler()\nX_scaled = scaler.fit_transform(X)\n\n# PCA on ALL variables together\nfa = FactorAnalyzer(n_factors=4, rotation='varimax')\nfa.fit(X_scaled)\nscores = fa.transform(X_scaled)\n```\n\n2. **Interpret loadings** to map factors to categories (optional for understanding)\n\n3. **Use factor scores directly** for R² decomposition\n\n**Important**: Do NOT run separate PCA for each category. Run one global PCA on all variables, then use the resulting factor scores for contribution analysis.\n\n## Interpreting Factor Loadings\n\nLoadings show correlation between original variables and components:\n\n| Loading | Interpretation |\n|---------|----------------|\n| > 0.7 | Strong association |\n| 0.4 - 0.7 | Moderate association |\n| \u003C 0.4 | Weak association |\n\n## Example: Economic Indicators\n```python\nimport pandas as pd\nfrom sklearn.preprocessing import StandardScaler\nfrom factor_analyzer import FactorAnalyzer\n\n# Variables: gdp, unemployment, inflation, interest_rate, exports, imports\ndf = pd.read_csv('economic_data.csv')\nvariables = ['gdp', 'unemployment', 'inflation',\n             'interest_rate', 'exports', 'imports']\n\nX = df[variables].values\nscaler = StandardScaler()\nX_scaled = scaler.fit_transform(X)\n\nfa = FactorAnalyzer(n_factors=3, rotation='varimax')\nfa.fit(X_scaled)\n\n# View loadings\nloadings_df = pd.DataFrame(\n    fa.loadings_,\n    index=variables,\n    columns=['RC1', 'RC2', 'RC3']\n)\nprint(loadings_df.round(2))\n```\n\n## Choosing Number of Factors\n\n### Option 1: Kaiser Criterion\n```python\n# Check eigenvalues\neigenvalues, _ = fa.get_eigenvalues()\n\n# Keep factors with eigenvalue > 1\nn_factors = sum(eigenvalues > 1)\n```\n\n### Option 2: Domain Knowledge\n\nIf you know how many categories your variables should group into, specify directly:\n```python\n# Example: health data with 3 expected categories (lifestyle, genetics, environment)\nfa = FactorAnalyzer(n_factors=3, rotation='varimax')\n```\n\n## Common Issues\n\n| Issue | Cause | Solution |\n|-------|-------|----------|\n| Loadings all similar | Too few factors | Increase n_factors |\n| Negative loadings | Inverse relationship | Normal, interpret direction |\n| Low variance explained | Data not suitable for PCA | Check correlations first |\n\n## Best Practices\n\n- Always standardize data before PCA\n- Use varimax rotation for interpretability\n- Check factor loadings to name components\n- Use Kaiser criterion or domain knowledge for n_factors\n- For attribution analysis, run ONE global PCA on all variables\n","# PCA Decomposition Guide\n\n## Overview\n\nPrincipal Component Analysis (PCA) reduces many correlated variables into fewer uncorrelated components. Varimax rotation makes components more interpretable by maximizing variance.\n\n## When to Use PCA\n\n- Many correlated predictor variables\n- Need to identify underlying factor groups\n- Reduce multicollinearity before regression\n- Exploratory data analysis\n\n## Basic PCA with Varimax Rotation\n```python\nfrom sklearn.preprocessing import StandardScaler\nfrom factor_analyzer import FactorAnalyzer\n\n# Standardize data first\nscaler = StandardScaler()\nX_scaled = scaler.fit_transform(X)\n\n# PCA with varimax rotation\nfa = FactorAnalyzer(n_factors=4, rotation='varimax')\nfa.fit(X_scaled)\n\n# Get factor loadings\nloadings = fa.loadings_\n\n# Get component scores for each observation\nscores = fa.transform(X_scaled)\n```\n\n## Workflow for Attribution Analysis\n\nWhen using PCA for contribution analysis with predefined categories:\n\n1. **Combine ALL variables first**, then do PCA together:\n```python\n# Include all variables from all categories in one matrix\nall_vars = ['AirTemp', 'NetRadiation', 'Precip', 'Inflow', 'Outflow',\n            'WindSpeed', 'DevelopedArea', 'AgricultureArea']\nX = df[all_vars].values\n\nscaler = StandardScaler()\nX_scaled = scaler.fit_transform(X)\n\n# PCA on ALL variables together\nfa = FactorAnalyzer(n_factors=4, rotation='varimax')\nfa.fit(X_scaled)\nscores = fa.transform(X_scaled)\n```\n\n2. **Interpret loadings** to map factors to categories (optional for understanding)\n\n3. **Use factor scores directly** for R² decomposition\n\n**Important**: Do NOT run separate PCA for each category. Run one global PCA on all variables, then use the resulting factor scores for contribution analysis.\n\n## Interpreting Factor Loadings\n\nLoadings show correlation between original variables and components:\n\n| Loading | Interpretation |\n|---------|----------------|\n| > 0.7 | Strong association |\n| 0.4 - 0.7 | Moderate association |\n| \u003C 0.4 | Weak association |\n\n## Example: Economic Indicators\n```python\nimport pandas as pd\nfrom sklearn.preprocessing import StandardScaler\nfrom factor_analyzer import FactorAnalyzer\n\n# Variables: gdp, unemployment, inflation, interest_rate, exports, imports\ndf = pd.read_csv('economic_data.csv')\nvariables = ['gdp', 'unemployment', 'inflation',\n             'interest_rate', 'exports', 'imports']\n\nX = df[variables].values\nscaler = StandardScaler()\nX_scaled = scaler.fit_transform(X)\n\nfa = FactorAnalyzer(n_factors=3, rotation='varimax')\nfa.fit(X_scaled)\n\n# View loadings\nloadings_df = pd.DataFrame(\n    fa.loadings_,\n    index=variables,\n    columns=['RC1', 'RC2', 'RC3']\n)\nprint(loadings_df.round(2))\n```\n\n## Choosing Number of Factors\n\n### Option 1: Kaiser Criterion\n```python\n# Check eigenvalues\neigenvalues, _ = fa.get_eigenvalues()\n\n# Keep factors with eigenvalue > 1\nn_factors = sum(eigenvalues > 1)\n```\n\n### Option 2: Domain Knowledge\n\nIf you know how many categories your variables should group into, specify directly:\n```python\n# Example: health data with 3 expected categories (lifestyle, genetics, environment)\nfa = FactorAnalyzer(n_factors=3, rotation='varimax')\n```\n\n## Common Issues\n\n| Issue | Cause | Solution |\n|-------|-------|----------|\n| Loadings all similar | Too few factors | Increase n_factors |\n| Negative loadings | Inverse relationship | Normal, interpret direction |\n| Low variance explained | Data not suitable for PCA | Check correlations first |\n\n## Best Practices\n\n- Always standardize data before PCA\n- Use varimax rotation for interpretability\n- Check factor loadings to name components\n- Use Kaiser criterion or domain knowledge for n_factors\n- For attribution analysis, run ONE global PCA on all variables\n",{"name":5,"license":15,"description":7},"main","cdcb6d230f3b15c3c33f8a2bdd16439f43602cbe","tests\u002Ffixtures\u002Fskillsbench_slice\u002Flake-warming-attribution\u002Fenvironment\u002Fskills\u002Fpca-decomposition",1,"https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark","https:\u002F\u002Fgithub.com\u002Flinyouxue","2026-11-14 20:28:35",{"source":8,"skillName":5,"commands":32,"prompt":42,"zipAvailable":43},[33,36,39],{"tool":34,"command":35},"npx","npx skills add linyouxue\u002Fskill-repair-benchmark --skill pca-decomposition",{"tool":37,"command":38},"bunx","bunx skills add linyouxue\u002Fskill-repair-benchmark --skill pca-decomposition",{"tool":40,"command":41},"pnpm","pnpm dlx skills add linyouxue\u002Fskill-repair-benchmark --skill pca-decomposition","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark\u002Fblob\u002Fmain\u002Ftests\u002Ffixtures\u002Fskillsbench_slice\u002Flake-warming-attribution\u002Fenvironment\u002Fskills\u002Fpca-decomposition\u002FSKILL.md",true,[],[46,54,61,68,73,78],{"skillNo":47,"name":48,"nameZh":6,"description":49,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":50,"licenseFileUrl":6,"sourceHtmlUrl":51,"categories":52,"keywords":53,"publishedAt":19},"01M7E1HGVRY73NBJ022CJG13X6","video-frame-extraction","Extract frames from video files and save them as images using OpenCV","Apache-2.0","https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark\u002Fblob\u002Fmain\u002Fjpg-ocr-stat\u002Fresult\u002Fskilltta-claude4.7\u002Fgroup_03\u002Frun_03\u002Finputs\u002Fskills\u002Fvideo-frame-extraction\u002FSKILL.md",[],[],{"skillNo":55,"name":56,"nameZh":6,"description":57,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":50,"licenseFileUrl":6,"sourceHtmlUrl":58,"categories":59,"keywords":60,"publishedAt":19},"01M7E1HAG5R7CJ9C8NYJS771MB","openai-vision","Analyze images and multi-frame sequences using OpenAI GPT vision models","https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark\u002Fblob\u002Fmain\u002Fjpg-ocr-stat\u002Fresult\u002Fskilltta-claude4.7\u002Fgroup_03\u002Frun_03\u002Finputs\u002Fskills\u002Fopenai-vision\u002FSKILL.md",[],[],{"skillNo":62,"name":63,"nameZh":6,"description":64,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":50,"licenseFileUrl":6,"sourceHtmlUrl":65,"categories":66,"keywords":67,"publishedAt":19},"01M7E1H7DADKB6QBWKC2KQ63SZ","image-ocr","Extract text content from images using Tesseract OCR via Python, including structured field extraction from receipts and forms","https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark\u002Fblob\u002Fmain\u002Fjpg-ocr-stat\u002Fresult\u002Fskilltta-claude4.7\u002Fgroup_03\u002Frun_03\u002Finputs\u002Fskills\u002Fimage-ocr\u002FSKILL.md",[],[],{"skillNo":69,"name":48,"nameZh":6,"description":49,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":50,"licenseFileUrl":6,"sourceHtmlUrl":70,"categories":71,"keywords":72,"publishedAt":19},"01M7E1H0WBNT43TENGQY7AVZHD","https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark\u002Fblob\u002Fmain\u002Fjpg-ocr-stat\u002Fresult\u002Fskilltta-claude4.7\u002Fgroup_03\u002Frun_02\u002Finputs\u002Fskills\u002Fvideo-frame-extraction\u002FSKILL.md",[],[],{"skillNo":74,"name":56,"nameZh":6,"description":57,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":50,"licenseFileUrl":6,"sourceHtmlUrl":75,"categories":76,"keywords":77,"publishedAt":19},"01M7E1GTC7D4N4Q2EF03875J9E","https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark\u002Fblob\u002Fmain\u002Fjpg-ocr-stat\u002Fresult\u002Fskilltta-claude4.7\u002Fgroup_03\u002Frun_02\u002Finputs\u002Fskills\u002Fopenai-vision\u002FSKILL.md",[],[],{"skillNo":79,"name":63,"nameZh":6,"description":64,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":50,"licenseFileUrl":6,"sourceHtmlUrl":80,"categories":81,"keywords":82,"publishedAt":19},"01M7E1GQ92CWFMGH53KSSE4WER","https:\u002F\u002Fgithub.com\u002Flinyouxue\u002Fskill-repair-benchmark\u002Fblob\u002Fmain\u002Fjpg-ocr-stat\u002Fresult\u002Fskilltta-claude4.7\u002Fgroup_03\u002Frun_02\u002Finputs\u002Fskills\u002Fimage-ocr\u002FSKILL.md",[],[]]