diff --git a/AI-USE.md b/AI-USE.md new file mode 100644 index 0000000..5d9b3ae --- /dev/null +++ b/AI-USE.md @@ -0,0 +1,24 @@ +# AI Assistance Disclosure + +This project used Google Antigravity with Gemini models to assist development. + +## Tools Used + +- Environment: Google Antigravity IDE. +- Models: Gemini 3.1 Pro (Planning mode) and Gemini 3.1 Flash. + +## Tasks Assisted by AI + +1. Repository scaffolding: Directory structures, Makefile automation targets, and GitHub Actions CI pipelines. +2. Data normalization: Fuzzy matching logic using RapidFuzz, alias resolution maps, and duplicate detection scripts. +3. Mining algorithms: Apriori level-wise candidate generation and integration of FP-growth benchmarks with `mlxtend`. +4. Serving layer: Export of trained logistic regression coefficients to lightweight JSON artifacts and stable softmax inference in NumPy. +5. User interface: React frontend setup with Vite, Tailwind CSS tokens, and Framer Motion micro-interactions. +6. Documentation and test generation: API test cases, smoke verification scripts, and numbers auditing scripts. + +## Manual Human Verification + +1. Data integrity: Cross-checked row counts and drop reasons across raw datasets, clean Parquet tables, and baskets. +2. Production testing: Validated live responses from `https://skillgraph-exp.vercel.app` using `curl` and browser inspection. +3. Metric validation: Verified classification metrics and calibration errors directly against `artifacts/metrics.json`. +4. Code review: Inspected all pull requests, contract schemas, and git authorship history. diff --git a/README.md b/README.md index 7bf2d38..34284b2 100644 --- a/README.md +++ b/README.md @@ -1,64 +1,434 @@ -# SkillGraph: India Job Market Mining Engine +# ๐Ÿงญ SkillGraph: India Job Market Mining Engine -Live Application: https://skillgraph-exp.vercel.app +SkillGraph maps applicant skill profiles to Indian technology roles, predicts readiness with qualitative bands, and recommends prioritized skill additions with co-occurrence companions. The system is built from 12,872 labelled Indian tech job postings, association rule mining with FP-growth, and a calibrated logistic regression classifier. -![Desktop View](docs/screenshots/persona1-desktop.png) -![Mobile View](docs/screenshots/persona1-mobile.png) +[![Python 3.12](https://img.shields.io/badge/Python-3.12-3776AB?style=flat-square&logo=python&logoColor=white)](https://www.python.org/) +[![FastAPI](https://img.shields.io/badge/FastAPI-0.142.2-009688?style=flat-square&logo=fastapi&logoColor=white)](https://fastapi.tiangolo.com/) +[![React 18](https://img.shields.io/badge/React-18.3.1-61DAFB?style=flat-square&logo=react&logoColor=black)](https://react.dev/) +[![Vite](https://img.shields.io/badge/Vite-6.0.7-646CFF?style=flat-square&logo=vite&logoColor=white)](https://vitejs.dev/) +[![Vercel](https://img.shields.io/badge/Vercel-Deployed-000000?style=flat-square&logo=vercel&logoColor=white)](https://vercel.com/) +[![Live App](https://img.shields.io/badge/Live-skillgraph--exp.vercel.app-17804F?style=flat-square)](https://skillgraph-exp.vercel.app) -## What It Does -- Extracts and normalizes skills from unstructured job postings. -- Classifies user skills into one of 10 tech roles using a machine learning model. -- Recommends skill gaps to learn next based on association rules mined from the tech posting subset. +--- -## Architecture +## ๐ŸŒ Live Deployment + +| Service | URL | +|---|---| +| **Web Application** | [skillgraph-exp.vercel.app](https://skillgraph-exp.vercel.app) | +| **API Health** | [skillgraph-api-notionatul.vercel.app/api/health](https://skillgraph-api-notionatul.vercel.app/api/health) | +| **API Documentation** | [skillgraph-api-notionatul.vercel.app/docs](https://skillgraph-api-notionatul.vercel.app/docs) | +| **Data Release** | [GitHub Release data-v4](https://github.com/AtulACleaver/SkillGraph/releases/tag/data-v4) | +| **Model Release** | [GitHub Release model-v4](https://github.com/AtulACleaver/SkillGraph/releases/tag/model-v4) | +| **Rules Release** | [GitHub Release rules-v2](https://github.com/AtulACleaver/SkillGraph/releases/tag/rules-v2) | + +--- + +## ๐Ÿ“ธ Preview + +

+ SkillGraph Desktop Interface Preview +

+ +--- + +## โœจ Features + +- **Readiness scoring with qualitative bands**: Probability outputs pair with role top-20 skill coverage to place applicants in Ready, Close, or Not yet. +- **Top 3 role family matches**: Softmax probabilities rank the closest career tracks from 10 calibrated role distributions. +- **Ranked skill gap recommendations**: Counterfactual probability gains multiplied by empirical posting frequency identify the top 5 skills to learn next. +- **Companion skill discovery**: Mined association rules surface co-occurring tools at lift >= 1.50 for combined learning. +- **Fast autocomplete over aliases**: Prefix search indexes 800 canonical vocabulary skills and 834 synonyms from `taxonomy/skill_aliases.csv`. +- **Immediate input validation**: Unrecognized skills and out-of-domain inputs return structured feedback before analysis. +- **Single-request evaluation**: The `/api/analyze` endpoint executes matching, readiness calibration, and gap ranking in one round trip. +- **One-command pipeline rebuild**: A single `make all` command runs extraction, cleaning, normalization, training, and rule generation. + +--- + +## ๐ŸŽฏ How It Works + +### The Data and Mining Pipeline + +```mermaid +flowchart TD + subgraph ETL["ETL Pipeline (Atul)"] + Raw["Raw Data (XLSX)"] --> Clean["Clean Postings"] + Clean --> Norm["Normalize Skills (800 Vocab)"] + Norm --> Label["Role Labelling (10 Families)"] + Norm --> Baskets["Market Baskets"] + end + + subgraph ML["Machine Learning (Aditya)"] + Label --> Split["Stratified Split (8,941 Train)"] + Split --> Aug["Data Augmentation (26,039 Rows)"] + Aug --> Train["L2 Logistic Regression"] + Train --> Export["Export model.json"] + end + + subgraph Mining["Association Mining (Aryan)"] + Baskets --> FPG["FP-Growth (Support 0.5%)"] + FPG --> Rules["Rule Mining (231 Rules)"] + Rules --> ExportRules["Export rules.json"] + end + + Export --> Artifacts["Committed Artifacts"] + ExportRules --> Artifacts + Norm --> ExportVocab["Export skill_vocab.json"] + ExportVocab --> Artifacts +``` + +### Serving Architecture ```mermaid flowchart LR - A[XLSX Data] --> B(ETL Pipeline) - B --> C(ML Training) - B --> D(Rule Mining) - C --> E[JSON Artifacts] - D --> E - E --> F[FastAPI on Vercel] - F --> G[React on Vercel] + Browser["User Browser"] --> Client["React UI (Vercel)"] + Client --> Rewrite["Vercel Rewrite (/api/*)"] + Rewrite --> API["FastAPI (Vercel Serverless)"] + API --> NormRuntime["Normalize Skills"] + NormRuntime --> Predict["NumPy Softmax (model.json)"] + NormRuntime --> Gap["Gap Ranking (rules.json)"] + Predict --> Response["JSON Response"] + Gap --> Response + Response --> Client +``` + +### Readiness Decision Rules + +Readiness bands require satisfying both a probability threshold and a role coverage threshold (`ml/predict.py`). The final band is the minimum of the two. + +| Band | Probability Requirement | Role Top-20 Coverage Requirement | Interpretation | +|---|---|---|---| +| **Ready** | Probability >= 0.60 | Coverage >= 0.20 | Strong fit across both model probability and core skills | +| **Close** | Probability >= 0.30 | Coverage >= 0.10 | Within reach, 1 to 2 skills away from target role expectations | +| **Not yet** | Probability < 0.30 | Coverage < 0.10 | Early starting point, foundational skills missing | + +### Gap Scoring and Rule Constraints + +Skill gaps rank candidate competencies by potential impact on readiness (`mining/gap.py`). + +| Component | Rule / Cutoff | Source File | +|---|---|---| +| **Gap Score** | Score = Delta Readiness ร— Empirical Role Coverage | `mining/gap.py` | +| **Readiness Gain** | Counterfactual probability delta via `ml.predict.delta_readiness` | `ml/predict.py` | +| **Companion Lift** | Lift >= 1.50 for co-occurring gap skills | `mining/gap.py` | +| **Non-Learnable Filter** | Excludes non-learnable tokens from `taxonomy/non_learnable.txt` | `taxonomy/non_learnable.txt` | +| **Redundancy Filter** | Prunes synonyms and word subsets via `_is_redundant_skill` | `mining/gap.py` | + +--- + +## ๐Ÿ“Š Results + +The table below summarizes dataset, model, mining, and latency metrics across the repository. + +| Metric | Value | Source | +|---|---|---| +| Labelled Postings | 12,872 | `data/stats/label.json` | +| Role Families | 10 | `taxonomy/role_families.csv` | +| Vocabulary Size | 800 | `artifacts/skill_vocab.json` | +| Mapped Mass | 65.4% (177,432 / 271,108) | `docs/stats.json` | +| Test Macro F1 | 0.7499 | `artifacts/metrics.json` | +| Test Accuracy | 0.7527 | `artifacts/metrics.json` | +| Test Top-3 Accuracy | 0.9254 | `artifacts/metrics.json` | +| Majority Baseline Accuracy | 0.1774 | `artifacts/metrics.json` | +| Short-Input Test Macro F1 | 0.6116 | `artifacts/metrics.json` | +| ECE (Pooled OvR) | 0.0120 | `artifacts/metrics.json` | +| ECE (Top-Label) | 0.0614 | `artifacts/metrics.json` | +| Mined Association Rules | 231 | `artifacts/rules.parquet` | +| Apriori Mining Time (0.5% Sup) | 43.6936 s | `docs/bench.json` | +| FP-Growth Mining Time (0.5% Sup) | 0.3454 s | `docs/bench.json` | +| Mining Speedup | 126.49x | `docs/bench.json` | +| Production Latency (p50) | 454.4 ms | `docs/deploy.md` | +| Production Latency (p95) | 728.8 ms | `docs/deploy.md` | +| Production Cold Start | 2521.1 ms | `docs/deploy.md` | + +Logistic regression shipped over LightGBM because LightGBM scored 0.7648 test macro F1 against logistic regression at 0.7499, a difference of 1.49 percentage points that fell short of the required 3.0-point threshold. + +--- + +## ๐Ÿงช Benchmark Methodology + +Detailed documentation is available in [docs/model.md](docs/model.md), [docs/mining.md](docs/mining.md), and [docs/deploy.md](docs/deploy.md). + +### 1. Model Evaluation +- **Splits**: 8,941 raw train rows expanded to 26,039 via data augmentation (`ml/augment.py`), 1,916 validation rows, and 1,917 test rows. +- **Augmentation**: Subsampling 2 copies per posting with random subsets of size between 2 and `n-1` skills to reflect partial resumes. +- **Short-Input Test Set**: Constructed by pruning test postings down to 2 to 3 skills, testing classification on sparse user input. + +```bash +# Reproduce model training and metrics +make train +``` + +### 2. Apriori vs FP-Growth +- **Dataset**: 34,569 baskets extracted from `data/clean.parquet`. +- **Threshold**: Minimum support 0.005 (0.50%), minimum confidence 0.30, minimum lift 1.20. +- **Results**: Both algorithms found identical 501 itemsets. Apriori required 43.6936 seconds, while FP-growth finished in 0.3454 seconds (126.49x speedup). Hardware environment was not recorded in `docs/bench.json`. + +```bash +# Reproduce mining benchmark +make bench ``` -## Quick Start +### 3. Production Latency +- **Environment**: Vercel Serverless Function running Python 3.12, measured on 2026-10-05. +- **Procedure**: 20 sequential POST requests to `https://skillgraph-exp.vercel.app/api/analyze` using `curl` with payload `{"skills":["python","sql","pandas"],"desired_role":"Data / BI Analyst"}`. +- **Metrics**: Cold start latency measured at 2521.1 ms; warm sequential requests recorded p50 of 454.4 ms and p95 of 728.8 ms. ```bash +# Run production smoke verification +bash scripts/smoke.sh https://skillgraph-exp.vercel.app +``` + +--- + +## ๐Ÿš€ Local Development + +### Prerequisites +- Python 3.12 +- Node.js 22 (or Node.js 18+) +- GitHub CLI (`gh`) authenticated via `gh auth login` + +### Quick Start +To run the application locally using prebuilt artifacts: + +```bash +# 1. Setup virtual environment and frontend packages make setup + +# 2. Download prebuilt data and model artifacts +make fetch-data + +# 3. Start local API server (prints http://127.0.0.1:8000) make api + +# 4. In a separate terminal, start frontend dev server (prints http://localhost:5173) make web ``` -## Full Rebuild +### Full Pipeline Rebuild +To rebuild the dataset, vocabulary, model, and association rules from raw data: ```bash +# Place raw XLSX into data/raw/indian-job-market-dataset-2025.xlsx make all ``` -## Key Numbers -- **Dataset**: 97,929 raw rows, 34,569 baskets -- **Normalization**: 69.9% mapped mass -- **Model**: 0.7499 Test Macro F1 -- **Mining**: 231 rules -- **Engineering**: 2521.1 ms cold start latency, 454.4 ms p50 latency - -## Limitations -- 8-tag cap per job posting input. -- "Software Engineer (generic)" generic titles are excluded. -- Data represents posted demand, not hired skills. -- No usable posting dates in the source data, so a random split was used. -- Short-input F1 drops significantly. -- Overconfident top bin in the model calibration. -- Covers India tech postings only. - -## Team - -| Name | GitHub | Role | -| - | - | - | -| Atul | AtulACleaver | ETL | -| Aditya | | ML | -| Aryan | eccentricAryan404 | Mining and Taxonomy | -| Archit | Archit1302-wolf | API | -| Shashank | ssp0009 | Frontend | \ No newline at end of file +Pipeline wall clock execution times recorded in `data/stats/`: clean stage 4.14 seconds (`data/stats/clean.json`), labelling stage 1.70 seconds (`data/stats/label.json`), training stage 8.84 seconds (`data/stats/train.json`). Total rebuild time completes in under 20 seconds. + +--- + +## ๐Ÿ“ Project Structure + +```text +SkillGraph/ +โ”œโ”€โ”€ .github/workflows/ci.yml # GitHub Actions CI workflow +โ”œโ”€โ”€ AGENTS.md # Engineering guidelines and ownership contracts +โ”œโ”€โ”€ Makefile # Top-level pipeline automation targets +โ”œโ”€โ”€ README.md # Project documentation and results overview +โ”œโ”€โ”€ app.py # Vercel Serverless entrypoint +โ”œโ”€โ”€ requirements.txt # Pinned runtime dependencies +โ”œโ”€โ”€ requirements-dev.txt # Build-time dependencies for training and mining +โ”œโ”€โ”€ api/ # Serving layer (Archit) +โ”‚ โ”œโ”€โ”€ artifacts.py # In-memory artifact loader and validator +โ”‚ โ”œโ”€โ”€ main.py # FastAPI route definitions and handlers +โ”‚ โ””โ”€โ”€ schemas.py # Pydantic request and response models +โ”œโ”€โ”€ artifacts/ # Committed model, rules, and vocabulary JSON files +โ”‚ โ”œโ”€โ”€ metrics.json # Evaluation metrics, confusion matrix, calibration +โ”‚ โ”œโ”€โ”€ model.json # Exported logistic regression weights and classes +โ”‚ โ”œโ”€โ”€ role_profiles.json # Top skills and empirical frequencies per role +โ”‚ โ”œโ”€โ”€ rules.json # Mined association rules for inference +โ”‚ โ”œโ”€โ”€ skill_vocab.json # Ordered 800 canonical skill strings +โ”‚ โ””โ”€โ”€ skills_autocomplete.json # Autocomplete list with synonyms +โ”œโ”€โ”€ docs/ # Detailed architecture, benchmarks, and audits +โ”‚ โ”œโ”€โ”€ api.md # Endpoint documentation with live request/response examples +โ”‚ โ”œโ”€โ”€ bench.json # Apriori vs FP-growth itemset benchmark data +โ”‚ โ”œโ”€โ”€ contracts.md # Inter-module data schemas and persona contracts +โ”‚ โ”œโ”€โ”€ deploy.md # Vercel deployment settings and latency records +โ”‚ โ”œโ”€โ”€ mining.md # Market basket mining and gap ranking details +โ”‚ โ”œโ”€โ”€ model.md # Classification model architecture and metrics +โ”‚ โ”œโ”€โ”€ numbers_audit.md # Numbers reconciliation table and audit log +โ”‚ โ””โ”€โ”€ stats.json # Unified repository statistics +โ”œโ”€โ”€ etl/ # Extraction, normalization, and labelling (Atul) +โ”‚ โ”œโ”€โ”€ clean.py # Deduplication and tech keyword filtering +โ”‚ โ”œโ”€โ”€ label.py # Role assignment and market basket generation +โ”‚ โ”œโ”€โ”€ normalize.py # Skill string cleaning, alias lookup, RapidFuzz +โ”‚ โ”œโ”€โ”€ paths.py # File paths and artifact directory constants +โ”‚ โ”œโ”€โ”€ pipeline.py # End-to-end data pipeline orchestrator +โ”‚ โ””โ”€โ”€ tech_terms.txt # Keyword list for initial tech subset selection +โ”œโ”€โ”€ frontend/ # React web application (Shashank) +โ”‚ โ”œโ”€โ”€ package.json # Frontend package dependencies +โ”‚ โ”œโ”€โ”€ vercel.json # API route rewrites for Vercel deployment +โ”‚ โ”œโ”€โ”€ vite.config.js # Vite bundler configuration +โ”‚ โ””โ”€โ”€ src/ # Application components, hooks, and styles +โ”‚ โ”œโ”€โ”€ App.jsx # Main application interface and view manager +โ”‚ โ”œโ”€โ”€ animations.js # Framer Motion animation configurations +โ”‚ โ”œโ”€โ”€ components/ # ReadinessPanel, GapPanel, MatchPanel, inputs +โ”‚ โ””โ”€โ”€ hooks/ # Count-up and scroll reveal hooks +โ”œโ”€โ”€ mining/ # Association mining and gap scoring (Aryan) +โ”‚ โ”œโ”€โ”€ apriori.py # Level-wise Apriori implementation from scratch +โ”‚ โ”œโ”€โ”€ fpgrowth_bench.py # Benchmark comparing Apriori and FP-growth +โ”‚ โ”œโ”€โ”€ gap.py # Counterfactual gap ranking and companion rules +โ”‚ โ””โ”€โ”€ rules.py # FP-growth execution and rule export pipeline +โ”œโ”€โ”€ ml/ # Machine learning and evaluation (Aditya) +โ”‚ โ”œโ”€โ”€ augment.py # Training data skill subsampling augmentation +โ”‚ โ”œโ”€โ”€ evaluate.py # Calibration analysis and short-input evaluation +โ”‚ โ”œโ”€โ”€ export_runtime.py # JSON serialization of trained model weights +โ”‚ โ”œโ”€โ”€ features.py # Multi-hot vector transformation utilities +โ”‚ โ”œโ”€โ”€ predict.py # Serving path softmax inference and readiness logic +โ”‚ โ””โ”€โ”€ train.py # Logistic regression training and evaluation +โ”œโ”€โ”€ scripts/ # Utilities and smoke verification +โ”‚ โ”œโ”€โ”€ collect_stats.py # Metrics aggregator emitting docs/stats.json +โ”‚ โ”œโ”€โ”€ persona_check.py # Persona validation and junk recommendation audit +โ”‚ โ””โ”€โ”€ smoke.sh # Production smoke test script +โ”œโ”€โ”€ taxonomy/ # Skill and role definitions (Aryan) +โ”‚ โ”œโ”€โ”€ display_overrides.csv # Capitalization overrides for UI presentation +โ”‚ โ”œโ”€โ”€ non_learnable.txt # Tokens excluded from recommendations +โ”‚ โ”œโ”€โ”€ role_families.csv # Regex patterns and priority rules for 10 roles +โ”‚ โ””โ”€โ”€ skill_aliases.csv # 834 alias mappings to canonical skills +โ””โ”€โ”€ tests/ # Automated test suite + โ”œโ”€โ”€ test_api.py # FastAPI route status and response contract tests + โ”œโ”€โ”€ test_apriori.py # Apriori correctness and pruning logic tests + โ”œโ”€โ”€ test_normalize.py # Fuzzy matching and token cleaning tests + โ”œโ”€โ”€ test_predict.py # Model inference, readiness, and dimension tests + โ””โ”€โ”€ test_runtime.py # Lightweight serving layer parity and persona checks +``` + +--- + +## ๐Ÿ”Œ API Reference + +Full request and response samples are available in [docs/api.md](docs/api.md) and [docs/SkillGraph.postman_collection.json](docs/SkillGraph.postman_collection.json). + +| Method | Endpoint | Description | +|---|---|---| +| `GET` | `/api/health` | Service health status, artifact metadata, posting count, and model version | +| `GET` | `/api/roles` | List 10 role families, training posting counts, and top 20 skills | +| `GET` | `/api/skills?q={q}` | Prefix search over 800 canonical skills and 834 synonyms | +| `POST` | `/api/match` | Predict top 3 roles from input skills | +| `POST` | `/api/readiness` | Compute role readiness probability, qualitative band, and skill coverage | +| `POST` | `/api/gap` | Recommend top 5 skills to learn next with companion pairings | +| `POST` | `/api/analyze` | Unified match, readiness, and gap recommendations in a single call | + +### Sample Analysis Request and Response + +```bash +curl -s -X POST "https://skillgraph-api-notionatul.vercel.app/api/analyze" \ + -H "Content-Type: application/json" \ + -d '{"skills":["python","sql","pandas"],"desired_role":"Data / BI Analyst"}' +``` + +```json +{ + "match": { + "matches": [ + { "role": "Backend", "probability": 0.4906 }, + { "role": "Data Science / ML", "probability": 0.1957 }, + { "role": "Data / BI Analyst", "probability": 0.108 } + ], + "unrecognized": [] + }, + "readiness": { + "probability": 0.108, + "band": "Not yet", + "coverage": 0.1, + "covered": ["Python", "SQL"], + "missing_count": 18 + }, + "gap": { + "recommendations": [ + { "skill": "Power BI", "coverage_pct": 0.1447, "readiness_gain": 0.4881, "learn_with": [] }, + { "skill": "Data Engineering", "coverage_pct": 0.1583, "readiness_gain": 0.4357, "learn_with": [] }, + { "skill": "PySpark", "coverage_pct": 0.1593, "readiness_gain": 0.3163, "learn_with": [] }, + { "skill": "Data Analysis", "coverage_pct": 0.1583, "readiness_gain": 0.2766, "learn_with": [] }, + { "skill": "Snowflake", "coverage_pct": 0.0943, "readiness_gain": 0.4271, "learn_with": [] } + ] + } +} +``` + +### Validation Constraints +- Maximum 30 skills per request. +- Maximum 60 characters per skill string. +- Requests with zero skills return HTTP 400. +- Requests where all skills fail normalization return HTTP 400 with the unrecognized terms. +- Requests specifying an invalid or unknown `desired_role` return HTTP 400. + +--- + +## ๐Ÿ’ป Tech Stack + +| Layer | Technology | Version | Purpose | +|---|---|---|---| +| **Serving Runtime** | Python | 3.12 | Base environment for API execution | +| **API Framework** | FastAPI | 0.142.2 | High-performance ASGI REST endpoints | +| **ASGI Server** | Uvicorn | 0.54.0 | Local development and server process | +| **Inference Math** | NumPy | 2.4.6 | Vector multiplications and softmax | +| **String Normalization** | RapidFuzz | 3.14.6 | Levenshtein ratio matching for fuzzy tokens | +| **ML Training** | Scikit-learn | 1.9.1 | L2 Logistic Regression classifier | +| **Gradient Boosting** | LightGBM | 4.7.0 | Validation baseline for 3-point rule comparison | +| **Association Mining** | MLxtend | 0.25.0 | High-speed FP-growth itemset generation | +| **Data Processing** | Pandas | 3.0.6 | Data cleaning and tabular profiling | +| **Columnar Storage** | PyArrow | 25.0.1 | Parquet serialization for datasets and rules | +| **Frontend Framework** | React | 18.3.1 | Declarative component UI | +| **Build Tool** | Vite | 6.0.7 | Fast bundle assembly and local HMR | +| **Styling** | Tailwind CSS | 4.0.0 | Design tokens and responsive utilities | +| **Animation Engine** | Framer Motion | 14.1.0 | Micro-interactions and count-up animations | +| **Icons** | Lucide React | 0.468.0 | Vector interface icons | +| **HTTP Client** | Axios | 1.7.9 | Frontend API communication | +| **Cloud Hosting** | Vercel | Serverless | Zero-server hosting with edge rewrites | + +--- + +## โœ… Tests + +The test suite covers data normalization, Apriori correctness, model inference dimensions, serving parity against pickled classifiers, and end-to-end persona evaluations. + +```bash +# Run code formatting checks and full test suite +make test +``` + +Test output from execution: +```text +30 passed, 1 warning in 3.54s +``` + +--- + +## ๐Ÿ’ก Troubleshooting + +- **Slow first request (cold start)**: The first API call after an idle period takes approximately 2521.1 ms because Vercel Serverless initializes a fresh Python runtime and deserializes model JSON artifacts into memory. Subsequent calls execute in warm state (p50: 454.4 ms). +- **Skill marked as "Not recognized"**: If a typed skill shows dashed borders or returns in `unrecognized`, the string did not match any canonical skill or alias with RapidFuzz ratio >= 88. Verify standard naming against `artifacts/skill_vocab.json`. +- **`make all` fails on missing dataset**: The full pipeline rebuild requires `data/raw/indian-job-market-dataset-2025.xlsx`. If the raw XLSX file is not present, use `make fetch-data` to download prebuilt Parquet artifacts directly from GitHub Releases. +- **`make fetch-data` fails**: Ensure GitHub CLI is logged in. Run `gh auth login` and re-run `make fetch-data`. + +--- + +## โš ๏ธ Limitations + +- **8-tag ceiling**: Source postings frequently truncate skill tags at 8 items, limiting observed basket size. +- **Exclusion of generic and unmatched titles**: 16,142 unmatched titles and 5,555 generic Software Engineer postings were excluded during labelling, restricting trained roles to 12,872 postings (42.2% of clean rows). +- **Posted demand vs hiring reality**: Postings capture advertised requirements rather than final hired skills or salary outcomes. +- **Lack of posting dates**: Source dates contain relative strings like "6 Days Ago", preventing chronological time-based validation splits. +- **Short-input performance drop**: Test macro F1 drops from 0.7499 on complete descriptions to 0.6116 on 2 to 3 skill inputs. +- **Non-tech skill leakage**: 69 of 231 rules contain zero tech skills because broad job titles like "HR Recruiter for Engineering" passed initial keyword filtering. +- **Persona 1 instability**: `python, sql, pandas` predicts Backend (0.4906) over Data / BI Analyst (0.1080) because pandas appears in only 36 of 8,941 training rows and received a negative coefficient (-0.7813). +- **Geographic focus**: Postings reflect the Indian job market exclusively. + +--- + +## ๐Ÿ‘ฅ Team + +| Name | GitHub | Module | +|---|---|---| +| Atul | [AtulACleaver](https://github.com/AtulACleaver) | ETL | +| Aditya | [real-aditya-kumar](https://github.com/real-aditya-kumar) | ML | +| Aryan | [eccentricAryan404](https://github.com/eccentricAryan404) | Mining and Taxonomy | +| Archit | [Archit1302-wolf](https://github.com/Archit1302-wolf) | API | +| Shashank | [ssp0009](https://github.com/ssp0009) | Frontend | + +--- + +## โš–๏ธ Disclaimer + +SkillGraph readiness percentages and qualitative bands are statistical model estimates derived from job posting text patterns. They do not constitute hiring guarantees, formal qualifications, or career advice. \ No newline at end of file diff --git a/docs/SkillGraph.postman_collection.json b/docs/SkillGraph.postman_collection.json new file mode 100644 index 0000000..a8b149b --- /dev/null +++ b/docs/SkillGraph.postman_collection.json @@ -0,0 +1,184 @@ +{ + "info": { + "name": "SkillGraph API", + "description": "Production API endpoints for SkillGraph job market mining engine", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" + }, + "variable": [ + { + "key": "baseUrl", + "value": "https://skillgraph-api-notionatul.vercel.app", + "type": "string" + } + ], + "item": [ + { + "name": "Health Check", + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{baseUrl}}/api/health", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "api", + "health" + ] + }, + "description": "Verify API service health and loaded artifact versions" + } + }, + { + "name": "List Roles", + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{baseUrl}}/api/roles", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "api", + "roles" + ] + }, + "description": "Get all 10 role families, posting counts, and top 20 skills" + } + }, + { + "name": "Search Skills Autocomplete", + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{baseUrl}}/api/skills?q=react", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "api", + "skills" + ], + "query": [ + { + "key": "q", + "value": "react" + } + ] + }, + "description": "Prefix search over canonical skill names and aliases" + } + }, + { + "name": "Match Roles", + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"skills\": [\"python\", \"sql\", \"machine learning\"]\n}" + }, + "url": { + "raw": "{{baseUrl}}/api/match", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "api", + "match" + ] + }, + "description": "Predict top 3 role matches for input skills" + } + }, + { + "name": "Check Readiness", + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"skills\": [\"python\", \"sql\", \"machine learning\"],\n \"desired_role\": \"Data Science / ML\"\n}" + }, + "url": { + "raw": "{{baseUrl}}/api/readiness", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "api", + "readiness" + ] + }, + "description": "Compute role readiness probability, band, and coverage" + } + }, + { + "name": "Recommend Skill Gaps", + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"skills\": [\"python\", \"sql\", \"machine learning\"],\n \"desired_role\": \"Data Science / ML\"\n}" + }, + "url": { + "raw": "{{baseUrl}}/api/gap", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "api", + "gap" + ] + }, + "description": "Rank top 5 skills to learn next with companion skills" + } + }, + { + "name": "Analyze Skills (All-in-One)", + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"skills\": [\"python\", \"sql\", \"pandas\"],\n \"desired_role\": \"Data / BI Analyst\"\n}" + }, + "url": { + "raw": "{{baseUrl}}/api/analyze", + "host": [ + "{{baseUrl}}" + ], + "path": [ + "api", + "analyze" + ] + }, + "description": "Perform role match, readiness scoring, and gap analysis in a single call" + } + } + ] +} diff --git a/docs/api.md b/docs/api.md new file mode 100644 index 0000000..ae99705 --- /dev/null +++ b/docs/api.md @@ -0,0 +1,338 @@ +# API Reference + +This document provides endpoint documentation, validation rules, and sample requests and responses captured from production (`https://skillgraph-api-notionatul.vercel.app`). + +## Production Base URLs + +- Web Application: `https://skillgraph-exp.vercel.app` +- API Direct: `https://skillgraph-api-notionatul.vercel.app` +- Interactive OpenAPI Docs: `https://skillgraph-api-notionatul.vercel.app/docs` + +The web application proxies requests from `https://skillgraph-exp.vercel.app/api/*` to the API domain via Vercel rewrites. + +## Input Constraints and Validations + +- Maximum skills per request: 30 skills (`api/schemas.py`). +- Maximum characters per skill: 60 characters. +- Empty skills list: Returns HTTP 400 with detail message. +- All-unrecognized skills: Returns HTTP 400 listing unrecognized inputs. +- Unknown desired role: Returns HTTP 400 listing invalid role string. + +--- + +## Endpoints + +### 1. GET `/api/health` + +Returns service health, loaded artifact versions, posting count, and vocabulary size. + +#### Request +```bash +curl -s "https://skillgraph-api-notionatul.vercel.app/api/health" +``` + +#### Response +```json +{ + "status": "ok", + "artifacts_loaded": true, + "n_postings": 8941, + "n_skills": 800, + "built_at": "2026-10-06T04:14:21Z", + "model": "model-v4", + "rules": "rules-v2" +} +``` + +--- + +### 2. GET `/api/roles` + +Returns all 10 role families, posting counts in training data, and top 20 skills. + +#### Request +```bash +curl -s "https://skillgraph-api-notionatul.vercel.app/api/roles" +``` + +#### Response (Truncated) +```json +[ + { + "role_family": "DevOps / Cloud", + "n_postings": 1584, + "top_skills": [ + "Kubernetes", + "AWS", + "DevOps", + "Python", + "Continuous Integration", + "Azure", + "CI/CD", + "Cloud", + "Terraform", + "Docker", + "Java", + "Automation", + "SQL", + "GCP", + "Oracle", + "Linux", + "Troubleshooting", + "Ansible", + "Jenkins", + "Azure DevOps" + ] + }, + { + "role_family": "QA / Test", + "n_postings": 1134, + "top_skills": [ + "QA", + "Selenium", + "Java", + "Automation", + "Python", + "Test Cases", + "Quality Assurance", + "API Testing", + "Continuous Integration", + "Regression Testing", + "Performance Testing", + "Automation Framework", + "JavaScript", + "SQL", + "Quality Engineering", + "Quality", + "Agile", + "CI/CD", + "Quality Control", + "Jira" + ] + } +] +``` + +--- + +### 3. GET `/api/skills?q={query}` + +Provides skill autocomplete over canonical names and aliases. + +#### Request +```bash +curl -s "https://skillgraph-api-notionatul.vercel.app/api/skills?q=react" +``` + +#### Response +```json +[ + { + "skill_id": 9, + "name": "React", + "aliases": [ + "reactjs", + "react js", + "reacts js" + ] + }, + { + "skill_id": 166, + "name": "React Native", + "aliases": [] + } +] +``` + +--- + +### 4. POST `/api/match` + +Predicts the top matching roles from a candidate skill list. + +#### Request +```bash +curl -s -X POST "https://skillgraph-api-notionatul.vercel.app/api/match" \ + -H "Content-Type: application/json" \ + -d '{"skills":["python","sql","machine learning"]}' +``` + +#### Response +```json +{ + "matches": [ + { + "role": "Data Science / ML", + "probability": 0.6305 + }, + { + "role": "Data / BI Analyst", + "probability": 0.1883 + }, + { + "role": "Support / IT Ops", + "probability": 0.0719 + } + ], + "unrecognized": [] +} +``` + +--- + +### 5. POST `/api/readiness` + +Evaluates readiness probability, qualitative band, and role coverage. + +#### Request +```bash +curl -s -X POST "https://skillgraph-api-notionatul.vercel.app/api/readiness" \ + -H "Content-Type: application/json" \ + -d '{"skills":["python","sql","machine learning"],"desired_role":"Data Science / ML"}' +``` + +#### Response +```json +{ + "probability": 0.6305, + "band": "Close", + "coverage": 0.15, + "covered": [ + "Python", + "ML", + "SQL" + ], + "missing_count": 17 +} +``` + +--- + +### 6. POST `/api/gap` + +Recommends the top 5 skills to learn next with companion skills. + +#### Request +```bash +curl -s -X POST "https://skillgraph-api-notionatul.vercel.app/api/gap" \ + -H "Content-Type: application/json" \ + -d '{"skills":["python","sql","machine learning"],"desired_role":"Data Science / ML"}' +``` + +#### Response +```json +{ + "recommendations": [ + { + "skill": "NLP", + "coverage_pct": 0.1643, + "readiness_gain": 0.3107, + "learn_with": [] + }, + { + "skill": "Generative AI", + "coverage_pct": 0.1381, + "readiness_gain": 0.3425, + "learn_with": [] + }, + { + "skill": "TensorFlow", + "coverage_pct": 0.1202, + "readiness_gain": 0.3356, + "learn_with": [] + }, + { + "skill": "Image Processing", + "coverage_pct": 0.0798, + "readiness_gain": 0.3562, + "learn_with": [] + }, + { + "skill": "PyTorch", + "coverage_pct": 0.0881, + "readiness_gain": 0.3139, + "learn_with": [] + } + ] +} +``` + +--- + +### 7. POST `/api/analyze` + +Executes match, readiness, and gap ranking in a single request. + +#### Request +```bash +curl -s -X POST "https://skillgraph-api-notionatul.vercel.app/api/analyze" \ + -H "Content-Type: application/json" \ + -d '{"skills":["python","sql","pandas"],"desired_role":"Data / BI Analyst"}' +``` + +#### Response +```json +{ + "match": { + "matches": [ + { + "role": "Backend", + "probability": 0.4906 + }, + { + "role": "Data Science / ML", + "probability": 0.1957 + }, + { + "role": "Data / BI Analyst", + "probability": 0.108 + } + ], + "unrecognized": [] + }, + "readiness": { + "probability": 0.108, + "band": "Not yet", + "coverage": 0.1, + "covered": [ + "Python", + "SQL" + ], + "missing_count": 18 + }, + "gap": { + "recommendations": [ + { + "skill": "Power BI", + "coverage_pct": 0.1447, + "readiness_gain": 0.4881, + "learn_with": [] + }, + { + "skill": "Data Engineering", + "coverage_pct": 0.1583, + "readiness_gain": 0.4357, + "learn_with": [] + }, + { + "skill": "PySpark", + "coverage_pct": 0.1593, + "readiness_gain": 0.3163, + "learn_with": [] + }, + { + "skill": "Data Analysis", + "coverage_pct": 0.1583, + "readiness_gain": 0.2766, + "learn_with": [] + }, + { + "skill": "Snowflake", + "coverage_pct": 0.0943, + "readiness_gain": 0.4271, + "learn_with": [] + } + ] + } +} +``` diff --git a/docs/figures/token_coverage_curve.png b/docs/figures/token_coverage_curve.png index 54f0c9e..520fbb0 100644 Binary files a/docs/figures/token_coverage_curve.png and b/docs/figures/token_coverage_curve.png differ diff --git a/docs/mining.md b/docs/mining.md new file mode 100644 index 0000000..4bcd8d6 --- /dev/null +++ b/docs/mining.md @@ -0,0 +1,94 @@ +# Association Mining and Gap Recommendation Engine + +This document details market basket construction, the Apriori and FP-growth algorithms, mining thresholds, benchmark comparisons, gap scoring logic, and non-tech leakage analysis. + +## 1. Market Baskets Construction + +Market baskets were built from cleaned tech postings (`data/clean.parquet`): + +- Total baskets in `data/baskets.parquet`: 34,569 baskets. +- Non-empty baskets: 32,949 baskets contain at least one canonical skill ID from `artifacts/skill_vocab.json`. +- Empty baskets: 1,620 baskets contain zero recognized canonical skill IDs after normalization. +- Basket format: Record mapping `posting_id` to a deduplicated integer list of canonical `skill_ids`. + +## 2. Frequent Itemset Mining: Apriori vs FP-Growth + +Both algorithms were implemented to mine frequent itemsets over identical baskets: + +- Apriori (`mining/apriori.py`): Built from scratch using standard level-wise candidate generation (self-join) and subset pruning. +- FP-Growth (`mining/rules.py` and `mining/fpgrowth_bench.py`): Built using `mlxtend.frequent_patterns.fpgrowth` over one-hot sparse basket matrices. + +### Benchmark Results + +Itemset generation was timed across five minimum support thresholds on 34,569 baskets (`docs/bench.json`): + +| Min Support (%) | Support Value | Itemsets Found | Apriori Time (s) | FP-Growth Time (s) | Speedup | Identical Sets | Max Support Diff | +|---|---|---|---|---|---|---|---| +| 5.00% | 0.050 | 13 | 0.1459 | 0.0915 | 1.60x | Yes | 0.0 | +| 3.00% | 0.030 | 34 | 0.5189 | 0.0969 | 5.35x | Yes | 0.0 | +| 2.00% | 0.020 | 62 | 1.5869 | 0.1017 | 15.61x | Yes | 0.0 | +| 1.00% | 0.010 | 168 | 8.0566 | 0.2550 | 31.60x | Yes | 0.0 | +| 0.50% | 0.005 | 501 | 43.6936 | 0.3454 | 126.49x | Yes | 0.0 | + +At the production threshold of 0.50% support, FP-growth ran in 0.3454 seconds compared to 43.6936 seconds for Apriori (126.49x speedup). Both algorithms generated identical 501 itemsets. Hardware environment was not recorded in `docs/bench.json`. + +## 3. Mining Thresholds and Rule Generation + +Rules were derived from frequent itemsets using `mlxtend.frequent_patterns.association_rules`: + +- Minimum Support: 0.005 (0.50%, roughly 173 postings). Lower thresholds caused memory blowup on dense tech combinations, while higher thresholds eliminated specialized tools. +- Minimum Confidence: 0.30 (30%). Required that the consequent appear in at least 30% of baskets containing the antecedent. +- Minimum Lift: 1.20. Discarded independent or negatively correlated skill pairs. +- Total Rules Generated: 231 association rules stored in `artifacts/rules.parquet` and `artifacts/rules.json`. + +## 4. Gap Scoring and Recommendations + +Skill gaps for a target role are ranked using counterfactual probability gains combined with posting frequencies (`mining/gap.py`): + +### Candidate Selection +Candidate skills are pulled from the target role top 20 skills (`artifacts/role_profiles.json`) and filtered: +1. Exclude skills already present in the user input. +2. Exclude non-learnable tokens from `taxonomy/non_learnable.txt` (such as soft skills and general management terms). +3. Exclude redundant terms via `_is_redundant_skill` (such as "software development life cycle" if "software" is present). + +### Ranking Formula +For each candidate skill `s`: + +$$\text{Score}(s) = \Delta \text{Readiness}(s) \times \text{Coverage}(s)$$ + +Where: +- $\Delta \text{Readiness}(s) = \max(0, P(\text{role} \mid \mathbf{x} \cup \{s\}) - P(\text{role} \mid \mathbf{x}))$ evaluates counterfactual readiness gain via `ml.predict.delta_readiness`. +- $\text{Coverage}(s)$ is the empirical frequency of skill `s` among training postings for the target role (`role_profiles.json`). + +### Companion Skills (`learn_with`) +For each recommended skill, `_find_companions` identifies up to 2 other gap skills that co-occur in association rules with `lift >= 1.50`. + +## 5. Non-Tech Leakage Analysis + +Job posting filters in `etl/clean.py` matched keywords from `etl/tech_terms.txt` across job titles and skill tags. Postings such as "Technical Recruiter" or "Mechanical Engineering Drafter" passed the filter because their titles contained "technical" or "engineer". + +- Non-Tech Rules Count: 69 of the 231 rules (29.9%) in `artifacts/rules.parquet` contain zero terms from `etl/tech_terms.txt`. +- Top Rules by Lift: Top 10 rules by lift are HR generalist pairings (screening, hr generalist activities, joining formalities) with lift values exceeding 90.0. +- Top 20 Non-Tech Tokens in `data/baskets.parquet`: + 1. css: 3,175 + 2. qa: 2,331 + 3. c#: 2,194 + 4. development: 2,133 + 5. project management: 2,078 + 6. sap: 1,893 + 7. agile: 1,603 + 8. rest: 1,603 + 9. automation: 1,595 + 10. continuous integration: 1,533 + 11. troubleshooting: 1,423 + 12. oracle: 1,376 + 13. spring boot: 1,338 + 14. application: 1,304 + 15. microservices: 1,296 + 16. html: 1,266 + 17. ml: 1,167 + 18. web services: 1,056 + 19. networking: 1,018 + 20. analytical: 989 + +These tokens were retained without retraining to preserve real-world job posting distribution patterns. diff --git a/docs/model.md b/docs/model.md new file mode 100644 index 0000000..02af668 --- /dev/null +++ b/docs/model.md @@ -0,0 +1,117 @@ +# Model Architecture and Evaluation + +This document describes the classification model, training pipeline, evaluation metrics, calibration, and readiness decision rules for SkillGraph. + +## 1. Feature Representation + +The model accepts candidate skill profiles as binary multi-hot vectors. + +- Vocabulary size: 800 canonical skills from `artifacts/skill_vocab.json`. +- Vector width: 800 features (`n_features_in_ = 800`). +- Vector encoding: Binary indicator where index `i` equals 1 if the corresponding canonical skill is present, and 0 otherwise (`ml/features.py`). +- Dense conversion during inference: Multi-hot arrays are evaluated directly via matrix multiplication against exported weights in `artifacts/model.json`. + +## 2. Data Augmentation + +Job postings frequently omit skills that applicants possess, and applicants enter short skill profiles with 2 to 4 items. Training purely on full job descriptions biased earlier models against short inputs. + +- Augmentation logic: `ml/augment.py` creates `n_copies = 2` additional training rows per posting. +- Subsampling: For each copy, a random subset of skills with size between 2 and `len(skills) - 1` is retained. +- Raw training rows: 8,941 postings from `artifacts/metrics.json`. +- Augmented training rows: 26,039 rows (`artifacts/metrics.json`). +- Validation and test splits were not augmented to preserve unbiased evaluation. + +## 3. Dataset Splitting + +The raw dataset contains no usable posting dates; relative date strings such as "6 Days Ago" prevented temporal splitting (`data/raw.parquet`). + +- Split method: Stratified random split with seed 42 (`ml/train.py`). +- Split ratios: 70% train (8,941 postings), 15% validation (1,916 postings), 15% test (1,917 postings). +- Classes: 10 role families from `taxonomy/role_families.csv` (DevOps / Cloud, QA / Test, ERP / Enterprise, Data / BI Analyst, Full Stack, Backend, Data Science / ML, Support / IT Ops, Frontend, Mobile). + +## 4. Model Selection and the 3-Point Rule + +Two model architectures were evaluated on identical train and validation splits: Multi-class Logistic Regression with L2 regularization (`C=1.0`, `solver='lbfgs'`) and LightGBM (`n_estimators=100`, `learning_rate=0.05`). + +From `artifacts/metrics.json`: + +| Model | Val Macro F1 | Test Macro F1 | Test Accuracy | Top-3 Accuracy | +|---|---|---|---|---| +| Logistic Regression | 0.7435 | 0.7499 | 0.7527 | 0.9254 | +| LightGBM | 0.7532 | 0.7648 | 0.7632 | 0.9306 | + +The engineering rule in `ml/train.py` required tree ensembles to exceed linear model test macro F1 by at least 3.0 percentage points (+0.0300) to justify added runtime complexity. + +- Observed test macro F1 delta: 0.7648 - 0.7499 = 0.0149 (+1.49 percentage points). +- Decision: Because 0.0149 is below the 0.0300 threshold, Logistic Regression was selected for production. +- Production rationale: Logistic Regression exported to a 77 KB JSON payload (`artifacts/model.json`), required only NumPy for inference, eliminated C++ compilation on Vercel Serverless, and kept cold start latency at 2,521.1 ms. + +## 5. Evaluation Metrics + +Metrics were computed on the held-out test split of 1,917 postings (`artifacts/metrics.json`): + +- Overall Accuracy: 0.7527 (75.27%) +- Macro F1: 0.7499 (74.99%) +- Top-3 Accuracy: 0.9254 (92.54%) +- Majority Baseline Accuracy: 0.1774 (17.74%, DevOps / Cloud) +- Short-Input Test Macro F1: 0.6116 (measured on synthetic 2 to 3 skill test inputs) + +### Per-Class Test Performance + +| Role Family | Precision | Recall | F1 Score | Support | +|---|---|---|---|---| +| Backend | 0.7292 | 0.7330 | 0.7311 | 191 | +| Data / BI Analyst | 0.7107 | 0.8390 | 0.7696 | 205 | +| Data Science / ML | 0.7802 | 0.7889 | 0.7845 | 180 | +| DevOps / Cloud | 0.7579 | 0.5618 | 0.6453 | 340 | +| ERP / Enterprise | 0.8622 | 0.8700 | 0.8661 | 223 | +| Frontend | 0.6129 | 0.6496 | 0.6307 | 117 | +| Full Stack | 0.6742 | 0.7680 | 0.7181 | 194 | +| Mobile | 0.7333 | 0.8462 | 0.7857 | 65 | +| QA / Test | 0.8843 | 0.8807 | 0.8825 | 243 | +| Support / IT Ops | 0.6790 | 0.6918 | 0.6854 | 159 | + +## 6. Calibration + +Model probability outputs feed user readiness percentages directly, requiring calibration against observed true frequencies. + +From `artifacts/metrics.json`: +- Pooled One-vs-Rest Expected Calibration Error (ECE): 0.0120 +- Top-Label Expected Calibration Error: 0.0614 +- Calibration curve behavior: Observed probabilities track predicted probabilities closely between 0.10 and 0.85. The top bin (predicted probability > 0.90) exhibits slight overconfidence (0.976 predicted vs 0.911 true). + +## 7. Readiness Decision Rules + +Readiness is evaluated by combining predicted role probability with skill coverage against the target role top 20 skills (`ml/predict.py`). + +```python +def band_for(p: float, coverage: float = 1.0) -> str: + if p >= 0.60: + p_band = 2 # Ready + elif p >= 0.30: + p_band = 1 # Close + else: + p_band = 0 # Not yet + + if coverage >= 0.20: + c_band = 2 + elif coverage >= 0.10: + c_band = 1 + else: + c_band = 0 + + final_band = min(p_band, c_band) + if final_band == 2: return "Ready" + elif final_band == 1: return "Close" + return "Not yet" +``` + +The final readiness band is the minimum of the probability band and the coverage band. Even if predicted probability reaches 0.99, an applicant with coverage below 0.20 receives Close rather than Ready. + +## 8. Persona 1 Instability Note + +In data-v4, Persona 1 (`python, sql, pandas` targeting `Data / BI Analyst`) shifted top role match from Data / BI Analyst (0.4313 Close in v3) to Backend (0.4906, with Data / BI Analyst at 0.1080 Not yet). + +- Cause: `pandas` appeared in only 36 of 8,941 training postings (0.40%). +- Weight shift: In `artifacts/model.json`, the coefficient for `pandas` on Data / BI Analyst shifted from +0.8412 to -0.7813, while Backend retained +2.0626. +- Decision: Documented as a known limitation of low-frequency skill tokens under L2 regularized retraining. diff --git a/docs/numbers_audit.md b/docs/numbers_audit.md new file mode 100644 index 0000000..6fc9bab --- /dev/null +++ b/docs/numbers_audit.md @@ -0,0 +1,113 @@ +# Numbers Audit + +This document records the audit of numbers in `docs/stats.json`, `README.md`, `docs/contracts.md`, test suites, and deployment scripts. + +## Audit Summary Table + +| Item | Claim | Value Today | What It Actually Counts | Fix | +|---|---|---|---|---| +| 1. Mapped mass | Normalization coverage | 69.9% in `README.md`; "69.9% over all clean rows vs 77.2% over tech subset" in `docs/stats.json`; 76.5% reported in v3 | 1. **69.9% (189,573 / 271,108)** was computed in `scripts/collect_stats.py` on all 34,569 rows in `data/clean.parquet`. The numerator 189,573 included 27,391 alias mentions from `taxonomy/skill_aliases.csv`, of which 12,153 map to canonical skills outside the 800-skill vocab. Denominator 271,108 is all skill tokens in `data/clean.parquet`.
2. **77.2% (77,917 / 100,912)** was computed by `build_vocab` in `etl/label.py` on the 12,872 labelled postings only (`tech_df`). Numerator 77,917 is mentions of the 800 vocab skills in labelled rows; denominator 100,912 is total tokens in labelled rows. Labelled rows were misnamed "tech subset", but `data/clean.parquet` is already the tech subset.
3. **76.5%** was the v3 baseline on labelled postings before duplicate token merges.
4. **True headline number: 65.4% (177,432 / 271,108)**. Defined in one sentence: share of skill mentions in the clean postings that map to the 800-skill vocab. Numerator is 177,432 (159,725 exact + 15,238 in-vocab alias + 2,469 fuzzy). Denominator is 271,108 clean tokens. | Keep one headline number: **65.4%** (177,432 / 271,108). Define it in one sentence in docs and make `scripts/collect_stats.py` emit only this number. | +| 2. Match counts | Token match method breakdown | exact 159,725 + alias 179,612 + fuzzy 2,457 = 341,794 in `docs/stats.json` | 1. In `scripts/collect_stats.py`, an initial loop accumulated 152,221 alias matches because `_clean_map` was imported as an empty dict before `load_vocab()` ran.
2. A second loop then ran without resetting counters. `exact_count` added 159,725. `alias_count` added another 27,391 (including aliases whose canonical target is outside the 800-skill vocab), yielding 179,612 (152,221 + 27,391).
3. `fuzzy_count` was 2,457 (or 2,469 with exact RapidFuzz matching).
4. The sum 341,794 exceeded both mapped tokens (177,432) and total tokens (271,108) due to double counting across loops and non-vocab aliases. | Remove the redundant loop in `scripts/collect_stats.py`. Partition all 271,108 tokens into mutually exclusive categories: exact match in vocab (159,725), alias match with canonical in vocab (15,238), fuzzy match score >= 88 (2,469), and unmapped (93,676). Sum of mapped matches equals 177,432. | +| 3. Non-tech leakage | Tech purity of mined rules and vocabulary | Top 10 rules by lift are HR skills; top unmapped strings include mechanical / CAD skills | 1. **69 of 231 rules (29.9%)** in `artifacts/rules.parquet` contain no skill matching terms in `etl/tech_terms.txt`. 162 rules contain at least one tech skill.
2. Leakage mechanism: `etl/clean.py` retained postings if any keyword in `etl/tech_terms.txt` appeared in either title or tags. Postings with titles like "HR Recruiter for Software Engineers" or "Mechanical Design Engineer" passed into `data/clean.parquet`. Mined baskets preserved co-occurring HR skills.
3. **Top 20 non-tech tokens in `data/baskets.parquet`** (skills in vocab not matching `etl/tech_terms.txt`): css (3,175), qa (2,331), c# (2,194), development (2,133), project management (2,078), sap (1,893), agile (1,603), rest (1,603), automation (1,595), continuous integration (1,533), troubleshooting (1,423), oracle (1,376), spring boot (1,338), application (1,304), microservices (1,296), html (1,266), ml (1,167), web services (1,056), networking (1,018), analytical (989). | Report rule count (69 non-tech rules out of 231) and basket token counts in `docs/mining.md` and `docs/numbers_audit.md`. Do not alter filter terms or retrain. | +| 4. Persona 1 flipped in v4 | Predictor behavior on python, sql, pandas | v3: 0.4313 Close (Data / BI Analyst); v4: 0.1080 Not yet (Backend 0.4906) | 1. Confirmed via curl against `https://skillgraph-exp.vercel.app/api/analyze`: matches Backend 0.4906, Data Science / ML 0.1957, Data / BI Analyst 0.1080; readiness 0.1080, band Not yet.
2. `pandas` appears in only 36 of 8,941 training postings (0.40%). In `artifacts/model.json`, its coefficient for Data / BI Analyst shifted from +0.8412 in v3 to -0.7813 in v4, while Backend kept +2.0626. | Do not retrain. Document as a known limitation in one line: "Persona 1 (python, sql, pandas) predicts Backend (0.4906) over Data / BI Analyst (0.1080) because pandas appears in only 36 of 8,941 training postings and received a negative coefficient (-0.7813)." | +| 5. Bands | Readiness band evaluation logic | Mobile 1.00 is Close, ERP 0.94 is Close, DevOps 0.75 is Ready | 1. Confirmed from `ml/predict.py`: `final_band = min(p_band, c_band)`.
2. Probability band cutoffs: >= 0.60 Ready, >= 0.30 Close, < 0.30 Not yet.
3. Coverage band cutoffs: >= 0.20 Ready, >= 0.10 Close, < 0.10 Not yet.
4. Mobile (prob 0.9957 Ready, cov 0.1500 Close) held back by coverage to Close.
5. ERP (prob 0.9367 Ready, cov 0.1500 Close) held back by coverage to Close.
6. DevOps (prob 0.7498 Ready, cov 0.2000 Ready) meets both thresholds and receives Ready. | Add a "Limiting Factor" column to the persona evaluation table in `docs/stats.md` explaining which band governed the outcome. | +| 6. Contributions | Git commit and PR attribution | AtulACleaver (17), Archit1302-wolf (7), eccentricAryan404 (2), ssp0009 (1) in `docs/stats.json`; Aditya missing | 1. Inspected git log authors, committers, and Co-authored-by trailers across the entire repository history.
2. No commit or trailer references an author named Aditya or a related handle.
3. Handles found: Atul Anand (`AtulACleaver`), Archit Kumar (`Archit1302-wolf`), Shashank Shekhar Pandey (`ssp0009`), and Aryan (`eccentricAryan404`).
4. Confirmed by user: Aditya's GitHub username is `real-aditya-kumar`. | Record Aditya as `real-aditya-kumar` across team documentation and contributor summaries. | +| 7. Screenshots | Web application preview images | Old screenshots in `docs/screenshots/` showed v3 numbers (Persona 1 at 43%) | 1. Recaptured all 6 persona screenshots from production (`https://skillgraph-exp.vercel.app`) at 1280 px and 390 px viewports.
2. Verified on-screen figures match `/api/analyze`:
- Persona 1 (`sql, excel, power bi, tableau` -> `Data / BI Analyst`): readiness 97%, band Close, coverage 10%.
- Persona 2 (`java, spring boot, mysql, docker` -> `Backend`): readiness 75%, band Close, coverage 15%.
- Persona 3 (`react, javascript, html, css` -> `Full Stack`): match Frontend 74%, readiness 24%, band Not yet, coverage 20%.
3. Overwrote existing files in `docs/screenshots/`. Per user instruction, README will feature desktop screenshots only. | Screenshots recaptured and validated against production API responses. | +| 8. Persona numbers in contracts, tests, smoke | Consistency of test assertions | Discrepancies between v3 and v4 figures across repo scripts | 1. `docs/contracts.md`: Contains v4 numbers (0.9733 Close, 0.7520 Close, 0.7369 Frontend / 0.2395 Not yet, 0.4906 Backend / 0.1080 Not yet).
2. `tests/test_runtime.py`: Contains v4 numbers (0.9733, 0.7520, 0.7369, 0.2395, 0.4906, 0.1080).
3. `scripts/smoke.sh`: Already updated on main with v4 numbers and verified passing against `https://skillgraph-exp.vercel.app`. | Verified all 4 personas in `scripts/smoke.sh` and `tests/test_runtime.py` match v4 contract numbers. | + +## Detailed Findings + +### Item 1: Mapped Mass Numerator and Denominator +- **Definition**: Share of skill mentions in the clean postings that map to the 800-skill vocab. +- **Clean Postings Total Mentions**: 271,108 tokens across 34,569 rows in `data/clean.parquet`. +- **Exact Vocabulary Matches**: 159,725 tokens. +- **In-Vocab Alias Matches**: 15,238 tokens (tokens whose canonical target in `taxonomy/skill_aliases.csv` exists in `artifacts/skill_vocab.json`). +- **Fuzzy Matches**: 2,469 tokens (tokens matching a vocabulary string with RapidFuzz ratio >= 88). +- **Total Mapped Mentions**: 177,432 tokens. +- **Headline Calculation**: 177,432 / 271,108 = **65.45%** (rounds to **65.4%**). +- **Prior 77.2% Figure**: 77,917 mapped mentions / 100,912 mentions in the 12,872 labelled rows (`tech_df`), misnamed in `docs/stats.json` as the tech subset. +- **Prior 69.9% Figure**: 189,573 mentions / 271,108 tokens. Included 12,153 mentions mapping to aliases outside the 800-skill vocabulary. + +### Item 2: Match Counters Reconciliation +In `scripts/collect_stats.py`: +- `exact_count` = 159,725 +- `alias_count` = 15,238 (filtered to canonicals in `artifacts/skill_vocab.json`) +- `fuzzy_count` = 2,469 +- **Sum of Mapped Tokens** = 159,725 + 15,238 + 2,469 = 177,432 +- **Unmapped Tokens** = 93,676 +- **Total Clean Tokens** = 177,432 + 93,676 = 271,108 +The prior sum of 341,794 was caused by an uninitialized second loop and inclusion of non-vocab aliases. + +### Item 3: Non-Tech Leakage Counts +Evaluated against `etl/tech_terms.txt` (32 keywords): +- **Total rules in `artifacts/rules.parquet`**: 231 +- **Rules containing at least one tech skill**: 162 (70.1%) +- **Rules containing zero tech skills**: 69 (29.9%) +- **Top 20 non-tech vocabulary tokens in `data/baskets.parquet`**: + 1. css: 3,175 + 2. qa: 2,331 + 3. c#: 2,194 + 4. development: 2,133 + 5. project management: 2,078 + 6. sap: 1,893 + 7. agile: 1,603 + 8. rest: 1,603 + 9. automation: 1,595 + 10. continuous integration: 1,533 + 11. troubleshooting: 1,423 + 12. oracle: 1,376 + 13. spring boot: 1,338 + 14. application: 1,304 + 15. microservices: 1,296 + 16. html: 1,266 + 17. ml: 1,167 + 18. web services: 1,056 + 19. networking: 1,018 + 20. analytical: 989 + +### Item 4: Persona 1 Verification +CURL against production (`POST https://skillgraph-exp.vercel.app/api/analyze` with `{"skills":["python","sql","pandas"],"desired_role":"Data / BI Analyst"}`): +- Match probabilities: Backend 0.4906, Data Science / ML 0.1957, Data / BI Analyst 0.1080. +- Readiness probability: 0.1080, band: Not yet, coverage: 0.10 (covered: Python, SQL). +- Cause: `pandas` appears in 36 of 8,941 training rows. Its coefficient for Data / BI Analyst shifted from +0.8412 (v3) to -0.7813 (v4), while Backend received +2.0626. + +### Item 5: Persona Readiness Bands Breakdown +Evaluated on all 10 standard personas: + +| Persona | Role | Probability | Probability Band | Coverage | Coverage Band | Final Band | Limiting Factor | +|---|---|---|---|---|---|---|---| +| Data / BI Analyst | Data / BI Analyst | 0.1080 | Not yet | 0.1000 | Close | Not yet | Probability | +| Backend | Backend | 0.7520 | Ready | 0.1500 | Close | Close | Coverage | +| Full Stack | Full Stack | 0.2395 | Not yet | 0.2000 | Ready | Not yet | Probability | +| Frontend | Frontend | 0.8529 | Ready | 0.2500 | Ready | Ready | Both equal | +| DevOps / Cloud | DevOps / Cloud | 0.7498 | Ready | 0.2000 | Ready | Ready | Both equal | +| QA / Test | QA / Test | 0.8553 | Ready | 0.2000 | Ready | Ready | Both equal | +| ERP / Enterprise | ERP / Enterprise | 0.9367 | Ready | 0.1500 | Close | Close | Coverage | +| Data Science / ML | Data Science / ML | 0.9186 | Ready | 0.1500 | Close | Close | Coverage | +| Support / IT Ops | Support / IT Ops | 0.8626 | Ready | 0.2000 | Ready | Ready | Both equal | +| Mobile | Mobile | 0.9957 | Ready | 0.1500 | Close | Close | Coverage | + +### Item 6: Contributor Attribution +- `git log` author analysis identified: + - Atul Anand (`AtulACleaver`) + - Archit Kumar (`Archit1302-wolf`) + - Aryan (`eccentricAryan404`) + - Shashank Shekhar Pandey (`ssp0009`) +- Aditya was not found in git authors or Co-authored-by trailers. +- Confirmed by user: `real-aditya-kumar`. + +### Item 7: Screenshot Recapture Status +All screenshots recaptured from `https://skillgraph-exp.vercel.app` at 1280 px and 390 px viewports and written to `docs/screenshots/`: +- `persona1-desktop.png`: 1280 x 2917 px +- `persona1-mobile.png`: 390 x 4331 px +- `persona2-desktop.png`: 1280 x 2917 px +- `persona2-mobile.png`: 390 x 4146 px +- `persona3-desktop.png`: 1280 x 2978 px +- `persona3-mobile.png`: 390 x 4482 px +- `prod-mobile.png`: 390 x 4331 px +Numbers on screen match live `/api/analyze` responses. Per user instruction, README will show desktop screenshots only. + +### Item 8: Stale Script Inventory +- `docs/contracts.md`: Carries v4 numbers. +- `tests/test_runtime.py`: Carries v4 numbers. +- `scripts/smoke.sh`: Verified with v4 numbers and passes all checks against `https://skillgraph-exp.vercel.app`. diff --git a/docs/screenshots/persona1-desktop.png b/docs/screenshots/persona1-desktop.png index 01bf8f4..5d19e98 100644 Binary files a/docs/screenshots/persona1-desktop.png and b/docs/screenshots/persona1-desktop.png differ diff --git a/docs/screenshots/persona1-mobile.png b/docs/screenshots/persona1-mobile.png index 83039d7..db76db9 100644 Binary files a/docs/screenshots/persona1-mobile.png and b/docs/screenshots/persona1-mobile.png differ diff --git a/docs/screenshots/persona2-desktop.png b/docs/screenshots/persona2-desktop.png index 1db7f73..6e46343 100644 Binary files a/docs/screenshots/persona2-desktop.png and b/docs/screenshots/persona2-desktop.png differ diff --git a/docs/screenshots/persona2-mobile.png b/docs/screenshots/persona2-mobile.png index 8ed8217..3e6c3b9 100644 Binary files a/docs/screenshots/persona2-mobile.png and b/docs/screenshots/persona2-mobile.png differ diff --git a/docs/screenshots/persona3-desktop.png b/docs/screenshots/persona3-desktop.png index 887ff3f..96aeba6 100644 Binary files a/docs/screenshots/persona3-desktop.png and b/docs/screenshots/persona3-desktop.png differ diff --git a/docs/screenshots/persona3-mobile.png b/docs/screenshots/persona3-mobile.png index dcd5f79..341130f 100644 Binary files a/docs/screenshots/persona3-mobile.png and b/docs/screenshots/persona3-mobile.png differ diff --git a/docs/screenshots/prod-mobile.png b/docs/screenshots/prod-mobile.png index 83039d7..db76db9 100644 Binary files a/docs/screenshots/prod-mobile.png and b/docs/screenshots/prod-mobile.png differ diff --git a/docs/stats.json b/docs/stats.json index 99e5320..5130176 100644 --- a/docs/stats.json +++ b/docs/stats.json @@ -103,7 +103,7 @@ "source": "taxonomy/skill_aliases.csv" }, "mapped mass": { - "value": "189573 / 271108 (69.9%) (Note: 69.9% over all clean rows vs 77.2% over tech subset)", + "value": "177432 / 271108 (65.4%)", "source": "computed from data/clean.parquet" }, "exact match count": { @@ -111,15 +111,15 @@ "source": "computed" }, "alias match count": { - "value": 179612, + "value": 15238, "source": "computed" }, "fuzzy match count": { - "value": 2457, + "value": 2469, "source": "computed" }, "top 20 unmapped strings": { - "value": "{'design engineering': 213, 'simulation': 169, 'site engineering': 136, '3d modeling': 134, 'software development methodologies': 131, 'analyzing information': 120, 'software sales': 117, 'catia': 109, 'cobol': 105, 'business strategy': 103, 'hmi': 101, 'mechanical design': 101, 'electrical design': 100, 'rtos': 100, 'maintenance engineering': 98, 'sales engineering': 98, 'plm': 98, 'preventive maintenance': 96, 'equipment': 96, 'data entry operation': 94}", + "value": "{'autocad': 557, 'development methodologies': 516, 'mechanical engineering': 250, 'data entry': 247, 'electrical engineering': 214, 'design engineering': 213, 'plc': 202, 'civil engineering': 185, 'mechanical': 181, 'maintenance': 177, 'simulation': 169, 'electricals': 162, 'solid works': 160, 'construction': 142, 'site execution': 139, 'site engineering': 136, 'fabrication': 135, '3d modeling': 134, 'market research': 132, 'instrumentation': 132}", "source": "computed" } }, @@ -281,7 +281,7 @@ }, "product": { "personas": { - "value": "Data / BI Analyst (Data / BI Analyst): readiness 0.11, band Not yet, top match Backend, gaps ['Power BI', 'Data Engineering', 'PySpark', 'Data Analysis', 'Snowflake']\nBackend (Backend): readiness 0.75, band Close, top match Backend, gaps ['Microservices', 'Hibernate', 'Kafka', 'Python', 'Golang']\nFull Stack (Full Stack): readiness 0.24, band Not yet, top match Frontend, gaps ['Java', 'Spring Boot', 'AWS', 'C#', 'Python']\nFrontend (Frontend): readiness 0.85, band Ready, top match Frontend, gaps ['UI', 'Angular', 'Redux', 'Git', 'Bootstrap']\nDevOps / Cloud (DevOps / Cloud): readiness 0.75, band Ready, top match DevOps / Cloud, gaps ['Terraform', 'Continuous Integration', 'Azure DevOps', 'CI/CD', 'Jenkins']\nQA / Test (QA / Test): readiness 0.86, band Ready, top match QA / Test, gaps ['Test Cases', 'API Testing', 'Performance Testing', 'Automation Framework', 'Regression Testing']\nERP / Enterprise (ERP / Enterprise): readiness 0.94, band Close, top match ERP / Enterprise, gaps ['ServiceNow', 'JavaScript', 'Salesforce', 'SAP S/4HANA', 'Master Data']\nData Science / ML (Data Science / ML): readiness 0.92, band Close, top match Data Science / ML, gaps ['NLP', 'Generative AI', 'TensorFlow', 'Image Processing', 'Research']\nSupport / IT Ops (Support / IT Ops): readiness 0.86, band Ready, top match Support / IT Ops, gaps ['Network Engineering', 'Customer Service', 'WAN', 'DNS', 'Switching']\nMobile (Mobile): readiness 1.00, band Close, top match Mobile, gaps ['iOS', 'Flutter', 'React Native', 'Swift', 'MVVM']", + "value": "Data / BI Analyst (Data / BI Analyst): readiness 0.11, band Not yet, limiter Probability, top match Backend, gaps ['Power BI', 'Data Engineering', 'PySpark', 'Data Analysis', 'Snowflake']\nBackend (Backend): readiness 0.75, band Close, limiter Coverage, top match Backend, gaps ['Microservices', 'Hibernate', 'Kafka', 'Python', 'Golang']\nFull Stack (Full Stack): readiness 0.24, band Not yet, limiter Probability, top match Frontend, gaps ['Java', 'Spring Boot', 'AWS', 'C#', 'Python']\nFrontend (Frontend): readiness 0.85, band Ready, limiter Both equal, top match Frontend, gaps ['UI', 'Angular', 'Redux', 'Git', 'Bootstrap']\nDevOps / Cloud (DevOps / Cloud): readiness 0.75, band Ready, limiter Both equal, top match DevOps / Cloud, gaps ['Terraform', 'Continuous Integration', 'Azure DevOps', 'CI/CD', 'Jenkins']\nQA / Test (QA / Test): readiness 0.86, band Ready, limiter Both equal, top match QA / Test, gaps ['Test Cases', 'API Testing', 'Performance Testing', 'Automation Framework', 'Regression Testing']\nERP / Enterprise (ERP / Enterprise): readiness 0.94, band Close, limiter Coverage, top match ERP / Enterprise, gaps ['ServiceNow', 'JavaScript', 'Salesforce', 'SAP S/4HANA', 'Master Data']\nData Science / ML (Data Science / ML): readiness 0.92, band Close, limiter Coverage, top match Data Science / ML, gaps ['NLP', 'Generative AI', 'TensorFlow', 'Image Processing', 'Research']\nSupport / IT Ops (Support / IT Ops): readiness 0.86, band Ready, limiter Both equal, top match Support / IT Ops, gaps ['Network Engineering', 'Customer Service', 'WAN', 'DNS', 'Switching']\nMobile (Mobile): readiness 1.00, band Close, limiter Coverage, top match Mobile, gaps ['iOS', 'Flutter', 'React Native', 'Swift', 'MVVM']", "source": "in-process analyze_skills" } }, @@ -291,7 +291,7 @@ "source": "pytest tests/" }, "lines of code": { - "value": "\n.github: 41\napi: 353\netl: 718\nfrontend: 5446\nmining: 795\nml: 649\nroot: 167\nscripts: 1007\ntaxonomy: 987\ntests: 703", + "value": "\n.github: 41\napi: 353\netl: 718\nfrontend: 5772\nmining: 795\nml: 649\nroot: 180\nscripts: 995\ntaxonomy: 987\ntests: 703", "source": "git ls-files per dir" }, "slim runtime install size": { @@ -299,7 +299,7 @@ "source": "fresh venv from requirements.txt" }, "frontend dist size": { - "value": "276K", + "value": "424K", "source": "du -sh frontend/dist" }, "Vercel function size": { @@ -319,11 +319,11 @@ "source": "docs/deploy.md" }, "commits and merged PRs": { - "value": "\n7 Archit1302-wolf\n 17 AtulACleaver\n 2 eccentricAryan404\n 1 ssp0009", + "value": "\n7 Archit1302-wolf\n 19 AtulACleaver\n 2 eccentricAryan404\n 2 ssp0009\n 0 real-aditya-kumar", "source": "gh pr list" }, "releases": { - "value": "\nrules-v2\tLatest\trules-v2\t2026-10-05T19:34:48Z\nmodel-v4\t\tmodel-v4\t2026-10-05T19:34:26Z\ndata-v4\t\tdata-v4\t2026-10-05T19:34:17Z\nrules-v1\t\trules-v1\t2026-10-04T07:06:17Z\nmodel-v3\t\tmodel-v3\t2026-10-04T04:16:41Z\ndata-v3\t\tdata-v3\t2026-10-03T18:20:30Z\ndata-v2\t\tdata-v2\t2026-10-03T17:13:22Z\nmodel-v2\t\tmodel-v2\t2026-10-03T17:13:21Z\nData Handoff v1\t\tdata-v1\t2026-10-02T07:47:18Z", + "value": "\nSkillGraph v1.0.0\tLatest\tv1.0.0\t2026-10-06T11:08:41Z\nrules-v2\t\trules-v2\t2026-10-05T19:34:48Z\nmodel-v4\t\tmodel-v4\t2026-10-05T19:34:26Z\ndata-v4\t\tdata-v4\t2026-10-05T19:34:17Z\nrules-v1\t\trules-v1\t2026-10-04T07:06:17Z\nmodel-v3\t\tmodel-v3\t2026-10-04T04:16:41Z\ndata-v3\t\tdata-v3\t2026-10-03T18:20:30Z\ndata-v2\t\tdata-v2\t2026-10-03T17:13:22Z\nmodel-v2\t\tmodel-v2\t2026-10-03T17:13:21Z\nData Handoff v1\t\tdata-v1\t2026-10-02T07:47:18Z", "source": "gh release list" } } diff --git a/docs/stats.md b/docs/stats.md index 517afe5..2f653d0 100644 --- a/docs/stats.md +++ b/docs/stats.md @@ -32,11 +32,11 @@ |---|---|---| | vocab size | 800 | artifacts/skill_vocab.json | | alias count | 834 | taxonomy/skill_aliases.csv | -| mapped mass | 189573 / 271108 (69.9%) (Note: 69.9% over all clean rows vs 77.2% over tech subset) | computed from data/clean.parquet | +| mapped mass | 177432 / 271108 (65.4%) | computed from data/clean.parquet | | exact match count | 159725 | computed | -| alias match count | 179612 | computed | -| fuzzy match count | 2457 | computed | -| top 20 unmapped strings | {'design engineering': 213, 'simulation': 169, 'site engineering': 136, '3d modeling': 134, 'software development methodologies': 131, 'analyzing information': 120, 'software sales': 117, 'catia': 109, 'cobol': 105, 'business strategy': 103, 'hmi': 101, 'mechanical design': 101, 'electrical design': 100, 'rtos': 100, 'maintenance engineering': 98, 'sales engineering': 98, 'plm': 98, 'preventive maintenance': 96, 'equipment': 96, 'data entry operation': 94} | computed | +| alias match count | 15238 | computed | +| fuzzy match count | 2469 | computed | +| top 20 unmapped strings | {'autocad': 557, 'development methodologies': 516, 'mechanical engineering': 250, 'data entry': 247, 'electrical engineering': 214, 'design engineering': 213, 'plc': 202, 'civil engineering': 185, 'mechanical': 181, 'maintenance': 177, 'simulation': 169, 'electricals': 162, 'solid works': 160, 'construction': 142, 'site execution': 139, 'site engineering': 136, 'fabrication': 135, '3d modeling': 134, 'market research': 132, 'instrumentation': 132} | computed | ## Model | Metric | Value | Source | @@ -87,19 +87,19 @@ ## Product | Metric | Value | Source | |---|---|---| -| personas | Data / BI Analyst (Data / BI Analyst): readiness 0.11, band Not yet, top match Backend, gaps ['Power BI', 'Data Engineering', 'PySpark', 'Data Analysis', 'Snowflake']
Backend (Backend): readiness 0.75, band Close, top match Backend, gaps ['Microservices', 'Hibernate', 'Kafka', 'Python', 'Golang']
Full Stack (Full Stack): readiness 0.24, band Not yet, top match Frontend, gaps ['Java', 'Spring Boot', 'AWS', 'C#', 'Python']
Frontend (Frontend): readiness 0.85, band Ready, top match Frontend, gaps ['UI', 'Angular', 'Redux', 'Git', 'Bootstrap']
DevOps / Cloud (DevOps / Cloud): readiness 0.75, band Ready, top match DevOps / Cloud, gaps ['Terraform', 'Continuous Integration', 'Azure DevOps', 'CI/CD', 'Jenkins']
QA / Test (QA / Test): readiness 0.86, band Ready, top match QA / Test, gaps ['Test Cases', 'API Testing', 'Performance Testing', 'Automation Framework', 'Regression Testing']
ERP / Enterprise (ERP / Enterprise): readiness 0.94, band Close, top match ERP / Enterprise, gaps ['ServiceNow', 'JavaScript', 'Salesforce', 'SAP S/4HANA', 'Master Data']
Data Science / ML (Data Science / ML): readiness 0.92, band Close, top match Data Science / ML, gaps ['NLP', 'Generative AI', 'TensorFlow', 'Image Processing', 'Research']
Support / IT Ops (Support / IT Ops): readiness 0.86, band Ready, top match Support / IT Ops, gaps ['Network Engineering', 'Customer Service', 'WAN', 'DNS', 'Switching']
Mobile (Mobile): readiness 1.00, band Close, top match Mobile, gaps ['iOS', 'Flutter', 'React Native', 'Swift', 'MVVM'] | in-process analyze_skills | +| personas | Data / BI Analyst (Data / BI Analyst): readiness 0.11, band Not yet, limiter Probability, top match Backend, gaps ['Power BI', 'Data Engineering', 'PySpark', 'Data Analysis', 'Snowflake']
Backend (Backend): readiness 0.75, band Close, limiter Coverage, top match Backend, gaps ['Microservices', 'Hibernate', 'Kafka', 'Python', 'Golang']
Full Stack (Full Stack): readiness 0.24, band Not yet, limiter Probability, top match Frontend, gaps ['Java', 'Spring Boot', 'AWS', 'C#', 'Python']
Frontend (Frontend): readiness 0.85, band Ready, limiter Both equal, top match Frontend, gaps ['UI', 'Angular', 'Redux', 'Git', 'Bootstrap']
DevOps / Cloud (DevOps / Cloud): readiness 0.75, band Ready, limiter Both equal, top match DevOps / Cloud, gaps ['Terraform', 'Continuous Integration', 'Azure DevOps', 'CI/CD', 'Jenkins']
QA / Test (QA / Test): readiness 0.86, band Ready, limiter Both equal, top match QA / Test, gaps ['Test Cases', 'API Testing', 'Performance Testing', 'Automation Framework', 'Regression Testing']
ERP / Enterprise (ERP / Enterprise): readiness 0.94, band Close, limiter Coverage, top match ERP / Enterprise, gaps ['ServiceNow', 'JavaScript', 'Salesforce', 'SAP S/4HANA', 'Master Data']
Data Science / ML (Data Science / ML): readiness 0.92, band Close, limiter Coverage, top match Data Science / ML, gaps ['NLP', 'Generative AI', 'TensorFlow', 'Image Processing', 'Research']
Support / IT Ops (Support / IT Ops): readiness 0.86, band Ready, limiter Both equal, top match Support / IT Ops, gaps ['Network Engineering', 'Customer Service', 'WAN', 'DNS', 'Switching']
Mobile (Mobile): readiness 1.00, band Close, limiter Coverage, top match Mobile, gaps ['iOS', 'Flutter', 'React Native', 'Swift', 'MVVM'] | in-process analyze_skills | ## Engineering | Metric | Value | Source | |---|---|---| | test pass count | 30 | pytest tests/ | -| lines of code |
.github: 41
api: 353
etl: 718
frontend: 5446
mining: 795
ml: 649
root: 167
scripts: 1007
taxonomy: 987
tests: 703 | git ls-files per dir | +| lines of code |
.github: 41
api: 353
etl: 718
frontend: 5772
mining: 795
ml: 649
root: 180
scripts: 995
taxonomy: 987
tests: 703 | git ls-files per dir | | slim runtime install size | 66M | fresh venv from requirements.txt | -| frontend dist size | 276K | du -sh frontend/dist | +| frontend dist size | 424K | du -sh frontend/dist | | Vercel function size | 39.1 MB | docs/deploy.md | | production latency (cold start ms) | 2521.1 | docs/deploy.md | | production latency (p50 ms) | 454.4 | docs/deploy.md | | production latency (p95 ms) | 728.8 | docs/deploy.md | -| commits and merged PRs |
7 Archit1302-wolf
17 AtulACleaver
2 eccentricAryan404
1 ssp0009 | gh pr list | -| releases |
rules-v2 Latest rules-v2 2026-10-05T19:34:48Z
model-v4 model-v4 2026-10-05T19:34:26Z
data-v4 data-v4 2026-10-05T19:34:17Z
rules-v1 rules-v1 2026-10-04T07:06:17Z
model-v3 model-v3 2026-10-04T04:16:41Z
data-v3 data-v3 2026-10-03T18:20:30Z
data-v2 data-v2 2026-10-03T17:13:22Z
model-v2 model-v2 2026-10-03T17:13:21Z
Data Handoff v1 data-v1 2026-10-02T07:47:18Z | gh release list | +| commits and merged PRs |
7 Archit1302-wolf
19 AtulACleaver
2 eccentricAryan404
2 ssp0009
0 real-aditya-kumar | gh pr list | +| releases |
SkillGraph v1.0.0 Latest v1.0.0 2026-10-06T11:08:41Z
rules-v2 rules-v2 2026-10-05T19:34:48Z
model-v4 model-v4 2026-10-05T19:34:26Z
data-v4 data-v4 2026-10-05T19:34:17Z
rules-v1 rules-v1 2026-10-04T07:06:17Z
model-v3 model-v3 2026-10-04T04:16:41Z
data-v3 data-v3 2026-10-03T18:20:30Z
data-v2 data-v2 2026-10-03T17:13:22Z
model-v2 model-v2 2026-10-03T17:13:21Z
Data Handoff v1 data-v1 2026-10-02T07:47:18Z | gh release list | diff --git a/scripts/collect_stats.py b/scripts/collect_stats.py index 8f7790c..28b54f3 100644 --- a/scripts/collect_stats.py +++ b/scripts/collect_stats.py @@ -97,9 +97,8 @@ def normalization_stats(): stats['normalization']['alias count'] = {"value": len(aliases), "source": "taxonomy/skill_aliases.csv"} - from etl.normalize import _aliases, _clean_map, _clean_token, _vocab, load_vocab - load_vocab() - _choices = [c for c in _vocab if len(c) >= 4] + import etl.normalize as norm + norm.load_vocab() raw = pd.read_parquet('data/clean.parquet') all_tokens = [] @@ -114,49 +113,27 @@ def normalization_stats(): alias_count = 0 fuzzy_count = 0 unmapped = [] - - # We can get mapped mass directly from label pipeline output, but let's approximate - for t, count in token_counts.items(): - cleaned = _clean_token(t) - if not cleaned: - unmapped.extend([t] * count) - elif cleaned in _clean_map: - exact_count += count - elif cleaned in _aliases: - alias_count += count - else: - unmapped.extend([t] * count) - - # From pipeline logs: Mapped mass is 77917 out of 100912 - # So fuzzy_count = 77917 - exact_count - alias_count - # Wait, the pipeline only keeps counts for tokens in _vocab (which is top 800) - # Our unmapped list is technically those that didn't match exactly or alias. - # Actually, we can just use normalize_skill WITHOUT multiprocessing, but with the built-in fuzzy_cache! - # Let's just use normalize_skill! - from etl.normalize import normalize_skill - unmapped = [] mapped_mass = 0 - fuzzy_count = 0 - import etl.normalize + for t, count in token_counts.items(): - cleaned = _clean_token(t) + cleaned = norm._clean_token(t) if not cleaned: unmapped.extend([t] * count) continue - if cleaned in etl.normalize._clean_map: + if cleaned in norm._clean_map: exact_count += count mapped_mass += count - elif cleaned in etl.normalize._aliases: + elif cleaned in norm._aliases and norm._aliases[cleaned] in norm._clean_map: alias_count += count mapped_mass += count else: - if normalize_skill(t) is not None: + if norm.normalize_skill(t) is not None: fuzzy_count += count mapped_mass += count else: unmapped.extend([t] * count) - stats['normalization']['mapped mass'] = {"value": f"{mapped_mass} / {total} ({mapped_mass/total*100:.1f}%) (Note: 69.9% over all clean rows vs 77.2% over tech subset)", "source": "computed from data/clean.parquet"} + stats['normalization']['mapped mass'] = {"value": f"{mapped_mass} / {total} ({mapped_mass/total*100:.1f}%)", "source": "computed from data/clean.parquet"} stats['normalization']['exact match count'] = {"value": exact_count, "source": "computed"} stats['normalization']['alias match count'] = {"value": alias_count, "source": "computed"} stats['normalization']['fuzzy match count'] = {"value": fuzzy_count, "source": "computed"} @@ -408,7 +385,15 @@ def product_stats(): match = data.get("match", {}).get("matches", [{}])[0].get("role", "None") gaps = data.get("gap", {}).get("recommendations", [])[:5] gap_names = [g["skill"] for g in gaps] - results.append(f"{p['name']} ({p['role']}): readiness {readiness.get('probability', 0):.2f}, band {readiness.get('band')}, top match {match}, gaps {gap_names}") + prob = readiness.get("probability", 0) + cov = readiness.get("coverage", 0) + band = readiness.get("band") + + p_val = 2 if prob >= 0.60 else (1 if prob >= 0.30 else 0) + c_val = 2 if cov >= 0.20 else (1 if cov >= 0.10 else 0) + limiter = "Coverage" if c_val < p_val else ("Probability" if p_val < c_val else "Both equal") + + results.append(f"{p['name']} ({p['role']}): readiness {prob:.2f}, band {band}, limiter {limiter}, top match {match}, gaps {gap_names}") stats['product']['personas'] = {"value": "\n".join(results), "source": "in-process analyze_skills"} except Exception as e: # noqa: BLE001 @@ -451,7 +436,10 @@ def engineering_stats(): stats['engineering']['production latency (p95 ms)'] = {"value": float(p95.group(1)) if p95 else None, "source": "docs/deploy.md"} prs = safe_run("gh pr list --state merged --limit 200 --json author --jq '.[].author.login' | sort | uniq -c") - stats['engineering']['commits and merged PRs'] = {"value": "\n" + str(prs), "source": "gh pr list"} + prs_str = str(prs) if prs else "" + if "real-aditya-kumar" not in prs_str: + prs_str += "\n 0 real-aditya-kumar" + stats['engineering']['commits and merged PRs'] = {"value": "\n" + prs_str.strip(), "source": "gh pr list"} releases = safe_run("gh release list") stats['engineering']['releases'] = {"value": "\n" + str(releases), "source": "gh release list"}