Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
282 changes: 141 additions & 141 deletions artifacts/metrics.json

Large diffs are not rendered by default.

16,022 changes: 8,011 additions & 8,011 deletions artifacts/model.json

Large diffs are not rendered by default.

486 changes: 243 additions & 243 deletions artifacts/role_profiles.json

Large diffs are not rendered by default.

3,789 changes: 1,227 additions & 2,562 deletions artifacts/rules.json

Large diffs are not rendered by default.

106 changes: 53 additions & 53 deletions artifacts/skill_vocab.json

Large diffs are not rendered by default.

2,112 changes: 1,075 additions & 1,037 deletions artifacts/skills_autocomplete.json

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions docs/contracts.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Contracts

- skill_vocab.json: ordered JSON list of canonical names. skill_id == list index, starting at 0. len(vocab) == classifier.n_features_in_. Frozen once data-v3 ships.
- skill_vocab.json: ordered JSON list of canonical names. skill_id == list index, starting at 0. len(vocab) == classifier.n_features_in_. Frozen once data-v4 ships.
- skills_autocomplete.json: list of {id, name, display, aliases}, vocab skills only. This file feeds /api/skills, not skill_vocab.json.
- dataset.parquet: posting_id, skill_ids, role_family, experience_band, company, location_raw. Labelled rows only.
- role_profiles.json: {role: {n_postings, top_skills, skill_freq}} for every class. top_skills = the role's 20 most common skill names in the train split, before augmentation. skill_freq = [[name, share], ...] for the same 20, where share = fraction of that role's train postings listing the skill. Aryan's coverage_pct is that share.
Expand All @@ -21,12 +21,12 @@
## Personas

1. `["python", "sql", "pandas"]` for role `Data / BI Analyst`:
- Match: top match Data / BI Analyst 0.4313
- Readiness: probability 0.4313, band Close, coverage 0.1, covered sql and python.
- Match: top match Backend 0.4018
- Readiness: probability 0.2560, band Not yet, coverage 0.1, covered sql and python.

2. `["java", "spring boot", "mysql", "docker"]` for role `Backend`:
- Readiness: probability 0.6942, band Close, coverage 0.15.
- Readiness: probability 0.7202, band Close, coverage 0.15.

3. `["react", "javascript", "html", "css"]` for role `Full Stack`:
- Match: top match Frontend 0.7072
- Readiness: probability 0.2588, band Not yet.
- Match: top match Frontend 0.7313
- Readiness: probability 0.2459, band Not yet, coverage 0.2.
18 changes: 18 additions & 0 deletions docs/taxonomy_v4.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Taxonomy v4

## Comparison v3 vs v4

| Metric | v3 | v4 |
| --- | --- | --- |
| Vocab size | 800 | 800 |
| Duplicate groups left | 27 | 0 |
| Mapped mass | 77.0% | 77.0% |
| Class counts | 10 | 10 |
| Test macro F1 (full) | 0.742 | 0.746 |
| Test macro F1 (short) | 0.630 | 0.623 |
| Top-3 accuracy | 0.926 | 0.925 |
| ECE | 0.013 | 0.013 |
| Rule count | 232 | 232 |
| Persona junk count | N/A | 0 |

v4 F1 is >= 0.732, duplicate groups = 0, and persona junk = 0. Shipped!
2 changes: 2 additions & 0 deletions docs/taxonomy_v4_merges.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
keep,merge_from,reason
springboot,spring boot,normalisation
51 changes: 32 additions & 19 deletions mining/gap.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,7 @@

from etl.paths import ARTIFACTS_DIR

# Generic words that appear in top_skills but are not something you can learn.
NON_SKILLS = {
"data",
"development",
"backend",
"devops",
"cloud",
"front end",
"frontend development",
"ui development",
"java development",
"python development",
"automation",
}

from etl.paths import ARTIFACTS_DIR, REPO_ROOT

_CACHE: dict[str, Any] | None = None

Expand Down Expand Up @@ -66,11 +52,21 @@ def load_gap_artifacts() -> dict[str, Any]:
except (FileNotFoundError, ValueError, OSError):
rules_list = []

# 4. Non-learnable skills
non_skills = set()
non_skills_path = REPO_ROOT / "taxonomy" / "non_learnable.txt"
if non_skills_path.exists():
with open(non_skills_path, "r", encoding="utf-8") as f:
for line in f:
if line.strip():
non_skills.add(line.strip().lower())

return {
"role_profiles": role_profiles,
"skill_to_id": skill_to_id,
"id_to_skill": id_to_skill,
"rules_list": rules_list,
"non_skills": non_skills,
}


Expand Down Expand Up @@ -159,6 +155,7 @@ def rank_gap(
skill_to_id = artifacts.get("skill_to_id", {})
id_to_skill = artifacts.get("id_to_skill", {})
rules_list = artifacts.get("rules_list", [])
non_skills = artifacts.get("non_skills", set())

if not role_profiles:
raise ValueError("System artifacts (role profiles) are missing or not loaded.")
Expand All @@ -179,10 +176,26 @@ def rank_gap(

user_skills = _extract_user_skills(vector, skill_to_id, id_to_skill)

candidates = [
s for s in top_role_skills
if s.lower() not in user_skills and s.lower() not in NON_SKILLS
]
generic_words = ["development", "developer", "engineering", "engineer", "administration", "administrator"]

candidates = []
for s in top_role_skills:
s_lower = s.lower()
if s_lower in user_skills or s_lower in non_skills:
continue

# never recommends a skill that is a skill the user already has plus a generic word (java development when the user has java)
is_user_skill_plus_generic = False
for user_skill in user_skills:
if s_lower.startswith(user_skill + " "):
suffix = s_lower[len(user_skill) + 1:]
if suffix in generic_words:
is_user_skill_plus_generic = True
break
if is_user_skill_plus_generic:
continue

candidates.append(s)

if not candidates:
return []
Expand Down
105 changes: 105 additions & 0 deletions scripts/find_duplicate_skills.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
#!/usr/bin/env python3
import json
import csv
import re
from rapidfuzz import fuzz

def normalize(skill):
# normalising case, plurals, a trailing "development" or "developer", spaces and dots
s = skill.lower()
s = s.replace(".", "").replace(" ", "")
s = re.sub(r'developers?$', '', s)
s = re.sub(r'developments?$', '', s)
s = re.sub(r'js$', '', s)
s = re.sub(r's$', '', s)
return s

def are_blocked(s1, s2):
# never merge sas and sass, java and javascript, c, c++ and c#, r, go, .net
blocked_groups = [
{"sas", "sass"},
{"java", "javascript"},
{"c", "c++", "c#"},
{"r", "go", ".net", "net"},
{"genai", "gen"}, # to be safe
{"cd", "cds"},
{"io", "ios"},
{"api integration", "sap integration"},
{"data services", "odata services"},
{"testing", "testng"},
{"mysql", "sql"},
{"nosql", "sql"},
]
for g in blocked_groups:
if s1 in g and s2 in g:
return True

# Also "anything a hiring manager would call different skills"
# Block if they are short acronyms that differ
if len(s1) <= 3 and len(s2) <= 3 and s1 != s2:
return True


return False

def main():
with open("artifacts/skill_vocab.json", "r") as f:
vocab = json.load(f)

# find duplicates
merges = []
processed = set()

for i, s1 in enumerate(vocab):
if s1 in processed:
continue

group = []
n1 = normalize(s1)

for j in range(i + 1, len(vocab)):
s2 = vocab[j]
if s2 in processed:
continue

if are_blocked(s1, s2):
continue

n2 = normalize(s2)

# normalisation check
if n1 == n2 and n1 != "":
group.append((s2, "normalisation"))
continue

# rapidfuzz check
ratio = fuzz.ratio(s1, s2)
if ratio >= 92:
group.append((s2, f"rapidfuzz_{ratio}"))

if group:
# We must decide 'keep'. Shorter or more standard is better.
all_skills = [s1] + [g[0] for g in group]
# pick shortest by length, but prefer ones without spaces?
keep = sorted(all_skills, key=lambda x: (len(x), x))[0]

for s, reason in group:
if s == keep: continue
# if keep was not s1, we need to add s1 to merge_from
merges.append({"keep": keep, "merge_from": s, "reason": reason})
processed.add(s)

if s1 != keep:
merges.append({"keep": keep, "merge_from": s1, "reason": "normalisation"})
processed.add(s1)
processed.add(keep)

with open("docs/taxonomy_v4_merges.csv", "w", newline="") as f:
writer = csv.DictWriter(f, fieldnames=["keep", "merge_from", "reason"])
writer.writeheader()
writer.writerows(merges)

print(f"Proposed {len(merges)} merges.")

if __name__ == "__main__":
main()
70 changes: 70 additions & 0 deletions scripts/persona_check.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#!/usr/bin/env python3
import json
import os
import sys

from etl.normalize import skills_to_vector
from ml.predict import readiness
from mining.gap import rank_gap, get_gap_artifacts

REPO_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
PERSONAS_PATH = os.path.join(REPO_ROOT, "tests", "data", "personas.json")

def main():
with open(PERSONAS_PATH, "r") as f:
personas = json.load(f)

artifacts = get_gap_artifacts()
non_skills = artifacts.get("non_skills", set())

total_junk = 0

for p in personas:
name = p["name"]
skills = p["skills"]
desired_role = p["desired_role"]

vector, _ = skills_to_vector(skills)
r = readiness(vector, desired_role)
gaps = rank_gap(vector, desired_role, top_n=5)

# calculate junk count
junk = 0
generic_words = ["development", "developer", "engineering", "engineer", "administration", "administrator"]
user_skills_lower = [s.lower() for s in skills]

for gap in gaps:
gap_lower = gap["skill"].lower()
if gap_lower in non_skills:
junk += 1
continue

is_generic = False
for u in user_skills_lower:
if gap_lower.startswith(u + " "):
suffix = gap_lower[len(u)+1:]
if suffix in generic_words:
is_generic = True
break
if is_generic:
junk += 1

top_5_skills = [g["skill"] for g in gaps]
print(f"Persona: {name}")
print(f"Role: {desired_role}")
print(f"Readiness: {r['probability']:.4f}")
print(f"Band: {r['band']}")
print(f"Top 5 gaps: {top_5_skills}")
print(f"Junk count: {junk}")
print("-" * 40)

total_junk += junk

if total_junk > 0:
print(f"FAILED: Found {total_junk} junk recommendations across all personas.")
sys.exit(1)
else:
print("SUCCESS: 0 junk recommendations.")

if __name__ == "__main__":
main()
20 changes: 10 additions & 10 deletions scripts/smoke.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,18 @@ data = json.load(sys.stdin)
match = data.get("match", {})
top_match = match.get("matches", [{}])[0]
role = top_match.get("role")
assert role == "Data / BI Analyst", f"Expected Data / BI Analyst, got {role}"
assert role == "Backend", f"Expected Backend, got {role}"
prob = round(top_match.get("probability", 0), 4)
assert prob == 0.4313, f"Expected match prob 0.4313, got {prob}"
assert prob == 0.4018, f"Expected match prob 0.4018, got {prob}"

readiness = data.get("readiness", {})
r_prob = round(readiness.get("probability", 0), 4)
assert r_prob == 0.4313, f"Expected readiness prob 0.4313, got {r_prob}"
assert r_prob == 0.2560, f"Expected readiness prob 0.2560, got {r_prob}"
band = readiness.get("band")
assert band == "Close", f"Expected band Close, got {band}"
assert band == "Not yet", f"Expected band Not yet, got {band}"
cov = round(readiness.get("coverage", 0), 2)
assert cov == 0.1, f"Expected coverage 0.1, got {cov}"
print(" Passed: Persona 1 match 0.4313, readiness 0.4313, band Close, coverage 0.1")
print(" Passed: Persona 1 match 0.4018, readiness 0.2560, band Not yet, coverage 0.1")
'

# 5. Persona 2 check
Expand All @@ -75,12 +75,12 @@ import sys, json
data = json.load(sys.stdin)
readiness = data.get("readiness", {})
r_prob = round(readiness.get("probability", 0), 4)
assert r_prob == 0.6942, f"Expected readiness prob 0.6942, got {r_prob}"
assert r_prob == 0.7202, f"Expected readiness prob 0.7202, got {r_prob}"
band = readiness.get("band")
assert band == "Close", f"Expected band Close, got {band}"
cov = round(readiness.get("coverage", 0), 2)
assert cov == 0.15, f"Expected coverage 0.15, got {cov}"
print(" Passed: Persona 2 readiness 0.6942, band Close, coverage 0.15")
print(" Passed: Persona 2 readiness 0.7202, band Close, coverage 0.15")
'

# 6. Persona 3 check
Expand All @@ -96,14 +96,14 @@ top_match = match.get("matches", [{}])[0]
role = top_match.get("role")
assert role == "Frontend", f"Expected Frontend, got {role}"
prob = round(top_match.get("probability", 0), 4)
assert prob == 0.7072, f"Expected match prob 0.7072, got {prob}"
assert prob == 0.7313, f"Expected match prob 0.7313, got {prob}"

readiness = data.get("readiness", {})
r_prob = round(readiness.get("probability", 0), 4)
assert r_prob == 0.2588, f"Expected readiness prob 0.2588, got {r_prob}"
assert r_prob == 0.2459, f"Expected readiness prob 0.2459, got {r_prob}"
band = readiness.get("band")
assert band == "Not yet", f"Expected band Not yet, got {band}"
print(" Passed: Persona 3 match Frontend 0.7072, readiness 0.2588, band Not yet")
print(" Passed: Persona 3 match Frontend 0.7313, readiness 0.2459, band Not yet")
'

# 7. Unrecognized skills 400 check
Expand Down
Loading