hired.taxonomy.graph#
Skill relatedness from occupational co-occurrence (pure Python, no numpy).
Two skills are related when occupations require them together more often than
chance predicts. For skills i and j over N occupations, with
n_i the (weighted) number of occupations using i and C_ij the
(weighted) number using both:
RCA_ij = C_ij / (n_i * n_j / N) # observed / expected co-occurrence
SR_ij = (RCA_ij - 1) / (RCA_ij + 1) # in (-1, 1); clipped to [0, 1]
SR is the skill-relatedness measure of Neffke & Henning (2013), which the
research note recommends (misc/docs/research/skills-taxonomy-and-adjacency.md).
Essential links weigh 1, optional ones optional_weight. Pairs seen in
fewer than min_cooccurrence occupations are dropped (one shared occupation
between two rare skills gives a huge, meaningless ratio), and each skill keeps
only its top_k strongest links.
>>> from hired.taxonomy.base import Occupation
>>> occs = [Occupation(id=f'o{i}', label='', source='t', essential=es)
... for i, es in enumerate([['py', 'ml'], ['py', 'ml'], ['py', 'web'],
... ['cook', 'serve'], ['cook', 'serve']])]
>>> edges = relatedness_edges(occs)
>>> edges['py'][0][0], edges['py'][0][1] > 0
('ml', True)
>>> 'cook' in dict(edges['py'])
False
Module Attributes
|
Functions
|
Union of edge sets over disjoint id spaces (e.g. ESCO and O*NET). |
|
Skill-relatedness edges ( |
- hired.taxonomy.graph.Edges#
{node_id: [(other_id, score), ...]}, strongest first.