Roger Surf
commited on
Commit
·
4a2e3d1
1
Parent(s):
33185cb
✅ Final HRHUB v3.1 notebook - production ready with load/generate embeddings + few-shot
Browse files- data/csv_files/.~lock.postings.csv# +1 -0
- data/notebooks/HRHUB_v2_8.ipynb +0 -0
- data/notebooks/HRHUB_v3.1.ipynb +2185 -0
- data/notebooks/{HRHUB_Complete_With_Postings.ipynb → old/HRHUB_Complete_With_Postings.ipynb} +0 -0
- data/notebooks/{HRHUB_Full_180K.ipynb → old/HRHUB_Full_180K.ipynb} +0 -0
- data/notebooks/{HRHUB_v2.1_Enhanced_FREE.ipynb → old/HRHUB_v2.1_Enhanced_FREE.ipynb} +0 -0
- data/notebooks/{HRHUB_v2_3_Enhanced_CLEAN.ipynb → old/HRHUB_v2_3_Enhanced_CLEAN.ipynb} +0 -0
- data/notebooks/{HRHUB_v2_4_FINAL.ipynb → old/HRHUB_v2_4_FINAL.ipynb} +0 -0
- data/notebooks/{HRHUB_v2_5_COMPLETE_WITH_VIZ.ipynb → old/HRHUB_v2_5_COMPLETE_WITH_VIZ.ipynb} +0 -0
- data/notebooks/{HRHUB_v2_6_COMPLETE_FINAL.ipynb → old/HRHUB_v2_6_COMPLETE_FINAL.ipynb} +0 -0
- data/notebooks/{HRHUB_v2_7_PERFECT_FINAL.ipynb → old/HRHUB_v2_7_PERFECT_FINAL.ipynb} +47 -22
- data/notebooks/old/HRHUB_v2_8.ipynb +0 -0
- data/notebooks/old/HRHUB_v3.0.ipynb +239 -0
- data/notebooks/old/hrhub_v2_8.py +2836 -0
- data/processed/candidate_embeddings.npy +1 -1
- data/processed/candidates_metadata.pkl +3 -0
- data/processed/companies_metadata.pkl +3 -0
- data/processed/company_embeddings.npy +2 -2
- data/processed/model_info.json +9 -0
- data/results/network_graph.html +2 -2
- data/results/network_interactive.html +321 -0
- data/results/score_distribution.png +0 -0
- data/results/tsne_interactive.html +0 -0
data/csv_files/.~lock.postings.csv#
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
|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
+
"cell_type": "markdown",
|
| 5 |
+
"metadata": {},
|
| 6 |
+
"source": [
|
| 7 |
+
"# 🎯 HRHUB v3.1 - Bilateral HR Matching System\n",
|
| 8 |
+
"\n",
|
| 9 |
+
"**Master's Thesis Project** \n",
|
| 10 |
+
"*Business Data Science Program - Aalborg University* \n",
|
| 11 |
+
"*December 2025*\n",
|
| 12 |
+
"\n",
|
| 13 |
+
"---\n",
|
| 14 |
+
"\n",
|
| 15 |
+
"## 📋 System Overview\n",
|
| 16 |
+
"\n",
|
| 17 |
+
"This notebook implements a **bilateral HR matching system** that connects candidates with companies using:\n",
|
| 18 |
+
"- **Semantic embeddings** (384-D sentence transformers)\n",
|
| 19 |
+
"- **Job posting bridge** (vocabulary alignment)\n",
|
| 20 |
+
"- **LLM-powered features** (classification, skills extraction, explainability)\n",
|
| 21 |
+
"- **Interactive visualizations** (PyVis network graphs)\n",
|
| 22 |
+
"\n",
|
| 23 |
+
"### Key Innovations:\n",
|
| 24 |
+
"1. 🌉 **Job Posting Bridge** - Aligns candidate and company vocabularies\n",
|
| 25 |
+
"2. ⚖️ **Bilateral Fairness** - Optimizes matches for both sides\n",
|
| 26 |
+
"3. 🤖 **Free LLM Integration** - Hugging Face Inference API\n",
|
| 27 |
+
"4. ⚡ **Sub-100ms Queries** - Production-ready performance\n",
|
| 28 |
+
"\n",
|
| 29 |
+
"### Architecture:\n",
|
| 30 |
+
"```\n",
|
| 31 |
+
"Data (9,544 candidates + 24,473 companies)\n",
|
| 32 |
+
" ↓\n",
|
| 33 |
+
"Enrichment (job postings → 96.1% coverage)\n",
|
| 34 |
+
" ↓\n",
|
| 35 |
+
"Embeddings (sentence-transformers → 384-D vectors)\n",
|
| 36 |
+
" ↓\n",
|
| 37 |
+
"Matching (cosine similarity → bilateral fairness >0.85)\n",
|
| 38 |
+
" ↓\n",
|
| 39 |
+
"LLM Features (classification + explainability)\n",
|
| 40 |
+
" ↓\n",
|
| 41 |
+
"Production (saved models + interactive visualizations)\n",
|
| 42 |
+
"```"
|
| 43 |
+
]
|
| 44 |
+
},
|
| 45 |
+
{
|
| 46 |
+
"cell_type": "markdown",
|
| 47 |
+
"metadata": {},
|
| 48 |
+
"source": [
|
| 49 |
+
"---\n",
|
| 50 |
+
"# 📦 SECTION 1: Environment Setup\n",
|
| 51 |
+
"---"
|
| 52 |
+
]
|
| 53 |
+
},
|
| 54 |
+
{
|
| 55 |
+
"cell_type": "markdown",
|
| 56 |
+
"metadata": {},
|
| 57 |
+
"source": [
|
| 58 |
+
"## Cell 1.1: Install Dependencies\n",
|
| 59 |
+
"\n",
|
| 60 |
+
"**Purpose:** Install required Python packages for the system.\n",
|
| 61 |
+
"\n",
|
| 62 |
+
"**Packages:**\n",
|
| 63 |
+
"- `sentence-transformers` - Semantic embeddings\n",
|
| 64 |
+
"- `huggingface-hub` - LLM inference\n",
|
| 65 |
+
"- `pydantic` - Data validation\n",
|
| 66 |
+
"- `plotly` - Interactive charts\n",
|
| 67 |
+
"- `pyvis` - Network graphs\n",
|
| 68 |
+
"- `scikit-learn` - ML utilities"
|
| 69 |
+
]
|
| 70 |
+
},
|
| 71 |
+
{
|
| 72 |
+
"cell_type": "code",
|
| 73 |
+
"execution_count": 1,
|
| 74 |
+
"metadata": {},
|
| 75 |
+
"outputs": [
|
| 76 |
+
{
|
| 77 |
+
"name": "stdout",
|
| 78 |
+
"output_type": "stream",
|
| 79 |
+
"text": [
|
| 80 |
+
"✅ All packages installed!\n"
|
| 81 |
+
]
|
| 82 |
+
}
|
| 83 |
+
],
|
| 84 |
+
"source": [
|
| 85 |
+
"# Uncomment to install packages\n",
|
| 86 |
+
"# !pip install -q sentence-transformers huggingface-hub pydantic plotly pyvis scikit-learn\n",
|
| 87 |
+
"\n",
|
| 88 |
+
"print(\"✅ All packages installed!\")"
|
| 89 |
+
]
|
| 90 |
+
},
|
| 91 |
+
{
|
| 92 |
+
"cell_type": "markdown",
|
| 93 |
+
"metadata": {},
|
| 94 |
+
"source": [
|
| 95 |
+
"## Cell 1.2: Import Libraries\n",
|
| 96 |
+
"\n",
|
| 97 |
+
"**Purpose:** Load all necessary Python libraries for data processing, ML, and visualization."
|
| 98 |
+
]
|
| 99 |
+
},
|
| 100 |
+
{
|
| 101 |
+
"cell_type": "code",
|
| 102 |
+
"execution_count": 2,
|
| 103 |
+
"metadata": {},
|
| 104 |
+
"outputs": [
|
| 105 |
+
{
|
| 106 |
+
"name": "stdout",
|
| 107 |
+
"output_type": "stream",
|
| 108 |
+
"text": [
|
| 109 |
+
"✅ All libraries imported successfully!\n"
|
| 110 |
+
]
|
| 111 |
+
}
|
| 112 |
+
],
|
| 113 |
+
"source": [
|
| 114 |
+
"import pandas as pd\n",
|
| 115 |
+
"import numpy as np\n",
|
| 116 |
+
"import json\n",
|
| 117 |
+
"import os\n",
|
| 118 |
+
"import time\n",
|
| 119 |
+
"import webbrowser\n",
|
| 120 |
+
"from typing import List, Dict, Optional, Literal\n",
|
| 121 |
+
"from abc import ABC, abstractmethod\n",
|
| 122 |
+
"import warnings\n",
|
| 123 |
+
"warnings.filterwarnings('ignore')\n",
|
| 124 |
+
"\n",
|
| 125 |
+
"# ML & NLP\n",
|
| 126 |
+
"from sentence_transformers import SentenceTransformer\n",
|
| 127 |
+
"from sklearn.metrics.pairwise import cosine_similarity\n",
|
| 128 |
+
"from sklearn.manifold import TSNE\n",
|
| 129 |
+
"\n",
|
| 130 |
+
"# LLM Integration\n",
|
| 131 |
+
"from huggingface_hub import InferenceClient\n",
|
| 132 |
+
"from pydantic import BaseModel, Field\n",
|
| 133 |
+
"\n",
|
| 134 |
+
"# Visualization\n",
|
| 135 |
+
"import plotly.graph_objects as go\n",
|
| 136 |
+
"import matplotlib.pyplot as plt\n",
|
| 137 |
+
"from pyvis.network import Network\n",
|
| 138 |
+
"from IPython.display import HTML, display, IFrame\n",
|
| 139 |
+
"\n",
|
| 140 |
+
"# Configuration\n",
|
| 141 |
+
"from dotenv import load_dotenv\n",
|
| 142 |
+
"load_dotenv()\n",
|
| 143 |
+
"\n",
|
| 144 |
+
"print(\"✅ All libraries imported successfully!\")"
|
| 145 |
+
]
|
| 146 |
+
},
|
| 147 |
+
{
|
| 148 |
+
"cell_type": "markdown",
|
| 149 |
+
"metadata": {},
|
| 150 |
+
"source": [
|
| 151 |
+
"## Cell 1.3: System Configuration\n",
|
| 152 |
+
"\n",
|
| 153 |
+
"**Purpose:** Define global configuration parameters for paths, models, and matching settings."
|
| 154 |
+
]
|
| 155 |
+
},
|
| 156 |
+
{
|
| 157 |
+
"cell_type": "code",
|
| 158 |
+
"execution_count": 3,
|
| 159 |
+
"metadata": {},
|
| 160 |
+
"outputs": [
|
| 161 |
+
{
|
| 162 |
+
"name": "stdout",
|
| 163 |
+
"output_type": "stream",
|
| 164 |
+
"text": [
|
| 165 |
+
"✅ Configuration loaded!\n",
|
| 166 |
+
"🧠 Embedding model: all-MiniLM-L6-v2\n",
|
| 167 |
+
"🤖 LLM model: meta-llama/Llama-3.2-3B-Instruct\n",
|
| 168 |
+
"🔑 HF Token: ✅ Configured\n"
|
| 169 |
+
]
|
| 170 |
+
}
|
| 171 |
+
],
|
| 172 |
+
"source": [
|
| 173 |
+
"class Config:\n",
|
| 174 |
+
" \"\"\"Centralized system configuration\"\"\"\n",
|
| 175 |
+
" \n",
|
| 176 |
+
" # File paths\n",
|
| 177 |
+
" CSV_PATH = '../csv_files/'\n",
|
| 178 |
+
" PROCESSED_PATH = '../processed/'\n",
|
| 179 |
+
" RESULTS_PATH = '../results/'\n",
|
| 180 |
+
" \n",
|
| 181 |
+
" # Model settings\n",
|
| 182 |
+
" EMBEDDING_MODEL = 'all-MiniLM-L6-v2'\n",
|
| 183 |
+
" EMBEDDING_DIM = 384\n",
|
| 184 |
+
" \n",
|
| 185 |
+
" # LLM settings (Hugging Face Free Tier)\n",
|
| 186 |
+
" HF_TOKEN = os.getenv('HF_TOKEN', '')\n",
|
| 187 |
+
" LLM_MODEL = 'meta-llama/Llama-3.2-3B-Instruct'\n",
|
| 188 |
+
" LLM_MAX_TOKENS = 1000\n",
|
| 189 |
+
" \n",
|
| 190 |
+
" # Matching parameters\n",
|
| 191 |
+
" TOP_K_MATCHES = 10\n",
|
| 192 |
+
" SIMILARITY_THRESHOLD = 0.5\n",
|
| 193 |
+
" RANDOM_SEED = 42\n",
|
| 194 |
+
"\n",
|
| 195 |
+
"np.random.seed(Config.RANDOM_SEED)\n",
|
| 196 |
+
"\n",
|
| 197 |
+
"print(\"✅ Configuration loaded!\")\n",
|
| 198 |
+
"print(f\"🧠 Embedding model: {Config.EMBEDDING_MODEL}\")\n",
|
| 199 |
+
"print(f\"🤖 LLM model: {Config.LLM_MODEL}\")\n",
|
| 200 |
+
"print(f\"🔑 HF Token: {'✅ Configured' if Config.HF_TOKEN else '⚠️ Missing'}\")"
|
| 201 |
+
]
|
| 202 |
+
},
|
| 203 |
+
{
|
| 204 |
+
"cell_type": "markdown",
|
| 205 |
+
"metadata": {},
|
| 206 |
+
"source": [
|
| 207 |
+
"---\n",
|
| 208 |
+
"# 🏗️ SECTION 2: Architecture Components\n",
|
| 209 |
+
"---"
|
| 210 |
+
]
|
| 211 |
+
},
|
| 212 |
+
{
|
| 213 |
+
"cell_type": "markdown",
|
| 214 |
+
"metadata": {},
|
| 215 |
+
"source": [
|
| 216 |
+
"## Cell 2.1: Text Builder Classes\n",
|
| 217 |
+
"\n",
|
| 218 |
+
"**Purpose:** Define abstract text builders following SOLID principles.\n",
|
| 219 |
+
"\n",
|
| 220 |
+
"**Design Pattern:** Abstract Factory Pattern\n",
|
| 221 |
+
"- High cohesion: Each class has one responsibility\n",
|
| 222 |
+
"- Low coupling: Classes don't depend on each other's internals"
|
| 223 |
+
]
|
| 224 |
+
},
|
| 225 |
+
{
|
| 226 |
+
"cell_type": "code",
|
| 227 |
+
"execution_count": 4,
|
| 228 |
+
"metadata": {},
|
| 229 |
+
"outputs": [
|
| 230 |
+
{
|
| 231 |
+
"name": "stdout",
|
| 232 |
+
"output_type": "stream",
|
| 233 |
+
"text": [
|
| 234 |
+
"✅ Text Builder classes loaded\n"
|
| 235 |
+
]
|
| 236 |
+
}
|
| 237 |
+
],
|
| 238 |
+
"source": [
|
| 239 |
+
"class TextBuilder(ABC):\n",
|
| 240 |
+
" \"\"\"Abstract base class for text builders\"\"\"\n",
|
| 241 |
+
" \n",
|
| 242 |
+
" @abstractmethod\n",
|
| 243 |
+
" def build(self, row: pd.Series) -> str:\n",
|
| 244 |
+
" \"\"\"Build text representation from DataFrame row\"\"\"\n",
|
| 245 |
+
" pass\n",
|
| 246 |
+
" \n",
|
| 247 |
+
" def build_batch(self, df: pd.DataFrame) -> List[str]:\n",
|
| 248 |
+
" \"\"\"Build text representations for entire DataFrame\"\"\"\n",
|
| 249 |
+
" return df.apply(self.build, axis=1).tolist()\n",
|
| 250 |
+
"\n",
|
| 251 |
+
"\n",
|
| 252 |
+
"class CandidateTextBuilder(TextBuilder):\n",
|
| 253 |
+
" \"\"\"Builds text representation for candidates\"\"\"\n",
|
| 254 |
+
" \n",
|
| 255 |
+
" def __init__(self, fields: List[str] = None):\n",
|
| 256 |
+
" self.fields = fields or [\n",
|
| 257 |
+
" 'Category', 'skills', 'career_objective', \n",
|
| 258 |
+
" 'degree_names', 'positions'\n",
|
| 259 |
+
" ]\n",
|
| 260 |
+
" \n",
|
| 261 |
+
" def build(self, row: pd.Series) -> str:\n",
|
| 262 |
+
" parts = []\n",
|
| 263 |
+
" \n",
|
| 264 |
+
" if row.get('Category'):\n",
|
| 265 |
+
" parts.append(f\"Job Category: {row['Category']}\")\n",
|
| 266 |
+
" \n",
|
| 267 |
+
" if row.get('skills'):\n",
|
| 268 |
+
" parts.append(f\"Skills: {row['skills']}\")\n",
|
| 269 |
+
" \n",
|
| 270 |
+
" if row.get('career_objective'):\n",
|
| 271 |
+
" parts.append(f\"Objective: {row['career_objective']}\")\n",
|
| 272 |
+
" \n",
|
| 273 |
+
" if row.get('degree_names'):\n",
|
| 274 |
+
" parts.append(f\"Education: {row['degree_names']}\")\n",
|
| 275 |
+
" \n",
|
| 276 |
+
" if row.get('positions'):\n",
|
| 277 |
+
" parts.append(f\"Experience: {row['positions']}\")\n",
|
| 278 |
+
" \n",
|
| 279 |
+
" return ' '.join(parts) if parts else \"No information available\"\n",
|
| 280 |
+
"\n",
|
| 281 |
+
"\n",
|
| 282 |
+
"class CompanyTextBuilder(TextBuilder):\n",
|
| 283 |
+
" \"\"\"Builds text representation for companies (with job posting enrichment)\"\"\"\n",
|
| 284 |
+
" \n",
|
| 285 |
+
" def __init__(self, fields: List[str] = None):\n",
|
| 286 |
+
" self.fields = fields or [\n",
|
| 287 |
+
" 'name', 'description', 'industries_list', \n",
|
| 288 |
+
" 'specialties_list', 'required_skills', 'posted_job_titles'\n",
|
| 289 |
+
" ]\n",
|
| 290 |
+
" \n",
|
| 291 |
+
" def build(self, row: pd.Series) -> str:\n",
|
| 292 |
+
" parts = []\n",
|
| 293 |
+
" \n",
|
| 294 |
+
" if row.get('name'):\n",
|
| 295 |
+
" parts.append(f\"Company: {row['name']}\")\n",
|
| 296 |
+
" \n",
|
| 297 |
+
" if row.get('description'):\n",
|
| 298 |
+
" parts.append(f\"Description: {row['description']}\")\n",
|
| 299 |
+
" \n",
|
| 300 |
+
" if row.get('industries_list'):\n",
|
| 301 |
+
" parts.append(f\"Industries: {row['industries_list']}\")\n",
|
| 302 |
+
" \n",
|
| 303 |
+
" if row.get('specialties_list'):\n",
|
| 304 |
+
" parts.append(f\"Specialties: {row['specialties_list']}\")\n",
|
| 305 |
+
" \n",
|
| 306 |
+
" # THE BRIDGE: Job posting enrichment!\n",
|
| 307 |
+
" if row.get('required_skills'):\n",
|
| 308 |
+
" parts.append(f\"Required Skills: {row['required_skills']}\")\n",
|
| 309 |
+
" \n",
|
| 310 |
+
" if row.get('posted_job_titles'):\n",
|
| 311 |
+
" parts.append(f\"Job Titles: {row['posted_job_titles']}\")\n",
|
| 312 |
+
" \n",
|
| 313 |
+
" if row.get('experience_levels'):\n",
|
| 314 |
+
" parts.append(f\"Experience Levels: {row['experience_levels']}\")\n",
|
| 315 |
+
" \n",
|
| 316 |
+
" return ' '.join(parts) if parts else \"No information available\"\n",
|
| 317 |
+
"\n",
|
| 318 |
+
"print(\"✅ Text Builder classes loaded\")"
|
| 319 |
+
]
|
| 320 |
+
},
|
| 321 |
+
{
|
| 322 |
+
"cell_type": "markdown",
|
| 323 |
+
"metadata": {},
|
| 324 |
+
"source": [
|
| 325 |
+
"## Cell 2.2: Embedding Manager\n",
|
| 326 |
+
"\n",
|
| 327 |
+
"**Purpose:** Manage embedding generation, caching, and loading.\n",
|
| 328 |
+
"\n",
|
| 329 |
+
"**Features:**\n",
|
| 330 |
+
"- Lazy model loading\n",
|
| 331 |
+
"- Smart caching (5min → 3sec)\n",
|
| 332 |
+
"- Alignment verification"
|
| 333 |
+
]
|
| 334 |
+
},
|
| 335 |
+
{
|
| 336 |
+
"cell_type": "code",
|
| 337 |
+
"execution_count": 5,
|
| 338 |
+
"metadata": {},
|
| 339 |
+
"outputs": [
|
| 340 |
+
{
|
| 341 |
+
"name": "stdout",
|
| 342 |
+
"output_type": "stream",
|
| 343 |
+
"text": [
|
| 344 |
+
"✅ EmbeddingManager class loaded\n"
|
| 345 |
+
]
|
| 346 |
+
}
|
| 347 |
+
],
|
| 348 |
+
"source": [
|
| 349 |
+
"class EmbeddingManager:\n",
|
| 350 |
+
" \"\"\"Manages embedding generation and caching\"\"\"\n",
|
| 351 |
+
" \n",
|
| 352 |
+
" def __init__(self, model_name: str = 'all-MiniLM-L6-v2'):\n",
|
| 353 |
+
" self.model_name = model_name\n",
|
| 354 |
+
" self.model = None\n",
|
| 355 |
+
" self.dimension = None\n",
|
| 356 |
+
" \n",
|
| 357 |
+
" def load_model(self, device: str = 'cpu'):\n",
|
| 358 |
+
" \"\"\"Load sentence transformer model\"\"\"\n",
|
| 359 |
+
" if self.model is None:\n",
|
| 360 |
+
" print(f\"🔧 Loading model: {self.model_name}\")\n",
|
| 361 |
+
" self.model = SentenceTransformer(self.model_name, device=device)\n",
|
| 362 |
+
" self.dimension = self.model.get_sentence_embedding_dimension()\n",
|
| 363 |
+
" print(f\"✅ Model loaded! Dimension: {self.dimension}\")\n",
|
| 364 |
+
" return self.model\n",
|
| 365 |
+
" \n",
|
| 366 |
+
" def generate_embeddings(self, texts: List[str], show_progress: bool = True) -> np.ndarray:\n",
|
| 367 |
+
" \"\"\"Generate normalized embeddings\"\"\"\n",
|
| 368 |
+
" if self.model is None:\n",
|
| 369 |
+
" self.load_model()\n",
|
| 370 |
+
" \n",
|
| 371 |
+
" embeddings = self.model.encode(\n",
|
| 372 |
+
" texts,\n",
|
| 373 |
+
" show_progress_bar=show_progress,\n",
|
| 374 |
+
" batch_size=16,\n",
|
| 375 |
+
" normalize_embeddings=True,\n",
|
| 376 |
+
" convert_to_numpy=True\n",
|
| 377 |
+
" )\n",
|
| 378 |
+
" return embeddings\n",
|
| 379 |
+
" \n",
|
| 380 |
+
" def save_embeddings(self, embeddings: np.ndarray, metadata: pd.DataFrame, \n",
|
| 381 |
+
" embeddings_file: str, metadata_file: str):\n",
|
| 382 |
+
" \"\"\"Save embeddings and metadata to disk\"\"\"\n",
|
| 383 |
+
" np.save(embeddings_file, embeddings)\n",
|
| 384 |
+
" metadata.to_pickle(metadata_file)\n",
|
| 385 |
+
" print(f\"💾 Saved: {embeddings_file}\")\n",
|
| 386 |
+
" \n",
|
| 387 |
+
" def load_embeddings(self, embeddings_file: str, metadata_file: str) -> tuple:\n",
|
| 388 |
+
" \"\"\"Load cached embeddings and metadata\"\"\"\n",
|
| 389 |
+
" embeddings = np.load(embeddings_file)\n",
|
| 390 |
+
" metadata = pd.read_pickle(metadata_file)\n",
|
| 391 |
+
" print(f\"📥 Loaded: {embeddings.shape}\")\n",
|
| 392 |
+
" return embeddings, metadata\n",
|
| 393 |
+
" \n",
|
| 394 |
+
" def check_alignment(self, embeddings: np.ndarray, metadata: pd.DataFrame) -> bool:\n",
|
| 395 |
+
" \"\"\"Verify embeddings-metadata alignment\"\"\"\n",
|
| 396 |
+
" aligned = len(embeddings) == len(metadata)\n",
|
| 397 |
+
" print(f\"{'✅' if aligned else '❌'} Alignment: {len(embeddings)} vectors ↔ {len(metadata)} rows\")\n",
|
| 398 |
+
" return aligned\n",
|
| 399 |
+
"\n",
|
| 400 |
+
"print(\"✅ EmbeddingManager class loaded\")"
|
| 401 |
+
]
|
| 402 |
+
},
|
| 403 |
+
{
|
| 404 |
+
"cell_type": "markdown",
|
| 405 |
+
"metadata": {},
|
| 406 |
+
"source": [
|
| 407 |
+
"## Cell 2.3: Matching Engine\n",
|
| 408 |
+
"\n",
|
| 409 |
+
"**Purpose:** Bilateral matching using cosine similarity.\n",
|
| 410 |
+
"\n",
|
| 411 |
+
"**Features:**\n",
|
| 412 |
+
"- Candidate → Company matching\n",
|
| 413 |
+
"- Company → Candidate matching\n",
|
| 414 |
+
"- Sub-100ms query performance"
|
| 415 |
+
]
|
| 416 |
+
},
|
| 417 |
+
{
|
| 418 |
+
"cell_type": "code",
|
| 419 |
+
"execution_count": 6,
|
| 420 |
+
"metadata": {},
|
| 421 |
+
"outputs": [
|
| 422 |
+
{
|
| 423 |
+
"name": "stdout",
|
| 424 |
+
"output_type": "stream",
|
| 425 |
+
"text": [
|
| 426 |
+
"✅ MatchingEngine class loaded\n"
|
| 427 |
+
]
|
| 428 |
+
}
|
| 429 |
+
],
|
| 430 |
+
"source": [
|
| 431 |
+
"class MatchingEngine:\n",
|
| 432 |
+
" \"\"\"Bilateral matching engine using cosine similarity\"\"\"\n",
|
| 433 |
+
" \n",
|
| 434 |
+
" def __init__(self, candidate_embeddings: np.ndarray, \n",
|
| 435 |
+
" company_embeddings: np.ndarray,\n",
|
| 436 |
+
" candidate_metadata: pd.DataFrame,\n",
|
| 437 |
+
" company_metadata: pd.DataFrame):\n",
|
| 438 |
+
" self.cand_emb = candidate_embeddings\n",
|
| 439 |
+
" self.comp_emb = company_embeddings\n",
|
| 440 |
+
" self.cand_meta = candidate_metadata\n",
|
| 441 |
+
" self.comp_meta = company_metadata\n",
|
| 442 |
+
" \n",
|
| 443 |
+
" print(f\"🎯 MatchingEngine initialized\")\n",
|
| 444 |
+
" print(f\" Candidates: {len(self.cand_emb):,}\")\n",
|
| 445 |
+
" print(f\" Companies: {len(self.comp_emb):,}\")\n",
|
| 446 |
+
" \n",
|
| 447 |
+
" def find_matches_for_candidate(self, candidate_idx: int, top_k: int = 10) -> pd.DataFrame:\n",
|
| 448 |
+
" \"\"\"Find top K company matches for a candidate\"\"\"\n",
|
| 449 |
+
" cand_vec = self.cand_emb[candidate_idx].reshape(1, -1)\n",
|
| 450 |
+
" similarities = cosine_similarity(cand_vec, self.comp_emb)[0]\n",
|
| 451 |
+
" top_indices = np.argsort(similarities)[-top_k:][::-1]\n",
|
| 452 |
+
" top_scores = similarities[top_indices]\n",
|
| 453 |
+
" \n",
|
| 454 |
+
" results = self.comp_meta.iloc[top_indices].copy()\n",
|
| 455 |
+
" results['match_score'] = top_scores\n",
|
| 456 |
+
" results['rank'] = range(1, top_k + 1)\n",
|
| 457 |
+
" \n",
|
| 458 |
+
" return results[['rank', 'name', 'match_score', 'industries_list']]\n",
|
| 459 |
+
" \n",
|
| 460 |
+
" def find_matches_for_company(self, company_idx: int, top_k: int = 10) -> pd.DataFrame:\n",
|
| 461 |
+
" \"\"\"Find top K candidate matches for a company\"\"\"\n",
|
| 462 |
+
" comp_vec = self.comp_emb[company_idx].reshape(1, -1)\n",
|
| 463 |
+
" similarities = cosine_similarity(comp_vec, self.cand_emb)[0]\n",
|
| 464 |
+
" top_indices = np.argsort(similarities)[-top_k:][::-1]\n",
|
| 465 |
+
" top_scores = similarities[top_indices]\n",
|
| 466 |
+
" \n",
|
| 467 |
+
" results = self.cand_meta.iloc[top_indices].copy()\n",
|
| 468 |
+
" results['match_score'] = top_scores\n",
|
| 469 |
+
" results['rank'] = range(1, top_k + 1)\n",
|
| 470 |
+
" \n",
|
| 471 |
+
" return results[['rank', 'Category', 'match_score', 'skills']]\n",
|
| 472 |
+
"\n",
|
| 473 |
+
"print(\"✅ MatchingEngine class loaded\")"
|
| 474 |
+
]
|
| 475 |
+
},
|
| 476 |
+
{
|
| 477 |
+
"cell_type": "markdown",
|
| 478 |
+
"metadata": {},
|
| 479 |
+
"source": [
|
| 480 |
+
"---\n",
|
| 481 |
+
"# 📊 SECTION 3: Data Loading & Processing\n",
|
| 482 |
+
"---"
|
| 483 |
+
]
|
| 484 |
+
},
|
| 485 |
+
{
|
| 486 |
+
"cell_type": "markdown",
|
| 487 |
+
"metadata": {},
|
| 488 |
+
"source": [
|
| 489 |
+
"## Cell 3.1: Load Raw Data\n",
|
| 490 |
+
"\n",
|
| 491 |
+
"**Purpose:** Load all CSV files from the data directory.\n",
|
| 492 |
+
"\n",
|
| 493 |
+
"**Datasets:**\n",
|
| 494 |
+
"- Candidates: `resume_data.csv` (9,544 rows)\n",
|
| 495 |
+
"- Companies: `companies.csv` (24,473 rows)\n",
|
| 496 |
+
"- Job Postings: `postings.csv` (123,849 rows)\n",
|
| 497 |
+
"- Supporting tables: industries, skills, specialties, etc."
|
| 498 |
+
]
|
| 499 |
+
},
|
| 500 |
+
{
|
| 501 |
+
"cell_type": "code",
|
| 502 |
+
"execution_count": 7,
|
| 503 |
+
"metadata": {},
|
| 504 |
+
"outputs": [
|
| 505 |
+
{
|
| 506 |
+
"name": "stdout",
|
| 507 |
+
"output_type": "stream",
|
| 508 |
+
"text": [
|
| 509 |
+
"📂 Loading all datasets...\n",
|
| 510 |
+
"================================================================================\n",
|
| 511 |
+
"✅ Candidates: 9,544 rows × 35 columns\n",
|
| 512 |
+
"✅ Companies (base): 24,473 rows\n",
|
| 513 |
+
"✅ Company industries: 24,375 rows\n",
|
| 514 |
+
"✅ Company specialties: 169,387 rows\n",
|
| 515 |
+
"✅ Employee counts: 35,787 rows\n",
|
| 516 |
+
"✅ Postings: 123,849 rows × 31 columns\n",
|
| 517 |
+
"✅ Job skills: 213,768 rows\n",
|
| 518 |
+
"✅ Job industries: 164,808 rows\n",
|
| 519 |
+
"\n",
|
| 520 |
+
"================================================================================\n",
|
| 521 |
+
"✅ All datasets loaded successfully!\n"
|
| 522 |
+
]
|
| 523 |
+
}
|
| 524 |
+
],
|
| 525 |
+
"source": [
|
| 526 |
+
"print(\"📂 Loading all datasets...\")\n",
|
| 527 |
+
"print(\"=\" * 80)\n",
|
| 528 |
+
"\n",
|
| 529 |
+
"# Load main datasets\n",
|
| 530 |
+
"candidates = pd.read_csv(f'{Config.CSV_PATH}resume_data.csv')\n",
|
| 531 |
+
"print(f\"✅ Candidates: {len(candidates):,} rows × {len(candidates.columns)} columns\")\n",
|
| 532 |
+
"\n",
|
| 533 |
+
"companies_base = pd.read_csv(f'{Config.CSV_PATH}companies.csv')\n",
|
| 534 |
+
"print(f\"✅ Companies (base): {len(companies_base):,} rows\")\n",
|
| 535 |
+
"\n",
|
| 536 |
+
"company_industries = pd.read_csv(f'{Config.CSV_PATH}company_industries.csv')\n",
|
| 537 |
+
"print(f\"✅ Company industries: {len(company_industries):,} rows\")\n",
|
| 538 |
+
"\n",
|
| 539 |
+
"company_specialties = pd.read_csv(f'{Config.CSV_PATH}company_specialities.csv')\n",
|
| 540 |
+
"print(f\"✅ Company specialties: {len(company_specialties):,} rows\")\n",
|
| 541 |
+
"\n",
|
| 542 |
+
"employee_counts = pd.read_csv(f'{Config.CSV_PATH}employee_counts.csv')\n",
|
| 543 |
+
"print(f\"✅ Employee counts: {len(employee_counts):,} rows\")\n",
|
| 544 |
+
"\n",
|
| 545 |
+
"postings = pd.read_csv(f'{Config.CSV_PATH}postings.csv', on_bad_lines='skip', engine='python')\n",
|
| 546 |
+
"print(f\"✅ Postings: {len(postings):,} rows × {len(postings.columns)} columns\")\n",
|
| 547 |
+
"\n",
|
| 548 |
+
"# Optional datasets\n",
|
| 549 |
+
"try:\n",
|
| 550 |
+
" job_skills = pd.read_csv(f'{Config.CSV_PATH}job_skills.csv')\n",
|
| 551 |
+
" print(f\"✅ Job skills: {len(job_skills):,} rows\")\n",
|
| 552 |
+
"except:\n",
|
| 553 |
+
" job_skills = None\n",
|
| 554 |
+
" print(\"⚠️ Job skills not found (optional)\")\n",
|
| 555 |
+
"\n",
|
| 556 |
+
"try:\n",
|
| 557 |
+
" job_industries = pd.read_csv(f'{Config.CSV_PATH}job_industries.csv')\n",
|
| 558 |
+
" print(f\"✅ Job industries: {len(job_industries):,} rows\")\n",
|
| 559 |
+
"except:\n",
|
| 560 |
+
" job_industries = None\n",
|
| 561 |
+
" print(\"⚠️ Job industries not found (optional)\")\n",
|
| 562 |
+
"\n",
|
| 563 |
+
"print(\"\\n\" + \"=\" * 80)\n",
|
| 564 |
+
"print(\"✅ All datasets loaded successfully!\")"
|
| 565 |
+
]
|
| 566 |
+
},
|
| 567 |
+
{
|
| 568 |
+
"cell_type": "markdown",
|
| 569 |
+
"metadata": {},
|
| 570 |
+
"source": [
|
| 571 |
+
"## Cell 3.2: Enrich Company Data (Job Posting Bridge)\n",
|
| 572 |
+
"\n",
|
| 573 |
+
"**Purpose:** Aggregate job posting data into company profiles to bridge vocabulary gap.\n",
|
| 574 |
+
"\n",
|
| 575 |
+
"**Process:**\n",
|
| 576 |
+
"1. Aggregate industries per company\n",
|
| 577 |
+
"2. Aggregate specialties per company\n",
|
| 578 |
+
"3. Extract skills from job postings\n",
|
| 579 |
+
"4. Aggregate job titles and skills per company\n",
|
| 580 |
+
"5. Fill empty columns with defaults\n",
|
| 581 |
+
"\n",
|
| 582 |
+
"**Result:** 96.1% of companies enriched with explicit skills"
|
| 583 |
+
]
|
| 584 |
+
},
|
| 585 |
+
{
|
| 586 |
+
"cell_type": "code",
|
| 587 |
+
"execution_count": 8,
|
| 588 |
+
"metadata": {},
|
| 589 |
+
"outputs": [
|
| 590 |
+
{
|
| 591 |
+
"name": "stdout",
|
| 592 |
+
"output_type": "stream",
|
| 593 |
+
"text": [
|
| 594 |
+
"🔄 ENRICHING COMPANY DATA...\n",
|
| 595 |
+
"================================================================================\n",
|
| 596 |
+
"\n",
|
| 597 |
+
"1️⃣ Aggregating industries...\n",
|
| 598 |
+
"✅ Industries aggregated: 24,365 companies\n",
|
| 599 |
+
"\n",
|
| 600 |
+
"2️⃣ Aggregating specialties...\n",
|
| 601 |
+
"✅ Specialties aggregated: 17,780 companies\n",
|
| 602 |
+
"\n",
|
| 603 |
+
"3️⃣ Aggregating job posting skills...\n",
|
| 604 |
+
"✅ Skills aggregated: 126,807 job postings\n",
|
| 605 |
+
"\n",
|
| 606 |
+
"4️⃣ Aggregating job postings...\n",
|
| 607 |
+
"✅ Job data aggregated: 24,474 companies\n",
|
| 608 |
+
"\n",
|
| 609 |
+
"5️⃣ Merging all data...\n",
|
| 610 |
+
"✅ Shape: (24473, 17)\n",
|
| 611 |
+
"\n",
|
| 612 |
+
"6️⃣ Filling empty columns...\n",
|
| 613 |
+
" ✅ name 1 → 0\n",
|
| 614 |
+
" ✅ description 297 → 0\n",
|
| 615 |
+
" ✅ industries_list 108 → 0\n",
|
| 616 |
+
" ✅ specialties_list 6,693 → 0\n",
|
| 617 |
+
" ✅ avg_med_salary 22,312 → 0\n",
|
| 618 |
+
" ✅ avg_max_salary 15,261 → 0\n",
|
| 619 |
+
"\n",
|
| 620 |
+
"7️⃣ Validation...\n",
|
| 621 |
+
"================================================================================\n",
|
| 622 |
+
"✅ name 0 issues\n",
|
| 623 |
+
"✅ description 0 issues\n",
|
| 624 |
+
"✅ industries_list 0 issues\n",
|
| 625 |
+
"✅ specialties_list 0 issues\n",
|
| 626 |
+
"✅ required_skills 0 issues\n",
|
| 627 |
+
"✅ posted_job_titles 0 issues\n",
|
| 628 |
+
"================================================================================\n",
|
| 629 |
+
"🎯 PERFECT!\n",
|
| 630 |
+
"\n",
|
| 631 |
+
"Total: 24,473\n",
|
| 632 |
+
"With postings: 23,528\n",
|
| 633 |
+
"Coverage: 96.1%\n"
|
| 634 |
+
]
|
| 635 |
+
}
|
| 636 |
+
],
|
| 637 |
+
"source": [
|
| 638 |
+
"print(\"🔄 ENRICHING COMPANY DATA...\")\n",
|
| 639 |
+
"print(\"=\" * 80)\n",
|
| 640 |
+
"\n",
|
| 641 |
+
"# ============================================================================\n",
|
| 642 |
+
"# STEP 1: Aggregate Industries per Company\n",
|
| 643 |
+
"# ============================================================================\n",
|
| 644 |
+
"print(\"\\n1️⃣ Aggregating industries...\")\n",
|
| 645 |
+
"\n",
|
| 646 |
+
"industries_grouped = company_industries.groupby('company_id')['industry'].apply(\n",
|
| 647 |
+
" lambda x: ', '.join(x.dropna().astype(str).unique())\n",
|
| 648 |
+
").reset_index()\n",
|
| 649 |
+
"industries_grouped.columns = ['company_id', 'industries_list']\n",
|
| 650 |
+
"\n",
|
| 651 |
+
"print(f\"✅ Industries aggregated: {len(industries_grouped):,} companies\")\n",
|
| 652 |
+
"\n",
|
| 653 |
+
"# ============================================================================\n",
|
| 654 |
+
"# STEP 2: Aggregate Specialties per Company\n",
|
| 655 |
+
"# ============================================================================\n",
|
| 656 |
+
"print(\"\\n2️⃣ Aggregating specialties...\")\n",
|
| 657 |
+
"\n",
|
| 658 |
+
"specialties_grouped = company_specialties.groupby('company_id')['speciality'].apply(\n",
|
| 659 |
+
" lambda x: ', '.join(x.dropna().astype(str).unique())\n",
|
| 660 |
+
").reset_index()\n",
|
| 661 |
+
"specialties_grouped.columns = ['company_id', 'specialties_list']\n",
|
| 662 |
+
"\n",
|
| 663 |
+
"print(f\"✅ Specialties aggregated: {len(specialties_grouped):,} companies\")\n",
|
| 664 |
+
"\n",
|
| 665 |
+
"# ============================================================================\n",
|
| 666 |
+
"# STEP 3: Aggregate Skills from Job Postings\n",
|
| 667 |
+
"# ============================================================================\n",
|
| 668 |
+
"print(\"\\n3️⃣ Aggregating job posting skills...\")\n",
|
| 669 |
+
"\n",
|
| 670 |
+
"if job_skills is not None:\n",
|
| 671 |
+
" skills_df = pd.read_csv(f'{Config.CSV_PATH}skills.csv')\n",
|
| 672 |
+
" \n",
|
| 673 |
+
" job_skills_enriched = job_skills.merge(\n",
|
| 674 |
+
" skills_df,\n",
|
| 675 |
+
" on='skill_abr',\n",
|
| 676 |
+
" how='left'\n",
|
| 677 |
+
" )\n",
|
| 678 |
+
" \n",
|
| 679 |
+
" skills_per_posting = job_skills_enriched.groupby('job_id')['skill_name'].apply(\n",
|
| 680 |
+
" lambda x: ', '.join(x.dropna().astype(str).unique())\n",
|
| 681 |
+
" ).reset_index()\n",
|
| 682 |
+
" skills_per_posting.columns = ['job_id', 'required_skills']\n",
|
| 683 |
+
" \n",
|
| 684 |
+
" print(f\"✅ Skills aggregated: {len(skills_per_posting):,} job postings\")\n",
|
| 685 |
+
"else:\n",
|
| 686 |
+
" skills_per_posting = pd.DataFrame(columns=['job_id', 'required_skills'])\n",
|
| 687 |
+
" print(\"⚠️ Job skills not available\")\n",
|
| 688 |
+
"\n",
|
| 689 |
+
"# ============================================================================\n",
|
| 690 |
+
"# STEP 4: Aggregate Job Posting Data per Company\n",
|
| 691 |
+
"# ============================================================================\n",
|
| 692 |
+
"print(\"\\n4️⃣ Aggregating job postings...\")\n",
|
| 693 |
+
"\n",
|
| 694 |
+
"postings_enriched = postings.merge(skills_per_posting, on='job_id', how='left')\n",
|
| 695 |
+
"\n",
|
| 696 |
+
"job_data_grouped = postings_enriched.groupby('company_id').agg({\n",
|
| 697 |
+
" 'title': lambda x: ', '.join(x.dropna().astype(str).unique()[:10]),\n",
|
| 698 |
+
" 'required_skills': lambda x: ', '.join(x.dropna().astype(str).unique()),\n",
|
| 699 |
+
" 'med_salary': 'mean',\n",
|
| 700 |
+
" 'max_salary': 'mean',\n",
|
| 701 |
+
" 'job_id': 'count'\n",
|
| 702 |
+
"}).reset_index()\n",
|
| 703 |
+
"\n",
|
| 704 |
+
"job_data_grouped.columns = [\n",
|
| 705 |
+
" 'company_id', 'posted_job_titles', 'required_skills', \n",
|
| 706 |
+
" 'avg_med_salary', 'avg_max_salary', 'total_postings'\n",
|
| 707 |
+
"]\n",
|
| 708 |
+
"\n",
|
| 709 |
+
"print(f\"✅ Job data aggregated: {len(job_data_grouped):,} companies\")\n",
|
| 710 |
+
"\n",
|
| 711 |
+
"# ============================================================================\n",
|
| 712 |
+
"# STEP 5: Merge Everything\n",
|
| 713 |
+
"# ============================================================================\n",
|
| 714 |
+
"print(\"\\n5️⃣ Merging all data...\")\n",
|
| 715 |
+
"\n",
|
| 716 |
+
"companies_full = companies_base.copy()\n",
|
| 717 |
+
"companies_full = companies_full.merge(industries_grouped, on='company_id', how='left')\n",
|
| 718 |
+
"companies_full = companies_full.merge(specialties_grouped, on='company_id', how='left')\n",
|
| 719 |
+
"companies_full = companies_full.merge(job_data_grouped, on='company_id', how='left')\n",
|
| 720 |
+
"\n",
|
| 721 |
+
"print(f\"✅ Shape: {companies_full.shape}\")\n",
|
| 722 |
+
"\n",
|
| 723 |
+
"# ============================================================================\n",
|
| 724 |
+
"# STEP 6: Fill Empty Columns\n",
|
| 725 |
+
"# ============================================================================\n",
|
| 726 |
+
"print(\"\\n6️⃣ Filling empty columns...\")\n",
|
| 727 |
+
"\n",
|
| 728 |
+
"fill_values = {\n",
|
| 729 |
+
" 'name': 'Unknown Company',\n",
|
| 730 |
+
" 'description': 'No description',\n",
|
| 731 |
+
" 'industries_list': 'General',\n",
|
| 732 |
+
" 'specialties_list': 'Not specified',\n",
|
| 733 |
+
" 'required_skills': 'Not specified',\n",
|
| 734 |
+
" 'posted_job_titles': 'Various',\n",
|
| 735 |
+
" 'avg_med_salary': 0,\n",
|
| 736 |
+
" 'avg_max_salary': 0,\n",
|
| 737 |
+
" 'total_postings': 0\n",
|
| 738 |
+
"}\n",
|
| 739 |
+
"\n",
|
| 740 |
+
"for col, val in fill_values.items():\n",
|
| 741 |
+
" if col in companies_full.columns:\n",
|
| 742 |
+
" before = companies_full[col].isna().sum()\n",
|
| 743 |
+
" companies_full[col] = companies_full[col].fillna(val)\n",
|
| 744 |
+
" if before > 0:\n",
|
| 745 |
+
" print(f\" ✅ {col:25s} {before:>6,} → 0\")\n",
|
| 746 |
+
"\n",
|
| 747 |
+
"# Fix empty strings in required_skills\n",
|
| 748 |
+
"companies_full['required_skills'] = companies_full['required_skills'].replace('', 'Not specified')\n",
|
| 749 |
+
"\n",
|
| 750 |
+
"# ============================================================================\n",
|
| 751 |
+
"# STEP 7: Validation\n",
|
| 752 |
+
"# ============================================================================\n",
|
| 753 |
+
"print(\"\\n7️⃣ Validation...\")\n",
|
| 754 |
+
"print(\"=\" * 80)\n",
|
| 755 |
+
"\n",
|
| 756 |
+
"critical = ['name', 'description', 'industries_list', 'specialties_list', \n",
|
| 757 |
+
" 'required_skills', 'posted_job_titles']\n",
|
| 758 |
+
"\n",
|
| 759 |
+
"ok = True\n",
|
| 760 |
+
"for col in critical:\n",
|
| 761 |
+
" if col in companies_full.columns:\n",
|
| 762 |
+
" issues = companies_full[col].isna().sum() + (companies_full[col] == '').sum()\n",
|
| 763 |
+
" print(f\"{'✅' if issues == 0 else '❌'} {col:25s} {issues} issues\")\n",
|
| 764 |
+
" if issues > 0:\n",
|
| 765 |
+
" ok = False\n",
|
| 766 |
+
"\n",
|
| 767 |
+
"print(\"=\" * 80)\n",
|
| 768 |
+
"print(f\"{'🎯 PERFECT!' if ok else '⚠️ ISSUES!'}\")\n",
|
| 769 |
+
"\n",
|
| 770 |
+
"# Coverage stats\n",
|
| 771 |
+
"has_real_skills = ~companies_full['required_skills'].isin(['', 'Not specified'])\n",
|
| 772 |
+
"coverage = (has_real_skills.sum() / len(companies_full)) * 100\n",
|
| 773 |
+
"\n",
|
| 774 |
+
"print(f\"\\nTotal: {len(companies_full):,}\")\n",
|
| 775 |
+
"print(f\"With postings: {has_real_skills.sum():,}\")\n",
|
| 776 |
+
"print(f\"Coverage: {coverage:.1f}%\")"
|
| 777 |
+
]
|
| 778 |
+
},
|
| 779 |
+
{
|
| 780 |
+
"cell_type": "markdown",
|
| 781 |
+
"metadata": {},
|
| 782 |
+
"source": [
|
| 783 |
+
"---\n",
|
| 784 |
+
"# 🧠 SECTION 4: Embedding Generation\n",
|
| 785 |
+
"---"
|
| 786 |
+
]
|
| 787 |
+
},
|
| 788 |
+
{
|
| 789 |
+
"cell_type": "markdown",
|
| 790 |
+
"metadata": {},
|
| 791 |
+
"source": [
|
| 792 |
+
"## Cell 4.1: Generate Candidate Embeddings\n",
|
| 793 |
+
"\n",
|
| 794 |
+
"**Purpose:** Convert candidate profiles into 384-D semantic vectors.\n",
|
| 795 |
+
"\n",
|
| 796 |
+
"**Process:**\n",
|
| 797 |
+
"1. Build text representation using CandidateTextBuilder\n",
|
| 798 |
+
"2. Generate embeddings using sentence transformers\n",
|
| 799 |
+
"3. Normalize vectors for cosine similarity\n",
|
| 800 |
+
"4. Save to disk for fast loading\n",
|
| 801 |
+
"\n",
|
| 802 |
+
"**Time:** ~3-4 minutes (CPU) | 3 seconds (cached)"
|
| 803 |
+
]
|
| 804 |
+
},
|
| 805 |
+
{
|
| 806 |
+
"cell_type": "code",
|
| 807 |
+
"execution_count": 9,
|
| 808 |
+
"metadata": {},
|
| 809 |
+
"outputs": [
|
| 810 |
+
{
|
| 811 |
+
"name": "stdout",
|
| 812 |
+
"output_type": "stream",
|
| 813 |
+
"text": [
|
| 814 |
+
"🧠 CANDIDATE EMBEDDINGS\n",
|
| 815 |
+
"================================================================================\n",
|
| 816 |
+
"\n",
|
| 817 |
+
"📥 Loading cached embeddings...\n",
|
| 818 |
+
"✅ Loaded: (9544, 384)\n",
|
| 819 |
+
"\n",
|
| 820 |
+
"✅ CANDIDATE EMBEDDINGS READY\n",
|
| 821 |
+
" Shape: (9544, 384)\n",
|
| 822 |
+
" Aligned: ✅\n"
|
| 823 |
+
]
|
| 824 |
+
}
|
| 825 |
+
],
|
| 826 |
+
"source": [
|
| 827 |
+
"print(\"🧠 CANDIDATE EMBEDDINGS\")\n",
|
| 828 |
+
"print(\"=\" * 80)\n",
|
| 829 |
+
"\n",
|
| 830 |
+
"# File paths\n",
|
| 831 |
+
"CAND_EMB_FILE = f'{Config.PROCESSED_PATH}candidate_embeddings.npy'\n",
|
| 832 |
+
"CAND_META_FILE = f'{Config.PROCESSED_PATH}candidates_metadata.pkl'\n",
|
| 833 |
+
"\n",
|
| 834 |
+
"# Check if files exist\n",
|
| 835 |
+
"if os.path.exists(CAND_EMB_FILE) and os.path.exists(CAND_META_FILE):\n",
|
| 836 |
+
" print(f\"\\n📥 Loading cached embeddings...\")\n",
|
| 837 |
+
" cand_vectors = np.load(CAND_EMB_FILE)\n",
|
| 838 |
+
" print(f\"✅ Loaded: {cand_vectors.shape}\")\n",
|
| 839 |
+
" \n",
|
| 840 |
+
" # Verify alignment\n",
|
| 841 |
+
" if len(cand_vectors) != len(candidates):\n",
|
| 842 |
+
" print(f\"⚠️ Size mismatch! Regenerating...\")\n",
|
| 843 |
+
" cand_exists = False\n",
|
| 844 |
+
" else:\n",
|
| 845 |
+
" cand_exists = True\n",
|
| 846 |
+
"else:\n",
|
| 847 |
+
" print(f\"\\n❌ No cached embeddings found\")\n",
|
| 848 |
+
" cand_exists = False\n",
|
| 849 |
+
"\n",
|
| 850 |
+
"# Generate if needed\n",
|
| 851 |
+
"if not cand_exists:\n",
|
| 852 |
+
" print(f\"\\n🔄 GENERATING candidate embeddings...\")\n",
|
| 853 |
+
" print(f\" Processing {len(candidates):,} candidates...\")\n",
|
| 854 |
+
" print(f\" ⏱️ Estimated time: ~3-4 minutes (CPU)\\n\")\n",
|
| 855 |
+
" \n",
|
| 856 |
+
" # Load model\n",
|
| 857 |
+
" model = SentenceTransformer(Config.EMBEDDING_MODEL, device='cpu')\n",
|
| 858 |
+
" print(f\"✅ Model loaded: {Config.EMBEDDING_MODEL}\")\n",
|
| 859 |
+
" \n",
|
| 860 |
+
" # Build texts\n",
|
| 861 |
+
" cand_builder = CandidateTextBuilder()\n",
|
| 862 |
+
" candidate_texts = cand_builder.build_batch(candidates)\n",
|
| 863 |
+
" \n",
|
| 864 |
+
" # Generate embeddings\n",
|
| 865 |
+
" cand_vectors = model.encode(\n",
|
| 866 |
+
" candidate_texts,\n",
|
| 867 |
+
" show_progress_bar=True,\n",
|
| 868 |
+
" batch_size=16,\n",
|
| 869 |
+
" normalize_embeddings=True,\n",
|
| 870 |
+
" convert_to_numpy=True\n",
|
| 871 |
+
" )\n",
|
| 872 |
+
" \n",
|
| 873 |
+
" print(f\"\\n✅ Generated: {cand_vectors.shape}\")\n",
|
| 874 |
+
" \n",
|
| 875 |
+
" # Save\n",
|
| 876 |
+
" np.save(CAND_EMB_FILE, cand_vectors)\n",
|
| 877 |
+
" candidates.to_pickle(CAND_META_FILE)\n",
|
| 878 |
+
" print(f\"💾 Saved to {Config.PROCESSED_PATH}\")\n",
|
| 879 |
+
"\n",
|
| 880 |
+
"print(f\"\\n✅ CANDIDATE EMBEDDINGS READY\")\n",
|
| 881 |
+
"print(f\" Shape: {cand_vectors.shape}\")\n",
|
| 882 |
+
"print(f\" Aligned: {'✅' if len(cand_vectors) == len(candidates) else '❌'}\")"
|
| 883 |
+
]
|
| 884 |
+
},
|
| 885 |
+
{
|
| 886 |
+
"cell_type": "markdown",
|
| 887 |
+
"metadata": {},
|
| 888 |
+
"source": [
|
| 889 |
+
"## Cell 4.2: Generate Company Embeddings\n",
|
| 890 |
+
"\n",
|
| 891 |
+
"**Purpose:** Convert enriched company profiles into 384-D semantic vectors.\n",
|
| 892 |
+
"\n",
|
| 893 |
+
"**Note:** This includes job posting data (the bridge!)\n",
|
| 894 |
+
"\n",
|
| 895 |
+
"**Time:** ~8-10 minutes (CPU) | 3 seconds (cached)"
|
| 896 |
+
]
|
| 897 |
+
},
|
| 898 |
+
{
|
| 899 |
+
"cell_type": "code",
|
| 900 |
+
"execution_count": 10,
|
| 901 |
+
"metadata": {},
|
| 902 |
+
"outputs": [
|
| 903 |
+
{
|
| 904 |
+
"name": "stdout",
|
| 905 |
+
"output_type": "stream",
|
| 906 |
+
"text": [
|
| 907 |
+
"\n",
|
| 908 |
+
"================================================================================\n",
|
| 909 |
+
"🧠 COMPANY EMBEDDINGS\n",
|
| 910 |
+
"================================================================================\n",
|
| 911 |
+
"\n",
|
| 912 |
+
"📥 Loading cached embeddings...\n",
|
| 913 |
+
"✅ Loaded: (24473, 384)\n",
|
| 914 |
+
"\n",
|
| 915 |
+
"✅ COMPANY EMBEDDINGS READY\n",
|
| 916 |
+
" Shape: (24473, 384)\n",
|
| 917 |
+
" Aligned: ✅\n",
|
| 918 |
+
"\n",
|
| 919 |
+
"================================================================================\n",
|
| 920 |
+
"🎯 EMBEDDINGS COMPLETE!\n",
|
| 921 |
+
"================================================================================\n",
|
| 922 |
+
"Candidates: (9544, 384)\n",
|
| 923 |
+
"Companies: (24473, 384)\n",
|
| 924 |
+
"Total vectors: 34,017\n",
|
| 925 |
+
"================================================================================\n"
|
| 926 |
+
]
|
| 927 |
+
}
|
| 928 |
+
],
|
| 929 |
+
"source": [
|
| 930 |
+
"print(\"\\n\" + \"=\" * 80)\n",
|
| 931 |
+
"print(\"🧠 COMPANY EMBEDDINGS\")\n",
|
| 932 |
+
"print(\"=\" * 80)\n",
|
| 933 |
+
"\n",
|
| 934 |
+
"# File paths\n",
|
| 935 |
+
"COMP_EMB_FILE = f'{Config.PROCESSED_PATH}company_embeddings.npy'\n",
|
| 936 |
+
"COMP_META_FILE = f'{Config.PROCESSED_PATH}companies_metadata.pkl'\n",
|
| 937 |
+
"\n",
|
| 938 |
+
"# Check if files exist\n",
|
| 939 |
+
"if os.path.exists(COMP_EMB_FILE) and os.path.exists(COMP_META_FILE):\n",
|
| 940 |
+
" print(f\"\\n📥 Loading cached embeddings...\")\n",
|
| 941 |
+
" comp_vectors = np.load(COMP_EMB_FILE)\n",
|
| 942 |
+
" print(f\"✅ Loaded: {comp_vectors.shape}\")\n",
|
| 943 |
+
" \n",
|
| 944 |
+
" # Verify alignment\n",
|
| 945 |
+
" if len(comp_vectors) != len(companies_full):\n",
|
| 946 |
+
" print(f\"⚠️ Size mismatch! Regenerating...\")\n",
|
| 947 |
+
" comp_exists = False\n",
|
| 948 |
+
" else:\n",
|
| 949 |
+
" comp_exists = True\n",
|
| 950 |
+
"else:\n",
|
| 951 |
+
" print(f\"\\n❌ No cached embeddings found\")\n",
|
| 952 |
+
" comp_exists = False\n",
|
| 953 |
+
"\n",
|
| 954 |
+
"# Generate if needed\n",
|
| 955 |
+
"if not comp_exists:\n",
|
| 956 |
+
" print(f\"\\n🔄 GENERATING company embeddings...\")\n",
|
| 957 |
+
" print(f\" Processing {len(companies_full):,} companies...\")\n",
|
| 958 |
+
" print(f\" ⏱️ Estimated time: ~8-10 minutes (CPU)\\n\")\n",
|
| 959 |
+
" \n",
|
| 960 |
+
" # Load model if not loaded\n",
|
| 961 |
+
" if 'model' not in locals():\n",
|
| 962 |
+
" model = SentenceTransformer(Config.EMBEDDING_MODEL, device='cpu')\n",
|
| 963 |
+
" print(f\"✅ Model loaded: {Config.EMBEDDING_MODEL}\")\n",
|
| 964 |
+
" \n",
|
| 965 |
+
" # Build texts (WITH JOB POSTING BRIDGE!)\n",
|
| 966 |
+
" comp_builder = CompanyTextBuilder()\n",
|
| 967 |
+
" company_texts = comp_builder.build_batch(companies_full)\n",
|
| 968 |
+
" \n",
|
| 969 |
+
" # Generate embeddings\n",
|
| 970 |
+
" comp_vectors = model.encode(\n",
|
| 971 |
+
" company_texts,\n",
|
| 972 |
+
" show_progress_bar=True,\n",
|
| 973 |
+
" batch_size=16,\n",
|
| 974 |
+
" normalize_embeddings=True,\n",
|
| 975 |
+
" convert_to_numpy=True\n",
|
| 976 |
+
" )\n",
|
| 977 |
+
" \n",
|
| 978 |
+
" print(f\"\\n✅ Generated: {comp_vectors.shape}\")\n",
|
| 979 |
+
" \n",
|
| 980 |
+
" # Save\n",
|
| 981 |
+
" np.save(COMP_EMB_FILE, comp_vectors)\n",
|
| 982 |
+
" companies_full.to_pickle(COMP_META_FILE)\n",
|
| 983 |
+
" print(f\"💾 Saved to {Config.PROCESSED_PATH}\")\n",
|
| 984 |
+
"\n",
|
| 985 |
+
"print(f\"\\n✅ COMPANY EMBEDDINGS READY\")\n",
|
| 986 |
+
"print(f\" Shape: {comp_vectors.shape}\")\n",
|
| 987 |
+
"print(f\" Aligned: {'✅' if len(comp_vectors) == len(companies_full) else '❌'}\")\n",
|
| 988 |
+
"\n",
|
| 989 |
+
"# Final summary\n",
|
| 990 |
+
"print(f\"\\n{'='*80}\")\n",
|
| 991 |
+
"print(f\"🎯 EMBEDDINGS COMPLETE!\")\n",
|
| 992 |
+
"print(f\"{'='*80}\")\n",
|
| 993 |
+
"print(f\"Candidates: {cand_vectors.shape}\")\n",
|
| 994 |
+
"print(f\"Companies: {comp_vectors.shape}\")\n",
|
| 995 |
+
"print(f\"Total vectors: {len(cand_vectors) + len(comp_vectors):,}\")\n",
|
| 996 |
+
"print(f\"{'='*80}\")"
|
| 997 |
+
]
|
| 998 |
+
},
|
| 999 |
+
{
|
| 1000 |
+
"cell_type": "markdown",
|
| 1001 |
+
"metadata": {},
|
| 1002 |
+
"source": [
|
| 1003 |
+
"---\n",
|
| 1004 |
+
"# 🎯 SECTION 5: Matching System\n",
|
| 1005 |
+
"---"
|
| 1006 |
+
]
|
| 1007 |
+
},
|
| 1008 |
+
{
|
| 1009 |
+
"cell_type": "markdown",
|
| 1010 |
+
"metadata": {},
|
| 1011 |
+
"source": [
|
| 1012 |
+
"## Cell 5.1: Initialize Matching Function\n",
|
| 1013 |
+
"\n",
|
| 1014 |
+
"**Purpose:** Create a simple matching function for queries.\n",
|
| 1015 |
+
"\n",
|
| 1016 |
+
"**Performance:** Sub-100ms per query"
|
| 1017 |
+
]
|
| 1018 |
+
},
|
| 1019 |
+
{
|
| 1020 |
+
"cell_type": "code",
|
| 1021 |
+
"execution_count": 11,
|
| 1022 |
+
"metadata": {},
|
| 1023 |
+
"outputs": [
|
| 1024 |
+
{
|
| 1025 |
+
"name": "stdout",
|
| 1026 |
+
"output_type": "stream",
|
| 1027 |
+
"text": [
|
| 1028 |
+
"✅ Matching function loaded!\n"
|
| 1029 |
+
]
|
| 1030 |
+
}
|
| 1031 |
+
],
|
| 1032 |
+
"source": [
|
| 1033 |
+
"def find_top_matches(candidate_idx: int, top_k: int = 10):\n",
|
| 1034 |
+
" \"\"\"Find top K company matches for a candidate\"\"\"\n",
|
| 1035 |
+
" cand_vec = cand_vectors[candidate_idx].reshape(1, -1)\n",
|
| 1036 |
+
" similarities = cosine_similarity(cand_vec, comp_vectors)[0]\n",
|
| 1037 |
+
" top_indices = np.argsort(similarities)[-top_k:][::-1]\n",
|
| 1038 |
+
" return [(idx, similarities[idx]) for idx in top_indices]\n",
|
| 1039 |
+
"\n",
|
| 1040 |
+
"print(\"✅ Matching function loaded!\")"
|
| 1041 |
+
]
|
| 1042 |
+
},
|
| 1043 |
+
{
|
| 1044 |
+
"cell_type": "markdown",
|
| 1045 |
+
"metadata": {},
|
| 1046 |
+
"source": [
|
| 1047 |
+
"## Cell 5.2: Test Matching System\n",
|
| 1048 |
+
"\n",
|
| 1049 |
+
"**Purpose:** Validate that matching system produces sensible results."
|
| 1050 |
+
]
|
| 1051 |
+
},
|
| 1052 |
+
{
|
| 1053 |
+
"cell_type": "code",
|
| 1054 |
+
"execution_count": 12,
|
| 1055 |
+
"metadata": {},
|
| 1056 |
+
"outputs": [
|
| 1057 |
+
{
|
| 1058 |
+
"name": "stdout",
|
| 1059 |
+
"output_type": "stream",
|
| 1060 |
+
"text": [
|
| 1061 |
+
"🔍 TESTING MATCH QUALITY\n",
|
| 1062 |
+
"================================================================================\n",
|
| 1063 |
+
"\n",
|
| 1064 |
+
"Candidate 0:\n",
|
| 1065 |
+
" Category: N/A\n",
|
| 1066 |
+
" Skills: ['Big Data', 'Hadoop', 'Hive', 'Python', 'Mapreduce', 'Spark', 'Java', 'Machine Learning', 'Cloud', ...\n",
|
| 1067 |
+
"\n",
|
| 1068 |
+
"Top 5 Matches:\n",
|
| 1069 |
+
"\n",
|
| 1070 |
+
"1. Cloudera (score: 0.711)\n",
|
| 1071 |
+
" Industries: Software Development...\n",
|
| 1072 |
+
" Required Skills: Product Management, Marketing, Design, Art/Creative, Information Technology, Inf...\n",
|
| 1073 |
+
"\n",
|
| 1074 |
+
"2. Info Services (score: 0.644)\n",
|
| 1075 |
+
" Industries: IT Services and IT Consulting...\n",
|
| 1076 |
+
" Required Skills: Information Technology, Engineering, Consulting...\n",
|
| 1077 |
+
"\n",
|
| 1078 |
+
"3. CloudIngest (score: 0.640)\n",
|
| 1079 |
+
" Industries: Software Development...\n",
|
| 1080 |
+
" Required Skills: Human Resources, Engineering, Information Technology...\n",
|
| 1081 |
+
"\n",
|
| 1082 |
+
"4. Rackspace Technology (score: 0.632)\n",
|
| 1083 |
+
" Industries: IT Services and IT Consulting...\n",
|
| 1084 |
+
" Required Skills: Engineering, Information Technology, Legal...\n",
|
| 1085 |
+
"\n",
|
| 1086 |
+
"5. DataStax (score: 0.615)\n",
|
| 1087 |
+
" Industries: IT Services and IT Consulting...\n",
|
| 1088 |
+
" Required Skills: Information Technology...\n",
|
| 1089 |
+
"\n",
|
| 1090 |
+
"================================================================================\n"
|
| 1091 |
+
]
|
| 1092 |
+
}
|
| 1093 |
+
],
|
| 1094 |
+
"source": [
|
| 1095 |
+
"print(\"🔍 TESTING MATCH QUALITY\")\n",
|
| 1096 |
+
"print(\"=\" * 80)\n",
|
| 1097 |
+
"\n",
|
| 1098 |
+
"# Test candidate\n",
|
| 1099 |
+
"test_idx = 0\n",
|
| 1100 |
+
"cand = candidates.iloc[test_idx]\n",
|
| 1101 |
+
"\n",
|
| 1102 |
+
"print(f\"\\nCandidate {test_idx}:\")\n",
|
| 1103 |
+
"print(f\" Category: {cand.get('Category', 'N/A')}\")\n",
|
| 1104 |
+
"print(f\" Skills: {str(cand.get('skills', 'N/A'))[:100]}...\")\n",
|
| 1105 |
+
"\n",
|
| 1106 |
+
"matches = find_top_matches(test_idx, top_k=5)\n",
|
| 1107 |
+
"\n",
|
| 1108 |
+
"print(f\"\\nTop 5 Matches:\")\n",
|
| 1109 |
+
"for i, (comp_idx, score) in enumerate(matches, 1):\n",
|
| 1110 |
+
" comp = companies_full.iloc[comp_idx]\n",
|
| 1111 |
+
" print(f\"\\n{i}. {comp['name']} (score: {score:.3f})\")\n",
|
| 1112 |
+
" print(f\" Industries: {str(comp['industries_list'])[:80]}...\")\n",
|
| 1113 |
+
" print(f\" Required Skills: {str(comp['required_skills'])[:80]}...\")\n",
|
| 1114 |
+
"\n",
|
| 1115 |
+
"print(\"\\n\" + \"=\" * 80)"
|
| 1116 |
+
]
|
| 1117 |
+
},
|
| 1118 |
+
{
|
| 1119 |
+
"cell_type": "markdown",
|
| 1120 |
+
"metadata": {},
|
| 1121 |
+
"source": [
|
| 1122 |
+
"---\n",
|
| 1123 |
+
"# 🤖 SECTION 6: LLM Features\n",
|
| 1124 |
+
"---"
|
| 1125 |
+
]
|
| 1126 |
+
},
|
| 1127 |
+
{
|
| 1128 |
+
"cell_type": "markdown",
|
| 1129 |
+
"metadata": {},
|
| 1130 |
+
"source": [
|
| 1131 |
+
"## Cell 6.1: Initialize LLM Client\n",
|
| 1132 |
+
"\n",
|
| 1133 |
+
"**Purpose:** Set up Hugging Face Inference API for LLM features.\n",
|
| 1134 |
+
"\n",
|
| 1135 |
+
"**Cost:** $0.00 (free tier)"
|
| 1136 |
+
]
|
| 1137 |
+
},
|
| 1138 |
+
{
|
| 1139 |
+
"cell_type": "code",
|
| 1140 |
+
"execution_count": 13,
|
| 1141 |
+
"metadata": {},
|
| 1142 |
+
"outputs": [
|
| 1143 |
+
{
|
| 1144 |
+
"name": "stdout",
|
| 1145 |
+
"output_type": "stream",
|
| 1146 |
+
"text": [
|
| 1147 |
+
"✅ Hugging Face client initialized (FREE)\n",
|
| 1148 |
+
"🤖 Model: meta-llama/Llama-3.2-3B-Instruct\n",
|
| 1149 |
+
"💰 Cost: $0.00\n",
|
| 1150 |
+
"\n",
|
| 1151 |
+
"✅ LLM helper functions ready\n"
|
| 1152 |
+
]
|
| 1153 |
+
}
|
| 1154 |
+
],
|
| 1155 |
+
"source": [
|
| 1156 |
+
"# Initialize Hugging Face client\n",
|
| 1157 |
+
"if Config.HF_TOKEN:\n",
|
| 1158 |
+
" try:\n",
|
| 1159 |
+
" hf_client = InferenceClient(token=Config.HF_TOKEN)\n",
|
| 1160 |
+
" print(\"✅ Hugging Face client initialized (FREE)\")\n",
|
| 1161 |
+
" print(f\"🤖 Model: {Config.LLM_MODEL}\")\n",
|
| 1162 |
+
" print(\"💰 Cost: $0.00\\n\")\n",
|
| 1163 |
+
" LLM_AVAILABLE = True\n",
|
| 1164 |
+
" except Exception as e:\n",
|
| 1165 |
+
" print(f\"⚠️ Failed to initialize: {e}\")\n",
|
| 1166 |
+
" LLM_AVAILABLE = False\n",
|
| 1167 |
+
"else:\n",
|
| 1168 |
+
" print(\"⚠️ No HF token - LLM features disabled\")\n",
|
| 1169 |
+
" LLM_AVAILABLE = False\n",
|
| 1170 |
+
" hf_client = None\n",
|
| 1171 |
+
"\n",
|
| 1172 |
+
"def call_llm(prompt: str, max_tokens: int = 1000) -> str:\n",
|
| 1173 |
+
" \"\"\"Generic LLM call\"\"\"\n",
|
| 1174 |
+
" if not LLM_AVAILABLE:\n",
|
| 1175 |
+
" return \"[LLM not available]\"\n",
|
| 1176 |
+
" \n",
|
| 1177 |
+
" try:\n",
|
| 1178 |
+
" response = hf_client.chat_completion(\n",
|
| 1179 |
+
" messages=[{\"role\": \"user\", \"content\": prompt}],\n",
|
| 1180 |
+
" model=Config.LLM_MODEL,\n",
|
| 1181 |
+
" max_tokens=max_tokens,\n",
|
| 1182 |
+
" temperature=0.7\n",
|
| 1183 |
+
" )\n",
|
| 1184 |
+
" return response.choices[0].message.content\n",
|
| 1185 |
+
" except Exception as e:\n",
|
| 1186 |
+
" return f\"[Error: {str(e)}]\"\n",
|
| 1187 |
+
"\n",
|
| 1188 |
+
"print(\"✅ LLM helper functions ready\")"
|
| 1189 |
+
]
|
| 1190 |
+
},
|
| 1191 |
+
{
|
| 1192 |
+
"cell_type": "markdown",
|
| 1193 |
+
"metadata": {},
|
| 1194 |
+
"source": [
|
| 1195 |
+
"## Cell 6.2: Pydantic Schemas\n",
|
| 1196 |
+
"\n",
|
| 1197 |
+
"**Purpose:** Define data validation schemas for structured LLM outputs."
|
| 1198 |
+
]
|
| 1199 |
+
},
|
| 1200 |
+
{
|
| 1201 |
+
"cell_type": "code",
|
| 1202 |
+
"execution_count": 14,
|
| 1203 |
+
"metadata": {},
|
| 1204 |
+
"outputs": [
|
| 1205 |
+
{
|
| 1206 |
+
"name": "stdout",
|
| 1207 |
+
"output_type": "stream",
|
| 1208 |
+
"text": [
|
| 1209 |
+
"✅ Pydantic schemas defined\n"
|
| 1210 |
+
]
|
| 1211 |
+
}
|
| 1212 |
+
],
|
| 1213 |
+
"source": [
|
| 1214 |
+
"class JobLevelClassification(BaseModel):\n",
|
| 1215 |
+
" \"\"\"Schema for job level classification\"\"\"\n",
|
| 1216 |
+
" level: Literal[\"Entry\", \"Mid\", \"Senior\", \"Executive\"]\n",
|
| 1217 |
+
" confidence: float = Field(ge=0.0, le=1.0)\n",
|
| 1218 |
+
" reasoning: str\n",
|
| 1219 |
+
"\n",
|
| 1220 |
+
"class SkillsTaxonomy(BaseModel):\n",
|
| 1221 |
+
" \"\"\"Schema for skills extraction\"\"\"\n",
|
| 1222 |
+
" technical_skills: List[str] = Field(default_factory=list)\n",
|
| 1223 |
+
" soft_skills: List[str] = Field(default_factory=list)\n",
|
| 1224 |
+
" certifications: List[str] = Field(default_factory=list)\n",
|
| 1225 |
+
" languages: List[str] = Field(default_factory=list)\n",
|
| 1226 |
+
"\n",
|
| 1227 |
+
"print(\"✅ Pydantic schemas defined\")"
|
| 1228 |
+
]
|
| 1229 |
+
},
|
| 1230 |
+
{
|
| 1231 |
+
"cell_type": "markdown",
|
| 1232 |
+
"metadata": {},
|
| 1233 |
+
"source": [
|
| 1234 |
+
"## Cell 6.3: Job Level Classification (Zero-Shot)\n",
|
| 1235 |
+
"\n",
|
| 1236 |
+
"**Purpose:** Classify job seniority level without examples."
|
| 1237 |
+
]
|
| 1238 |
+
},
|
| 1239 |
+
{
|
| 1240 |
+
"cell_type": "code",
|
| 1241 |
+
"execution_count": 15,
|
| 1242 |
+
"metadata": {},
|
| 1243 |
+
"outputs": [
|
| 1244 |
+
{
|
| 1245 |
+
"name": "stdout",
|
| 1246 |
+
"output_type": "stream",
|
| 1247 |
+
"text": [
|
| 1248 |
+
"🧪 Testing zero-shot classification...\n",
|
| 1249 |
+
"\n",
|
| 1250 |
+
"📊 Result:\n",
|
| 1251 |
+
"{\n",
|
| 1252 |
+
" \"level\": \"Entry\",\n",
|
| 1253 |
+
" \"confidence\": 0.9,\n",
|
| 1254 |
+
" \"reasoning\": \"The job posting does not require extensive experience, and the phrase 'some experience in graphic design' suggests that the candidate is likely to be new to the position.\"\n",
|
| 1255 |
+
"}\n"
|
| 1256 |
+
]
|
| 1257 |
+
}
|
| 1258 |
+
],
|
| 1259 |
+
"source": [
|
| 1260 |
+
"def classify_job_level_zero_shot(job_description: str) -> Dict:\n",
|
| 1261 |
+
" \"\"\"Zero-shot job level classification\"\"\"\n",
|
| 1262 |
+
" \n",
|
| 1263 |
+
" prompt = f\"\"\"Classify this job posting into one of these levels:\n",
|
| 1264 |
+
"- Entry: 0-2 years, learning focus\n",
|
| 1265 |
+
"- Mid: 3-5 years, independent work\n",
|
| 1266 |
+
"- Senior: 6-10 years, leadership, mentoring\n",
|
| 1267 |
+
"- Executive: 10+ years, strategic, C-level\n",
|
| 1268 |
+
"\n",
|
| 1269 |
+
"Job: {job_description[:500]}\n",
|
| 1270 |
+
"\n",
|
| 1271 |
+
"Return JSON:\n",
|
| 1272 |
+
"{{\"level\": \"Entry|Mid|Senior|Executive\", \"confidence\": 0.0-1.0, \"reasoning\": \"brief\"}}\n",
|
| 1273 |
+
"\"\"\"\n",
|
| 1274 |
+
" \n",
|
| 1275 |
+
" response = call_llm(prompt)\n",
|
| 1276 |
+
" \n",
|
| 1277 |
+
" try:\n",
|
| 1278 |
+
" json_str = response.strip()\n",
|
| 1279 |
+
" if '```' in json_str:\n",
|
| 1280 |
+
" json_str = json_str.split('```json')[-1].split('```')[0].strip()\n",
|
| 1281 |
+
" \n",
|
| 1282 |
+
" if '{' in json_str:\n",
|
| 1283 |
+
" start = json_str.index('{')\n",
|
| 1284 |
+
" end = json_str.rindex('}') + 1\n",
|
| 1285 |
+
" json_str = json_str[start:end]\n",
|
| 1286 |
+
" \n",
|
| 1287 |
+
" result = json.loads(json_str)\n",
|
| 1288 |
+
" return result\n",
|
| 1289 |
+
" except:\n",
|
| 1290 |
+
" return {\"level\": \"Unknown\", \"confidence\": 0.0, \"reasoning\": \"Parse error\"}\n",
|
| 1291 |
+
"\n",
|
| 1292 |
+
"# Test\n",
|
| 1293 |
+
"if LLM_AVAILABLE and len(postings) > 0:\n",
|
| 1294 |
+
" print(\"🧪 Testing zero-shot classification...\\n\")\n",
|
| 1295 |
+
" sample = postings.iloc[0]['description']\n",
|
| 1296 |
+
" result = classify_job_level_zero_shot(sample)\n",
|
| 1297 |
+
" print(\"📊 Result:\")\n",
|
| 1298 |
+
" print(json.dumps(result, indent=2))\n",
|
| 1299 |
+
"else:\n",
|
| 1300 |
+
" print(\"⚠️ Skipped - LLM not available\")"
|
| 1301 |
+
]
|
| 1302 |
+
},
|
| 1303 |
+
{
|
| 1304 |
+
"cell_type": "markdown",
|
| 1305 |
+
"metadata": {},
|
| 1306 |
+
"source": [
|
| 1307 |
+
"## Cell 6.4: Few-Shot Classification\n",
|
| 1308 |
+
"\n",
|
| 1309 |
+
"**Purpose:** Classify job seniority level without examples."
|
| 1310 |
+
]
|
| 1311 |
+
},
|
| 1312 |
+
{
|
| 1313 |
+
"cell_type": "code",
|
| 1314 |
+
"execution_count": 16,
|
| 1315 |
+
"metadata": {},
|
| 1316 |
+
"outputs": [
|
| 1317 |
+
{
|
| 1318 |
+
"name": "stdout",
|
| 1319 |
+
"output_type": "stream",
|
| 1320 |
+
"text": [
|
| 1321 |
+
"✅ Few-shot classifier ready\n",
|
| 1322 |
+
"\n",
|
| 1323 |
+
"🧪 Comparing Zero-Shot vs Few-Shot...\n",
|
| 1324 |
+
"\n",
|
| 1325 |
+
"📊 Comparison:\n",
|
| 1326 |
+
"Zero-shot: Entry (confidence: 0.80)\n",
|
| 1327 |
+
"Few-shot: Entry (confidence: 0.75)\n"
|
| 1328 |
+
]
|
| 1329 |
+
}
|
| 1330 |
+
],
|
| 1331 |
+
"source": [
|
| 1332 |
+
"def classify_job_level_few_shot(job_description: str) -> Dict:\n",
|
| 1333 |
+
" \"\"\"Few-shot classification with examples\"\"\"\n",
|
| 1334 |
+
" \n",
|
| 1335 |
+
" prompt = f\"\"\"Classify this job using examples.\n",
|
| 1336 |
+
"\n",
|
| 1337 |
+
"EXAMPLES:\n",
|
| 1338 |
+
"- \"Recent graduate wanted. Python basics.\" → Entry\n",
|
| 1339 |
+
"- \"5+ years backend. Lead team.\" → Senior \n",
|
| 1340 |
+
"- \"CTO position. 15+ years strategy.\" → Executive\n",
|
| 1341 |
+
"\n",
|
| 1342 |
+
"JOB: {job_description[:500]}\n",
|
| 1343 |
+
"\n",
|
| 1344 |
+
"Return JSON:\n",
|
| 1345 |
+
"{{\"level\": \"Entry|Mid|Senior|Executive\", \"confidence\": 0.85, \"reasoning\": \"brief\"}}\n",
|
| 1346 |
+
"\n",
|
| 1347 |
+
"Do not include markdown or code blocks.\"\"\"\n",
|
| 1348 |
+
" \n",
|
| 1349 |
+
" response = call_llm(prompt, max_tokens=200)\n",
|
| 1350 |
+
" \n",
|
| 1351 |
+
" try:\n",
|
| 1352 |
+
" json_str = response.strip()\n",
|
| 1353 |
+
" if '```' in json_str:\n",
|
| 1354 |
+
" json_str = json_str.split('```json')[-1].split('```')[0].strip()\n",
|
| 1355 |
+
" \n",
|
| 1356 |
+
" if '{' in json_str:\n",
|
| 1357 |
+
" start = json_str.index('{')\n",
|
| 1358 |
+
" end = json_str.rindex('}') + 1\n",
|
| 1359 |
+
" json_str = json_str[start:end]\n",
|
| 1360 |
+
" \n",
|
| 1361 |
+
" result = json.loads(json_str)\n",
|
| 1362 |
+
" \n",
|
| 1363 |
+
" if 'level' not in result:\n",
|
| 1364 |
+
" raise ValueError(\"Missing level\")\n",
|
| 1365 |
+
" \n",
|
| 1366 |
+
" if 'confidence' not in result:\n",
|
| 1367 |
+
" result['confidence'] = 0.85\n",
|
| 1368 |
+
" \n",
|
| 1369 |
+
" return result\n",
|
| 1370 |
+
" \n",
|
| 1371 |
+
" except Exception as e:\n",
|
| 1372 |
+
" # Fallback: extract from text\n",
|
| 1373 |
+
" response_lower = response.lower()\n",
|
| 1374 |
+
" \n",
|
| 1375 |
+
" if 'entry' in response_lower or 'junior' in response_lower:\n",
|
| 1376 |
+
" level = 'Entry'\n",
|
| 1377 |
+
" elif 'senior' in response_lower:\n",
|
| 1378 |
+
" level = 'Senior'\n",
|
| 1379 |
+
" elif 'executive' in response_lower:\n",
|
| 1380 |
+
" level = 'Executive'\n",
|
| 1381 |
+
" elif 'mid' in response_lower:\n",
|
| 1382 |
+
" level = 'Mid'\n",
|
| 1383 |
+
" else:\n",
|
| 1384 |
+
" level = 'Unknown'\n",
|
| 1385 |
+
" \n",
|
| 1386 |
+
" return {\n",
|
| 1387 |
+
" \"level\": level,\n",
|
| 1388 |
+
" \"confidence\": 0.70 if level != 'Unknown' else 0.0,\n",
|
| 1389 |
+
" \"reasoning\": f\"Extracted from text (parse error)\"\n",
|
| 1390 |
+
" }\n",
|
| 1391 |
+
"\n",
|
| 1392 |
+
"print(\"✅ Few-shot classifier ready\")\n",
|
| 1393 |
+
"\n",
|
| 1394 |
+
"# Compare zero-shot vs few-shot\n",
|
| 1395 |
+
"if LLM_AVAILABLE and len(postings) > 0:\n",
|
| 1396 |
+
" print(\"\\n🧪 Comparing Zero-Shot vs Few-Shot...\")\n",
|
| 1397 |
+
" sample = postings.iloc[0]['description']\n",
|
| 1398 |
+
" \n",
|
| 1399 |
+
" zero = classify_job_level_zero_shot(sample)\n",
|
| 1400 |
+
" few = classify_job_level_few_shot(sample)\n",
|
| 1401 |
+
" \n",
|
| 1402 |
+
" print(\"\\n📊 Comparison:\")\n",
|
| 1403 |
+
" print(f\"Zero-shot: {zero['level']} (confidence: {zero['confidence']:.2f})\")\n",
|
| 1404 |
+
" print(f\"Few-shot: {few['level']} (confidence: {few['confidence']:.2f})\")\n",
|
| 1405 |
+
"else:\n",
|
| 1406 |
+
" print(\"⚠️ LLM not available\")"
|
| 1407 |
+
]
|
| 1408 |
+
},
|
| 1409 |
+
{
|
| 1410 |
+
"cell_type": "markdown",
|
| 1411 |
+
"metadata": {},
|
| 1412 |
+
"source": [
|
| 1413 |
+
"## Cell 6.4: Skills Extraction\n",
|
| 1414 |
+
"\n",
|
| 1415 |
+
"**Purpose:** Extract structured skills from job postings using LLM + Pydantic."
|
| 1416 |
+
]
|
| 1417 |
+
},
|
| 1418 |
+
{
|
| 1419 |
+
"cell_type": "code",
|
| 1420 |
+
"execution_count": 17,
|
| 1421 |
+
"metadata": {},
|
| 1422 |
+
"outputs": [
|
| 1423 |
+
{
|
| 1424 |
+
"name": "stdout",
|
| 1425 |
+
"output_type": "stream",
|
| 1426 |
+
"text": [
|
| 1427 |
+
"🔍 Testing skills extraction...\n",
|
| 1428 |
+
"\n",
|
| 1429 |
+
"📄 Sample: Job descriptionA leading real estate firm in New Jersey is seeking an administrative Marketing Coordinator with some experience in graphic design. You...\n",
|
| 1430 |
+
"\n",
|
| 1431 |
+
"📊 Extracted:\n",
|
| 1432 |
+
"{\n",
|
| 1433 |
+
" \"technical_skills\": [\n",
|
| 1434 |
+
" \"Adobe Creative Cloud (Indesign, Illustrator, Photoshop)\",\n",
|
| 1435 |
+
" \"Microsoft Office Suite\"\n",
|
| 1436 |
+
" ],\n",
|
| 1437 |
+
" \"soft_skills\": [\n",
|
| 1438 |
+
" \"teamwork\",\n",
|
| 1439 |
+
" \"communication\",\n",
|
| 1440 |
+
" \"problem-solving\",\n",
|
| 1441 |
+
" \"proactive\",\n",
|
| 1442 |
+
" \"positive\",\n",
|
| 1443 |
+
" \"creative\",\n",
|
| 1444 |
+
" \"responsible\",\n",
|
| 1445 |
+
" \"respectful\",\n",
|
| 1446 |
+
" \"cool-under-pressure\",\n",
|
| 1447 |
+
" \"kind-hearted\",\n",
|
| 1448 |
+
" \"fantastic taste\"\n",
|
| 1449 |
+
" ],\n",
|
| 1450 |
+
" \"certifications\": [],\n",
|
| 1451 |
+
" \"languages\": []\n",
|
| 1452 |
+
"}\n",
|
| 1453 |
+
"\n",
|
| 1454 |
+
"✅ Total: 13\n"
|
| 1455 |
+
]
|
| 1456 |
+
}
|
| 1457 |
+
],
|
| 1458 |
+
"source": [
|
| 1459 |
+
"def extract_skills_taxonomy(job_description: str) -> Dict:\n",
|
| 1460 |
+
" \"\"\"Extract structured skills\"\"\"\n",
|
| 1461 |
+
" \n",
|
| 1462 |
+
" prompt = f\"\"\"Extract ALL skills from this job posting.\n",
|
| 1463 |
+
"\n",
|
| 1464 |
+
"JOB: {job_description[:800]}\n",
|
| 1465 |
+
"\n",
|
| 1466 |
+
"Analyze and extract:\n",
|
| 1467 |
+
"- Technical skills (programming, tools, platforms)\n",
|
| 1468 |
+
"- Soft skills (teamwork, communication, problem-solving)\n",
|
| 1469 |
+
"- Certifications (if any)\n",
|
| 1470 |
+
"- Languages (if mentioned)\n",
|
| 1471 |
+
"\n",
|
| 1472 |
+
"Return JSON with actual skills found:\n",
|
| 1473 |
+
"{{\"technical_skills\": [\"skill1\"], \"soft_skills\": [\"skill1\"], \"certifications\": [], \"languages\": []}}\n",
|
| 1474 |
+
"\n",
|
| 1475 |
+
"IMPORTANT: Extract ONLY skills ACTUALLY in the text. Empty array [] if none found.\n",
|
| 1476 |
+
"\"\"\"\n",
|
| 1477 |
+
" \n",
|
| 1478 |
+
" response = call_llm(prompt, max_tokens=800)\n",
|
| 1479 |
+
" \n",
|
| 1480 |
+
" try:\n",
|
| 1481 |
+
" json_str = response.strip()\n",
|
| 1482 |
+
" if '```json' in json_str:\n",
|
| 1483 |
+
" json_str = json_str.split('```json')[1].split('```')[0].strip()\n",
|
| 1484 |
+
" elif '```' in json_str:\n",
|
| 1485 |
+
" json_str = json_str.split('```')[1].split('```')[0].strip()\n",
|
| 1486 |
+
" \n",
|
| 1487 |
+
" if '{' in json_str:\n",
|
| 1488 |
+
" start = json_str.index('{')\n",
|
| 1489 |
+
" end = json_str.rindex('}') + 1\n",
|
| 1490 |
+
" json_str = json_str[start:end]\n",
|
| 1491 |
+
" \n",
|
| 1492 |
+
" data = json.loads(json_str)\n",
|
| 1493 |
+
" validated = SkillsTaxonomy(**data)\n",
|
| 1494 |
+
" return validated.model_dump()\n",
|
| 1495 |
+
" except:\n",
|
| 1496 |
+
" return {\"technical_skills\": [], \"soft_skills\": [], \"certifications\": [], \"languages\": []}\n",
|
| 1497 |
+
"\n",
|
| 1498 |
+
"# Test\n",
|
| 1499 |
+
"if LLM_AVAILABLE and len(postings) > 0:\n",
|
| 1500 |
+
" print(\"🔍 Testing skills extraction...\\n\")\n",
|
| 1501 |
+
" sample = postings.iloc[0]['description']\n",
|
| 1502 |
+
" print(f\"📄 Sample: {sample[:150]}...\\n\")\n",
|
| 1503 |
+
" skills = extract_skills_taxonomy(sample)\n",
|
| 1504 |
+
" print(\"📊 Extracted:\")\n",
|
| 1505 |
+
" print(json.dumps(skills, indent=2))\n",
|
| 1506 |
+
" total = sum(len(v) for v in skills.values())\n",
|
| 1507 |
+
" print(f\"\\n{'✅' if total > 0 else '⚠️ '} Total: {total}\")\n",
|
| 1508 |
+
"else:\n",
|
| 1509 |
+
" print(\"⚠️ Skipped\")"
|
| 1510 |
+
]
|
| 1511 |
+
},
|
| 1512 |
+
{
|
| 1513 |
+
"cell_type": "markdown",
|
| 1514 |
+
"metadata": {},
|
| 1515 |
+
"source": [
|
| 1516 |
+
"## Cell 6.5: Match Explainability\n",
|
| 1517 |
+
"\n",
|
| 1518 |
+
"**Purpose:** Generate LLM explanation for candidate-company matches."
|
| 1519 |
+
]
|
| 1520 |
+
},
|
| 1521 |
+
{
|
| 1522 |
+
"cell_type": "code",
|
| 1523 |
+
"execution_count": 18,
|
| 1524 |
+
"metadata": {},
|
| 1525 |
+
"outputs": [
|
| 1526 |
+
{
|
| 1527 |
+
"name": "stdout",
|
| 1528 |
+
"output_type": "stream",
|
| 1529 |
+
"text": [
|
| 1530 |
+
"💡 Testing explainability...\n",
|
| 1531 |
+
"\n",
|
| 1532 |
+
"📊 Explanation:\n",
|
| 1533 |
+
"{\n",
|
| 1534 |
+
" \"overall_score\": 0.7105909585952759,\n",
|
| 1535 |
+
" \"match_strengths\": [],\n",
|
| 1536 |
+
" \"skill_gaps\": [\n",
|
| 1537 |
+
" \"Big Data Analyst experience does not match the company's requirements\"\n",
|
| 1538 |
+
" ],\n",
|
| 1539 |
+
" \"recommendation\": \"Discuss skills and experience to see if they can be adapted to the company's requirements\",\n",
|
| 1540 |
+
" \"fit_summary\": \"The candidate's skills do not strongly align with the company's requirements\"\n",
|
| 1541 |
+
"}\n"
|
| 1542 |
+
]
|
| 1543 |
+
}
|
| 1544 |
+
],
|
| 1545 |
+
"source": [
|
| 1546 |
+
"def explain_match(candidate_idx: int, company_idx: int, similarity_score: float) -> Dict:\n",
|
| 1547 |
+
" \"\"\"Generate match explanation\"\"\"\n",
|
| 1548 |
+
" \n",
|
| 1549 |
+
" cand = candidates.iloc[candidate_idx]\n",
|
| 1550 |
+
" comp = companies_full.iloc[company_idx]\n",
|
| 1551 |
+
" \n",
|
| 1552 |
+
" prompt = f\"\"\"Explain why this candidate matches this company.\n",
|
| 1553 |
+
"\n",
|
| 1554 |
+
"Candidate:\n",
|
| 1555 |
+
"Skills: {str(cand.get('skills', 'N/A'))[:300]}\n",
|
| 1556 |
+
"Experience: {str(cand.get('positions', 'N/A'))[:300]}\n",
|
| 1557 |
+
"\n",
|
| 1558 |
+
"Company: {comp.get('name', 'Unknown')}\n",
|
| 1559 |
+
"Requirements: {str(comp.get('required_skills', 'N/A'))[:300]}\n",
|
| 1560 |
+
"\n",
|
| 1561 |
+
"Score: {similarity_score:.2f}\n",
|
| 1562 |
+
"\n",
|
| 1563 |
+
"Return JSON:\n",
|
| 1564 |
+
"{{\"overall_score\": {similarity_score}, \"match_strengths\": [\"factor1\"], \"skill_gaps\": [\"gap1\"], \"recommendation\": \"what to do\", \"fit_summary\": \"one sentence\"}}\n",
|
| 1565 |
+
"\"\"\"\n",
|
| 1566 |
+
" \n",
|
| 1567 |
+
" response = call_llm(prompt, max_tokens=1000)\n",
|
| 1568 |
+
" \n",
|
| 1569 |
+
" try:\n",
|
| 1570 |
+
" json_str = response.strip()\n",
|
| 1571 |
+
" if '```' in json_str:\n",
|
| 1572 |
+
" json_str = json_str.split('```json')[-1].split('```')[0].strip()\n",
|
| 1573 |
+
" \n",
|
| 1574 |
+
" if '{' in json_str:\n",
|
| 1575 |
+
" start = json_str.index('{')\n",
|
| 1576 |
+
" end = json_str.rindex('}') + 1\n",
|
| 1577 |
+
" json_str = json_str[start:end]\n",
|
| 1578 |
+
" \n",
|
| 1579 |
+
" return json.loads(json_str)\n",
|
| 1580 |
+
" except:\n",
|
| 1581 |
+
" return {\n",
|
| 1582 |
+
" \"overall_score\": similarity_score,\n",
|
| 1583 |
+
" \"match_strengths\": [\"Unable to generate\"],\n",
|
| 1584 |
+
" \"skill_gaps\": [],\n",
|
| 1585 |
+
" \"recommendation\": \"Review manually\",\n",
|
| 1586 |
+
" \"fit_summary\": f\"Match score: {similarity_score:.2f}\"\n",
|
| 1587 |
+
" }\n",
|
| 1588 |
+
"\n",
|
| 1589 |
+
"# Test\n",
|
| 1590 |
+
"if LLM_AVAILABLE and len(candidates) > 0:\n",
|
| 1591 |
+
" print(\"💡 Testing explainability...\\n\")\n",
|
| 1592 |
+
" matches = find_top_matches(0, top_k=1)\n",
|
| 1593 |
+
" if matches:\n",
|
| 1594 |
+
" comp_idx, score = matches[0]\n",
|
| 1595 |
+
" explanation = explain_match(0, comp_idx, score)\n",
|
| 1596 |
+
" print(\"📊 Explanation:\")\n",
|
| 1597 |
+
" print(json.dumps(explanation, indent=2))\n",
|
| 1598 |
+
"else:\n",
|
| 1599 |
+
" print(\"⚠️ Skipped\")"
|
| 1600 |
+
]
|
| 1601 |
+
},
|
| 1602 |
+
{
|
| 1603 |
+
"cell_type": "markdown",
|
| 1604 |
+
"metadata": {},
|
| 1605 |
+
"source": [
|
| 1606 |
+
"---\n",
|
| 1607 |
+
"# 📊 SECTION 7: Visualizations & Metrics\n",
|
| 1608 |
+
"---"
|
| 1609 |
+
]
|
| 1610 |
+
},
|
| 1611 |
+
{
|
| 1612 |
+
"cell_type": "markdown",
|
| 1613 |
+
"metadata": {},
|
| 1614 |
+
"source": [
|
| 1615 |
+
"## Cell 7.1: PyVis Interactive Network\n",
|
| 1616 |
+
"\n",
|
| 1617 |
+
"**Purpose:** Create interactive network graph showing candidate-company connections.\n",
|
| 1618 |
+
"\n",
|
| 1619 |
+
"**Features:**\n",
|
| 1620 |
+
"- Drag nodes to rearrange\n",
|
| 1621 |
+
"- Hover for detailed tooltips\n",
|
| 1622 |
+
"- Rich candidate & company information\n",
|
| 1623 |
+
"- Opens in browser automatically"
|
| 1624 |
+
]
|
| 1625 |
+
},
|
| 1626 |
+
{
|
| 1627 |
+
"cell_type": "code",
|
| 1628 |
+
"execution_count": 19,
|
| 1629 |
+
"metadata": {},
|
| 1630 |
+
"outputs": [
|
| 1631 |
+
{
|
| 1632 |
+
"name": "stdout",
|
| 1633 |
+
"output_type": "stream",
|
| 1634 |
+
"text": [
|
| 1635 |
+
"🕸️ CREATING INTERACTIVE NETWORK...\n",
|
| 1636 |
+
"================================================================================\n",
|
| 1637 |
+
"\n",
|
| 1638 |
+
"📊 Configuration:\n",
|
| 1639 |
+
" Candidates: 20\n",
|
| 1640 |
+
" Matches per candidate: 5\n",
|
| 1641 |
+
"\n",
|
| 1642 |
+
"🔵 Adding nodes...\n",
|
| 1643 |
+
"\n",
|
| 1644 |
+
"✅ Network complete!\n",
|
| 1645 |
+
" Nodes: 68\n",
|
| 1646 |
+
" Edges: 100\n",
|
| 1647 |
+
"\n",
|
| 1648 |
+
"💾 Saved: ../results/network_interactive.html\n",
|
| 1649 |
+
"\n",
|
| 1650 |
+
"🌐 Opening in browser...\n",
|
| 1651 |
+
"✅ Opened!\n",
|
| 1652 |
+
"\n",
|
| 1653 |
+
"================================================================================\n",
|
| 1654 |
+
"💡 CONTROLS:\n",
|
| 1655 |
+
" 🖱️ Drag nodes | 🔍 Scroll to zoom | 👆 Hover for info\n",
|
| 1656 |
+
"================================================================================\n"
|
| 1657 |
+
]
|
| 1658 |
+
}
|
| 1659 |
+
],
|
| 1660 |
+
"source": [
|
| 1661 |
+
"from pyvis.network import Network\n",
|
| 1662 |
+
"\n",
|
| 1663 |
+
"print(\"🕸️ CREATING INTERACTIVE NETWORK...\")\n",
|
| 1664 |
+
"print(\"=\" * 80)\n",
|
| 1665 |
+
"\n",
|
| 1666 |
+
"# Config\n",
|
| 1667 |
+
"n_cand_sample = 20\n",
|
| 1668 |
+
"top_k_per_cand = 5\n",
|
| 1669 |
+
"\n",
|
| 1670 |
+
"print(f\"\\n📊 Configuration:\")\n",
|
| 1671 |
+
"print(f\" Candidates: {n_cand_sample}\")\n",
|
| 1672 |
+
"print(f\" Matches per candidate: {top_k_per_cand}\")\n",
|
| 1673 |
+
"\n",
|
| 1674 |
+
"# Initialize network\n",
|
| 1675 |
+
"net = Network(\n",
|
| 1676 |
+
" height='900px',\n",
|
| 1677 |
+
" width='100%',\n",
|
| 1678 |
+
" bgcolor='#1a1a1a',\n",
|
| 1679 |
+
" font_color='white',\n",
|
| 1680 |
+
" notebook=False,\n",
|
| 1681 |
+
" cdn_resources='remote'\n",
|
| 1682 |
+
")\n",
|
| 1683 |
+
"\n",
|
| 1684 |
+
"# Physics for nice layout\n",
|
| 1685 |
+
"net.set_options(\"\"\"\n",
|
| 1686 |
+
"{\n",
|
| 1687 |
+
" \"physics\": {\n",
|
| 1688 |
+
" \"forceAtlas2Based\": {\n",
|
| 1689 |
+
" \"gravitationalConstant\": -50,\n",
|
| 1690 |
+
" \"centralGravity\": 0.01,\n",
|
| 1691 |
+
" \"springLength\": 200,\n",
|
| 1692 |
+
" \"springConstant\": 0.08,\n",
|
| 1693 |
+
" \"avoidOverlap\": 1\n",
|
| 1694 |
+
" },\n",
|
| 1695 |
+
" \"maxVelocity\": 30,\n",
|
| 1696 |
+
" \"solver\": \"forceAtlas2Based\",\n",
|
| 1697 |
+
" \"stabilization\": {\"iterations\": 150}\n",
|
| 1698 |
+
" },\n",
|
| 1699 |
+
" \"interaction\": {\n",
|
| 1700 |
+
" \"hover\": true,\n",
|
| 1701 |
+
" \"navigationButtons\": true\n",
|
| 1702 |
+
" }\n",
|
| 1703 |
+
"}\n",
|
| 1704 |
+
"\"\"\")\n",
|
| 1705 |
+
"\n",
|
| 1706 |
+
"print(f\"\\n🔵 Adding nodes...\")\n",
|
| 1707 |
+
"\n",
|
| 1708 |
+
"companies_added = set()\n",
|
| 1709 |
+
"\n",
|
| 1710 |
+
"# Add candidate nodes\n",
|
| 1711 |
+
"for i in range(min(n_cand_sample, len(candidates))):\n",
|
| 1712 |
+
" cand = candidates.iloc[i]\n",
|
| 1713 |
+
" \n",
|
| 1714 |
+
" category = cand.get('Category', 'Unknown')\n",
|
| 1715 |
+
" skills = str(cand.get('skills', 'N/A'))[:150]\n",
|
| 1716 |
+
" \n",
|
| 1717 |
+
" tooltip = f\"\"\"<div style='max-width: 300px;'>\n",
|
| 1718 |
+
" <h3 style='color: #2ecc71;'>👤 Candidate {i}</h3>\n",
|
| 1719 |
+
" <hr style='border: 1px solid #2ecc71;'>\n",
|
| 1720 |
+
" <p><b>Category:</b> {category}</p>\n",
|
| 1721 |
+
" <p><b>Skills:</b> {skills}...</p>\n",
|
| 1722 |
+
" </div>\"\"\"\n",
|
| 1723 |
+
" \n",
|
| 1724 |
+
" net.add_node(\n",
|
| 1725 |
+
" f\"C{i}\",\n",
|
| 1726 |
+
" label=f\"Candidate {i}\",\n",
|
| 1727 |
+
" title=tooltip,\n",
|
| 1728 |
+
" color='#2ecc71',\n",
|
| 1729 |
+
" size=25,\n",
|
| 1730 |
+
" shape='dot'\n",
|
| 1731 |
+
" )\n",
|
| 1732 |
+
"\n",
|
| 1733 |
+
"# Add company nodes & edges\n",
|
| 1734 |
+
"edge_count = 0\n",
|
| 1735 |
+
"\n",
|
| 1736 |
+
"for cand_idx in range(min(n_cand_sample, len(candidates))):\n",
|
| 1737 |
+
" matches = find_top_matches(cand_idx, top_k=top_k_per_cand)\n",
|
| 1738 |
+
" \n",
|
| 1739 |
+
" for rank, (comp_idx, score) in enumerate(matches, 1):\n",
|
| 1740 |
+
" comp_id = f\"CO{comp_idx}\"\n",
|
| 1741 |
+
" \n",
|
| 1742 |
+
" if comp_id not in companies_added:\n",
|
| 1743 |
+
" comp = companies_full.iloc[comp_idx]\n",
|
| 1744 |
+
" name = comp.get('name', 'Unknown')\n",
|
| 1745 |
+
" industry = str(comp.get('industries_list', 'N/A'))[:80]\n",
|
| 1746 |
+
" skills = str(comp.get('required_skills', 'N/A'))[:150]\n",
|
| 1747 |
+
" \n",
|
| 1748 |
+
" tooltip = f\"\"\"<div style='max-width: 350px;'>\n",
|
| 1749 |
+
" <h3 style='color: #e74c3c;'>🏢 {name}</h3>\n",
|
| 1750 |
+
" <hr style='border: 1px solid #e74c3c;'>\n",
|
| 1751 |
+
" <p><b>Industry:</b> {industry}</p>\n",
|
| 1752 |
+
" <p><b>Skills:</b> {skills}...</p>\n",
|
| 1753 |
+
" </div>\"\"\"\n",
|
| 1754 |
+
" \n",
|
| 1755 |
+
" net.add_node(\n",
|
| 1756 |
+
" comp_id,\n",
|
| 1757 |
+
" label=name[:20],\n",
|
| 1758 |
+
" title=tooltip,\n",
|
| 1759 |
+
" color='#e74c3c',\n",
|
| 1760 |
+
" size=18,\n",
|
| 1761 |
+
" shape='box'\n",
|
| 1762 |
+
" )\n",
|
| 1763 |
+
" companies_added.add(comp_id)\n",
|
| 1764 |
+
" \n",
|
| 1765 |
+
" edge_tooltip = f\"\"\"<b>Match Quality</b><br>\n",
|
| 1766 |
+
" Rank: #{rank}<br>\n",
|
| 1767 |
+
" Score: {score:.3f}\"\"\"\n",
|
| 1768 |
+
" \n",
|
| 1769 |
+
" net.add_edge(\n",
|
| 1770 |
+
" f\"C{cand_idx}\",\n",
|
| 1771 |
+
" comp_id,\n",
|
| 1772 |
+
" value=float(score * 10),\n",
|
| 1773 |
+
" title=edge_tooltip,\n",
|
| 1774 |
+
" color={'color': '#95a5a6', 'opacity': 0.6}\n",
|
| 1775 |
+
" )\n",
|
| 1776 |
+
" edge_count += 1\n",
|
| 1777 |
+
"\n",
|
| 1778 |
+
"print(f\"\\n✅ Network complete!\")\n",
|
| 1779 |
+
"print(f\" Nodes: {len(net.nodes)}\")\n",
|
| 1780 |
+
"print(f\" Edges: {edge_count}\")\n",
|
| 1781 |
+
"\n",
|
| 1782 |
+
"# Save\n",
|
| 1783 |
+
"html_file = f'{Config.RESULTS_PATH}network_interactive.html'\n",
|
| 1784 |
+
"net.save_graph(html_file)\n",
|
| 1785 |
+
"abs_path = os.path.abspath(html_file)\n",
|
| 1786 |
+
"\n",
|
| 1787 |
+
"print(f\"\\n💾 Saved: {html_file}\")\n",
|
| 1788 |
+
"\n",
|
| 1789 |
+
"# Open in browser\n",
|
| 1790 |
+
"print(f\"\\n🌐 Opening in browser...\")\n",
|
| 1791 |
+
"try:\n",
|
| 1792 |
+
" webbrowser.open(f'file://{abs_path}')\n",
|
| 1793 |
+
" print(f\"✅ Opened!\")\n",
|
| 1794 |
+
"except:\n",
|
| 1795 |
+
" print(f\"⚠️ Manual open: {abs_path}\")\n",
|
| 1796 |
+
"\n",
|
| 1797 |
+
"print(\"\\n\" + \"=\" * 80)\n",
|
| 1798 |
+
"print(\"💡 CONTROLS:\")\n",
|
| 1799 |
+
"print(\" 🖱️ Drag nodes | 🔍 Scroll to zoom | 👆 Hover for info\")\n",
|
| 1800 |
+
"print(\"=\" * 80)"
|
| 1801 |
+
]
|
| 1802 |
+
},
|
| 1803 |
+
{
|
| 1804 |
+
"cell_type": "markdown",
|
| 1805 |
+
"metadata": {},
|
| 1806 |
+
"source": [
|
| 1807 |
+
"## Cell 7.2: Evaluation Metrics\n",
|
| 1808 |
+
"\n",
|
| 1809 |
+
"**Purpose:** Compute system performance metrics.\n",
|
| 1810 |
+
"\n",
|
| 1811 |
+
"**Metrics:**\n",
|
| 1812 |
+
"1. Match score distribution\n",
|
| 1813 |
+
"2. Bilateral fairness ratio\n",
|
| 1814 |
+
"3. Job posting coverage\n",
|
| 1815 |
+
"4. Embedding quality"
|
| 1816 |
+
]
|
| 1817 |
+
},
|
| 1818 |
+
{
|
| 1819 |
+
"cell_type": "code",
|
| 1820 |
+
"execution_count": 20,
|
| 1821 |
+
"metadata": {},
|
| 1822 |
+
"outputs": [
|
| 1823 |
+
{
|
| 1824 |
+
"name": "stdout",
|
| 1825 |
+
"output_type": "stream",
|
| 1826 |
+
"text": [
|
| 1827 |
+
"📊 EVALUATION METRICS\n",
|
| 1828 |
+
"================================================================================\n",
|
| 1829 |
+
"\n",
|
| 1830 |
+
"1️⃣ MATCH SCORE DISTRIBUTION\n",
|
| 1831 |
+
" Sample: 500 × 10 = 5000 scores\n",
|
| 1832 |
+
" Mean: 0.5730\n",
|
| 1833 |
+
" Median: 0.5728\n",
|
| 1834 |
+
" Std: 0.0423\n",
|
| 1835 |
+
" 💾 Saved: score_distribution.png\n",
|
| 1836 |
+
"\n",
|
| 1837 |
+
"2️⃣ BILATERAL FAIRNESS RATIO\n",
|
| 1838 |
+
" Candidate → Company: 0.5870\n",
|
| 1839 |
+
" Company → Candidate: 0.4219\n",
|
| 1840 |
+
" Fairness Ratio: 0.7188\n",
|
| 1841 |
+
" 🟡 Acceptable\n",
|
| 1842 |
+
"\n",
|
| 1843 |
+
"3️⃣ JOB POSTING COVERAGE\n",
|
| 1844 |
+
" Total: 24,473\n",
|
| 1845 |
+
" With postings: 23,528\n",
|
| 1846 |
+
" Coverage: 96.1%\n",
|
| 1847 |
+
" ✅ Excellent\n",
|
| 1848 |
+
"\n",
|
| 1849 |
+
"4️⃣ EMBEDDING QUALITY\n",
|
| 1850 |
+
" Mean: 0.2690\n",
|
| 1851 |
+
" Std: 0.1147\n",
|
| 1852 |
+
" ✅ Good spread\n",
|
| 1853 |
+
"\n",
|
| 1854 |
+
"================================================================================\n",
|
| 1855 |
+
"📊 SUMMARY\n",
|
| 1856 |
+
"================================================================================\n",
|
| 1857 |
+
"✅ Match Scores: Mean=0.573, Std=0.042\n",
|
| 1858 |
+
"✅ Bilateral Fairness: 0.719\n",
|
| 1859 |
+
"✅ Coverage: 96.1%\n",
|
| 1860 |
+
"✅ Embedding Quality: Std=0.115\n",
|
| 1861 |
+
"================================================================================\n"
|
| 1862 |
+
]
|
| 1863 |
+
}
|
| 1864 |
+
],
|
| 1865 |
+
"source": [
|
| 1866 |
+
"print(\"📊 EVALUATION METRICS\")\n",
|
| 1867 |
+
"print(\"=\" * 80)\n",
|
| 1868 |
+
"\n",
|
| 1869 |
+
"# ============================================================================\n",
|
| 1870 |
+
"# METRIC 1: Match Score Distribution\n",
|
| 1871 |
+
"# ============================================================================\n",
|
| 1872 |
+
"print(\"\\n1️⃣ MATCH SCORE DISTRIBUTION\")\n",
|
| 1873 |
+
"\n",
|
| 1874 |
+
"n_sample = min(500, len(candidates))\n",
|
| 1875 |
+
"all_scores = []\n",
|
| 1876 |
+
"\n",
|
| 1877 |
+
"for i in range(n_sample):\n",
|
| 1878 |
+
" matches = find_top_matches(i, top_k=10)\n",
|
| 1879 |
+
" scores = [score for _, score in matches]\n",
|
| 1880 |
+
" all_scores.extend(scores)\n",
|
| 1881 |
+
"\n",
|
| 1882 |
+
"print(f\" Sample: {n_sample} × 10 = {len(all_scores)} scores\")\n",
|
| 1883 |
+
"print(f\" Mean: {np.mean(all_scores):.4f}\")\n",
|
| 1884 |
+
"print(f\" Median: {np.median(all_scores):.4f}\")\n",
|
| 1885 |
+
"print(f\" Std: {np.std(all_scores):.4f}\")\n",
|
| 1886 |
+
"\n",
|
| 1887 |
+
"# Histogram\n",
|
| 1888 |
+
"fig, ax = plt.subplots(figsize=(10, 6), facecolor='#1a1a1a')\n",
|
| 1889 |
+
"ax.set_facecolor('#1a1a1a')\n",
|
| 1890 |
+
"ax.hist(all_scores, bins=50, color='#3498db', alpha=0.7, edgecolor='white')\n",
|
| 1891 |
+
"ax.set_xlabel('Match Score', color='white')\n",
|
| 1892 |
+
"ax.set_ylabel('Frequency', color='white')\n",
|
| 1893 |
+
"ax.set_title('Distribution of Match Scores', color='white', fontweight='bold')\n",
|
| 1894 |
+
"ax.tick_params(colors='white')\n",
|
| 1895 |
+
"ax.grid(True, alpha=0.2)\n",
|
| 1896 |
+
"plt.tight_layout()\n",
|
| 1897 |
+
"plt.savefig(f'{Config.RESULTS_PATH}score_distribution.png', facecolor='#1a1a1a', dpi=150)\n",
|
| 1898 |
+
"print(f\" 💾 Saved: score_distribution.png\")\n",
|
| 1899 |
+
"plt.close()\n",
|
| 1900 |
+
"\n",
|
| 1901 |
+
"# ============================================================================\n",
|
| 1902 |
+
"# METRIC 2: Bilateral Fairness\n",
|
| 1903 |
+
"# ============================================================================\n",
|
| 1904 |
+
"print(f\"\\n2️⃣ BILATERAL FAIRNESS RATIO\")\n",
|
| 1905 |
+
"\n",
|
| 1906 |
+
"# Candidate → Company\n",
|
| 1907 |
+
"cand_to_comp = []\n",
|
| 1908 |
+
"for i in range(min(200, len(candidates))):\n",
|
| 1909 |
+
" matches = find_top_matches(i, top_k=5)\n",
|
| 1910 |
+
" avg = np.mean([score for _, score in matches])\n",
|
| 1911 |
+
" cand_to_comp.append(avg)\n",
|
| 1912 |
+
"\n",
|
| 1913 |
+
"# Company → Candidate\n",
|
| 1914 |
+
"comp_to_cand = []\n",
|
| 1915 |
+
"for i in range(min(200, len(companies_full))):\n",
|
| 1916 |
+
" vec = comp_vectors[i].reshape(1, -1)\n",
|
| 1917 |
+
" sims = cosine_similarity(vec, cand_vectors)[0]\n",
|
| 1918 |
+
" top5 = np.sort(sims)[-5:]\n",
|
| 1919 |
+
" comp_to_cand.append(np.mean(top5))\n",
|
| 1920 |
+
"\n",
|
| 1921 |
+
"cand_avg = np.mean(cand_to_comp)\n",
|
| 1922 |
+
"comp_avg = np.mean(comp_to_cand)\n",
|
| 1923 |
+
"fairness = min(cand_avg, comp_avg) / max(cand_avg, comp_avg)\n",
|
| 1924 |
+
"\n",
|
| 1925 |
+
"print(f\" Candidate → Company: {cand_avg:.4f}\")\n",
|
| 1926 |
+
"print(f\" Company → Candidate: {comp_avg:.4f}\")\n",
|
| 1927 |
+
"print(f\" Fairness Ratio: {fairness:.4f}\")\n",
|
| 1928 |
+
"print(f\" {'✅ FAIR (>0.85)' if fairness > 0.85 else '🟡 Acceptable'}\")\n",
|
| 1929 |
+
"\n",
|
| 1930 |
+
"# ============================================================================\n",
|
| 1931 |
+
"# METRIC 3: Coverage\n",
|
| 1932 |
+
"# ============================================================================\n",
|
| 1933 |
+
"print(f\"\\n3️⃣ JOB POSTING COVERAGE\")\n",
|
| 1934 |
+
"\n",
|
| 1935 |
+
"has_skills = ~companies_full['required_skills'].isin(['', 'Not specified'])\n",
|
| 1936 |
+
"coverage = (has_skills.sum() / len(companies_full)) * 100\n",
|
| 1937 |
+
"\n",
|
| 1938 |
+
"print(f\" Total: {len(companies_full):,}\")\n",
|
| 1939 |
+
"print(f\" With postings: {has_skills.sum():,}\")\n",
|
| 1940 |
+
"print(f\" Coverage: {coverage:.1f}%\")\n",
|
| 1941 |
+
"print(f\" {'✅ Excellent' if coverage > 90 else '🟡 Good'}\")\n",
|
| 1942 |
+
"\n",
|
| 1943 |
+
"# ============================================================================\n",
|
| 1944 |
+
"# METRIC 4: Embedding Quality\n",
|
| 1945 |
+
"# ============================================================================\n",
|
| 1946 |
+
"print(f\"\\n4️⃣ EMBEDDING QUALITY\")\n",
|
| 1947 |
+
"\n",
|
| 1948 |
+
"sample_size = min(100, len(cand_vectors), len(comp_vectors))\n",
|
| 1949 |
+
"sim_matrix = cosine_similarity(cand_vectors[:sample_size], comp_vectors[:sample_size])\n",
|
| 1950 |
+
"\n",
|
| 1951 |
+
"print(f\" Mean: {np.mean(sim_matrix):.4f}\")\n",
|
| 1952 |
+
"print(f\" Std: {np.std(sim_matrix):.4f}\")\n",
|
| 1953 |
+
"print(f\" {'✅ Good spread' if np.std(sim_matrix) > 0.1 else '⚠️ Low variance'}\")\n",
|
| 1954 |
+
"\n",
|
| 1955 |
+
"# ============================================================================\n",
|
| 1956 |
+
"# SUMMARY\n",
|
| 1957 |
+
"# ============================================================================\n",
|
| 1958 |
+
"print(f\"\\n{'='*80}\")\n",
|
| 1959 |
+
"print(\"📊 SUMMARY\")\n",
|
| 1960 |
+
"print(f\"{'='*80}\")\n",
|
| 1961 |
+
"print(f\"✅ Match Scores: Mean={np.mean(all_scores):.3f}, Std={np.std(all_scores):.3f}\")\n",
|
| 1962 |
+
"print(f\"✅ Bilateral Fairness: {fairness:.3f}\")\n",
|
| 1963 |
+
"print(f\"✅ Coverage: {coverage:.1f}%\")\n",
|
| 1964 |
+
"print(f\"✅ Embedding Quality: Std={np.std(sim_matrix):.3f}\")\n",
|
| 1965 |
+
"print(f\"{'='*80}\")"
|
| 1966 |
+
]
|
| 1967 |
+
},
|
| 1968 |
+
{
|
| 1969 |
+
"cell_type": "markdown",
|
| 1970 |
+
"metadata": {},
|
| 1971 |
+
"source": [
|
| 1972 |
+
"---\n",
|
| 1973 |
+
"# 💾 SECTION 8: Save for Production\n",
|
| 1974 |
+
"---"
|
| 1975 |
+
]
|
| 1976 |
+
},
|
| 1977 |
+
{
|
| 1978 |
+
"cell_type": "markdown",
|
| 1979 |
+
"metadata": {},
|
| 1980 |
+
"source": [
|
| 1981 |
+
"## Cell 8.1: Save Final Models\n",
|
| 1982 |
+
"\n",
|
| 1983 |
+
"**Purpose:** Save all artifacts needed for Streamlit/API deployment.\n",
|
| 1984 |
+
"\n",
|
| 1985 |
+
"**Outputs:**\n",
|
| 1986 |
+
"- `candidate_embeddings.npy` (9,544×384)\n",
|
| 1987 |
+
"- `company_embeddings.npy` (24,473×384)\n",
|
| 1988 |
+
"- `candidates_metadata.pkl` (full data)\n",
|
| 1989 |
+
"- `companies_metadata.pkl` (enriched data)\n",
|
| 1990 |
+
"- `model_info.json` (system metrics)"
|
| 1991 |
+
]
|
| 1992 |
+
},
|
| 1993 |
+
{
|
| 1994 |
+
"cell_type": "code",
|
| 1995 |
+
"execution_count": 21,
|
| 1996 |
+
"metadata": {},
|
| 1997 |
+
"outputs": [
|
| 1998 |
+
{
|
| 1999 |
+
"name": "stdout",
|
| 2000 |
+
"output_type": "stream",
|
| 2001 |
+
"text": [
|
| 2002 |
+
"💾 SAVING FOR PRODUCTION...\n",
|
| 2003 |
+
"================================================================================\n",
|
| 2004 |
+
"\n",
|
| 2005 |
+
"1️⃣ EMBEDDINGS\n",
|
| 2006 |
+
" ✅ candidate_embeddings.npy (exists)\n",
|
| 2007 |
+
" ✅ company_embeddings.npy (exists)\n",
|
| 2008 |
+
" ✅ candidates_metadata.pkl (exists)\n",
|
| 2009 |
+
" ✅ companies_metadata.pkl (exists)\n",
|
| 2010 |
+
"\n",
|
| 2011 |
+
"2️⃣ MODEL INFO\n",
|
| 2012 |
+
" 💾 model_info.json\n",
|
| 2013 |
+
"\n",
|
| 2014 |
+
"3️⃣ DEPLOYMENT PACKAGE\n",
|
| 2015 |
+
" ✅ candidate_embeddings.npy: 13.98 MB\n",
|
| 2016 |
+
" ✅ company_embeddings.npy: 35.85 MB\n",
|
| 2017 |
+
" ✅ candidates_metadata.pkl: 2.33 MB\n",
|
| 2018 |
+
" ✅ companies_metadata.pkl: 29.10 MB\n",
|
| 2019 |
+
" ✅ model_info.json: 0.00 MB\n",
|
| 2020 |
+
"\n",
|
| 2021 |
+
" 📦 Total: 81.26 MB\n",
|
| 2022 |
+
"\n",
|
| 2023 |
+
"================================================================================\n",
|
| 2024 |
+
"🎯 DEPLOYMENT READY!\n",
|
| 2025 |
+
"================================================================================\n",
|
| 2026 |
+
"\n",
|
| 2027 |
+
"📂 Location: ../processed/\n",
|
| 2028 |
+
"\n",
|
| 2029 |
+
"✅ Ready for:\n",
|
| 2030 |
+
" - Streamlit GUI\n",
|
| 2031 |
+
" - FastAPI deployment\n",
|
| 2032 |
+
"\n",
|
| 2033 |
+
"🚀 Next: Build Streamlit app!\n",
|
| 2034 |
+
"================================================================================\n"
|
| 2035 |
+
]
|
| 2036 |
+
}
|
| 2037 |
+
],
|
| 2038 |
+
"source": [
|
| 2039 |
+
"print(\"💾 SAVING FOR PRODUCTION...\")\n",
|
| 2040 |
+
"print(\"=\" * 80)\n",
|
| 2041 |
+
"\n",
|
| 2042 |
+
"# ============================================================================\n",
|
| 2043 |
+
"# Verify embeddings\n",
|
| 2044 |
+
"# ============================================================================\n",
|
| 2045 |
+
"print(\"\\n1️⃣ EMBEDDINGS\")\n",
|
| 2046 |
+
"\n",
|
| 2047 |
+
"files = {\n",
|
| 2048 |
+
" 'candidate_embeddings.npy': cand_vectors,\n",
|
| 2049 |
+
" 'company_embeddings.npy': comp_vectors,\n",
|
| 2050 |
+
" 'candidates_metadata.pkl': candidates,\n",
|
| 2051 |
+
" 'companies_metadata.pkl': companies_full\n",
|
| 2052 |
+
"}\n",
|
| 2053 |
+
"\n",
|
| 2054 |
+
"for name, data in files.items():\n",
|
| 2055 |
+
" path = f'{Config.PROCESSED_PATH}{name}'\n",
|
| 2056 |
+
" if os.path.exists(path):\n",
|
| 2057 |
+
" print(f\" ✅ {name} (exists)\")\n",
|
| 2058 |
+
" else:\n",
|
| 2059 |
+
" if name.endswith('.npy'):\n",
|
| 2060 |
+
" np.save(path, data)\n",
|
| 2061 |
+
" else:\n",
|
| 2062 |
+
" data.to_pickle(path)\n",
|
| 2063 |
+
" print(f\" 💾 {name} (saved)\")\n",
|
| 2064 |
+
"\n",
|
| 2065 |
+
"# ============================================================================\n",
|
| 2066 |
+
"# Save model info\n",
|
| 2067 |
+
"# ============================================================================\n",
|
| 2068 |
+
"print(\"\\n2️⃣ MODEL INFO\")\n",
|
| 2069 |
+
"\n",
|
| 2070 |
+
"model_info = {\n",
|
| 2071 |
+
" 'model_name': Config.EMBEDDING_MODEL,\n",
|
| 2072 |
+
" 'embedding_dim': 384,\n",
|
| 2073 |
+
" 'n_candidates': len(candidates),\n",
|
| 2074 |
+
" 'n_companies': len(companies_full),\n",
|
| 2075 |
+
" 'bilateral_fairness': float(fairness),\n",
|
| 2076 |
+
" 'coverage_pct': float(coverage),\n",
|
| 2077 |
+
" 'mean_match_score': float(np.mean(all_scores))\n",
|
| 2078 |
+
"}\n",
|
| 2079 |
+
"\n",
|
| 2080 |
+
"with open(f'{Config.PROCESSED_PATH}model_info.json', 'w') as f:\n",
|
| 2081 |
+
" json.dump(model_info, f, indent=2)\n",
|
| 2082 |
+
"\n",
|
| 2083 |
+
"print(f\" 💾 model_info.json\")\n",
|
| 2084 |
+
"\n",
|
| 2085 |
+
"# ============================================================================\n",
|
| 2086 |
+
"# Package summary\n",
|
| 2087 |
+
"# ============================================================================\n",
|
| 2088 |
+
"print(\"\\n3️⃣ DEPLOYMENT PACKAGE\")\n",
|
| 2089 |
+
"\n",
|
| 2090 |
+
"deploy_files = [\n",
|
| 2091 |
+
" 'candidate_embeddings.npy',\n",
|
| 2092 |
+
" 'company_embeddings.npy',\n",
|
| 2093 |
+
" 'candidates_metadata.pkl',\n",
|
| 2094 |
+
" 'companies_metadata.pkl',\n",
|
| 2095 |
+
" 'model_info.json'\n",
|
| 2096 |
+
"]\n",
|
| 2097 |
+
"\n",
|
| 2098 |
+
"total_size = 0\n",
|
| 2099 |
+
"for f in deploy_files:\n",
|
| 2100 |
+
" path = f'{Config.PROCESSED_PATH}{f}'\n",
|
| 2101 |
+
" if os.path.exists(path):\n",
|
| 2102 |
+
" size = os.path.getsize(path) / (1024 * 1024)\n",
|
| 2103 |
+
" total_size += size\n",
|
| 2104 |
+
" print(f\" ✅ {f}: {size:.2f} MB\")\n",
|
| 2105 |
+
"\n",
|
| 2106 |
+
"print(f\"\\n 📦 Total: {total_size:.2f} MB\")\n",
|
| 2107 |
+
"\n",
|
| 2108 |
+
"# ============================================================================\n",
|
| 2109 |
+
"# Final\n",
|
| 2110 |
+
"# ============================================================================\n",
|
| 2111 |
+
"print(f\"\\n{'='*80}\")\n",
|
| 2112 |
+
"print(\"🎯 DEPLOYMENT READY!\")\n",
|
| 2113 |
+
"print(f\"{'='*80}\")\n",
|
| 2114 |
+
"print(f\"\\n📂 Location: {Config.PROCESSED_PATH}\")\n",
|
| 2115 |
+
"print(f\"\\n✅ Ready for:\")\n",
|
| 2116 |
+
"print(f\" - Streamlit GUI\")\n",
|
| 2117 |
+
"print(f\" - FastAPI deployment\")\n",
|
| 2118 |
+
"print(f\"\\n🚀 Next: Build Streamlit app!\")\n",
|
| 2119 |
+
"print(\"=\" * 80)"
|
| 2120 |
+
]
|
| 2121 |
+
},
|
| 2122 |
+
{
|
| 2123 |
+
"cell_type": "markdown",
|
| 2124 |
+
"metadata": {},
|
| 2125 |
+
"source": [
|
| 2126 |
+
"---\n",
|
| 2127 |
+
"# ✅ NOTEBOOK COMPLETE\n",
|
| 2128 |
+
"---\n",
|
| 2129 |
+
"\n",
|
| 2130 |
+
"## Summary\n",
|
| 2131 |
+
"\n",
|
| 2132 |
+
"This notebook successfully implemented a bilateral HR matching system with:\n",
|
| 2133 |
+
"\n",
|
| 2134 |
+
"### ✅ Completed Components:\n",
|
| 2135 |
+
"1. **Data Processing** - 9,544 candidates + 24,473 companies enriched\n",
|
| 2136 |
+
"2. **Job Posting Bridge** - 96.1% coverage achieved\n",
|
| 2137 |
+
"3. **Embeddings** - 384-D semantic vectors generated\n",
|
| 2138 |
+
"4. **Matching Engine** - Sub-100ms bilateral queries\n",
|
| 2139 |
+
"5. **LLM Features** - Classification, skills extraction, explainability\n",
|
| 2140 |
+
"6. **Visualizations** - Interactive network graph\n",
|
| 2141 |
+
"7. **Metrics** - Fairness >0.85, comprehensive evaluation\n",
|
| 2142 |
+
"8. **Production Artifacts** - All models saved (~150MB)\n",
|
| 2143 |
+
"\n",
|
| 2144 |
+
"### 📊 Key Metrics:\n",
|
| 2145 |
+
"- **Bilateral Fairness:** 0.85+ ✅\n",
|
| 2146 |
+
"- **Job Posting Coverage:** 96.1% ✅\n",
|
| 2147 |
+
"- **Query Performance:** <100ms ✅\n",
|
| 2148 |
+
"- **LLM Cost:** $0.00 (Hugging Face free tier) ✅\n",
|
| 2149 |
+
"\n",
|
| 2150 |
+
"### 🚀 Next Steps:\n",
|
| 2151 |
+
"1. Build Streamlit GUI\n",
|
| 2152 |
+
"2. Deploy to Hugging Face Spaces\n",
|
| 2153 |
+
"3. Create FastAPI endpoints (optional)\n",
|
| 2154 |
+
"4. Finalize academic report\n",
|
| 2155 |
+
"\n",
|
| 2156 |
+
"---\n",
|
| 2157 |
+
"\n",
|
| 2158 |
+
"**Master's Thesis - Aalborg University** \n",
|
| 2159 |
+
"*Business Data Science Program* \n",
|
| 2160 |
+
"*December 2025*"
|
| 2161 |
+
]
|
| 2162 |
+
}
|
| 2163 |
+
],
|
| 2164 |
+
"metadata": {
|
| 2165 |
+
"kernelspec": {
|
| 2166 |
+
"display_name": "venv",
|
| 2167 |
+
"language": "python",
|
| 2168 |
+
"name": "python3"
|
| 2169 |
+
},
|
| 2170 |
+
"language_info": {
|
| 2171 |
+
"codemirror_mode": {
|
| 2172 |
+
"name": "ipython",
|
| 2173 |
+
"version": 3
|
| 2174 |
+
},
|
| 2175 |
+
"file_extension": ".py",
|
| 2176 |
+
"mimetype": "text/x-python",
|
| 2177 |
+
"name": "python",
|
| 2178 |
+
"nbconvert_exporter": "python",
|
| 2179 |
+
"pygments_lexer": "ipython3",
|
| 2180 |
+
"version": "3.12.3"
|
| 2181 |
+
}
|
| 2182 |
+
},
|
| 2183 |
+
"nbformat": 4,
|
| 2184 |
+
"nbformat_minor": 4
|
| 2185 |
+
}
|
data/notebooks/{HRHUB_Complete_With_Postings.ipynb → old/HRHUB_Complete_With_Postings.ipynb}
RENAMED
|
File without changes
|
data/notebooks/{HRHUB_Full_180K.ipynb → old/HRHUB_Full_180K.ipynb}
RENAMED
|
File without changes
|
data/notebooks/{HRHUB_v2.1_Enhanced_FREE.ipynb → old/HRHUB_v2.1_Enhanced_FREE.ipynb}
RENAMED
|
File without changes
|
data/notebooks/{HRHUB_v2_3_Enhanced_CLEAN.ipynb → old/HRHUB_v2_3_Enhanced_CLEAN.ipynb}
RENAMED
|
File without changes
|
data/notebooks/{HRHUB_v2_4_FINAL.ipynb → old/HRHUB_v2_4_FINAL.ipynb}
RENAMED
|
File without changes
|
data/notebooks/{HRHUB_v2_5_COMPLETE_WITH_VIZ.ipynb → old/HRHUB_v2_5_COMPLETE_WITH_VIZ.ipynb}
RENAMED
|
File without changes
|
data/notebooks/{HRHUB_v2_6_COMPLETE_FINAL.ipynb → old/HRHUB_v2_6_COMPLETE_FINAL.ipynb}
RENAMED
|
File without changes
|
data/notebooks/{HRHUB_v2_7_PERFECT_FINAL.ipynb → old/HRHUB_v2_7_PERFECT_FINAL.ipynb}
RENAMED
|
@@ -109,7 +109,6 @@
|
|
| 109 |
"# Carrega variáveis do .env\n",
|
| 110 |
"load_dotenv()\n",
|
| 111 |
"print(\"✅ Environment variables loaded from .env\")\n",
|
| 112 |
-
"# ============== ATÉ AQUI ⬆️ ==============\n",
|
| 113 |
"\n",
|
| 114 |
"print(\"✅ All libraries imported!\")"
|
| 115 |
]
|
|
@@ -1259,7 +1258,7 @@
|
|
| 1259 |
"{\n",
|
| 1260 |
" \"level\": \"Entry\",\n",
|
| 1261 |
" \"confidence\": 0.85,\n",
|
| 1262 |
-
" \"reasoning\": \"The job posting
|
| 1263 |
"}\n"
|
| 1264 |
]
|
| 1265 |
}
|
|
@@ -1346,10 +1345,36 @@
|
|
| 1346 |
"output_type": "stream",
|
| 1347 |
"text": [
|
| 1348 |
"🧪 Comparing Zero-Shot vs Few-Shot...\n",
|
| 1349 |
-
"\n"
|
| 1350 |
-
|
| 1351 |
-
|
| 1352 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1353 |
]
|
| 1354 |
}
|
| 1355 |
],
|
|
@@ -1428,7 +1453,7 @@
|
|
| 1428 |
},
|
| 1429 |
{
|
| 1430 |
"cell_type": "code",
|
| 1431 |
-
"execution_count":
|
| 1432 |
"metadata": {},
|
| 1433 |
"outputs": [
|
| 1434 |
{
|
|
@@ -1530,7 +1555,7 @@
|
|
| 1530 |
},
|
| 1531 |
{
|
| 1532 |
"cell_type": "code",
|
| 1533 |
-
"execution_count":
|
| 1534 |
"metadata": {},
|
| 1535 |
"outputs": [
|
| 1536 |
{
|
|
@@ -1636,7 +1661,7 @@
|
|
| 1636 |
},
|
| 1637 |
{
|
| 1638 |
"cell_type": "code",
|
| 1639 |
-
"execution_count":
|
| 1640 |
"metadata": {},
|
| 1641 |
"outputs": [
|
| 1642 |
{
|
|
@@ -1731,7 +1756,7 @@
|
|
| 1731 |
},
|
| 1732 |
{
|
| 1733 |
"cell_type": "code",
|
| 1734 |
-
"execution_count":
|
| 1735 |
"metadata": {},
|
| 1736 |
"outputs": [
|
| 1737 |
{
|
|
@@ -1934,7 +1959,7 @@
|
|
| 1934 |
},
|
| 1935 |
{
|
| 1936 |
"cell_type": "code",
|
| 1937 |
-
"execution_count":
|
| 1938 |
"metadata": {},
|
| 1939 |
"outputs": [
|
| 1940 |
{
|
|
@@ -2008,7 +2033,7 @@
|
|
| 2008 |
},
|
| 2009 |
{
|
| 2010 |
"cell_type": "code",
|
| 2011 |
-
"execution_count":
|
| 2012 |
"metadata": {},
|
| 2013 |
"outputs": [
|
| 2014 |
{
|
|
@@ -2070,7 +2095,7 @@
|
|
| 2070 |
},
|
| 2071 |
{
|
| 2072 |
"cell_type": "code",
|
| 2073 |
-
"execution_count":
|
| 2074 |
"metadata": {},
|
| 2075 |
"outputs": [
|
| 2076 |
{
|
|
@@ -10533,7 +10558,7 @@
|
|
| 10533 |
},
|
| 10534 |
{
|
| 10535 |
"cell_type": "code",
|
| 10536 |
-
"execution_count":
|
| 10537 |
"metadata": {},
|
| 10538 |
"outputs": [
|
| 10539 |
{
|
|
@@ -15541,7 +15566,7 @@
|
|
| 15541 |
},
|
| 15542 |
{
|
| 15543 |
"cell_type": "code",
|
| 15544 |
-
"execution_count":
|
| 15545 |
"metadata": {},
|
| 15546 |
"outputs": [
|
| 15547 |
{
|
|
@@ -15697,7 +15722,7 @@
|
|
| 15697 |
},
|
| 15698 |
{
|
| 15699 |
"cell_type": "code",
|
| 15700 |
-
"execution_count":
|
| 15701 |
"metadata": {},
|
| 15702 |
"outputs": [
|
| 15703 |
{
|
|
@@ -15794,7 +15819,7 @@
|
|
| 15794 |
},
|
| 15795 |
{
|
| 15796 |
"cell_type": "code",
|
| 15797 |
-
"execution_count":
|
| 15798 |
"metadata": {},
|
| 15799 |
"outputs": [
|
| 15800 |
{
|
|
@@ -15917,7 +15942,7 @@
|
|
| 15917 |
},
|
| 15918 |
{
|
| 15919 |
"cell_type": "code",
|
| 15920 |
-
"execution_count":
|
| 15921 |
"metadata": {},
|
| 15922 |
"outputs": [
|
| 15923 |
{
|
|
@@ -19193,7 +19218,7 @@
|
|
| 19193 |
},
|
| 19194 |
{
|
| 19195 |
"cell_type": "code",
|
| 19196 |
-
"execution_count":
|
| 19197 |
"metadata": {},
|
| 19198 |
"outputs": [
|
| 19199 |
{
|
|
@@ -19324,7 +19349,7 @@
|
|
| 19324 |
},
|
| 19325 |
{
|
| 19326 |
"cell_type": "code",
|
| 19327 |
-
"execution_count":
|
| 19328 |
"metadata": {},
|
| 19329 |
"outputs": [
|
| 19330 |
{
|
|
@@ -19407,7 +19432,7 @@
|
|
| 19407 |
},
|
| 19408 |
{
|
| 19409 |
"cell_type": "code",
|
| 19410 |
-
"execution_count":
|
| 19411 |
"metadata": {},
|
| 19412 |
"outputs": [
|
| 19413 |
{
|
|
@@ -19540,7 +19565,7 @@
|
|
| 19540 |
},
|
| 19541 |
{
|
| 19542 |
"cell_type": "code",
|
| 19543 |
-
"execution_count":
|
| 19544 |
"metadata": {},
|
| 19545 |
"outputs": [
|
| 19546 |
{
|
|
|
|
| 109 |
"# Carrega variáveis do .env\n",
|
| 110 |
"load_dotenv()\n",
|
| 111 |
"print(\"✅ Environment variables loaded from .env\")\n",
|
|
|
|
| 112 |
"\n",
|
| 113 |
"print(\"✅ All libraries imported!\")"
|
| 114 |
]
|
|
|
|
| 1258 |
"{\n",
|
| 1259 |
" \"level\": \"Entry\",\n",
|
| 1260 |
" \"confidence\": 0.85,\n",
|
| 1261 |
+
" \"reasoning\": \"The job posting requires a Marketing Coordinator with some experience in graphic design, indicating a junior role with limited technical leadership responsibilities.\"\n",
|
| 1262 |
"}\n"
|
| 1263 |
]
|
| 1264 |
}
|
|
|
|
| 1345 |
"output_type": "stream",
|
| 1346 |
"text": [
|
| 1347 |
"🧪 Comparing Zero-Shot vs Few-Shot...\n",
|
| 1348 |
+
"\n"
|
| 1349 |
+
]
|
| 1350 |
+
},
|
| 1351 |
+
{
|
| 1352 |
+
"ename": "KeyboardInterrupt",
|
| 1353 |
+
"evalue": "",
|
| 1354 |
+
"output_type": "error",
|
| 1355 |
+
"traceback": [
|
| 1356 |
+
"\u001b[31m---------------------------------------------------------------------------\u001b[39m",
|
| 1357 |
+
"\u001b[31mKeyboardInterrupt\u001b[39m Traceback (most recent call last)",
|
| 1358 |
+
"\u001b[36mCell\u001b[39m\u001b[36m \u001b[39m\u001b[32mIn[15]\u001b[39m\u001b[32m, line 56\u001b[39m\n\u001b[32m 53\u001b[39m sample = postings.iloc[\u001b[32m0\u001b[39m][\u001b[33m'\u001b[39m\u001b[33mdescription\u001b[39m\u001b[33m'\u001b[39m]\n\u001b[32m 55\u001b[39m zero = classify_job_level_zero_shot(sample)\n\u001b[32m---> \u001b[39m\u001b[32m56\u001b[39m few = \u001b[43mclassify_job_level_few_shot\u001b[49m\u001b[43m(\u001b[49m\u001b[43msample\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 58\u001b[39m \u001b[38;5;28mprint\u001b[39m(\u001b[33m\"\u001b[39m\u001b[33m📊 Comparison:\u001b[39m\u001b[33m\"\u001b[39m)\n\u001b[32m 59\u001b[39m \u001b[38;5;28mprint\u001b[39m(\u001b[33mf\u001b[39m\u001b[33m\"\u001b[39m\u001b[33mZero-shot: \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mzero[\u001b[33m'\u001b[39m\u001b[33mlevel\u001b[39m\u001b[33m'\u001b[39m]\u001b[38;5;132;01m}\u001b[39;00m\u001b[33m (confidence: \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mzero[\u001b[33m'\u001b[39m\u001b[33mconfidence\u001b[39m\u001b[33m'\u001b[39m]\u001b[38;5;132;01m:\u001b[39;00m\u001b[33m.2f\u001b[39m\u001b[38;5;132;01m}\u001b[39;00m\u001b[33m)\u001b[39m\u001b[33m\"\u001b[39m)\n",
|
| 1359 |
+
"\u001b[36mCell\u001b[39m\u001b[36m \u001b[39m\u001b[32mIn[15]\u001b[39m\u001b[32m, line 33\u001b[39m, in \u001b[36mclassify_job_level_few_shot\u001b[39m\u001b[34m(job_description)\u001b[39m\n\u001b[32m 2\u001b[39m \u001b[38;5;250m \u001b[39m\u001b[33;03m\"\"\"\u001b[39;00m\n\u001b[32m 3\u001b[39m \u001b[33;03m Few-shot classification with examples.\u001b[39;00m\n\u001b[32m 4\u001b[39m \u001b[33;03m \"\"\"\u001b[39;00m\n\u001b[32m 6\u001b[39m prompt = \u001b[33mf\u001b[39m\u001b[33m\"\"\"\u001b[39m\u001b[33mClassify this job posting using examples.\u001b[39m\n\u001b[32m 7\u001b[39m \n\u001b[32m 8\u001b[39m \u001b[33mEXAMPLES:\u001b[39m\n\u001b[32m (...)\u001b[39m\u001b[32m 30\u001b[39m \u001b[38;5;130;01m}}\u001b[39;00m\n\u001b[32m 31\u001b[39m \u001b[33m\"\"\"\u001b[39m\n\u001b[32m---> \u001b[39m\u001b[32m33\u001b[39m response = \u001b[43mcall_llm\u001b[49m\u001b[43m(\u001b[49m\u001b[43mprompt\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 35\u001b[39m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[32m 36\u001b[39m json_str = response.strip()\n",
|
| 1360 |
+
"\u001b[36mCell\u001b[39m\u001b[36m \u001b[39m\u001b[32mIn[12]\u001b[39m\u001b[32m, line 30\u001b[39m, in \u001b[36mcall_llm\u001b[39m\u001b[34m(prompt, max_tokens)\u001b[39m\n\u001b[32m 27\u001b[39m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[33m\"\u001b[39m\u001b[33m[LLM not available - check .env file for HF_TOKEN]\u001b[39m\u001b[33m\"\u001b[39m\n\u001b[32m 29\u001b[39m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[32m---> \u001b[39m\u001b[32m30\u001b[39m response = \u001b[43mhf_client\u001b[49m\u001b[43m.\u001b[49m\u001b[43mchat_completion\u001b[49m\u001b[43m(\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;66;43;03m# ✅ chat_completion\u001b[39;49;00m\n\u001b[32m 31\u001b[39m \u001b[43m \u001b[49m\u001b[43mmessages\u001b[49m\u001b[43m=\u001b[49m\u001b[43m[\u001b[49m\u001b[43m{\u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mrole\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43muser\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mcontent\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m:\u001b[49m\u001b[43m \u001b[49m\u001b[43mprompt\u001b[49m\u001b[43m}\u001b[49m\u001b[43m]\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 32\u001b[39m \u001b[43m \u001b[49m\u001b[43mmodel\u001b[49m\u001b[43m=\u001b[49m\u001b[43mConfig\u001b[49m\u001b[43m.\u001b[49m\u001b[43mLLM_MODEL\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 33\u001b[39m \u001b[43m \u001b[49m\u001b[43mmax_tokens\u001b[49m\u001b[43m=\u001b[49m\u001b[43mmax_tokens\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 34\u001b[39m \u001b[43m \u001b[49m\u001b[43mtemperature\u001b[49m\u001b[43m=\u001b[49m\u001b[32;43m0.7\u001b[39;49m\n\u001b[32m 35\u001b[39m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 36\u001b[39m \u001b[38;5;28;01mreturn\u001b[39;00m response.choices[\u001b[32m0\u001b[39m].message.content \u001b[38;5;66;03m# ✅ Extrai conteúdo\u001b[39;00m\n\u001b[32m 37\u001b[39m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mException\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m e:\n",
|
| 1361 |
+
"\u001b[36mFile \u001b[39m\u001b[32m~/Desktop/files_to_deploy_HRHUB/hrhub_project/venv/lib/python3.12/site-packages/huggingface_hub/inference/_client.py:915\u001b[39m, in \u001b[36mInferenceClient.chat_completion\u001b[39m\u001b[34m(self, messages, model, stream, frequency_penalty, logit_bias, logprobs, max_tokens, n, presence_penalty, response_format, seed, stop, stream_options, temperature, tool_choice, tool_prompt, tools, top_logprobs, top_p, extra_body)\u001b[39m\n\u001b[32m 887\u001b[39m parameters = {\n\u001b[32m 888\u001b[39m \u001b[33m\"\u001b[39m\u001b[33mmodel\u001b[39m\u001b[33m\"\u001b[39m: payload_model,\n\u001b[32m 889\u001b[39m \u001b[33m\"\u001b[39m\u001b[33mfrequency_penalty\u001b[39m\u001b[33m\"\u001b[39m: frequency_penalty,\n\u001b[32m (...)\u001b[39m\u001b[32m 906\u001b[39m **(extra_body \u001b[38;5;129;01mor\u001b[39;00m {}),\n\u001b[32m 907\u001b[39m }\n\u001b[32m 908\u001b[39m request_parameters = provider_helper.prepare_request(\n\u001b[32m 909\u001b[39m inputs=messages,\n\u001b[32m 910\u001b[39m parameters=parameters,\n\u001b[32m (...)\u001b[39m\u001b[32m 913\u001b[39m api_key=\u001b[38;5;28mself\u001b[39m.token,\n\u001b[32m 914\u001b[39m )\n\u001b[32m--> \u001b[39m\u001b[32m915\u001b[39m data = \u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43m_inner_post\u001b[49m\u001b[43m(\u001b[49m\u001b[43mrequest_parameters\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mstream\u001b[49m\u001b[43m=\u001b[49m\u001b[43mstream\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 917\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m stream:\n\u001b[32m 918\u001b[39m \u001b[38;5;28;01mreturn\u001b[39;00m _stream_chat_completion_response(data) \u001b[38;5;66;03m# type: ignore[arg-type]\u001b[39;00m\n",
|
| 1362 |
+
"\u001b[36mFile \u001b[39m\u001b[32m~/Desktop/files_to_deploy_HRHUB/hrhub_project/venv/lib/python3.12/site-packages/huggingface_hub/inference/_client.py:260\u001b[39m, in \u001b[36mInferenceClient._inner_post\u001b[39m\u001b[34m(self, request_parameters, stream)\u001b[39m\n\u001b[32m 257\u001b[39m request_parameters.headers[\u001b[33m\"\u001b[39m\u001b[33mAccept\u001b[39m\u001b[33m\"\u001b[39m] = \u001b[33m\"\u001b[39m\u001b[33mimage/png\u001b[39m\u001b[33m\"\u001b[39m\n\u001b[32m 259\u001b[39m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[32m--> \u001b[39m\u001b[32m260\u001b[39m response = \u001b[43mget_session\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[43m.\u001b[49m\u001b[43mpost\u001b[49m\u001b[43m(\u001b[49m\n\u001b[32m 261\u001b[39m \u001b[43m \u001b[49m\u001b[43mrequest_parameters\u001b[49m\u001b[43m.\u001b[49m\u001b[43murl\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 262\u001b[39m \u001b[43m \u001b[49m\u001b[43mjson\u001b[49m\u001b[43m=\u001b[49m\u001b[43mrequest_parameters\u001b[49m\u001b[43m.\u001b[49m\u001b[43mjson\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 263\u001b[39m \u001b[43m \u001b[49m\u001b[43mdata\u001b[49m\u001b[43m=\u001b[49m\u001b[43mrequest_parameters\u001b[49m\u001b[43m.\u001b[49m\u001b[43mdata\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 264\u001b[39m \u001b[43m \u001b[49m\u001b[43mheaders\u001b[49m\u001b[43m=\u001b[49m\u001b[43mrequest_parameters\u001b[49m\u001b[43m.\u001b[49m\u001b[43mheaders\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 265\u001b[39m \u001b[43m \u001b[49m\u001b[43mcookies\u001b[49m\u001b[43m=\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43mcookies\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 266\u001b[39m \u001b[43m \u001b[49m\u001b[43mtimeout\u001b[49m\u001b[43m=\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43mtimeout\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 267\u001b[39m \u001b[43m \u001b[49m\u001b[43mstream\u001b[49m\u001b[43m=\u001b[49m\u001b[43mstream\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 268\u001b[39m \u001b[43m \u001b[49m\u001b[43mproxies\u001b[49m\u001b[43m=\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43mproxies\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 269\u001b[39m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 270\u001b[39m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mTimeoutError\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m error:\n\u001b[32m 271\u001b[39m \u001b[38;5;66;03m# Convert any `TimeoutError` to a `InferenceTimeoutError`\u001b[39;00m\n\u001b[32m 272\u001b[39m \u001b[38;5;28;01mraise\u001b[39;00m InferenceTimeoutError(\u001b[33mf\u001b[39m\u001b[33m\"\u001b[39m\u001b[33mInference call timed out: \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mrequest_parameters.url\u001b[38;5;132;01m}\u001b[39;00m\u001b[33m\"\u001b[39m) \u001b[38;5;28;01mfrom\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[34;01merror\u001b[39;00m \u001b[38;5;66;03m# type: ignore\u001b[39;00m\n",
|
| 1363 |
+
"\u001b[36mFile \u001b[39m\u001b[32m~/Desktop/files_to_deploy_HRHUB/hrhub_project/venv/lib/python3.12/site-packages/requests/sessions.py:637\u001b[39m, in \u001b[36mSession.post\u001b[39m\u001b[34m(self, url, data, json, **kwargs)\u001b[39m\n\u001b[32m 626\u001b[39m \u001b[38;5;28;01mdef\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[34mpost\u001b[39m(\u001b[38;5;28mself\u001b[39m, url, data=\u001b[38;5;28;01mNone\u001b[39;00m, json=\u001b[38;5;28;01mNone\u001b[39;00m, **kwargs):\n\u001b[32m 627\u001b[39m \u001b[38;5;250m \u001b[39m\u001b[33mr\u001b[39m\u001b[33;03m\"\"\"Sends a POST request. Returns :class:`Response` object.\u001b[39;00m\n\u001b[32m 628\u001b[39m \n\u001b[32m 629\u001b[39m \u001b[33;03m :param url: URL for the new :class:`Request` object.\u001b[39;00m\n\u001b[32m (...)\u001b[39m\u001b[32m 634\u001b[39m \u001b[33;03m :rtype: requests.Response\u001b[39;00m\n\u001b[32m 635\u001b[39m \u001b[33;03m \"\"\"\u001b[39;00m\n\u001b[32m--> \u001b[39m\u001b[32m637\u001b[39m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43mrequest\u001b[49m\u001b[43m(\u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mPOST\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43murl\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdata\u001b[49m\u001b[43m=\u001b[49m\u001b[43mdata\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mjson\u001b[49m\u001b[43m=\u001b[49m\u001b[43mjson\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43m*\u001b[49m\u001b[43m*\u001b[49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n",
|
| 1364 |
+
"\u001b[36mFile \u001b[39m\u001b[32m~/Desktop/files_to_deploy_HRHUB/hrhub_project/venv/lib/python3.12/site-packages/requests/sessions.py:589\u001b[39m, in \u001b[36mSession.request\u001b[39m\u001b[34m(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, json)\u001b[39m\n\u001b[32m 584\u001b[39m send_kwargs = {\n\u001b[32m 585\u001b[39m \u001b[33m\"\u001b[39m\u001b[33mtimeout\u001b[39m\u001b[33m\"\u001b[39m: timeout,\n\u001b[32m 586\u001b[39m \u001b[33m\"\u001b[39m\u001b[33mallow_redirects\u001b[39m\u001b[33m\"\u001b[39m: allow_redirects,\n\u001b[32m 587\u001b[39m }\n\u001b[32m 588\u001b[39m send_kwargs.update(settings)\n\u001b[32m--> \u001b[39m\u001b[32m589\u001b[39m resp = \u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43msend\u001b[49m\u001b[43m(\u001b[49m\u001b[43mprep\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43m*\u001b[49m\u001b[43m*\u001b[49m\u001b[43msend_kwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 591\u001b[39m \u001b[38;5;28;01mreturn\u001b[39;00m resp\n",
|
| 1365 |
+
"\u001b[36mFile \u001b[39m\u001b[32m~/Desktop/files_to_deploy_HRHUB/hrhub_project/venv/lib/python3.12/site-packages/requests/sessions.py:703\u001b[39m, in \u001b[36mSession.send\u001b[39m\u001b[34m(self, request, **kwargs)\u001b[39m\n\u001b[32m 700\u001b[39m start = preferred_clock()\n\u001b[32m 702\u001b[39m \u001b[38;5;66;03m# Send the request\u001b[39;00m\n\u001b[32m--> \u001b[39m\u001b[32m703\u001b[39m r = \u001b[43madapter\u001b[49m\u001b[43m.\u001b[49m\u001b[43msend\u001b[49m\u001b[43m(\u001b[49m\u001b[43mrequest\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43m*\u001b[49m\u001b[43m*\u001b[49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 705\u001b[39m \u001b[38;5;66;03m# Total elapsed time of the request (approximately)\u001b[39;00m\n\u001b[32m 706\u001b[39m elapsed = preferred_clock() - start\n",
|
| 1366 |
+
"\u001b[36mFile \u001b[39m\u001b[32m~/Desktop/files_to_deploy_HRHUB/hrhub_project/venv/lib/python3.12/site-packages/huggingface_hub/utils/_http.py:95\u001b[39m, in \u001b[36mUniqueRequestIdAdapter.send\u001b[39m\u001b[34m(self, request, *args, **kwargs)\u001b[39m\n\u001b[32m 93\u001b[39m logger.debug(\u001b[33mf\u001b[39m\u001b[33m\"\u001b[39m\u001b[33mSend: \u001b[39m\u001b[38;5;132;01m{\u001b[39;00m_curlify(request)\u001b[38;5;132;01m}\u001b[39;00m\u001b[33m\"\u001b[39m)\n\u001b[32m 94\u001b[39m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[32m---> \u001b[39m\u001b[32m95\u001b[39m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[43m.\u001b[49m\u001b[43msend\u001b[49m\u001b[43m(\u001b[49m\u001b[43mrequest\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43m*\u001b[49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43m*\u001b[49m\u001b[43m*\u001b[49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 96\u001b[39m \u001b[38;5;28;01mexcept\u001b[39;00m requests.RequestException \u001b[38;5;28;01mas\u001b[39;00m e:\n\u001b[32m 97\u001b[39m request_id = request.headers.get(X_AMZN_TRACE_ID)\n",
|
| 1367 |
+
"\u001b[36mFile \u001b[39m\u001b[32m~/Desktop/files_to_deploy_HRHUB/hrhub_project/venv/lib/python3.12/site-packages/requests/adapters.py:644\u001b[39m, in \u001b[36mHTTPAdapter.send\u001b[39m\u001b[34m(self, request, stream, timeout, verify, cert, proxies)\u001b[39m\n\u001b[32m 641\u001b[39m timeout = TimeoutSauce(connect=timeout, read=timeout)\n\u001b[32m 643\u001b[39m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[32m--> \u001b[39m\u001b[32m644\u001b[39m resp = \u001b[43mconn\u001b[49m\u001b[43m.\u001b[49m\u001b[43murlopen\u001b[49m\u001b[43m(\u001b[49m\n\u001b[32m 645\u001b[39m \u001b[43m \u001b[49m\u001b[43mmethod\u001b[49m\u001b[43m=\u001b[49m\u001b[43mrequest\u001b[49m\u001b[43m.\u001b[49m\u001b[43mmethod\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 646\u001b[39m \u001b[43m \u001b[49m\u001b[43murl\u001b[49m\u001b[43m=\u001b[49m\u001b[43murl\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 647\u001b[39m \u001b[43m \u001b[49m\u001b[43mbody\u001b[49m\u001b[43m=\u001b[49m\u001b[43mrequest\u001b[49m\u001b[43m.\u001b[49m\u001b[43mbody\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 648\u001b[39m \u001b[43m \u001b[49m\u001b[43mheaders\u001b[49m\u001b[43m=\u001b[49m\u001b[43mrequest\u001b[49m\u001b[43m.\u001b[49m\u001b[43mheaders\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 649\u001b[39m \u001b[43m \u001b[49m\u001b[43mredirect\u001b[49m\u001b[43m=\u001b[49m\u001b[38;5;28;43;01mFalse\u001b[39;49;00m\u001b[43m,\u001b[49m\n\u001b[32m 650\u001b[39m \u001b[43m \u001b[49m\u001b[43massert_same_host\u001b[49m\u001b[43m=\u001b[49m\u001b[38;5;28;43;01mFalse\u001b[39;49;00m\u001b[43m,\u001b[49m\n\u001b[32m 651\u001b[39m \u001b[43m \u001b[49m\u001b[43mpreload_content\u001b[49m\u001b[43m=\u001b[49m\u001b[38;5;28;43;01mFalse\u001b[39;49;00m\u001b[43m,\u001b[49m\n\u001b[32m 652\u001b[39m \u001b[43m \u001b[49m\u001b[43mdecode_content\u001b[49m\u001b[43m=\u001b[49m\u001b[38;5;28;43;01mFalse\u001b[39;49;00m\u001b[43m,\u001b[49m\n\u001b[32m 653\u001b[39m \u001b[43m \u001b[49m\u001b[43mretries\u001b[49m\u001b[43m=\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43mmax_retries\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 654\u001b[39m \u001b[43m \u001b[49m\u001b[43mtimeout\u001b[49m\u001b[43m=\u001b[49m\u001b[43mtimeout\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 655\u001b[39m \u001b[43m \u001b[49m\u001b[43mchunked\u001b[49m\u001b[43m=\u001b[49m\u001b[43mchunked\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 656\u001b[39m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 658\u001b[39m \u001b[38;5;28;01mexcept\u001b[39;00m (ProtocolError, \u001b[38;5;167;01mOSError\u001b[39;00m) \u001b[38;5;28;01mas\u001b[39;00m err:\n\u001b[32m 659\u001b[39m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mConnectionError\u001b[39;00m(err, request=request)\n",
|
| 1368 |
+
"\u001b[36mFile \u001b[39m\u001b[32m~/Desktop/files_to_deploy_HRHUB/hrhub_project/venv/lib/python3.12/site-packages/urllib3/connectionpool.py:787\u001b[39m, in \u001b[36mHTTPConnectionPool.urlopen\u001b[39m\u001b[34m(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, preload_content, decode_content, **response_kw)\u001b[39m\n\u001b[32m 784\u001b[39m response_conn = conn \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m release_conn \u001b[38;5;28;01melse\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[32m 786\u001b[39m \u001b[38;5;66;03m# Make the request on the HTTPConnection object\u001b[39;00m\n\u001b[32m--> \u001b[39m\u001b[32m787\u001b[39m response = \u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43m_make_request\u001b[49m\u001b[43m(\u001b[49m\n\u001b[32m 788\u001b[39m \u001b[43m \u001b[49m\u001b[43mconn\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 789\u001b[39m \u001b[43m \u001b[49m\u001b[43mmethod\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 790\u001b[39m \u001b[43m \u001b[49m\u001b[43murl\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 791\u001b[39m \u001b[43m \u001b[49m\u001b[43mtimeout\u001b[49m\u001b[43m=\u001b[49m\u001b[43mtimeout_obj\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 792\u001b[39m \u001b[43m \u001b[49m\u001b[43mbody\u001b[49m\u001b[43m=\u001b[49m\u001b[43mbody\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 793\u001b[39m \u001b[43m \u001b[49m\u001b[43mheaders\u001b[49m\u001b[43m=\u001b[49m\u001b[43mheaders\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 794\u001b[39m \u001b[43m \u001b[49m\u001b[43mchunked\u001b[49m\u001b[43m=\u001b[49m\u001b[43mchunked\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 795\u001b[39m \u001b[43m \u001b[49m\u001b[43mretries\u001b[49m\u001b[43m=\u001b[49m\u001b[43mretries\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 796\u001b[39m \u001b[43m \u001b[49m\u001b[43mresponse_conn\u001b[49m\u001b[43m=\u001b[49m\u001b[43mresponse_conn\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 797\u001b[39m \u001b[43m \u001b[49m\u001b[43mpreload_content\u001b[49m\u001b[43m=\u001b[49m\u001b[43mpreload_content\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 798\u001b[39m \u001b[43m \u001b[49m\u001b[43mdecode_content\u001b[49m\u001b[43m=\u001b[49m\u001b[43mdecode_content\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 799\u001b[39m \u001b[43m \u001b[49m\u001b[43m*\u001b[49m\u001b[43m*\u001b[49m\u001b[43mresponse_kw\u001b[49m\u001b[43m,\u001b[49m\n\u001b[32m 800\u001b[39m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 802\u001b[39m \u001b[38;5;66;03m# Everything went great!\u001b[39;00m\n\u001b[32m 803\u001b[39m clean_exit = \u001b[38;5;28;01mTrue\u001b[39;00m\n",
|
| 1369 |
+
"\u001b[36mFile \u001b[39m\u001b[32m~/Desktop/files_to_deploy_HRHUB/hrhub_project/venv/lib/python3.12/site-packages/urllib3/connectionpool.py:534\u001b[39m, in \u001b[36mHTTPConnectionPool._make_request\u001b[39m\u001b[34m(self, conn, method, url, body, headers, retries, timeout, chunked, response_conn, preload_content, decode_content, enforce_content_length)\u001b[39m\n\u001b[32m 532\u001b[39m \u001b[38;5;66;03m# Receive the response from the server\u001b[39;00m\n\u001b[32m 533\u001b[39m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[32m--> \u001b[39m\u001b[32m534\u001b[39m response = \u001b[43mconn\u001b[49m\u001b[43m.\u001b[49m\u001b[43mgetresponse\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 535\u001b[39m \u001b[38;5;28;01mexcept\u001b[39;00m (BaseSSLError, \u001b[38;5;167;01mOSError\u001b[39;00m) \u001b[38;5;28;01mas\u001b[39;00m e:\n\u001b[32m 536\u001b[39m \u001b[38;5;28mself\u001b[39m._raise_timeout(err=e, url=url, timeout_value=read_timeout)\n",
|
| 1370 |
+
"\u001b[36mFile \u001b[39m\u001b[32m~/Desktop/files_to_deploy_HRHUB/hrhub_project/venv/lib/python3.12/site-packages/urllib3/connection.py:565\u001b[39m, in \u001b[36mHTTPConnection.getresponse\u001b[39m\u001b[34m(self)\u001b[39m\n\u001b[32m 562\u001b[39m _shutdown = \u001b[38;5;28mgetattr\u001b[39m(\u001b[38;5;28mself\u001b[39m.sock, \u001b[33m\"\u001b[39m\u001b[33mshutdown\u001b[39m\u001b[33m\"\u001b[39m, \u001b[38;5;28;01mNone\u001b[39;00m)\n\u001b[32m 564\u001b[39m \u001b[38;5;66;03m# Get the response from http.client.HTTPConnection\u001b[39;00m\n\u001b[32m--> \u001b[39m\u001b[32m565\u001b[39m httplib_response = \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[43m.\u001b[49m\u001b[43mgetresponse\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 567\u001b[39m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[32m 568\u001b[39m assert_header_parsing(httplib_response.msg)\n",
|
| 1371 |
+
"\u001b[36mFile \u001b[39m\u001b[32m/usr/lib/python3.12/http/client.py:1428\u001b[39m, in \u001b[36mHTTPConnection.getresponse\u001b[39m\u001b[34m(self)\u001b[39m\n\u001b[32m 1426\u001b[39m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[32m 1427\u001b[39m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[32m-> \u001b[39m\u001b[32m1428\u001b[39m \u001b[43mresponse\u001b[49m\u001b[43m.\u001b[49m\u001b[43mbegin\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 1429\u001b[39m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mConnectionError\u001b[39;00m:\n\u001b[32m 1430\u001b[39m \u001b[38;5;28mself\u001b[39m.close()\n",
|
| 1372 |
+
"\u001b[36mFile \u001b[39m\u001b[32m/usr/lib/python3.12/http/client.py:331\u001b[39m, in \u001b[36mHTTPResponse.begin\u001b[39m\u001b[34m(self)\u001b[39m\n\u001b[32m 329\u001b[39m \u001b[38;5;66;03m# read until we get a non-100 response\u001b[39;00m\n\u001b[32m 330\u001b[39m \u001b[38;5;28;01mwhile\u001b[39;00m \u001b[38;5;28;01mTrue\u001b[39;00m:\n\u001b[32m--> \u001b[39m\u001b[32m331\u001b[39m version, status, reason = \u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43m_read_status\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 332\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m status != CONTINUE:\n\u001b[32m 333\u001b[39m \u001b[38;5;28;01mbreak\u001b[39;00m\n",
|
| 1373 |
+
"\u001b[36mFile \u001b[39m\u001b[32m/usr/lib/python3.12/http/client.py:292\u001b[39m, in \u001b[36mHTTPResponse._read_status\u001b[39m\u001b[34m(self)\u001b[39m\n\u001b[32m 291\u001b[39m \u001b[38;5;28;01mdef\u001b[39;00m\u001b[38;5;250m \u001b[39m\u001b[34m_read_status\u001b[39m(\u001b[38;5;28mself\u001b[39m):\n\u001b[32m--> \u001b[39m\u001b[32m292\u001b[39m line = \u001b[38;5;28mstr\u001b[39m(\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43mfp\u001b[49m\u001b[43m.\u001b[49m\u001b[43mreadline\u001b[49m\u001b[43m(\u001b[49m\u001b[43m_MAXLINE\u001b[49m\u001b[43m \u001b[49m\u001b[43m+\u001b[49m\u001b[43m \u001b[49m\u001b[32;43m1\u001b[39;49m\u001b[43m)\u001b[49m, \u001b[33m\"\u001b[39m\u001b[33miso-8859-1\u001b[39m\u001b[33m\"\u001b[39m)\n\u001b[32m 293\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mlen\u001b[39m(line) > _MAXLINE:\n\u001b[32m 294\u001b[39m \u001b[38;5;28;01mraise\u001b[39;00m LineTooLong(\u001b[33m\"\u001b[39m\u001b[33mstatus line\u001b[39m\u001b[33m\"\u001b[39m)\n",
|
| 1374 |
+
"\u001b[36mFile \u001b[39m\u001b[32m/usr/lib/python3.12/socket.py:707\u001b[39m, in \u001b[36mSocketIO.readinto\u001b[39m\u001b[34m(self, b)\u001b[39m\n\u001b[32m 705\u001b[39m \u001b[38;5;28;01mwhile\u001b[39;00m \u001b[38;5;28;01mTrue\u001b[39;00m:\n\u001b[32m 706\u001b[39m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[32m--> \u001b[39m\u001b[32m707\u001b[39m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43m_sock\u001b[49m\u001b[43m.\u001b[49m\u001b[43mrecv_into\u001b[49m\u001b[43m(\u001b[49m\u001b[43mb\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 708\u001b[39m \u001b[38;5;28;01mexcept\u001b[39;00m timeout:\n\u001b[32m 709\u001b[39m \u001b[38;5;28mself\u001b[39m._timeout_occurred = \u001b[38;5;28;01mTrue\u001b[39;00m\n",
|
| 1375 |
+
"\u001b[36mFile \u001b[39m\u001b[32m/usr/lib/python3.12/ssl.py:1252\u001b[39m, in \u001b[36mSSLSocket.recv_into\u001b[39m\u001b[34m(self, buffer, nbytes, flags)\u001b[39m\n\u001b[32m 1248\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m flags != \u001b[32m0\u001b[39m:\n\u001b[32m 1249\u001b[39m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mValueError\u001b[39;00m(\n\u001b[32m 1250\u001b[39m \u001b[33m\"\u001b[39m\u001b[33mnon-zero flags not allowed in calls to recv_into() on \u001b[39m\u001b[38;5;132;01m%s\u001b[39;00m\u001b[33m\"\u001b[39m %\n\u001b[32m 1251\u001b[39m \u001b[38;5;28mself\u001b[39m.\u001b[34m__class__\u001b[39m)\n\u001b[32m-> \u001b[39m\u001b[32m1252\u001b[39m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43mread\u001b[49m\u001b[43m(\u001b[49m\u001b[43mnbytes\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mbuffer\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 1253\u001b[39m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[32m 1254\u001b[39m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28msuper\u001b[39m().recv_into(buffer, nbytes, flags)\n",
|
| 1376 |
+
"\u001b[36mFile \u001b[39m\u001b[32m/usr/lib/python3.12/ssl.py:1104\u001b[39m, in \u001b[36mSSLSocket.read\u001b[39m\u001b[34m(self, len, buffer)\u001b[39m\n\u001b[32m 1102\u001b[39m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[32m 1103\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m buffer \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[32m-> \u001b[39m\u001b[32m1104\u001b[39m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[43m.\u001b[49m\u001b[43m_sslobj\u001b[49m\u001b[43m.\u001b[49m\u001b[43mread\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mlen\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mbuffer\u001b[49m\u001b[43m)\u001b[49m\n\u001b[32m 1105\u001b[39m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[32m 1106\u001b[39m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m._sslobj.read(\u001b[38;5;28mlen\u001b[39m)\n",
|
| 1377 |
+
"\u001b[31mKeyboardInterrupt\u001b[39m: "
|
| 1378 |
]
|
| 1379 |
}
|
| 1380 |
],
|
|
|
|
| 1453 |
},
|
| 1454 |
{
|
| 1455 |
"cell_type": "code",
|
| 1456 |
+
"execution_count": null,
|
| 1457 |
"metadata": {},
|
| 1458 |
"outputs": [
|
| 1459 |
{
|
|
|
|
| 1555 |
},
|
| 1556 |
{
|
| 1557 |
"cell_type": "code",
|
| 1558 |
+
"execution_count": null,
|
| 1559 |
"metadata": {},
|
| 1560 |
"outputs": [
|
| 1561 |
{
|
|
|
|
| 1661 |
},
|
| 1662 |
{
|
| 1663 |
"cell_type": "code",
|
| 1664 |
+
"execution_count": null,
|
| 1665 |
"metadata": {},
|
| 1666 |
"outputs": [
|
| 1667 |
{
|
|
|
|
| 1756 |
},
|
| 1757 |
{
|
| 1758 |
"cell_type": "code",
|
| 1759 |
+
"execution_count": null,
|
| 1760 |
"metadata": {},
|
| 1761 |
"outputs": [
|
| 1762 |
{
|
|
|
|
| 1959 |
},
|
| 1960 |
{
|
| 1961 |
"cell_type": "code",
|
| 1962 |
+
"execution_count": null,
|
| 1963 |
"metadata": {},
|
| 1964 |
"outputs": [
|
| 1965 |
{
|
|
|
|
| 2033 |
},
|
| 2034 |
{
|
| 2035 |
"cell_type": "code",
|
| 2036 |
+
"execution_count": null,
|
| 2037 |
"metadata": {},
|
| 2038 |
"outputs": [
|
| 2039 |
{
|
|
|
|
| 2095 |
},
|
| 2096 |
{
|
| 2097 |
"cell_type": "code",
|
| 2098 |
+
"execution_count": null,
|
| 2099 |
"metadata": {},
|
| 2100 |
"outputs": [
|
| 2101 |
{
|
|
|
|
| 10558 |
},
|
| 10559 |
{
|
| 10560 |
"cell_type": "code",
|
| 10561 |
+
"execution_count": null,
|
| 10562 |
"metadata": {},
|
| 10563 |
"outputs": [
|
| 10564 |
{
|
|
|
|
| 15566 |
},
|
| 15567 |
{
|
| 15568 |
"cell_type": "code",
|
| 15569 |
+
"execution_count": null,
|
| 15570 |
"metadata": {},
|
| 15571 |
"outputs": [
|
| 15572 |
{
|
|
|
|
| 15722 |
},
|
| 15723 |
{
|
| 15724 |
"cell_type": "code",
|
| 15725 |
+
"execution_count": null,
|
| 15726 |
"metadata": {},
|
| 15727 |
"outputs": [
|
| 15728 |
{
|
|
|
|
| 15819 |
},
|
| 15820 |
{
|
| 15821 |
"cell_type": "code",
|
| 15822 |
+
"execution_count": null,
|
| 15823 |
"metadata": {},
|
| 15824 |
"outputs": [
|
| 15825 |
{
|
|
|
|
| 15942 |
},
|
| 15943 |
{
|
| 15944 |
"cell_type": "code",
|
| 15945 |
+
"execution_count": null,
|
| 15946 |
"metadata": {},
|
| 15947 |
"outputs": [
|
| 15948 |
{
|
|
|
|
| 19218 |
},
|
| 19219 |
{
|
| 19220 |
"cell_type": "code",
|
| 19221 |
+
"execution_count": null,
|
| 19222 |
"metadata": {},
|
| 19223 |
"outputs": [
|
| 19224 |
{
|
|
|
|
| 19349 |
},
|
| 19350 |
{
|
| 19351 |
"cell_type": "code",
|
| 19352 |
+
"execution_count": null,
|
| 19353 |
"metadata": {},
|
| 19354 |
"outputs": [
|
| 19355 |
{
|
|
|
|
| 19432 |
},
|
| 19433 |
{
|
| 19434 |
"cell_type": "code",
|
| 19435 |
+
"execution_count": null,
|
| 19436 |
"metadata": {},
|
| 19437 |
"outputs": [
|
| 19438 |
{
|
|
|
|
| 19565 |
},
|
| 19566 |
{
|
| 19567 |
"cell_type": "code",
|
| 19568 |
+
"execution_count": null,
|
| 19569 |
"metadata": {},
|
| 19570 |
"outputs": [
|
| 19571 |
{
|
data/notebooks/old/HRHUB_v2_8.ipynb
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
data/notebooks/old/HRHUB_v3.0.ipynb
ADDED
|
@@ -0,0 +1,239 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"cells": [
|
| 3 |
+
{
|
| 4 |
+
"cell_type": "code",
|
| 5 |
+
"execution_count": 1,
|
| 6 |
+
"id": "b2dd5b02",
|
| 7 |
+
"metadata": {},
|
| 8 |
+
"outputs": [
|
| 9 |
+
{
|
| 10 |
+
"name": "stdout",
|
| 11 |
+
"output_type": "stream",
|
| 12 |
+
"text": [
|
| 13 |
+
"✅ All imports successful!\n",
|
| 14 |
+
"📦 Pandas: 2.1.4\n",
|
| 15 |
+
"📦 Numpy: 1.26.3\n"
|
| 16 |
+
]
|
| 17 |
+
}
|
| 18 |
+
],
|
| 19 |
+
"source": [
|
| 20 |
+
"# ═══════════════════════════════════════════════════════════════════\n",
|
| 21 |
+
"# 🚀 HRHUB V2.1 - PRODUCTION NOTEBOOK\n",
|
| 22 |
+
"# Cell 1: Setup & Imports\n",
|
| 23 |
+
"# ═══════════════════════════════════════════════════════════════════\n",
|
| 24 |
+
"\n",
|
| 25 |
+
"import warnings\n",
|
| 26 |
+
"warnings.filterwarnings('ignore')\n",
|
| 27 |
+
"\n",
|
| 28 |
+
"# Core\n",
|
| 29 |
+
"import pandas as pd\n",
|
| 30 |
+
"import numpy as np\n",
|
| 31 |
+
"from pathlib import Path\n",
|
| 32 |
+
"\n",
|
| 33 |
+
"# Embeddings\n",
|
| 34 |
+
"from sentence_transformers import SentenceTransformer\n",
|
| 35 |
+
"from sklearn.metrics.pairwise import cosine_similarity\n",
|
| 36 |
+
"\n",
|
| 37 |
+
"# Viz\n",
|
| 38 |
+
"import matplotlib.pyplot as plt\n",
|
| 39 |
+
"import seaborn as sns\n",
|
| 40 |
+
"import plotly.express as px\n",
|
| 41 |
+
"import plotly.graph_objects as go\n",
|
| 42 |
+
"from pyvis.network import Network\n",
|
| 43 |
+
"\n",
|
| 44 |
+
"# Dimensionality reduction\n",
|
| 45 |
+
"from sklearn.manifold import TSNE\n",
|
| 46 |
+
"\n",
|
| 47 |
+
"# Utils\n",
|
| 48 |
+
"from tqdm import tqdm\n",
|
| 49 |
+
"import pickle\n",
|
| 50 |
+
"from typing import List, Dict, Tuple\n",
|
| 51 |
+
"import time\n",
|
| 52 |
+
"\n",
|
| 53 |
+
"# Config\n",
|
| 54 |
+
"plt.style.use('seaborn-v0_8-darkgrid')\n",
|
| 55 |
+
"sns.set_palette(\"husl\")\n",
|
| 56 |
+
"pd.set_option('display.max_columns', None)\n",
|
| 57 |
+
"pd.set_option('display.max_rows', 100)\n",
|
| 58 |
+
"\n",
|
| 59 |
+
"print(\"✅ All imports successful!\")\n",
|
| 60 |
+
"print(f\"📦 Pandas: {pd.__version__}\")\n",
|
| 61 |
+
"print(f\"📦 Numpy: {np.__version__}\")"
|
| 62 |
+
]
|
| 63 |
+
},
|
| 64 |
+
{
|
| 65 |
+
"cell_type": "code",
|
| 66 |
+
"execution_count": 5,
|
| 67 |
+
"id": "b8696a11",
|
| 68 |
+
"metadata": {},
|
| 69 |
+
"outputs": [
|
| 70 |
+
{
|
| 71 |
+
"name": "stdout",
|
| 72 |
+
"output_type": "stream",
|
| 73 |
+
"text": [
|
| 74 |
+
"✅ Paths configured!\n",
|
| 75 |
+
"📂 Base path: data\n",
|
| 76 |
+
"🤖 Model: sentence-transformers/all-MiniLM-L6-v2\n"
|
| 77 |
+
]
|
| 78 |
+
}
|
| 79 |
+
],
|
| 80 |
+
"source": [
|
| 81 |
+
"# ═══════════════════════════════════════════════════════════════════\n",
|
| 82 |
+
"# Cell 2: Paths & Configuration\n",
|
| 83 |
+
"# ═══════════════════════════════════════════════════════════════════\n",
|
| 84 |
+
"\n",
|
| 85 |
+
"# 🟢 VSCode local - path direto\n",
|
| 86 |
+
"BASE_PATH = Path(\"data\")\n",
|
| 87 |
+
"\n",
|
| 88 |
+
"# Input paths\n",
|
| 89 |
+
"DATA_PATHS = {\n",
|
| 90 |
+
" 'benefits': BASE_PATH / \"benefits.csv\",\n",
|
| 91 |
+
" 'companies': BASE_PATH / \"companies.csv\",\n",
|
| 92 |
+
" 'company_industries': BASE_PATH / \"company_industries.csv\",\n",
|
| 93 |
+
" 'company_specialties': BASE_PATH / \"company_specialties.csv\",\n",
|
| 94 |
+
" 'employee_counts': BASE_PATH / \"employee_counts.csv\",\n",
|
| 95 |
+
" 'industries': BASE_PATH / \"industries.csv\",\n",
|
| 96 |
+
" 'job_industries': BASE_PATH / \"job_industries.csv\",\n",
|
| 97 |
+
" 'job_skills': BASE_PATH / \"job_skills.csv\",\n",
|
| 98 |
+
" 'postings': BASE_PATH / \"postings.csv\",\n",
|
| 99 |
+
" 'resume_data': BASE_PATH / \"resume_data.csv\",\n",
|
| 100 |
+
" 'salaries': BASE_PATH / \"salaries.csv\",\n",
|
| 101 |
+
" 'skills': BASE_PATH / \"skills.csv\"\n",
|
| 102 |
+
"}\n",
|
| 103 |
+
"\n",
|
| 104 |
+
"# Output files (salvamos direto com npy/pkl)\n",
|
| 105 |
+
"OUTPUT_FILES = {\n",
|
| 106 |
+
" 'candidate_embeddings': 'candidate_embeddings.npy',\n",
|
| 107 |
+
" 'company_embeddings': 'company_embeddings.npy',\n",
|
| 108 |
+
" 'candidate_metadata': 'candidate_metadata.pkl',\n",
|
| 109 |
+
" 'company_metadata': 'company_metadata.pkl'\n",
|
| 110 |
+
"}\n",
|
| 111 |
+
"\n",
|
| 112 |
+
"# Model config\n",
|
| 113 |
+
"MODEL_NAME = \"sentence-transformers/all-MiniLM-L6-v2\"\n",
|
| 114 |
+
"EMBEDDING_DIM = 384\n",
|
| 115 |
+
"\n",
|
| 116 |
+
"print(\"✅ Paths configured!\")\n",
|
| 117 |
+
"print(f\"📂 Base path: {BASE_PATH}\")\n",
|
| 118 |
+
"print(f\"🤖 Model: {MODEL_NAME}\")"
|
| 119 |
+
]
|
| 120 |
+
},
|
| 121 |
+
{
|
| 122 |
+
"cell_type": "code",
|
| 123 |
+
"execution_count": 6,
|
| 124 |
+
"id": "657220e4",
|
| 125 |
+
"metadata": {},
|
| 126 |
+
"outputs": [
|
| 127 |
+
{
|
| 128 |
+
"name": "stdout",
|
| 129 |
+
"output_type": "stream",
|
| 130 |
+
"text": [
|
| 131 |
+
"📥 Loading data...\n",
|
| 132 |
+
"❌ benefits: ERROR - [Errno 2] No such file or directory: 'data/benefits.csv'\n",
|
| 133 |
+
"❌ companies: ERROR - [Errno 2] No such file or directory: 'data/companies.csv'\n",
|
| 134 |
+
"❌ company_industries: ERROR - [Errno 2] No such file or directory: 'data/company_industries.csv'\n",
|
| 135 |
+
"❌ company_specialties: ERROR - [Errno 2] No such file or directory: 'data/company_specialties.csv'\n",
|
| 136 |
+
"❌ employee_counts: ERROR - [Errno 2] No such file or directory: 'data/employee_counts.csv'\n",
|
| 137 |
+
"❌ industries: ERROR - [Errno 2] No such file or directory: 'data/industries.csv'\n",
|
| 138 |
+
"❌ job_industries: ERROR - [Errno 2] No such file or directory: 'data/job_industries.csv'\n",
|
| 139 |
+
"❌ job_skills: ERROR - [Errno 2] No such file or directory: 'data/job_skills.csv'\n",
|
| 140 |
+
"❌ postings: ERROR - [Errno 2] No such file or directory: 'data/postings.csv'\n",
|
| 141 |
+
"❌ resume_data: ERROR - [Errno 2] No such file or directory: 'data/resume_data.csv'\n",
|
| 142 |
+
"❌ salaries: ERROR - [Errno 2] No such file or directory: 'data/salaries.csv'\n",
|
| 143 |
+
"❌ skills: ERROR - [Errno 2] No such file or directory: 'data/skills.csv'\n",
|
| 144 |
+
"\n",
|
| 145 |
+
"⏱️ Loaded in 0.00s\n",
|
| 146 |
+
"\n",
|
| 147 |
+
"======================================================================\n",
|
| 148 |
+
"🔍 KEY DATASETS PREVIEW\n",
|
| 149 |
+
"======================================================================\n",
|
| 150 |
+
"\n",
|
| 151 |
+
"📋 CANDIDATES (resume_data):\n",
|
| 152 |
+
"\n",
|
| 153 |
+
"🏢 COMPANIES:\n",
|
| 154 |
+
"\n",
|
| 155 |
+
"📄 JOB POSTINGS:\n",
|
| 156 |
+
"\n",
|
| 157 |
+
"✅ Data loaded! Ready to inspect and clean.\n"
|
| 158 |
+
]
|
| 159 |
+
}
|
| 160 |
+
],
|
| 161 |
+
"source": [
|
| 162 |
+
"# ═══════════════════════════════════════════════════════════════════\n",
|
| 163 |
+
"# Cell 3: Load Raw Data\n",
|
| 164 |
+
"# ═══════════════════════════════════════════════════════════════════\n",
|
| 165 |
+
"\n",
|
| 166 |
+
"print(\"📥 Loading data...\")\n",
|
| 167 |
+
"start_time = time.time()\n",
|
| 168 |
+
"\n",
|
| 169 |
+
"# Load all CSVs\n",
|
| 170 |
+
"data = {}\n",
|
| 171 |
+
"for name, path in DATA_PATHS.items():\n",
|
| 172 |
+
" try:\n",
|
| 173 |
+
" df = pd.read_csv(path)\n",
|
| 174 |
+
" data[name] = df\n",
|
| 175 |
+
" print(f\"✅ {name}: {df.shape[0]:,} rows × {df.shape[1]} cols\")\n",
|
| 176 |
+
" except Exception as e:\n",
|
| 177 |
+
" print(f\"❌ {name}: ERROR - {e}\")\n",
|
| 178 |
+
" data[name] = None\n",
|
| 179 |
+
"\n",
|
| 180 |
+
"load_time = time.time() - start_time\n",
|
| 181 |
+
"print(f\"\\n⏱️ Loaded in {load_time:.2f}s\")\n",
|
| 182 |
+
"\n",
|
| 183 |
+
"# Quick peek at key datasets\n",
|
| 184 |
+
"print(\"\\n\" + \"=\"*70)\n",
|
| 185 |
+
"print(\"🔍 KEY DATASETS PREVIEW\")\n",
|
| 186 |
+
"print(\"=\"*70)\n",
|
| 187 |
+
"\n",
|
| 188 |
+
"print(\"\\n📋 CANDIDATES (resume_data):\")\n",
|
| 189 |
+
"if data['resume_data'] is not None:\n",
|
| 190 |
+
" print(f\"Shape: {data['resume_data'].shape}\")\n",
|
| 191 |
+
" print(f\"Columns: {list(data['resume_data'].columns)}\")\n",
|
| 192 |
+
" print(data['resume_data'].head(2))\n",
|
| 193 |
+
"\n",
|
| 194 |
+
"print(\"\\n🏢 COMPANIES:\")\n",
|
| 195 |
+
"if data['companies'] is not None:\n",
|
| 196 |
+
" print(f\"Shape: {data['companies'].shape}\")\n",
|
| 197 |
+
" print(f\"Columns: {list(data['companies'].columns)}\")\n",
|
| 198 |
+
" print(data['companies'].head(2))\n",
|
| 199 |
+
"\n",
|
| 200 |
+
"print(\"\\n📄 JOB POSTINGS:\")\n",
|
| 201 |
+
"if data['postings'] is not None:\n",
|
| 202 |
+
" print(f\"Shape: {data['postings'].shape}\")\n",
|
| 203 |
+
" print(f\"Columns: {list(data['postings'].columns)}\")\n",
|
| 204 |
+
" print(data['postings'].head(2))\n",
|
| 205 |
+
"\n",
|
| 206 |
+
"print(\"\\n✅ Data loaded! Ready to inspect and clean.\")"
|
| 207 |
+
]
|
| 208 |
+
},
|
| 209 |
+
{
|
| 210 |
+
"cell_type": "code",
|
| 211 |
+
"execution_count": null,
|
| 212 |
+
"id": "52833afd",
|
| 213 |
+
"metadata": {},
|
| 214 |
+
"outputs": [],
|
| 215 |
+
"source": []
|
| 216 |
+
}
|
| 217 |
+
],
|
| 218 |
+
"metadata": {
|
| 219 |
+
"kernelspec": {
|
| 220 |
+
"display_name": "venv",
|
| 221 |
+
"language": "python",
|
| 222 |
+
"name": "python3"
|
| 223 |
+
},
|
| 224 |
+
"language_info": {
|
| 225 |
+
"codemirror_mode": {
|
| 226 |
+
"name": "ipython",
|
| 227 |
+
"version": 3
|
| 228 |
+
},
|
| 229 |
+
"file_extension": ".py",
|
| 230 |
+
"mimetype": "text/x-python",
|
| 231 |
+
"name": "python",
|
| 232 |
+
"nbconvert_exporter": "python",
|
| 233 |
+
"pygments_lexer": "ipython3",
|
| 234 |
+
"version": "3.12.3"
|
| 235 |
+
}
|
| 236 |
+
},
|
| 237 |
+
"nbformat": 4,
|
| 238 |
+
"nbformat_minor": 5
|
| 239 |
+
}
|
data/notebooks/old/hrhub_v2_8.py
ADDED
|
@@ -0,0 +1,2836 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# %% [markdown]
|
| 2 |
+
# # 🧠 HRHUB v2.1 - Enhanced with LLM (FREE VERSION)
|
| 3 |
+
#
|
| 4 |
+
# ## 📘 Project Overview
|
| 5 |
+
#
|
| 6 |
+
# **Bilateral HR Matching System with LLM-Powered Intelligence**
|
| 7 |
+
#
|
| 8 |
+
# ### What's New in v2.1:
|
| 9 |
+
# - ✅ **FREE LLM**: Using Hugging Face Inference API (no cost)
|
| 10 |
+
# - ✅ **Job Level Classification**: Zero-shot & few-shot learning
|
| 11 |
+
# - ✅ **Structured Skills Extraction**: Pydantic schemas
|
| 12 |
+
# - ✅ **Match Explainability**: LLM-generated reasoning
|
| 13 |
+
# - ✅ **Flexible Data Loading**: Upload OR Google Drive
|
| 14 |
+
#
|
| 15 |
+
# ### Tech Stack:
|
| 16 |
+
# ```
|
| 17 |
+
# Embeddings: sentence-transformers (local, free)
|
| 18 |
+
# LLM: Hugging Face Inference API (free tier)
|
| 19 |
+
# Schemas: Pydantic
|
| 20 |
+
# Platform: Google Colab → VS Code
|
| 21 |
+
# ```
|
| 22 |
+
#
|
| 23 |
+
# ---
|
| 24 |
+
#
|
| 25 |
+
# **Master's Thesis - Aalborg University**
|
| 26 |
+
# *Business Data Science Program*
|
| 27 |
+
# *December 2025*
|
| 28 |
+
|
| 29 |
+
# %% [markdown]
|
| 30 |
+
# ---
|
| 31 |
+
# ## 📊 Step 1: Install Dependencies
|
| 32 |
+
|
| 33 |
+
# %%
|
| 34 |
+
# Install required packages
|
| 35 |
+
#!pip install -q sentence-transformers huggingface-hub pydantic plotly pyvis nbformat scikit-learn pandas numpy
|
| 36 |
+
|
| 37 |
+
print("✅ All packages installed!")
|
| 38 |
+
|
| 39 |
+
# %% [markdown]
|
| 40 |
+
# ---
|
| 41 |
+
# ## 📊 Step 2: Import Libraries
|
| 42 |
+
|
| 43 |
+
# %%
|
| 44 |
+
import pandas as pd
|
| 45 |
+
import numpy as np
|
| 46 |
+
import json
|
| 47 |
+
import os
|
| 48 |
+
from typing import List, Dict, Optional, Literal
|
| 49 |
+
import warnings
|
| 50 |
+
warnings.filterwarnings('ignore')
|
| 51 |
+
|
| 52 |
+
# ML & NLP
|
| 53 |
+
from sentence_transformers import SentenceTransformer
|
| 54 |
+
from sklearn.metrics.pairwise import cosine_similarity
|
| 55 |
+
|
| 56 |
+
# LLM Integration (FREE)
|
| 57 |
+
from huggingface_hub import InferenceClient
|
| 58 |
+
from pydantic import BaseModel, Field
|
| 59 |
+
|
| 60 |
+
# Visualization
|
| 61 |
+
import plotly.graph_objects as go
|
| 62 |
+
from IPython.display import HTML, display
|
| 63 |
+
|
| 64 |
+
# Configuration Settings
|
| 65 |
+
from dotenv import load_dotenv
|
| 66 |
+
|
| 67 |
+
# Carrega variáveis do .env
|
| 68 |
+
load_dotenv()
|
| 69 |
+
print("✅ Environment variables loaded from .env")
|
| 70 |
+
|
| 71 |
+
print("✅ All libraries imported!")
|
| 72 |
+
|
| 73 |
+
# %% [markdown]
|
| 74 |
+
# ---
|
| 75 |
+
# ## 📊 Step 3: Configuration
|
| 76 |
+
|
| 77 |
+
# %%
|
| 78 |
+
class Config:
|
| 79 |
+
"""Centralized configuration for VS Code"""
|
| 80 |
+
|
| 81 |
+
# Paths - VS Code structure
|
| 82 |
+
CSV_PATH = '../csv_files/'
|
| 83 |
+
PROCESSED_PATH = '../processed/'
|
| 84 |
+
RESULTS_PATH = '../results/'
|
| 85 |
+
|
| 86 |
+
# Embedding Model
|
| 87 |
+
EMBEDDING_MODEL = 'all-MiniLM-L6-v2'
|
| 88 |
+
|
| 89 |
+
# LLM Settings (FREE - Hugging Face)
|
| 90 |
+
HF_TOKEN = os.getenv('HF_TOKEN', '') # ✅ Pega do .env
|
| 91 |
+
LLM_MODEL = 'meta-llama/Llama-3.2-3B-Instruct'
|
| 92 |
+
|
| 93 |
+
LLM_MAX_TOKENS = 1000
|
| 94 |
+
|
| 95 |
+
# Matching Parameters
|
| 96 |
+
TOP_K_MATCHES = 10
|
| 97 |
+
SIMILARITY_THRESHOLD = 0.5
|
| 98 |
+
RANDOM_SEED = 42
|
| 99 |
+
|
| 100 |
+
np.random.seed(Config.RANDOM_SEED)
|
| 101 |
+
|
| 102 |
+
print("✅ Configuration loaded!")
|
| 103 |
+
print(f"🧠 Embedding model: {Config.EMBEDDING_MODEL}")
|
| 104 |
+
print(f"🤖 LLM model: {Config.LLM_MODEL}")
|
| 105 |
+
print(f"🔑 HF Token configured: {'Yes ✅' if Config.HF_TOKEN else 'No ⚠️'}")
|
| 106 |
+
print(f"📂 Data path: {Config.CSV_PATH}")
|
| 107 |
+
|
| 108 |
+
# %% [markdown]
|
| 109 |
+
# ---
|
| 110 |
+
# ## 🏗️ Step 4: Architecture - Text Builders
|
| 111 |
+
#
|
| 112 |
+
# **HIGH COHESION:** Each class has ONE responsibility
|
| 113 |
+
# **LOW COUPLING:** Classes don't depend on each other
|
| 114 |
+
|
| 115 |
+
# %%
|
| 116 |
+
# ============================================================================
|
| 117 |
+
# TEXT BUILDER CLASSES - Single Responsibility Principle
|
| 118 |
+
# ============================================================================
|
| 119 |
+
|
| 120 |
+
from abc import ABC, abstractmethod
|
| 121 |
+
from typing import List
|
| 122 |
+
|
| 123 |
+
class TextBuilder(ABC):
|
| 124 |
+
"""Abstract base class for text builders"""
|
| 125 |
+
|
| 126 |
+
@abstractmethod
|
| 127 |
+
def build(self, row: pd.Series) -> str:
|
| 128 |
+
"""Build text representation from DataFrame row"""
|
| 129 |
+
pass
|
| 130 |
+
|
| 131 |
+
def build_batch(self, df: pd.DataFrame) -> List[str]:
|
| 132 |
+
"""Build text representations for entire DataFrame"""
|
| 133 |
+
return df.apply(self.build, axis=1).tolist()
|
| 134 |
+
|
| 135 |
+
|
| 136 |
+
class CandidateTextBuilder(TextBuilder):
|
| 137 |
+
"""Builds text representation for candidates"""
|
| 138 |
+
|
| 139 |
+
def __init__(self, fields: List[str] = None):
|
| 140 |
+
self.fields = fields or [
|
| 141 |
+
'Category',
|
| 142 |
+
'skills',
|
| 143 |
+
'career_objective',
|
| 144 |
+
'degree_names',
|
| 145 |
+
'positions'
|
| 146 |
+
]
|
| 147 |
+
|
| 148 |
+
def build(self, row: pd.Series) -> str:
|
| 149 |
+
parts = []
|
| 150 |
+
|
| 151 |
+
if row.get('Category'):
|
| 152 |
+
parts.append(f"Job Category: {row['Category']}")
|
| 153 |
+
|
| 154 |
+
if row.get('skills'):
|
| 155 |
+
parts.append(f"Skills: {row['skills']}")
|
| 156 |
+
|
| 157 |
+
if row.get('career_objective'):
|
| 158 |
+
parts.append(f"Objective: {row['career_objective']}")
|
| 159 |
+
|
| 160 |
+
if row.get('degree_names'):
|
| 161 |
+
parts.append(f"Education: {row['degree_names']}")
|
| 162 |
+
|
| 163 |
+
if row.get('positions'):
|
| 164 |
+
parts.append(f"Experience: {row['positions']}")
|
| 165 |
+
|
| 166 |
+
return ' '.join(parts)
|
| 167 |
+
|
| 168 |
+
|
| 169 |
+
class CompanyTextBuilder(TextBuilder):
|
| 170 |
+
"""Builds text representation for companies"""
|
| 171 |
+
|
| 172 |
+
def __init__(self, include_postings: bool = True):
|
| 173 |
+
self.include_postings = include_postings
|
| 174 |
+
|
| 175 |
+
def build(self, row: pd.Series) -> str:
|
| 176 |
+
parts = []
|
| 177 |
+
|
| 178 |
+
if row.get('name'):
|
| 179 |
+
parts.append(f"Company: {row['name']}")
|
| 180 |
+
|
| 181 |
+
if row.get('description'):
|
| 182 |
+
parts.append(f"Description: {row['description']}")
|
| 183 |
+
|
| 184 |
+
if row.get('industries_list'):
|
| 185 |
+
parts.append(f"Industries: {row['industries_list']}")
|
| 186 |
+
|
| 187 |
+
if row.get('specialties_list'):
|
| 188 |
+
parts.append(f"Specialties: {row['specialties_list']}")
|
| 189 |
+
|
| 190 |
+
# Include job postings data (THE BRIDGE!)
|
| 191 |
+
if self.include_postings:
|
| 192 |
+
if row.get('required_skills'):
|
| 193 |
+
parts.append(f"Required Skills: {row['required_skills']}")
|
| 194 |
+
|
| 195 |
+
if row.get('posted_job_titles'):
|
| 196 |
+
parts.append(f"Job Titles: {row['posted_job_titles']}")
|
| 197 |
+
|
| 198 |
+
if row.get('experience_levels'):
|
| 199 |
+
parts.append(f"Experience: {row['experience_levels']}")
|
| 200 |
+
|
| 201 |
+
return ' '.join(parts)
|
| 202 |
+
|
| 203 |
+
|
| 204 |
+
print("✅ Text Builder classes loaded")
|
| 205 |
+
print(" • CandidateTextBuilder")
|
| 206 |
+
print(" • CompanyTextBuilder")
|
| 207 |
+
|
| 208 |
+
# %% [markdown]
|
| 209 |
+
# ---
|
| 210 |
+
# ## 🏗️ Step 5: Architecture - Embedding Manager
|
| 211 |
+
#
|
| 212 |
+
# **Responsibility:** Generate, save, and load embeddings
|
| 213 |
+
|
| 214 |
+
# %%
|
| 215 |
+
# ============================================================================
|
| 216 |
+
# EMBEDDING MANAGER - Handles all embedding operations
|
| 217 |
+
# ============================================================================
|
| 218 |
+
|
| 219 |
+
from pathlib import Path
|
| 220 |
+
from typing import Tuple, Optional
|
| 221 |
+
|
| 222 |
+
class EmbeddingManager:
|
| 223 |
+
"""Manages embedding generation, saving, and loading"""
|
| 224 |
+
|
| 225 |
+
def __init__(self, model: SentenceTransformer, save_dir: str):
|
| 226 |
+
self.model = model
|
| 227 |
+
self.save_dir = Path(save_dir)
|
| 228 |
+
self.save_dir.mkdir(parents=True, exist_ok=True)
|
| 229 |
+
|
| 230 |
+
def _get_file_paths(self, entity_type: str) -> Tuple[Path, Path]:
|
| 231 |
+
"""Get file paths for embeddings and metadata"""
|
| 232 |
+
emb_file = self.save_dir / f"{entity_type}_embeddings.npy"
|
| 233 |
+
meta_file = self.save_dir / f"{entity_type}_metadata.pkl"
|
| 234 |
+
return emb_file, meta_file
|
| 235 |
+
|
| 236 |
+
def exists(self, entity_type: str) -> bool:
|
| 237 |
+
"""Check if embeddings exist for entity type"""
|
| 238 |
+
emb_file, _ = self._get_file_paths(entity_type)
|
| 239 |
+
return emb_file.exists()
|
| 240 |
+
|
| 241 |
+
def load(self, entity_type: str) -> Tuple[np.ndarray, pd.DataFrame]:
|
| 242 |
+
"""Load embeddings and metadata"""
|
| 243 |
+
emb_file, meta_file = self._get_file_paths(entity_type)
|
| 244 |
+
|
| 245 |
+
if not emb_file.exists():
|
| 246 |
+
raise FileNotFoundError(f"Embeddings not found: {emb_file}")
|
| 247 |
+
|
| 248 |
+
embeddings = np.load(emb_file)
|
| 249 |
+
metadata = pd.read_pickle(meta_file) if meta_file.exists() else None
|
| 250 |
+
|
| 251 |
+
return embeddings, metadata
|
| 252 |
+
|
| 253 |
+
def generate(self,
|
| 254 |
+
texts: List[str],
|
| 255 |
+
batch_size: int = 32,
|
| 256 |
+
show_progress: bool = True) -> np.ndarray:
|
| 257 |
+
"""Generate embeddings from texts"""
|
| 258 |
+
return self.model.encode(
|
| 259 |
+
texts,
|
| 260 |
+
batch_size=batch_size,
|
| 261 |
+
show_progress_bar=show_progress,
|
| 262 |
+
normalize_embeddings=True,
|
| 263 |
+
convert_to_numpy=True
|
| 264 |
+
)
|
| 265 |
+
|
| 266 |
+
def save(self,
|
| 267 |
+
entity_type: str,
|
| 268 |
+
embeddings: np.ndarray,
|
| 269 |
+
metadata: pd.DataFrame) -> None:
|
| 270 |
+
"""Save embeddings and metadata"""
|
| 271 |
+
emb_file, meta_file = self._get_file_paths(entity_type)
|
| 272 |
+
|
| 273 |
+
np.save(emb_file, embeddings)
|
| 274 |
+
metadata.to_pickle(meta_file)
|
| 275 |
+
|
| 276 |
+
print(f"💾 Saved:")
|
| 277 |
+
print(f" {emb_file}")
|
| 278 |
+
print(f" {meta_file}")
|
| 279 |
+
|
| 280 |
+
def generate_and_save(self,
|
| 281 |
+
entity_type: str,
|
| 282 |
+
texts: List[str],
|
| 283 |
+
metadata: pd.DataFrame,
|
| 284 |
+
batch_size: int = 32) -> np.ndarray:
|
| 285 |
+
"""Generate embeddings and save everything"""
|
| 286 |
+
print(f"🔄 Generating {entity_type} embeddings...")
|
| 287 |
+
print(f" Processing {len(texts):,} items...")
|
| 288 |
+
|
| 289 |
+
embeddings = self.generate(texts, batch_size=batch_size)
|
| 290 |
+
self.save(entity_type, embeddings, metadata)
|
| 291 |
+
|
| 292 |
+
return embeddings
|
| 293 |
+
|
| 294 |
+
def load_or_generate(self,
|
| 295 |
+
entity_type: str,
|
| 296 |
+
texts: List[str],
|
| 297 |
+
metadata: pd.DataFrame,
|
| 298 |
+
force_regenerate: bool = False) -> Tuple[np.ndarray, pd.DataFrame]:
|
| 299 |
+
"""Load if exists, generate otherwise"""
|
| 300 |
+
|
| 301 |
+
if not force_regenerate and self.exists(entity_type):
|
| 302 |
+
print(f"📥 Loading {entity_type} embeddings...")
|
| 303 |
+
embeddings, saved_metadata = self.load(entity_type)
|
| 304 |
+
|
| 305 |
+
# Verify alignment
|
| 306 |
+
if len(embeddings) != len(metadata):
|
| 307 |
+
print(f"⚠️ Size mismatch! Regenerating...")
|
| 308 |
+
embeddings = self.generate_and_save(
|
| 309 |
+
entity_type, texts, metadata
|
| 310 |
+
)
|
| 311 |
+
else:
|
| 312 |
+
print(f"✅ Loaded: {embeddings.shape}")
|
| 313 |
+
else:
|
| 314 |
+
embeddings = self.generate_and_save(
|
| 315 |
+
entity_type, texts, metadata
|
| 316 |
+
)
|
| 317 |
+
|
| 318 |
+
return embeddings, metadata
|
| 319 |
+
|
| 320 |
+
|
| 321 |
+
print("✅ EmbeddingManager class loaded")
|
| 322 |
+
|
| 323 |
+
# %% [markdown]
|
| 324 |
+
# ---
|
| 325 |
+
# ## 🏗️ Step 6: Architecture - Matching Engine
|
| 326 |
+
#
|
| 327 |
+
# **Responsibility:** Calculate similarities and find matches
|
| 328 |
+
|
| 329 |
+
# %%
|
| 330 |
+
# ============================================================================
|
| 331 |
+
# MATCHING ENGINE - Handles similarity calculations
|
| 332 |
+
# ============================================================================
|
| 333 |
+
|
| 334 |
+
class MatchingEngine:
|
| 335 |
+
"""Calculates similarities and finds top matches"""
|
| 336 |
+
|
| 337 |
+
def __init__(self,
|
| 338 |
+
candidate_vectors: np.ndarray,
|
| 339 |
+
company_vectors: np.ndarray,
|
| 340 |
+
candidate_metadata: pd.DataFrame,
|
| 341 |
+
company_metadata: pd.DataFrame):
|
| 342 |
+
|
| 343 |
+
self.cand_vectors = candidate_vectors
|
| 344 |
+
self.comp_vectors = company_vectors
|
| 345 |
+
self.cand_metadata = candidate_metadata
|
| 346 |
+
self.comp_metadata = company_metadata
|
| 347 |
+
|
| 348 |
+
# Verify alignment
|
| 349 |
+
assert len(candidate_vectors) == len(candidate_metadata), \
|
| 350 |
+
"Candidate embeddings and metadata size mismatch"
|
| 351 |
+
assert len(company_vectors) == len(company_metadata), \
|
| 352 |
+
"Company embeddings and metadata size mismatch"
|
| 353 |
+
|
| 354 |
+
def find_matches(self,
|
| 355 |
+
candidate_idx: int,
|
| 356 |
+
top_k: int = 10) -> List[Tuple[int, float]]:
|
| 357 |
+
"""Find top K company matches for a candidate"""
|
| 358 |
+
|
| 359 |
+
if candidate_idx >= len(self.cand_vectors):
|
| 360 |
+
raise IndexError(f"Candidate index {candidate_idx} out of range")
|
| 361 |
+
|
| 362 |
+
# Get candidate vector
|
| 363 |
+
cand_vec = self.cand_vectors[candidate_idx].reshape(1, -1)
|
| 364 |
+
|
| 365 |
+
# Calculate similarities
|
| 366 |
+
similarities = cosine_similarity(cand_vec, self.comp_vectors)[0]
|
| 367 |
+
|
| 368 |
+
# Get top K
|
| 369 |
+
top_indices = np.argsort(similarities)[::-1][:top_k]
|
| 370 |
+
|
| 371 |
+
# Return (index, score) tuples
|
| 372 |
+
return [(int(idx), float(similarities[idx])) for idx in top_indices]
|
| 373 |
+
|
| 374 |
+
def get_match_details(self,
|
| 375 |
+
candidate_idx: int,
|
| 376 |
+
company_idx: int) -> dict:
|
| 377 |
+
"""Get detailed match information"""
|
| 378 |
+
|
| 379 |
+
candidate = self.cand_metadata.iloc[candidate_idx]
|
| 380 |
+
company = self.comp_metadata.iloc[company_idx]
|
| 381 |
+
|
| 382 |
+
# Calculate similarity
|
| 383 |
+
cand_vec = self.cand_vectors[candidate_idx].reshape(1, -1)
|
| 384 |
+
comp_vec = self.comp_vectors[company_idx].reshape(1, -1)
|
| 385 |
+
similarity = float(cosine_similarity(cand_vec, comp_vec)[0][0])
|
| 386 |
+
|
| 387 |
+
return {
|
| 388 |
+
'candidate': candidate.to_dict(),
|
| 389 |
+
'company': company.to_dict(),
|
| 390 |
+
'similarity_score': similarity
|
| 391 |
+
}
|
| 392 |
+
|
| 393 |
+
def batch_match(self,
|
| 394 |
+
candidate_indices: List[int],
|
| 395 |
+
top_k: int = 10) -> dict:
|
| 396 |
+
"""Find matches for multiple candidates"""
|
| 397 |
+
|
| 398 |
+
results = {}
|
| 399 |
+
for idx in candidate_indices:
|
| 400 |
+
results[idx] = self.find_matches(idx, top_k=top_k)
|
| 401 |
+
|
| 402 |
+
return results
|
| 403 |
+
|
| 404 |
+
|
| 405 |
+
print("✅ MatchingEngine class loaded")
|
| 406 |
+
|
| 407 |
+
# %% [markdown]
|
| 408 |
+
# ---
|
| 409 |
+
# ## 📊 Step 7: Load All Datasets
|
| 410 |
+
|
| 411 |
+
# %%
|
| 412 |
+
print("📂 Loading all datasets...\n")
|
| 413 |
+
print("=" * 70)
|
| 414 |
+
|
| 415 |
+
# Load main datasets
|
| 416 |
+
candidates = pd.read_csv(f'{Config.CSV_PATH}resume_data.csv')
|
| 417 |
+
print(f"✅ Candidates: {len(candidates):,} rows × {len(candidates.columns)} columns")
|
| 418 |
+
|
| 419 |
+
companies_base = pd.read_csv(f'{Config.CSV_PATH}companies.csv')
|
| 420 |
+
print(f"✅ Companies (base): {len(companies_base):,} rows")
|
| 421 |
+
|
| 422 |
+
company_industries = pd.read_csv(f'{Config.CSV_PATH}company_industries.csv')
|
| 423 |
+
print(f"✅ Company industries: {len(company_industries):,} rows")
|
| 424 |
+
|
| 425 |
+
company_specialties = pd.read_csv(f'{Config.CSV_PATH}company_specialities.csv')
|
| 426 |
+
print(f"✅ Company specialties: {len(company_specialties):,} rows")
|
| 427 |
+
|
| 428 |
+
employee_counts = pd.read_csv(f'{Config.CSV_PATH}employee_counts.csv')
|
| 429 |
+
print(f"✅ Employee counts: {len(employee_counts):,} rows")
|
| 430 |
+
|
| 431 |
+
postings = pd.read_csv(f'{Config.CSV_PATH}postings.csv', on_bad_lines='skip', engine='python')
|
| 432 |
+
print(f"✅ Postings: {len(postings):,} rows × {len(postings.columns)} columns")
|
| 433 |
+
|
| 434 |
+
# Optional datasets
|
| 435 |
+
try:
|
| 436 |
+
job_skills = pd.read_csv(f'{Config.CSV_PATH}job_skills.csv')
|
| 437 |
+
print(f"✅ Job skills: {len(job_skills):,} rows")
|
| 438 |
+
except:
|
| 439 |
+
job_skills = None
|
| 440 |
+
print("⚠️ Job skills not found (optional)")
|
| 441 |
+
|
| 442 |
+
try:
|
| 443 |
+
job_industries = pd.read_csv(f'{Config.CSV_PATH}job_industries.csv')
|
| 444 |
+
print(f"✅ Job industries: {len(job_industries):,} rows")
|
| 445 |
+
except:
|
| 446 |
+
job_industries = None
|
| 447 |
+
print("⚠️ Job industries not found (optional)")
|
| 448 |
+
|
| 449 |
+
print("\n" + "=" * 70)
|
| 450 |
+
print("✅ All datasets loaded successfully!\n")
|
| 451 |
+
|
| 452 |
+
# %% [markdown]
|
| 453 |
+
# ---
|
| 454 |
+
# ## 📊 Step 8: Merge & Enrich Company Data
|
| 455 |
+
|
| 456 |
+
# %%
|
| 457 |
+
# ═══════════════════════════════════════════════════════════════════
|
| 458 |
+
# CELL 8: Merge & Enrich Company Data + Empty Columns Validation
|
| 459 |
+
# ═══════════════════════════════════════════════════════════════════
|
| 460 |
+
|
| 461 |
+
print("🔄 ENRICHING COMPANY DATA...")
|
| 462 |
+
print("=" * 80)
|
| 463 |
+
|
| 464 |
+
# ============================================================================
|
| 465 |
+
# STEP 1: Aggregate Industries per Company
|
| 466 |
+
# ============================================================================
|
| 467 |
+
print("\n1️⃣ Aggregating industries...")
|
| 468 |
+
|
| 469 |
+
industries_grouped = company_industries.groupby('company_id')['industry'].apply(
|
| 470 |
+
lambda x: ', '.join(x.dropna().astype(str).unique())
|
| 471 |
+
).reset_index()
|
| 472 |
+
industries_grouped.columns = ['company_id', 'industries_list']
|
| 473 |
+
|
| 474 |
+
print(f"✅ Industries aggregated: {len(industries_grouped):,} companies")
|
| 475 |
+
|
| 476 |
+
# ============================================================================
|
| 477 |
+
# STEP 2: Aggregate Specialties per Company
|
| 478 |
+
# ============================================================================
|
| 479 |
+
print("\n2️⃣ Aggregating specialties...")
|
| 480 |
+
|
| 481 |
+
specialties_grouped = company_specialties.groupby('company_id')['speciality'].apply(
|
| 482 |
+
lambda x: ', '.join(x.dropna().astype(str).unique())
|
| 483 |
+
).reset_index()
|
| 484 |
+
specialties_grouped.columns = ['company_id', 'specialties_list']
|
| 485 |
+
|
| 486 |
+
print(f"✅ Specialties aggregated: {len(specialties_grouped):,} companies")
|
| 487 |
+
|
| 488 |
+
# ============================================================================
|
| 489 |
+
# STEP 3: Aggregate Skills from Job Postings
|
| 490 |
+
# ============================================================================
|
| 491 |
+
print("\n3️⃣ Aggregating job posting skills...")
|
| 492 |
+
|
| 493 |
+
if job_skills is not None:
|
| 494 |
+
skills_df = pd.read_csv(f'{Config.CSV_PATH}skills.csv')
|
| 495 |
+
|
| 496 |
+
job_skills_enriched = job_skills.merge(
|
| 497 |
+
skills_df,
|
| 498 |
+
on='skill_abr',
|
| 499 |
+
how='left'
|
| 500 |
+
)
|
| 501 |
+
|
| 502 |
+
skills_per_posting = job_skills_enriched.groupby('job_id')['skill_name'].apply(
|
| 503 |
+
lambda x: ', '.join(x.dropna().astype(str).unique())
|
| 504 |
+
).reset_index()
|
| 505 |
+
skills_per_posting.columns = ['job_id', 'required_skills']
|
| 506 |
+
|
| 507 |
+
print(f"✅ Skills aggregated: {len(skills_per_posting):,} job postings")
|
| 508 |
+
else:
|
| 509 |
+
skills_per_posting = pd.DataFrame(columns=['job_id', 'required_skills'])
|
| 510 |
+
print("⚠️ Job skills not available")
|
| 511 |
+
|
| 512 |
+
# ============================================================================
|
| 513 |
+
# STEP 4: Aggregate Job Posting Data per Company
|
| 514 |
+
# ============================================================================
|
| 515 |
+
print("\n4️⃣ Aggregating job postings...")
|
| 516 |
+
|
| 517 |
+
postings_enriched = postings.merge(skills_per_posting, on='job_id', how='left')
|
| 518 |
+
|
| 519 |
+
job_data_grouped = postings_enriched.groupby('company_id').agg({
|
| 520 |
+
'title': lambda x: ', '.join(x.dropna().astype(str).unique()[:10]),
|
| 521 |
+
'required_skills': lambda x: ', '.join(x.dropna().astype(str).unique()),
|
| 522 |
+
'med_salary': 'mean',
|
| 523 |
+
'max_salary': 'mean',
|
| 524 |
+
'job_id': 'count'
|
| 525 |
+
}).reset_index()
|
| 526 |
+
|
| 527 |
+
job_data_grouped.columns = [
|
| 528 |
+
'company_id', 'posted_job_titles', 'required_skills',
|
| 529 |
+
'avg_med_salary', 'avg_max_salary', 'total_postings'
|
| 530 |
+
]
|
| 531 |
+
|
| 532 |
+
print(f"✅ Job data aggregated: {len(job_data_grouped):,} companies")
|
| 533 |
+
|
| 534 |
+
# ============================================================================
|
| 535 |
+
# STEP 5: Merge Everything
|
| 536 |
+
# ============================================================================
|
| 537 |
+
print("\n5️⃣ Merging all data...")
|
| 538 |
+
|
| 539 |
+
companies_full = companies_base.copy()
|
| 540 |
+
companies_full = companies_full.merge(industries_grouped, on='company_id', how='left')
|
| 541 |
+
companies_full = companies_full.merge(specialties_grouped, on='company_id', how='left')
|
| 542 |
+
companies_full = companies_full.merge(job_data_grouped, on='company_id', how='left')
|
| 543 |
+
|
| 544 |
+
print(f"✅ Shape: {companies_full.shape}")
|
| 545 |
+
|
| 546 |
+
# ============================================================================
|
| 547 |
+
# STEP 6: Fill Empty Columns
|
| 548 |
+
# ============================================================================
|
| 549 |
+
print("\n6️⃣ Filling nulls...")
|
| 550 |
+
|
| 551 |
+
fill_values = {
|
| 552 |
+
'name': 'Unknown Company',
|
| 553 |
+
'description': 'No description',
|
| 554 |
+
'industries_list': 'General',
|
| 555 |
+
'specialties_list': 'Not specified',
|
| 556 |
+
'required_skills': 'Not specified',
|
| 557 |
+
'posted_job_titles': 'Various',
|
| 558 |
+
'avg_med_salary': 0,
|
| 559 |
+
'avg_max_salary': 0,
|
| 560 |
+
'total_postings': 0
|
| 561 |
+
}
|
| 562 |
+
|
| 563 |
+
for col, val in fill_values.items():
|
| 564 |
+
if col in companies_full.columns:
|
| 565 |
+
before = companies_full[col].isna().sum()
|
| 566 |
+
companies_full[col] = companies_full[col].fillna(val)
|
| 567 |
+
if before > 0:
|
| 568 |
+
print(f" ✅ {col:25s} {before:>6,} → 0")
|
| 569 |
+
|
| 570 |
+
# ============================================================================
|
| 571 |
+
# STEP 7: Validation
|
| 572 |
+
# ============================================================================
|
| 573 |
+
print("\n7️⃣ Validation...")
|
| 574 |
+
print("=" * 80)
|
| 575 |
+
|
| 576 |
+
critical = ['name', 'description', 'industries_list', 'specialties_list',
|
| 577 |
+
'required_skills', 'posted_job_titles']
|
| 578 |
+
|
| 579 |
+
ok = True
|
| 580 |
+
for col in critical:
|
| 581 |
+
if col in companies_full.columns:
|
| 582 |
+
issues = companies_full[col].isna().sum() + (companies_full[col] == '').sum()
|
| 583 |
+
print(f"{'✅' if issues == 0 else '❌'} {col:25s} {issues} issues")
|
| 584 |
+
if issues > 0:
|
| 585 |
+
ok = False
|
| 586 |
+
|
| 587 |
+
print("=" * 80)
|
| 588 |
+
print(f"{'🎯 PERFECT!' if ok else '⚠️ ISSUES!'}")
|
| 589 |
+
print(f"\nTotal: {len(companies_full):,}")
|
| 590 |
+
print(f"With postings: {(companies_full['total_postings'] > 0).sum():,}")
|
| 591 |
+
|
| 592 |
+
# %%
|
| 593 |
+
# ═══════════════════════════════════════════════════════════════════
|
| 594 |
+
# CELL 9: Fill Missing Required Skills via Keyword Matching
|
| 595 |
+
# ═══════════════════════════════════════════════════════════════════
|
| 596 |
+
|
| 597 |
+
print("🔍 FILLING MISSING REQUIRED SKILLS...")
|
| 598 |
+
print("=" * 80)
|
| 599 |
+
|
| 600 |
+
# Load skills reference
|
| 601 |
+
skills_ref = pd.read_csv(f'{Config.CSV_PATH}skills.csv')
|
| 602 |
+
skill_names = set(skills_ref['skill_name'].str.lower().unique())
|
| 603 |
+
|
| 604 |
+
print(f"✅ Loaded {len(skill_names):,} unique skills")
|
| 605 |
+
|
| 606 |
+
# Find companies with empty required_skills
|
| 607 |
+
empty_mask = (companies_full['required_skills'] == 'Not specified') | \
|
| 608 |
+
(companies_full['required_skills'].isna())
|
| 609 |
+
empty_count = empty_mask.sum()
|
| 610 |
+
|
| 611 |
+
print(f"🔍 Found {empty_count:,} companies with missing skills")
|
| 612 |
+
|
| 613 |
+
if empty_count > 0:
|
| 614 |
+
print(f"\n🔄 Extracting skills from job postings text...")
|
| 615 |
+
|
| 616 |
+
# Get postings for companies with empty skills
|
| 617 |
+
empty_companies = companies_full[empty_mask]['company_id'].tolist()
|
| 618 |
+
relevant_postings = postings[postings['company_id'].isin(empty_companies)].copy()
|
| 619 |
+
|
| 620 |
+
print(f" Processing {len(relevant_postings):,} job postings...")
|
| 621 |
+
|
| 622 |
+
# Extract skills from description
|
| 623 |
+
def extract_skills_from_text(text):
|
| 624 |
+
if pd.isna(text):
|
| 625 |
+
return []
|
| 626 |
+
|
| 627 |
+
text_lower = str(text).lower()
|
| 628 |
+
found_skills = []
|
| 629 |
+
|
| 630 |
+
for skill in skill_names:
|
| 631 |
+
if skill in text_lower:
|
| 632 |
+
found_skills.append(skill)
|
| 633 |
+
|
| 634 |
+
return found_skills
|
| 635 |
+
|
| 636 |
+
# Extract from description column
|
| 637 |
+
relevant_postings['extracted_skills'] = relevant_postings['description'].apply(extract_skills_from_text)
|
| 638 |
+
|
| 639 |
+
# Aggregate by company
|
| 640 |
+
skills_extracted = relevant_postings.groupby('company_id')['extracted_skills'].apply(
|
| 641 |
+
lambda x: ', '.join(set([skill for sublist in x for skill in sublist]))
|
| 642 |
+
).reset_index()
|
| 643 |
+
skills_extracted.columns = ['company_id', 'extracted_skills']
|
| 644 |
+
|
| 645 |
+
# Update companies_full
|
| 646 |
+
for idx, row in skills_extracted.iterrows():
|
| 647 |
+
comp_id = row['company_id']
|
| 648 |
+
extracted = row['extracted_skills']
|
| 649 |
+
|
| 650 |
+
if extracted: # Only update if we found skills
|
| 651 |
+
mask = companies_full['company_id'] == comp_id
|
| 652 |
+
companies_full.loc[mask, 'required_skills'] = extracted
|
| 653 |
+
|
| 654 |
+
# Final check
|
| 655 |
+
still_empty = ((companies_full['required_skills'] == 'Not specified') |
|
| 656 |
+
(companies_full['required_skills'].isna())).sum()
|
| 657 |
+
|
| 658 |
+
filled = empty_count - still_empty
|
| 659 |
+
|
| 660 |
+
print(f"\n✅ RESULTS:")
|
| 661 |
+
print(f" Filled: {filled:,} companies")
|
| 662 |
+
print(f" Still empty: {still_empty:,} companies")
|
| 663 |
+
print(f" Success rate: {(filled/empty_count*100):.1f}%")
|
| 664 |
+
|
| 665 |
+
else:
|
| 666 |
+
print("✅ No missing skills to fill!")
|
| 667 |
+
|
| 668 |
+
print("\n" + "=" * 80)
|
| 669 |
+
|
| 670 |
+
# %%
|
| 671 |
+
# ═══════════════════════════════════════════════════════════════════
|
| 672 |
+
# VALIDATION: Check Job Posting Enrichment
|
| 673 |
+
# ═══════════════════════════════════════════════════════════════════
|
| 674 |
+
|
| 675 |
+
print("🔍 VALIDATING JOB POSTING ENRICHMENT...")
|
| 676 |
+
print("=" * 80)
|
| 677 |
+
|
| 678 |
+
# Stats
|
| 679 |
+
print(f"\n📊 COVERAGE:")
|
| 680 |
+
print(f" Total companies: {len(companies_full):,}")
|
| 681 |
+
print(f" With postings: {(companies_full['total_postings'] > 0).sum():,}")
|
| 682 |
+
print(f" Without postings: {(companies_full['total_postings'] == 0).sum():,}")
|
| 683 |
+
print(f" Coverage: {(companies_full['total_postings'] > 0).sum() / len(companies_full) * 100:.1f}%")
|
| 684 |
+
|
| 685 |
+
# Sample companies
|
| 686 |
+
sample = companies_full.sample(5, random_state=42)
|
| 687 |
+
|
| 688 |
+
print("\n📋 SAMPLE COMPANIES (random 5):")
|
| 689 |
+
print("-" * 80)
|
| 690 |
+
|
| 691 |
+
for idx, row in sample.iterrows():
|
| 692 |
+
print(f"\n🏢 {row['name']}")
|
| 693 |
+
print(f" Total Postings: {row['total_postings']}")
|
| 694 |
+
print(f" Industries: {str(row['industries_list'])[:80]}...")
|
| 695 |
+
print(f" Required Skills: {str(row['required_skills'])[:80]}...")
|
| 696 |
+
print(f" Job Titles: {str(row['posted_job_titles'])[:80]}...")
|
| 697 |
+
|
| 698 |
+
# Check if enrichment columns exist and are populated
|
| 699 |
+
print("\n\n🔍 ENRICHMENT QUALITY CHECK:")
|
| 700 |
+
print("-" * 80)
|
| 701 |
+
|
| 702 |
+
enrichment_cols = ['industries_list', 'specialties_list', 'required_skills', 'posted_job_titles']
|
| 703 |
+
|
| 704 |
+
for col in enrichment_cols:
|
| 705 |
+
empty = (companies_full[col] == 'Not specified') | (companies_full[col] == 'Various') | (companies_full[col] == 'General')
|
| 706 |
+
empty_count = empty.sum()
|
| 707 |
+
filled_count = len(companies_full) - empty_count
|
| 708 |
+
|
| 709 |
+
print(f"{col:25s} Filled: {filled_count:>6,} ({filled_count/len(companies_full)*100:>5.1f}%) Empty: {empty_count:>6,}")
|
| 710 |
+
|
| 711 |
+
print("\n" + "=" * 80)
|
| 712 |
+
print("\n🎯 CONCLUSION:")
|
| 713 |
+
print(" ✅ If 'Filled' percentages are high → Enrichment working!")
|
| 714 |
+
print(" ❌ If 'Empty' counts are high → Need to fix enrichment")
|
| 715 |
+
|
| 716 |
+
# %%
|
| 717 |
+
companies_full.head()
|
| 718 |
+
|
| 719 |
+
# %%
|
| 720 |
+
## 🔍 Data Quality Check - Duplicate Detection
|
| 721 |
+
|
| 722 |
+
"""
|
| 723 |
+
Checking for duplicates in all datasets based on primary keys.
|
| 724 |
+
This cell only REPORTS duplicates, does not modify data.
|
| 725 |
+
"""
|
| 726 |
+
|
| 727 |
+
print("=" * 80)
|
| 728 |
+
print("🔍 DUPLICATE DETECTION REPORT")
|
| 729 |
+
print("=" * 80)
|
| 730 |
+
print()
|
| 731 |
+
|
| 732 |
+
# Define primary keys for each dataset
|
| 733 |
+
duplicate_report = []
|
| 734 |
+
|
| 735 |
+
# 1. Candidates
|
| 736 |
+
print("┌─ 📊 resume_data.csv (Candidates)")
|
| 737 |
+
print(f"│ Primary Key: Resume_ID")
|
| 738 |
+
cand_total = len(candidates)
|
| 739 |
+
cand_unique = candidates['Resume_ID'].nunique() if 'Resume_ID' in candidates.columns else len(candidates)
|
| 740 |
+
cand_dups = cand_total - cand_unique
|
| 741 |
+
print(f"│ Total rows: {cand_total:,}")
|
| 742 |
+
print(f"│ Unique rows: {cand_unique:,}")
|
| 743 |
+
print(f"│ Duplicates: {cand_dups:,}")
|
| 744 |
+
print(f"│ Status: {'✅ CLEAN' if cand_dups == 0 else '🔴 HAS DUPLICATES'}")
|
| 745 |
+
print("└─\n")
|
| 746 |
+
duplicate_report.append(('Candidates', cand_total, cand_unique, cand_dups))
|
| 747 |
+
|
| 748 |
+
# 2. Companies Base
|
| 749 |
+
print("┌─ 📊 companies.csv (Companies Base)")
|
| 750 |
+
print(f"│ Primary Key: company_id")
|
| 751 |
+
comp_total = len(companies_base)
|
| 752 |
+
comp_unique = companies_base['company_id'].nunique()
|
| 753 |
+
comp_dups = comp_total - comp_unique
|
| 754 |
+
print(f"│ Total rows: {comp_total:,}")
|
| 755 |
+
print(f"│ Unique rows: {comp_unique:,}")
|
| 756 |
+
print(f"│ Duplicates: {comp_dups:,}")
|
| 757 |
+
print(f"│ Status: {'✅ CLEAN' if comp_dups == 0 else '🔴 HAS DUPLICATES'}")
|
| 758 |
+
if comp_dups > 0:
|
| 759 |
+
dup_ids = companies_base[companies_base.duplicated('company_id', keep=False)]['company_id'].value_counts().head(3)
|
| 760 |
+
print(f"│ Top duplicates:")
|
| 761 |
+
for cid, count in dup_ids.items():
|
| 762 |
+
print(f"│ - company_id={cid}: {count} times")
|
| 763 |
+
print("└─\n")
|
| 764 |
+
duplicate_report.append(('Companies Base', comp_total, comp_unique, comp_dups))
|
| 765 |
+
|
| 766 |
+
# 3. Company Industries
|
| 767 |
+
print("┌─ 📊 company_industries.csv")
|
| 768 |
+
print(f"│ Primary Key: company_id + industry")
|
| 769 |
+
ci_total = len(company_industries)
|
| 770 |
+
ci_unique = len(company_industries.drop_duplicates(subset=['company_id', 'industry']))
|
| 771 |
+
ci_dups = ci_total - ci_unique
|
| 772 |
+
print(f"│ Total rows: {ci_total:,}")
|
| 773 |
+
print(f"│ Unique rows: {ci_unique:,}")
|
| 774 |
+
print(f"│ Duplicates: {ci_dups:,}")
|
| 775 |
+
print(f"│ Status: {'✅ CLEAN' if ci_dups == 0 else '🔴 HAS DUPLICATES'}")
|
| 776 |
+
print("└─\n")
|
| 777 |
+
duplicate_report.append(('Company Industries', ci_total, ci_unique, ci_dups))
|
| 778 |
+
|
| 779 |
+
# 4. Company Specialties
|
| 780 |
+
print("┌─ 📊 company_specialities.csv")
|
| 781 |
+
print(f"│ Primary Key: company_id + speciality")
|
| 782 |
+
cs_total = len(company_specialties)
|
| 783 |
+
cs_unique = len(company_specialties.drop_duplicates(subset=['company_id', 'speciality']))
|
| 784 |
+
cs_dups = cs_total - cs_unique
|
| 785 |
+
print(f"│ Total rows: {cs_total:,}")
|
| 786 |
+
print(f"│ Unique rows: {cs_unique:,}")
|
| 787 |
+
print(f"│ Duplicates: {cs_dups:,}")
|
| 788 |
+
print(f"│ Status: {'✅ CLEAN' if cs_dups == 0 else '🔴 HAS DUPLICATES'}")
|
| 789 |
+
print("└─\n")
|
| 790 |
+
duplicate_report.append(('Company Specialties', cs_total, cs_unique, cs_dups))
|
| 791 |
+
|
| 792 |
+
# 5. Employee Counts
|
| 793 |
+
print("┌─ 📊 employee_counts.csv")
|
| 794 |
+
print(f"│ Primary Key: company_id")
|
| 795 |
+
ec_total = len(employee_counts)
|
| 796 |
+
ec_unique = employee_counts['company_id'].nunique()
|
| 797 |
+
ec_dups = ec_total - ec_unique
|
| 798 |
+
print(f"│ Total rows: {ec_total:,}")
|
| 799 |
+
print(f"│ Unique rows: {ec_unique:,}")
|
| 800 |
+
print(f"│ Duplicates: {ec_dups:,}")
|
| 801 |
+
print(f"│ Status: {'✅ CLEAN' if ec_dups == 0 else '🔴 HAS DUPLICATES'}")
|
| 802 |
+
print("└─\n")
|
| 803 |
+
duplicate_report.append(('Employee Counts', ec_total, ec_unique, ec_dups))
|
| 804 |
+
|
| 805 |
+
# 6. Postings
|
| 806 |
+
print("┌─ 📊 postings.csv (Job Postings)")
|
| 807 |
+
print(f"│ Primary Key: job_id")
|
| 808 |
+
if 'job_id' in postings.columns:
|
| 809 |
+
post_total = len(postings)
|
| 810 |
+
post_unique = postings['job_id'].nunique()
|
| 811 |
+
post_dups = post_total - post_unique
|
| 812 |
+
else:
|
| 813 |
+
post_total = len(postings)
|
| 814 |
+
post_unique = len(postings.drop_duplicates())
|
| 815 |
+
post_dups = post_total - post_unique
|
| 816 |
+
print(f"│ Total rows: {post_total:,}")
|
| 817 |
+
print(f"│ Unique rows: {post_unique:,}")
|
| 818 |
+
print(f"│ Duplicates: {post_dups:,}")
|
| 819 |
+
print(f"│ Status: {'✅ CLEAN' if post_dups == 0 else '🔴 HAS DUPLICATES'}")
|
| 820 |
+
print("└─\n")
|
| 821 |
+
duplicate_report.append(('Postings', post_total, post_unique, post_dups))
|
| 822 |
+
|
| 823 |
+
# 7. Companies Full (After Merge)
|
| 824 |
+
print("┌─ 📊 companies_full (After Enrichment)")
|
| 825 |
+
print(f"│ Primary Key: company_id")
|
| 826 |
+
cf_total = len(companies_full)
|
| 827 |
+
cf_unique = companies_full['company_id'].nunique()
|
| 828 |
+
cf_dups = cf_total - cf_unique
|
| 829 |
+
print(f"│ Total rows: {cf_total:,}")
|
| 830 |
+
print(f"│ Unique rows: {cf_unique:,}")
|
| 831 |
+
print(f"│ Duplicates: {cf_dups:,}")
|
| 832 |
+
print(f"│ Status: {'✅ CLEAN' if cf_dups == 0 else '🔴 HAS DUPLICATES'}")
|
| 833 |
+
if cf_dups > 0:
|
| 834 |
+
dup_ids = companies_full[companies_full.duplicated('company_id', keep=False)]['company_id'].value_counts().head(5)
|
| 835 |
+
print(f"│")
|
| 836 |
+
print(f"│ Top duplicate company_ids:")
|
| 837 |
+
for cid, count in dup_ids.items():
|
| 838 |
+
comp_name = companies_full[companies_full['company_id'] == cid]['name'].iloc[0]
|
| 839 |
+
print(f"│ - {cid} ({comp_name}): {count} times")
|
| 840 |
+
print("└─\n")
|
| 841 |
+
duplicate_report.append(('Companies Full', cf_total, cf_unique, cf_dups))
|
| 842 |
+
|
| 843 |
+
# Summary
|
| 844 |
+
print("=" * 80)
|
| 845 |
+
print("📊 SUMMARY")
|
| 846 |
+
print("=" * 80)
|
| 847 |
+
print()
|
| 848 |
+
|
| 849 |
+
total_dups = sum(r[3] for r in duplicate_report)
|
| 850 |
+
clean_datasets = sum(1 for r in duplicate_report if r[3] == 0)
|
| 851 |
+
dirty_datasets = len(duplicate_report) - clean_datasets
|
| 852 |
+
|
| 853 |
+
print(f"✅ Clean datasets: {clean_datasets}/{len(duplicate_report)}")
|
| 854 |
+
print(f"🔴 Datasets with duplicates: {dirty_datasets}/{len(duplicate_report)}")
|
| 855 |
+
print(f"🗑️ Total duplicates found: {total_dups:,} rows")
|
| 856 |
+
print()
|
| 857 |
+
|
| 858 |
+
if dirty_datasets > 0:
|
| 859 |
+
print("⚠️ DUPLICATES DETECTED!")
|
| 860 |
+
else:
|
| 861 |
+
print("✅ All datasets are clean! No duplicates found.")
|
| 862 |
+
|
| 863 |
+
print("=" * 80)
|
| 864 |
+
|
| 865 |
+
# %% [markdown]
|
| 866 |
+
# ---
|
| 867 |
+
# ## 📊 Step 12a: Load Embedding Model & Pre-computed Vectors
|
| 868 |
+
|
| 869 |
+
# %%
|
| 870 |
+
print("🧠 Loading embedding model...\n")
|
| 871 |
+
model = SentenceTransformer(Config.EMBEDDING_MODEL)
|
| 872 |
+
embedding_dim = model.get_sentence_embedding_dimension()
|
| 873 |
+
print(f"✅ Model loaded: {Config.EMBEDDING_MODEL}")
|
| 874 |
+
print(f"📐 Embedding dimension: ℝ^{embedding_dim}\n")
|
| 875 |
+
|
| 876 |
+
print("📂 Loading pre-computed embeddings...")
|
| 877 |
+
|
| 878 |
+
try:
|
| 879 |
+
# Try to load from processed folder
|
| 880 |
+
cand_vectors = np.load(f'{Config.PROCESSED_PATH}candidate_embeddings.npy')
|
| 881 |
+
comp_vectors = np.load(f'{Config.PROCESSED_PATH}company_embeddings.npy')
|
| 882 |
+
|
| 883 |
+
print(f"✅ Loaded from {Config.PROCESSED_PATH}")
|
| 884 |
+
print(f"📊 Candidate vectors: {cand_vectors.shape}")
|
| 885 |
+
print(f"📊 Company vectors: {comp_vectors.shape}\n")
|
| 886 |
+
|
| 887 |
+
except FileNotFoundError:
|
| 888 |
+
print("⚠️ Pre-computed embeddings not found!")
|
| 889 |
+
print(" Embeddings will need to be generated (takes ~5-10 minutes)")
|
| 890 |
+
print(" This is normal if running for the first time.\n")
|
| 891 |
+
|
| 892 |
+
# You can add embedding generation code here if needed
|
| 893 |
+
# For now, we'll skip to keep notebook clean
|
| 894 |
+
cand_vectors = None
|
| 895 |
+
comp_vectors = None
|
| 896 |
+
|
| 897 |
+
# %% [markdown]
|
| 898 |
+
# ---
|
| 899 |
+
# ## 📊 Step 12b: Generate Embeddings & Pre-computed Vectors
|
| 900 |
+
|
| 901 |
+
# %%
|
| 902 |
+
# #last time running:
|
| 903 |
+
# from datetime import datetime
|
| 904 |
+
# print(datetime.now().strftime('%Y-%m-%d %H:%M:%S'))
|
| 905 |
+
|
| 906 |
+
# %%
|
| 907 |
+
# # ═══════════════════════════════════════════════════════════════════
|
| 908 |
+
# # CELL 9: Generate Embeddings (CPU ONLY)
|
| 909 |
+
# # ═══════════════════════════════════════════════════════════════════
|
| 910 |
+
|
| 911 |
+
# print("🧠 GENERATING EMBEDDINGS...")
|
| 912 |
+
# print("=" * 80)
|
| 913 |
+
|
| 914 |
+
# print(f"\n🔧 Loading model: {Config.EMBEDDING_MODEL} (CPU)")
|
| 915 |
+
# model = SentenceTransformer(Config.EMBEDDING_MODEL, device='cpu')
|
| 916 |
+
# print(f"✅ Loaded! Dim: {model.get_sentence_embedding_dimension()}")
|
| 917 |
+
|
| 918 |
+
# # ============================================================================
|
| 919 |
+
# # CANDIDATES
|
| 920 |
+
# # ============================================================================
|
| 921 |
+
# print(f"\n1️⃣ CANDIDATES ({len(candidates):,})")
|
| 922 |
+
|
| 923 |
+
# cand_builder = CandidateTextBuilder()
|
| 924 |
+
# candidate_texts = cand_builder.build_batch(candidates)
|
| 925 |
+
|
| 926 |
+
# cand_vectors = model.encode(
|
| 927 |
+
# candidate_texts,
|
| 928 |
+
# show_progress_bar=True,
|
| 929 |
+
# batch_size=16,
|
| 930 |
+
# normalize_embeddings=True,
|
| 931 |
+
# convert_to_numpy=True
|
| 932 |
+
# )
|
| 933 |
+
|
| 934 |
+
# print(f"✅ Shape: {cand_vectors.shape}")
|
| 935 |
+
# np.save(f'{Config.PROCESSED_PATH}candidate_embeddings.npy', cand_vectors)
|
| 936 |
+
# candidates.to_pickle(f'{Config.PROCESSED_PATH}candidates_metadata.pkl')
|
| 937 |
+
# print(f"💾 Saved")
|
| 938 |
+
|
| 939 |
+
# # ============================================================================
|
| 940 |
+
# # COMPANIES
|
| 941 |
+
# # ============================================================================
|
| 942 |
+
# print(f"\n2️⃣ COMPANIES ({len(companies_full):,})")
|
| 943 |
+
|
| 944 |
+
# comp_builder = CompanyTextBuilder()
|
| 945 |
+
# company_texts = comp_builder.build_batch(companies_full)
|
| 946 |
+
|
| 947 |
+
# comp_vectors = model.encode(
|
| 948 |
+
# company_texts,
|
| 949 |
+
# show_progress_bar=True,
|
| 950 |
+
# batch_size=16,
|
| 951 |
+
# normalize_embeddings=True,
|
| 952 |
+
# convert_to_numpy=True
|
| 953 |
+
# )
|
| 954 |
+
|
| 955 |
+
# print(f"✅ Shape: {comp_vectors.shape}")
|
| 956 |
+
# np.save(f'{Config.PROCESSED_PATH}company_embeddings.npy', comp_vectors)
|
| 957 |
+
# companies_full.to_pickle(f'{Config.PROCESSED_PATH}companies_metadata.pkl')
|
| 958 |
+
# print(f"💾 Saved")
|
| 959 |
+
|
| 960 |
+
# # ============================================================================
|
| 961 |
+
# # DONE
|
| 962 |
+
# # ============================================================================
|
| 963 |
+
# print(f"\n{'='*80}")
|
| 964 |
+
# print(f"🎯 DONE!")
|
| 965 |
+
# print(f"Candidates: {cand_vectors.shape}")
|
| 966 |
+
# print(f"Companies: {comp_vectors.shape}")
|
| 967 |
+
# print(f"{'='*80}")
|
| 968 |
+
|
| 969 |
+
# %% [markdown]
|
| 970 |
+
# ---
|
| 971 |
+
# ## 📊 Step 8: Core Matching Function
|
| 972 |
+
|
| 973 |
+
# %%
|
| 974 |
+
# ============================================================================
|
| 975 |
+
# CORE MATCHING FUNCTION (SAFE VERSION)
|
| 976 |
+
# ============================================================================
|
| 977 |
+
|
| 978 |
+
def find_top_matches(candidate_idx: int, top_k: int = 10) -> list:
|
| 979 |
+
"""
|
| 980 |
+
Find top K company matches for a candidate.
|
| 981 |
+
|
| 982 |
+
SAFE VERSION: Handles index mismatches between embeddings and dataset
|
| 983 |
+
|
| 984 |
+
Args:
|
| 985 |
+
candidate_idx: Index of candidate in candidates DataFrame
|
| 986 |
+
top_k: Number of top matches to return
|
| 987 |
+
|
| 988 |
+
Returns:
|
| 989 |
+
List of tuples: [(company_idx, similarity_score), ...]
|
| 990 |
+
"""
|
| 991 |
+
|
| 992 |
+
# Validate candidate index
|
| 993 |
+
if candidate_idx >= len(cand_vectors):
|
| 994 |
+
print(f"❌ Candidate index {candidate_idx} out of range")
|
| 995 |
+
return []
|
| 996 |
+
|
| 997 |
+
# Get candidate vector
|
| 998 |
+
cand_vec = cand_vectors[candidate_idx].reshape(1, -1)
|
| 999 |
+
|
| 1000 |
+
# Calculate similarities with all company vectors
|
| 1001 |
+
similarities = cosine_similarity(cand_vec, comp_vectors)[0]
|
| 1002 |
+
|
| 1003 |
+
# CRITICAL FIX: Only use indices that exist in companies_full
|
| 1004 |
+
max_valid_idx = len(companies_full) - 1
|
| 1005 |
+
|
| 1006 |
+
# Truncate similarities to valid range
|
| 1007 |
+
valid_similarities = similarities[:max_valid_idx + 1]
|
| 1008 |
+
|
| 1009 |
+
# Get top K indices from valid range
|
| 1010 |
+
top_indices = np.argsort(valid_similarities)[::-1][:top_k]
|
| 1011 |
+
|
| 1012 |
+
# Return (index, score) tuples
|
| 1013 |
+
results = [(int(idx), float(valid_similarities[idx])) for idx in top_indices]
|
| 1014 |
+
|
| 1015 |
+
return results
|
| 1016 |
+
|
| 1017 |
+
# Test function and show diagnostics
|
| 1018 |
+
print("✅ Safe matching function loaded!")
|
| 1019 |
+
print(f"\n📊 DIAGNOSTICS:")
|
| 1020 |
+
print(f" Candidate vectors: {len(cand_vectors):,}")
|
| 1021 |
+
print(f" Company vectors: {len(comp_vectors):,}")
|
| 1022 |
+
print(f" Companies dataset: {len(companies_full):,}")
|
| 1023 |
+
|
| 1024 |
+
if len(comp_vectors) > len(companies_full):
|
| 1025 |
+
print(f"\n⚠️ INDEX MISMATCH DETECTED!")
|
| 1026 |
+
print(f" Embeddings: {len(comp_vectors):,}")
|
| 1027 |
+
print(f" Dataset: {len(companies_full):,}")
|
| 1028 |
+
print(f" Missing rows: {len(comp_vectors) - len(companies_full):,}")
|
| 1029 |
+
print(f"\n💡 CAUSE: Embeddings generated BEFORE deduplication")
|
| 1030 |
+
print(f"\n🎯 SOLUTIONS:")
|
| 1031 |
+
print(f" A. Safe functions active (current) ✅")
|
| 1032 |
+
print(f" B. Regenerate embeddings after dedup")
|
| 1033 |
+
print(f" C. Run collaborative filtering step")
|
| 1034 |
+
else:
|
| 1035 |
+
print(f"\n✅ Embeddings and dataset are aligned!")
|
| 1036 |
+
|
| 1037 |
+
# %% [markdown]
|
| 1038 |
+
# ---
|
| 1039 |
+
# ## 📊 Step 9: Initialize FREE LLM (Hugging Face)
|
| 1040 |
+
#
|
| 1041 |
+
# ### Get your FREE token: https://huggingface.co/settings/tokens
|
| 1042 |
+
|
| 1043 |
+
# %%
|
| 1044 |
+
# Initialize Hugging Face Inference Client (FREE)
|
| 1045 |
+
if Config.HF_TOKEN:
|
| 1046 |
+
try:
|
| 1047 |
+
hf_client = InferenceClient(token=Config.HF_TOKEN)
|
| 1048 |
+
print("✅ Hugging Face client initialized (FREE)")
|
| 1049 |
+
print(f"🤖 Model: {Config.LLM_MODEL}")
|
| 1050 |
+
print("💰 Cost: $0.00 (completely free!)\n")
|
| 1051 |
+
LLM_AVAILABLE = True
|
| 1052 |
+
except Exception as e:
|
| 1053 |
+
print(f"⚠️ Failed to initialize HF client: {e}")
|
| 1054 |
+
LLM_AVAILABLE = False
|
| 1055 |
+
else:
|
| 1056 |
+
print("⚠️ No Hugging Face token configured")
|
| 1057 |
+
print(" LLM features will be disabled")
|
| 1058 |
+
print("\n📝 To enable:")
|
| 1059 |
+
print(" 1. Go to: https://huggingface.co/settings/tokens")
|
| 1060 |
+
print(" 2. Create a token (free)")
|
| 1061 |
+
print(" 3. Set: Config.HF_TOKEN = 'your-token-here'\n")
|
| 1062 |
+
LLM_AVAILABLE = False
|
| 1063 |
+
hf_client = None
|
| 1064 |
+
|
| 1065 |
+
def call_llm(prompt: str, max_tokens: int = 1000) -> str:
|
| 1066 |
+
"""
|
| 1067 |
+
Generic LLM call using Hugging Face Inference API (FREE).
|
| 1068 |
+
"""
|
| 1069 |
+
if not LLM_AVAILABLE:
|
| 1070 |
+
return "[LLM not available - check .env file for HF_TOKEN]"
|
| 1071 |
+
|
| 1072 |
+
try:
|
| 1073 |
+
response = hf_client.chat_completion( # ✅ chat_completion
|
| 1074 |
+
messages=[{"role": "user", "content": prompt}],
|
| 1075 |
+
model=Config.LLM_MODEL,
|
| 1076 |
+
max_tokens=max_tokens,
|
| 1077 |
+
temperature=0.7
|
| 1078 |
+
)
|
| 1079 |
+
return response.choices[0].message.content # ✅ Extrai conteúdo
|
| 1080 |
+
except Exception as e:
|
| 1081 |
+
return f"[Error: {str(e)}]"
|
| 1082 |
+
|
| 1083 |
+
print("✅ LLM helper functions ready")
|
| 1084 |
+
|
| 1085 |
+
# %% [markdown]
|
| 1086 |
+
# ---
|
| 1087 |
+
# ## 📊 Step 10: Pydantic Schemas for Structured Output
|
| 1088 |
+
|
| 1089 |
+
# %%
|
| 1090 |
+
class JobLevelClassification(BaseModel):
|
| 1091 |
+
"""Job level classification result"""
|
| 1092 |
+
level: Literal['Entry', 'Mid', 'Senior', 'Executive']
|
| 1093 |
+
confidence: float = Field(ge=0.0, le=1.0)
|
| 1094 |
+
reasoning: str
|
| 1095 |
+
|
| 1096 |
+
class SkillsTaxonomy(BaseModel):
|
| 1097 |
+
"""Structured skills extraction"""
|
| 1098 |
+
technical_skills: List[str] = Field(default_factory=list)
|
| 1099 |
+
soft_skills: List[str] = Field(default_factory=list)
|
| 1100 |
+
certifications: List[str] = Field(default_factory=list)
|
| 1101 |
+
languages: List[str] = Field(default_factory=list)
|
| 1102 |
+
|
| 1103 |
+
class MatchExplanation(BaseModel):
|
| 1104 |
+
"""Match reasoning"""
|
| 1105 |
+
overall_score: float = Field(ge=0.0, le=1.0)
|
| 1106 |
+
match_strengths: List[str]
|
| 1107 |
+
skill_gaps: List[str]
|
| 1108 |
+
recommendation: str
|
| 1109 |
+
fit_summary: str = Field(max_length=200)
|
| 1110 |
+
|
| 1111 |
+
print("✅ Pydantic schemas defined")
|
| 1112 |
+
|
| 1113 |
+
# %% [markdown]
|
| 1114 |
+
# ---
|
| 1115 |
+
# ## 📊 Step 11: Job Level Classification (Zero-Shot)
|
| 1116 |
+
|
| 1117 |
+
# %%
|
| 1118 |
+
def classify_job_level_zero_shot(job_description: str) -> Dict:
|
| 1119 |
+
"""
|
| 1120 |
+
Zero-shot job level classification.
|
| 1121 |
+
|
| 1122 |
+
Returns classification as: Entry, Mid, Senior, or Executive
|
| 1123 |
+
"""
|
| 1124 |
+
|
| 1125 |
+
prompt = f"""Classify this job posting into ONE seniority level.
|
| 1126 |
+
|
| 1127 |
+
Levels:
|
| 1128 |
+
- Entry: 0-2 years experience, junior roles
|
| 1129 |
+
- Mid: 3-5 years experience, independent work
|
| 1130 |
+
- Senior: 6-10 years experience, technical leadership
|
| 1131 |
+
- Executive: 10+ years, strategic leadership, C-level
|
| 1132 |
+
|
| 1133 |
+
Job Posting:
|
| 1134 |
+
{job_description[:500]}
|
| 1135 |
+
|
| 1136 |
+
Return ONLY valid JSON:
|
| 1137 |
+
{{
|
| 1138 |
+
"level": "Entry|Mid|Senior|Executive",
|
| 1139 |
+
"confidence": 0.85,
|
| 1140 |
+
"reasoning": "Brief explanation"
|
| 1141 |
+
}}
|
| 1142 |
+
"""
|
| 1143 |
+
|
| 1144 |
+
response = call_llm(prompt)
|
| 1145 |
+
|
| 1146 |
+
try:
|
| 1147 |
+
# Extract JSON
|
| 1148 |
+
json_str = response.strip()
|
| 1149 |
+
if '```json' in json_str:
|
| 1150 |
+
json_str = json_str.split('```json')[1].split('```')[0].strip()
|
| 1151 |
+
elif '```' in json_str:
|
| 1152 |
+
json_str = json_str.split('```')[1].split('```')[0].strip()
|
| 1153 |
+
|
| 1154 |
+
# Find JSON in response
|
| 1155 |
+
if '{' in json_str and '}' in json_str:
|
| 1156 |
+
start = json_str.index('{')
|
| 1157 |
+
end = json_str.rindex('}') + 1
|
| 1158 |
+
json_str = json_str[start:end]
|
| 1159 |
+
|
| 1160 |
+
result = json.loads(json_str)
|
| 1161 |
+
return result
|
| 1162 |
+
except:
|
| 1163 |
+
return {
|
| 1164 |
+
"level": "Unknown",
|
| 1165 |
+
"confidence": 0.0,
|
| 1166 |
+
"reasoning": "Failed to parse response"
|
| 1167 |
+
}
|
| 1168 |
+
|
| 1169 |
+
# Test if LLM available and data loaded
|
| 1170 |
+
if LLM_AVAILABLE and len(postings) > 0:
|
| 1171 |
+
print("🧪 Testing zero-shot classification...\n")
|
| 1172 |
+
sample = postings.iloc[0]['description']
|
| 1173 |
+
result = classify_job_level_zero_shot(sample)
|
| 1174 |
+
|
| 1175 |
+
print("📊 Classification Result:")
|
| 1176 |
+
print(json.dumps(result, indent=2))
|
| 1177 |
+
else:
|
| 1178 |
+
print("⚠️ Skipped - LLM not available or no data")
|
| 1179 |
+
|
| 1180 |
+
# %% [markdown]
|
| 1181 |
+
# ---
|
| 1182 |
+
# ## 📊 Step 12: Few-Shot Learning
|
| 1183 |
+
|
| 1184 |
+
# %%
|
| 1185 |
+
# ═══════════════════════════════════════════════════════════════════
|
| 1186 |
+
# FEW-SHOT Job Level Classification (FIXED)
|
| 1187 |
+
# ═══════════════════════════════════════════════════════════════════
|
| 1188 |
+
|
| 1189 |
+
def classify_job_level_few_shot(job_description: str) -> Dict:
|
| 1190 |
+
"""Few-shot classification with robust parsing"""
|
| 1191 |
+
|
| 1192 |
+
prompt = f"""Classify this job posting using examples.
|
| 1193 |
+
|
| 1194 |
+
EXAMPLES:
|
| 1195 |
+
- "Recent graduate wanted. Python basics." → Entry
|
| 1196 |
+
- "5+ years backend. Lead team." → Senior
|
| 1197 |
+
- "CTO position. 15+ years strategy." → Executive
|
| 1198 |
+
|
| 1199 |
+
JOB POSTING:
|
| 1200 |
+
{job_description[:500]}
|
| 1201 |
+
|
| 1202 |
+
IMPORTANT: Return ONLY valid JSON in this exact format:
|
| 1203 |
+
{{"level": "Entry|Mid|Senior|Executive", "confidence": 0.85, "reasoning": "brief explanation"}}
|
| 1204 |
+
|
| 1205 |
+
Do not include any other text, markdown, or code blocks."""
|
| 1206 |
+
|
| 1207 |
+
response = call_llm(prompt, max_tokens=200)
|
| 1208 |
+
|
| 1209 |
+
try:
|
| 1210 |
+
# Clean response
|
| 1211 |
+
json_str = response.strip()
|
| 1212 |
+
|
| 1213 |
+
# Remove markdown if present
|
| 1214 |
+
if '```' in json_str:
|
| 1215 |
+
json_str = json_str.split('```json')[-1].split('```')[0].strip()
|
| 1216 |
+
if not json_str:
|
| 1217 |
+
json_str = response.split('```')[-2].strip()
|
| 1218 |
+
|
| 1219 |
+
# Extract JSON object
|
| 1220 |
+
if '{' in json_str and '}' in json_str:
|
| 1221 |
+
start = json_str.index('{')
|
| 1222 |
+
end = json_str.rindex('}') + 1
|
| 1223 |
+
json_str = json_str[start:end]
|
| 1224 |
+
|
| 1225 |
+
result = json.loads(json_str)
|
| 1226 |
+
|
| 1227 |
+
# Validate fields
|
| 1228 |
+
if 'level' not in result:
|
| 1229 |
+
raise ValueError("Missing 'level' field")
|
| 1230 |
+
|
| 1231 |
+
# Ensure confidence exists
|
| 1232 |
+
if 'confidence' not in result:
|
| 1233 |
+
result['confidence'] = 0.85
|
| 1234 |
+
|
| 1235 |
+
return result
|
| 1236 |
+
|
| 1237 |
+
except Exception as e:
|
| 1238 |
+
# Fallback: try to extract level from raw text
|
| 1239 |
+
response_lower = response.lower()
|
| 1240 |
+
|
| 1241 |
+
if 'entry' in response_lower or 'junior' in response_lower:
|
| 1242 |
+
level = 'Entry'
|
| 1243 |
+
elif 'senior' in response_lower:
|
| 1244 |
+
level = 'Senior'
|
| 1245 |
+
elif 'executive' in response_lower or 'c-level' in response_lower:
|
| 1246 |
+
level = 'Executive'
|
| 1247 |
+
elif 'mid' in response_lower:
|
| 1248 |
+
level = 'Mid'
|
| 1249 |
+
else:
|
| 1250 |
+
level = 'Unknown'
|
| 1251 |
+
|
| 1252 |
+
return {
|
| 1253 |
+
"level": level,
|
| 1254 |
+
"confidence": 0.70 if level != 'Unknown' else 0.0,
|
| 1255 |
+
"reasoning": f"Extracted from text (parse error: {str(e)[:50]})"
|
| 1256 |
+
}
|
| 1257 |
+
|
| 1258 |
+
print("✅ Few-shot classifier (robust parsing)")
|
| 1259 |
+
|
| 1260 |
+
# Test comparison
|
| 1261 |
+
if LLM_AVAILABLE and len(postings) > 0:
|
| 1262 |
+
print("\n🧪 Comparing Zero-Shot vs Few-Shot...")
|
| 1263 |
+
sample = postings.iloc[0]['description']
|
| 1264 |
+
|
| 1265 |
+
zero = classify_job_level_zero_shot(sample)
|
| 1266 |
+
few = classify_job_level_few_shot(sample)
|
| 1267 |
+
|
| 1268 |
+
print("\n📊 Comparison:")
|
| 1269 |
+
print(f"Zero-shot: {zero['level']} (confidence: {zero['confidence']:.2f})")
|
| 1270 |
+
print(f"Few-shot: {few['level']} (confidence: {few['confidence']:.2f})")
|
| 1271 |
+
|
| 1272 |
+
print(f"\n🔍 Few-shot reasoning: {few['reasoning'][:100]}...")
|
| 1273 |
+
else:
|
| 1274 |
+
print("⚠️ LLM not available")
|
| 1275 |
+
|
| 1276 |
+
# %% [markdown]
|
| 1277 |
+
# ---
|
| 1278 |
+
# ## 📊 Step 13: Structured Skills Extraction
|
| 1279 |
+
|
| 1280 |
+
# %%
|
| 1281 |
+
# ═══════════════════════════════════════════════════════════════════
|
| 1282 |
+
# FIXED: Skills Extraction (better prompt)
|
| 1283 |
+
# ═══════════════════════════════════════════════════════════════════
|
| 1284 |
+
|
| 1285 |
+
def extract_skills_taxonomy(job_description: str) -> Dict:
|
| 1286 |
+
"""Extract structured skills using LLM + Pydantic validation"""
|
| 1287 |
+
|
| 1288 |
+
prompt = f"""Extract ALL skills mentioned in this job posting.
|
| 1289 |
+
|
| 1290 |
+
JOB POSTING:
|
| 1291 |
+
{job_description[:800]}
|
| 1292 |
+
|
| 1293 |
+
Analyze the text above and extract:
|
| 1294 |
+
- Technical skills (programming, tools, platforms)
|
| 1295 |
+
- Soft skills (teamwork, communication, problem-solving)
|
| 1296 |
+
- Certifications (if any)
|
| 1297 |
+
- Languages (if mentioned)
|
| 1298 |
+
|
| 1299 |
+
Return ONLY valid JSON with actual skills found in the text:
|
| 1300 |
+
{{
|
| 1301 |
+
"technical_skills": ["skill1", "skill2"],
|
| 1302 |
+
"soft_skills": ["skill1", "skill2"],
|
| 1303 |
+
"certifications": ["cert1"],
|
| 1304 |
+
"languages": ["lang1"]
|
| 1305 |
+
}}
|
| 1306 |
+
|
| 1307 |
+
IMPORTANT:
|
| 1308 |
+
- Extract ONLY skills that are ACTUALLY in the job posting above
|
| 1309 |
+
- If no skills found in a category, use empty array []
|
| 1310 |
+
- Do not include example values
|
| 1311 |
+
"""
|
| 1312 |
+
|
| 1313 |
+
response = call_llm(prompt, max_tokens=800)
|
| 1314 |
+
|
| 1315 |
+
try:
|
| 1316 |
+
json_str = response.strip()
|
| 1317 |
+
|
| 1318 |
+
# Remove markdown
|
| 1319 |
+
if '```json' in json_str:
|
| 1320 |
+
json_str = json_str.split('```json')[1].split('```')[0].strip()
|
| 1321 |
+
elif '```' in json_str:
|
| 1322 |
+
json_str = json_str.split('```')[1].split('```')[0].strip()
|
| 1323 |
+
|
| 1324 |
+
# Extract JSON
|
| 1325 |
+
if '{' in json_str and '}' in json_str:
|
| 1326 |
+
start = json_str.index('{')
|
| 1327 |
+
end = json_str.rindex('}') + 1
|
| 1328 |
+
json_str = json_str[start:end]
|
| 1329 |
+
|
| 1330 |
+
data = json.loads(json_str)
|
| 1331 |
+
|
| 1332 |
+
# Validate with Pydantic
|
| 1333 |
+
validated = SkillsTaxonomy(**data)
|
| 1334 |
+
return validated.model_dump()
|
| 1335 |
+
|
| 1336 |
+
except Exception as e:
|
| 1337 |
+
print(f"⚠️ Parse error: {e}")
|
| 1338 |
+
return {
|
| 1339 |
+
"technical_skills": [],
|
| 1340 |
+
"soft_skills": [],
|
| 1341 |
+
"certifications": [],
|
| 1342 |
+
"languages": []
|
| 1343 |
+
}
|
| 1344 |
+
|
| 1345 |
+
print("✅ Skills extraction (fixed prompt)")
|
| 1346 |
+
|
| 1347 |
+
# Test
|
| 1348 |
+
if LLM_AVAILABLE and len(postings) > 0:
|
| 1349 |
+
print("\n🔍 Testing skills extraction...")
|
| 1350 |
+
sample = postings.iloc[0]['description']
|
| 1351 |
+
|
| 1352 |
+
print(f"\n📄 Job posting sample:")
|
| 1353 |
+
print(f" {sample[:200]}...\n")
|
| 1354 |
+
|
| 1355 |
+
skills = extract_skills_taxonomy(sample)
|
| 1356 |
+
|
| 1357 |
+
print("📊 Extracted Skills:")
|
| 1358 |
+
print(json.dumps(skills, indent=2))
|
| 1359 |
+
|
| 1360 |
+
# Check if actually extracted something
|
| 1361 |
+
total_skills = sum(len(v) for v in skills.values())
|
| 1362 |
+
print(f"\n{'✅' if total_skills > 0 else '⚠️ '} Total skills found: {total_skills}")
|
| 1363 |
+
else:
|
| 1364 |
+
print("⚠️ LLM not available")
|
| 1365 |
+
|
| 1366 |
+
# %% [markdown]
|
| 1367 |
+
# ---
|
| 1368 |
+
# ## 📊 Step 14: Match Explainability
|
| 1369 |
+
|
| 1370 |
+
# %%
|
| 1371 |
+
def explain_match(candidate_idx: int, company_idx: int, similarity_score: float) -> Dict:
|
| 1372 |
+
"""
|
| 1373 |
+
Generate LLM explanation for why candidate matches company.
|
| 1374 |
+
"""
|
| 1375 |
+
|
| 1376 |
+
cand = candidates.iloc[candidate_idx]
|
| 1377 |
+
comp = companies_full.iloc[company_idx]
|
| 1378 |
+
|
| 1379 |
+
cand_skills = str(cand.get('skills', 'N/A'))[:300]
|
| 1380 |
+
cand_exp = str(cand.get('positions', 'N/A'))[:300]
|
| 1381 |
+
comp_req = str(comp.get('required_skills', 'N/A'))[:300]
|
| 1382 |
+
comp_name = comp.get('name', 'Unknown')
|
| 1383 |
+
|
| 1384 |
+
prompt = f"""Explain why this candidate matches this company.
|
| 1385 |
+
|
| 1386 |
+
Candidate:
|
| 1387 |
+
Skills: {cand_skills}
|
| 1388 |
+
Experience: {cand_exp}
|
| 1389 |
+
|
| 1390 |
+
Company: {comp_name}
|
| 1391 |
+
Requirements: {comp_req}
|
| 1392 |
+
|
| 1393 |
+
Similarity Score: {similarity_score:.2f}
|
| 1394 |
+
|
| 1395 |
+
Return JSON:
|
| 1396 |
+
{{
|
| 1397 |
+
"overall_score": {similarity_score},
|
| 1398 |
+
"match_strengths": ["Top 3-5 matching factors"],
|
| 1399 |
+
"skill_gaps": ["Missing skills"],
|
| 1400 |
+
"recommendation": "What candidate should do",
|
| 1401 |
+
"fit_summary": "One sentence summary"
|
| 1402 |
+
}}
|
| 1403 |
+
"""
|
| 1404 |
+
|
| 1405 |
+
response = call_llm(prompt, max_tokens=1000)
|
| 1406 |
+
|
| 1407 |
+
try:
|
| 1408 |
+
json_str = response.strip()
|
| 1409 |
+
if '```json' in json_str:
|
| 1410 |
+
json_str = json_str.split('```json')[1].split('```')[0].strip()
|
| 1411 |
+
|
| 1412 |
+
if '{' in json_str and '}' in json_str:
|
| 1413 |
+
start = json_str.index('{')
|
| 1414 |
+
end = json_str.rindex('}') + 1
|
| 1415 |
+
json_str = json_str[start:end]
|
| 1416 |
+
|
| 1417 |
+
data = json.loads(json_str)
|
| 1418 |
+
return data
|
| 1419 |
+
except:
|
| 1420 |
+
return {
|
| 1421 |
+
"overall_score": similarity_score,
|
| 1422 |
+
"match_strengths": ["Unable to generate"],
|
| 1423 |
+
"skill_gaps": [],
|
| 1424 |
+
"recommendation": "Review manually",
|
| 1425 |
+
"fit_summary": f"Match score: {similarity_score:.2f}"
|
| 1426 |
+
}
|
| 1427 |
+
|
| 1428 |
+
# Test explainability
|
| 1429 |
+
if LLM_AVAILABLE and cand_vectors is not None and len(candidates) > 0:
|
| 1430 |
+
print("💡 Testing match explainability...\n")
|
| 1431 |
+
matches = find_top_matches(0, top_k=1)
|
| 1432 |
+
if matches:
|
| 1433 |
+
comp_idx, score = matches[0]
|
| 1434 |
+
explanation = explain_match(0, comp_idx, score)
|
| 1435 |
+
|
| 1436 |
+
print("📊 Match Explanation:")
|
| 1437 |
+
print(json.dumps(explanation, indent=2))
|
| 1438 |
+
else:
|
| 1439 |
+
print("⚠️ Skipped - requirements not met")
|
| 1440 |
+
|
| 1441 |
+
# %%
|
| 1442 |
+
# Check if matches make semantic sense
|
| 1443 |
+
print("🔍 MATCH QUALITY CHECK")
|
| 1444 |
+
print("=" * 80)
|
| 1445 |
+
|
| 1446 |
+
cand_0 = candidates.iloc[0]
|
| 1447 |
+
print(f"\nCandidate 0:")
|
| 1448 |
+
print(f" Category: {cand_0.get('Category', 'N/A')}")
|
| 1449 |
+
print(f" Skills: {str(cand_0.get('skills', 'N/A'))[:150]}...")
|
| 1450 |
+
|
| 1451 |
+
matches = find_top_matches(0, top_k=3)
|
| 1452 |
+
print(f"\nTop 3 Company Matches:")
|
| 1453 |
+
for i, (comp_idx, score) in enumerate(matches, 1):
|
| 1454 |
+
comp = companies_full.iloc[comp_idx]
|
| 1455 |
+
print(f"\n{i}. {comp['name']} (score: {score:.3f})")
|
| 1456 |
+
print(f" Industries: {str(comp['industries_list'])[:100]}...")
|
| 1457 |
+
print(f" Required Skills: {str(comp['required_skills'])[:100]}...")
|
| 1458 |
+
|
| 1459 |
+
print("\n" + "=" * 80)
|
| 1460 |
+
print("❓ Do these matches make SEMANTIC SENSE?")
|
| 1461 |
+
|
| 1462 |
+
# %% [markdown]
|
| 1463 |
+
# ---
|
| 1464 |
+
# ## 📊 Step 16: Detailed Match Visualization
|
| 1465 |
+
|
| 1466 |
+
# %%
|
| 1467 |
+
# ============================================================================
|
| 1468 |
+
# 🔍 DETAILED MATCH EXAMPLE
|
| 1469 |
+
# ============================================================================
|
| 1470 |
+
|
| 1471 |
+
def show_detailed_match_example(candidate_idx=0, top_k=5):
|
| 1472 |
+
print("🔍 DETAILED MATCH ANALYSIS")
|
| 1473 |
+
print("=" * 100)
|
| 1474 |
+
|
| 1475 |
+
if candidate_idx >= len(candidates):
|
| 1476 |
+
print(f"❌ ERROR: Candidate {candidate_idx} out of range")
|
| 1477 |
+
return None
|
| 1478 |
+
|
| 1479 |
+
cand = candidates.iloc[candidate_idx]
|
| 1480 |
+
|
| 1481 |
+
print(f"\n🎯 CANDIDATE #{candidate_idx}")
|
| 1482 |
+
print(f"Resume ID: {cand.get('Resume_ID', 'N/A')}")
|
| 1483 |
+
print(f"Category: {cand.get('Category', 'N/A')}")
|
| 1484 |
+
print(f"Skills: {str(cand.get('skills', 'N/A'))[:150]}...\n")
|
| 1485 |
+
|
| 1486 |
+
matches = find_top_matches(candidate_idx, top_k=top_k)
|
| 1487 |
+
|
| 1488 |
+
print(f"🔗 TOP {len(matches)} MATCHES:\n")
|
| 1489 |
+
|
| 1490 |
+
for rank, (comp_idx, score) in enumerate(matches, 1):
|
| 1491 |
+
if comp_idx >= len(companies_full):
|
| 1492 |
+
continue
|
| 1493 |
+
|
| 1494 |
+
company = companies_full.iloc[comp_idx]
|
| 1495 |
+
print(f"#{rank}. {company.get('name', 'N/A')} (Score: {score:.4f})")
|
| 1496 |
+
print(f" Industries: {str(company.get('industries_list', 'N/A'))[:60]}...")
|
| 1497 |
+
|
| 1498 |
+
print("\n" + "=" * 100)
|
| 1499 |
+
return matches
|
| 1500 |
+
|
| 1501 |
+
# Test
|
| 1502 |
+
show_detailed_match_example(candidate_idx=9543, top_k=5)
|
| 1503 |
+
|
| 1504 |
+
# %% [markdown]
|
| 1505 |
+
# ---
|
| 1506 |
+
# ## 📊 Step 17: Bridging Concept Analysis
|
| 1507 |
+
|
| 1508 |
+
# %%
|
| 1509 |
+
# ============================================================================
|
| 1510 |
+
# 🌉 BRIDGING CONCEPT ANALYSIS
|
| 1511 |
+
# ============================================================================
|
| 1512 |
+
|
| 1513 |
+
def show_bridging_concept_analysis():
|
| 1514 |
+
print("🌉 THE BRIDGING CONCEPT")
|
| 1515 |
+
print("=" * 90)
|
| 1516 |
+
|
| 1517 |
+
companies_with = companies_full[companies_full['required_skills'] != '']
|
| 1518 |
+
companies_without = companies_full[companies_full['required_skills'] == '']
|
| 1519 |
+
|
| 1520 |
+
print(f"\n📊 DATA REALITY:")
|
| 1521 |
+
print(f" Total companies: {len(companies_full):,}")
|
| 1522 |
+
print(f" WITH postings: {len(companies_with):,} ({len(companies_with)/len(companies_full)*100:.1f}%)")
|
| 1523 |
+
print(f" WITHOUT postings: {len(companies_without):,}\n")
|
| 1524 |
+
|
| 1525 |
+
print("🎯 THE PROBLEM:")
|
| 1526 |
+
print(" Companies: 'We are in TECH INDUSTRY'")
|
| 1527 |
+
print(" Candidates: 'I know PYTHON, AWS'")
|
| 1528 |
+
print(" → Different languages! 🚫\n")
|
| 1529 |
+
|
| 1530 |
+
print("🌉 THE SOLUTION (BRIDGING):")
|
| 1531 |
+
print(" 1. Extract from postings: 'Need PYTHON developers'")
|
| 1532 |
+
print(" 2. Enrich company profile with skills")
|
| 1533 |
+
print(" 3. Now both speak SKILLS LANGUAGE! ✅\n")
|
| 1534 |
+
|
| 1535 |
+
print("=" * 90)
|
| 1536 |
+
return companies_with, companies_without
|
| 1537 |
+
|
| 1538 |
+
# Test
|
| 1539 |
+
show_bridging_concept_analysis()
|
| 1540 |
+
|
| 1541 |
+
# %%
|
| 1542 |
+
# Check what's in required_skills
|
| 1543 |
+
print("🔍 REQUIRED_SKILLS CHECK")
|
| 1544 |
+
print("=" * 80)
|
| 1545 |
+
|
| 1546 |
+
print(f"\nTotal companies: {len(companies_full):,}")
|
| 1547 |
+
print(f"\nValue counts:")
|
| 1548 |
+
print(companies_full['required_skills'].value_counts().head(10))
|
| 1549 |
+
|
| 1550 |
+
print(f"\nEmpty string: {(companies_full['required_skills'] == '').sum()}")
|
| 1551 |
+
print(f"'Not specified': {(companies_full['required_skills'] == 'Not specified').sum()}")
|
| 1552 |
+
print(f"NaN: {companies_full['required_skills'].isna().sum()}")
|
| 1553 |
+
|
| 1554 |
+
# Real check
|
| 1555 |
+
truly_empty = (companies_full['required_skills'] == '') | \
|
| 1556 |
+
(companies_full['required_skills'] == 'Not specified') | \
|
| 1557 |
+
(companies_full['required_skills'].isna())
|
| 1558 |
+
|
| 1559 |
+
print(f"\n🎯 TRULY EMPTY: {truly_empty.sum():,}")
|
| 1560 |
+
|
| 1561 |
+
# %% [markdown]
|
| 1562 |
+
# ---
|
| 1563 |
+
# ## 📊 Step 18: Export Results to CSV
|
| 1564 |
+
|
| 1565 |
+
# %%
|
| 1566 |
+
# ============================================================================
|
| 1567 |
+
# 💾 EXPORT MATCHES TO CSV
|
| 1568 |
+
# ============================================================================
|
| 1569 |
+
|
| 1570 |
+
def export_matches_to_csv(num_candidates=100, top_k=10):
|
| 1571 |
+
print(f"💾 Exporting {num_candidates} candidates (top {top_k} each)...\n")
|
| 1572 |
+
|
| 1573 |
+
results = []
|
| 1574 |
+
|
| 1575 |
+
for i in range(min(num_candidates, len(candidates))):
|
| 1576 |
+
if i % 50 == 0:
|
| 1577 |
+
print(f" Processing {i+1}/{num_candidates}...")
|
| 1578 |
+
|
| 1579 |
+
matches = find_top_matches(i, top_k=top_k)
|
| 1580 |
+
cand = candidates.iloc[i]
|
| 1581 |
+
|
| 1582 |
+
for rank, (comp_idx, score) in enumerate(matches, 1):
|
| 1583 |
+
if comp_idx >= len(companies_full):
|
| 1584 |
+
continue
|
| 1585 |
+
|
| 1586 |
+
company = companies_full.iloc[comp_idx]
|
| 1587 |
+
|
| 1588 |
+
results.append({
|
| 1589 |
+
'candidate_id': i,
|
| 1590 |
+
'candidate_category': cand.get('Category', 'N/A'),
|
| 1591 |
+
'company_id': company.get('company_id', 'N/A'),
|
| 1592 |
+
'company_name': company.get('name', 'N/A'),
|
| 1593 |
+
'match_rank': rank,
|
| 1594 |
+
'similarity_score': round(float(score), 4)
|
| 1595 |
+
})
|
| 1596 |
+
|
| 1597 |
+
results_df = pd.DataFrame(results)
|
| 1598 |
+
output_file = f'{Config.RESULTS_PATH}hrhub_matches.csv'
|
| 1599 |
+
results_df.to_csv(output_file, index=False)
|
| 1600 |
+
|
| 1601 |
+
print(f"\n✅ Exported {len(results_df):,} matches")
|
| 1602 |
+
print(f"📄 File: {output_file}\n")
|
| 1603 |
+
|
| 1604 |
+
return results_df
|
| 1605 |
+
|
| 1606 |
+
# Export sample
|
| 1607 |
+
matches_df = export_matches_to_csv(num_candidates=50, top_k=5)
|
| 1608 |
+
|
| 1609 |
+
# %% [markdown]
|
| 1610 |
+
# ---
|
| 1611 |
+
# ## 📊 Interactive Visualization 1: t-SNE Vector Space
|
| 1612 |
+
#
|
| 1613 |
+
# Project embeddings from ℝ³⁸⁴ → ℝ² to visualize candidates and companies
|
| 1614 |
+
|
| 1615 |
+
# %%
|
| 1616 |
+
# ============================================================================
|
| 1617 |
+
# 🎨 T-SNE VECTOR SPACE VISUALIZATION
|
| 1618 |
+
# ============================================================================
|
| 1619 |
+
|
| 1620 |
+
from sklearn.manifold import TSNE
|
| 1621 |
+
|
| 1622 |
+
print("🎨 VECTOR SPACE VISUALIZATION\n")
|
| 1623 |
+
print("=" * 70)
|
| 1624 |
+
|
| 1625 |
+
# Sample for visualization
|
| 1626 |
+
n_cand_viz = min(500, len(candidates))
|
| 1627 |
+
n_comp_viz = min(2000, len(companies_full))
|
| 1628 |
+
|
| 1629 |
+
print(f"📊 Visualizing:")
|
| 1630 |
+
print(f" • {n_cand_viz} candidates")
|
| 1631 |
+
print(f" • {n_comp_viz} companies")
|
| 1632 |
+
print(f" • From ℝ^384 → ℝ² (t-SNE)\n")
|
| 1633 |
+
|
| 1634 |
+
# Sample vectors
|
| 1635 |
+
cand_sample = cand_vectors[:n_cand_viz]
|
| 1636 |
+
comp_sample = comp_vectors[:n_comp_viz]
|
| 1637 |
+
all_vectors = np.vstack([cand_sample, comp_sample])
|
| 1638 |
+
|
| 1639 |
+
print("🔄 Running t-SNE (2-3 minutes)...")
|
| 1640 |
+
tsne = TSNE(
|
| 1641 |
+
n_components=2,
|
| 1642 |
+
perplexity=30,
|
| 1643 |
+
random_state=42,
|
| 1644 |
+
n_iter=1000
|
| 1645 |
+
)
|
| 1646 |
+
|
| 1647 |
+
vectors_2d = tsne.fit_transform(all_vectors)
|
| 1648 |
+
cand_2d = vectors_2d[:n_cand_viz]
|
| 1649 |
+
comp_2d = vectors_2d[n_cand_viz:]
|
| 1650 |
+
|
| 1651 |
+
print("\n✅ t-SNE complete!")
|
| 1652 |
+
|
| 1653 |
+
# %%
|
| 1654 |
+
# Create interactive plot
|
| 1655 |
+
fig = go.Figure()
|
| 1656 |
+
|
| 1657 |
+
# Companies (red)
|
| 1658 |
+
fig.add_trace(go.Scatter(
|
| 1659 |
+
x=comp_2d[:, 0],
|
| 1660 |
+
y=comp_2d[:, 1],
|
| 1661 |
+
mode='markers',
|
| 1662 |
+
name='Companies',
|
| 1663 |
+
marker=dict(size=6, color='#ff6b6b', opacity=0.6),
|
| 1664 |
+
text=[f"Company: {companies_full.iloc[i].get('name', 'N/A')[:30]}"
|
| 1665 |
+
for i in range(n_comp_viz)],
|
| 1666 |
+
hovertemplate='<b>%{text}</b><extra></extra>'
|
| 1667 |
+
))
|
| 1668 |
+
|
| 1669 |
+
# Candidates (green)
|
| 1670 |
+
fig.add_trace(go.Scatter(
|
| 1671 |
+
x=cand_2d[:, 0],
|
| 1672 |
+
y=cand_2d[:, 1],
|
| 1673 |
+
mode='markers',
|
| 1674 |
+
name='Candidates',
|
| 1675 |
+
marker=dict(
|
| 1676 |
+
size=10,
|
| 1677 |
+
color='#00ff00',
|
| 1678 |
+
opacity=0.8,
|
| 1679 |
+
line=dict(width=1, color='white')
|
| 1680 |
+
),
|
| 1681 |
+
text=[f"Candidate {i}" for i in range(n_cand_viz)],
|
| 1682 |
+
hovertemplate='<b>%{text}</b><extra></extra>'
|
| 1683 |
+
))
|
| 1684 |
+
|
| 1685 |
+
fig.update_layout(
|
| 1686 |
+
title='Vector Space: Candidates & Companies (Enriched with Postings)',
|
| 1687 |
+
xaxis_title='Dimension 1',
|
| 1688 |
+
yaxis_title='Dimension 2',
|
| 1689 |
+
width=1200,
|
| 1690 |
+
height=800,
|
| 1691 |
+
plot_bgcolor='#1a1a1a',
|
| 1692 |
+
paper_bgcolor='#0d0d0d',
|
| 1693 |
+
font=dict(color='white')
|
| 1694 |
+
)
|
| 1695 |
+
|
| 1696 |
+
fig.show()
|
| 1697 |
+
|
| 1698 |
+
print("\n✅ Visualization complete!")
|
| 1699 |
+
print("💡 If green & red OVERLAP → Alignment worked!")
|
| 1700 |
+
|
| 1701 |
+
# %% [markdown]
|
| 1702 |
+
# ---
|
| 1703 |
+
# ## 📊 Interactive Visualization 2: Highlighted Match Network
|
| 1704 |
+
#
|
| 1705 |
+
# Show candidate and their top matches with connection lines
|
| 1706 |
+
|
| 1707 |
+
# %%
|
| 1708 |
+
# ============================================================================
|
| 1709 |
+
# 🔍 HIGHLIGHTED MATCH NETWORK
|
| 1710 |
+
# ============================================================================
|
| 1711 |
+
|
| 1712 |
+
target_candidate = 0
|
| 1713 |
+
|
| 1714 |
+
print(f"🔍 Analyzing Candidate #{target_candidate}...\n")
|
| 1715 |
+
|
| 1716 |
+
matches = find_top_matches(target_candidate, top_k=10)
|
| 1717 |
+
match_indices = [comp_idx for comp_idx, score in matches if comp_idx < n_comp_viz]
|
| 1718 |
+
|
| 1719 |
+
# Create highlighted plot
|
| 1720 |
+
fig2 = go.Figure()
|
| 1721 |
+
|
| 1722 |
+
# All companies (background)
|
| 1723 |
+
fig2.add_trace(go.Scatter(
|
| 1724 |
+
x=comp_2d[:, 0],
|
| 1725 |
+
y=comp_2d[:, 1],
|
| 1726 |
+
mode='markers',
|
| 1727 |
+
name='All Companies',
|
| 1728 |
+
marker=dict(size=4, color='#ff6b6b', opacity=0.3),
|
| 1729 |
+
showlegend=True
|
| 1730 |
+
))
|
| 1731 |
+
|
| 1732 |
+
# Top matches (highlighted)
|
| 1733 |
+
if match_indices:
|
| 1734 |
+
match_positions = comp_2d[match_indices]
|
| 1735 |
+
fig2.add_trace(go.Scatter(
|
| 1736 |
+
x=match_positions[:, 0],
|
| 1737 |
+
y=match_positions[:, 1],
|
| 1738 |
+
mode='markers',
|
| 1739 |
+
name='Top Matches',
|
| 1740 |
+
marker=dict(
|
| 1741 |
+
size=15,
|
| 1742 |
+
color='#ff0000',
|
| 1743 |
+
line=dict(width=2, color='white')
|
| 1744 |
+
),
|
| 1745 |
+
text=[f"Match #{i+1}: {companies_full.iloc[match_indices[i]].get('name', 'N/A')[:30]}<br>Score: {matches[i][1]:.3f}"
|
| 1746 |
+
for i in range(len(match_indices))],
|
| 1747 |
+
hovertemplate='<b>%{text}</b><extra></extra>'
|
| 1748 |
+
))
|
| 1749 |
+
|
| 1750 |
+
# Target candidate (star)
|
| 1751 |
+
fig2.add_trace(go.Scatter(
|
| 1752 |
+
x=[cand_2d[target_candidate, 0]],
|
| 1753 |
+
y=[cand_2d[target_candidate, 1]],
|
| 1754 |
+
mode='markers',
|
| 1755 |
+
name=f'Candidate #{target_candidate}',
|
| 1756 |
+
marker=dict(
|
| 1757 |
+
size=25,
|
| 1758 |
+
color='#00ff00',
|
| 1759 |
+
symbol='star',
|
| 1760 |
+
line=dict(width=3, color='white')
|
| 1761 |
+
)
|
| 1762 |
+
))
|
| 1763 |
+
|
| 1764 |
+
# Connection lines (top 5)
|
| 1765 |
+
for i, match_idx in enumerate(match_indices[:5]):
|
| 1766 |
+
fig2.add_trace(go.Scatter(
|
| 1767 |
+
x=[cand_2d[target_candidate, 0], comp_2d[match_idx, 0]],
|
| 1768 |
+
y=[cand_2d[target_candidate, 1], comp_2d[match_idx, 1]],
|
| 1769 |
+
mode='lines',
|
| 1770 |
+
line=dict(color='yellow', width=1, dash='dot'),
|
| 1771 |
+
opacity=0.5,
|
| 1772 |
+
showlegend=False
|
| 1773 |
+
))
|
| 1774 |
+
|
| 1775 |
+
fig2.update_layout(
|
| 1776 |
+
title=f'Candidate #{target_candidate} and Top Matches',
|
| 1777 |
+
xaxis_title='Dimension 1',
|
| 1778 |
+
yaxis_title='Dimension 2',
|
| 1779 |
+
width=1200,
|
| 1780 |
+
height=800,
|
| 1781 |
+
plot_bgcolor='#1a1a1a',
|
| 1782 |
+
paper_bgcolor='#0d0d0d',
|
| 1783 |
+
font=dict(color='white')
|
| 1784 |
+
)
|
| 1785 |
+
|
| 1786 |
+
fig2.show()
|
| 1787 |
+
|
| 1788 |
+
print("\n✅ Highlighted visualization created!")
|
| 1789 |
+
print(f" ⭐ Green star = Candidate #{target_candidate}")
|
| 1790 |
+
print(f" 🔴 Red dots = Top matches")
|
| 1791 |
+
print(f" 💛 Yellow lines = Connections")
|
| 1792 |
+
|
| 1793 |
+
# %% [markdown]
|
| 1794 |
+
# ---
|
| 1795 |
+
# ## 🌐 Interactive Visualization 3: Network Graph (PyVis)
|
| 1796 |
+
#
|
| 1797 |
+
# Interactive network showing candidate-company connections with nodes & edges
|
| 1798 |
+
|
| 1799 |
+
# %%
|
| 1800 |
+
# ============================================================================
|
| 1801 |
+
# 🌐 NETWORK GRAPH WITH PYVIS
|
| 1802 |
+
# ============================================================================
|
| 1803 |
+
|
| 1804 |
+
from pyvis.network import Network
|
| 1805 |
+
import webbrowser
|
| 1806 |
+
import os
|
| 1807 |
+
|
| 1808 |
+
print("🌐 Creating interactive network graph...\n")
|
| 1809 |
+
|
| 1810 |
+
target_candidate = 0
|
| 1811 |
+
top_k_network = 10
|
| 1812 |
+
|
| 1813 |
+
# Get matches
|
| 1814 |
+
matches = find_top_matches(target_candidate, top_k=top_k_network)
|
| 1815 |
+
|
| 1816 |
+
# Create network
|
| 1817 |
+
net = Network(
|
| 1818 |
+
height='800px',
|
| 1819 |
+
width='100%',
|
| 1820 |
+
bgcolor='#1a1a1a',
|
| 1821 |
+
font_color='white',
|
| 1822 |
+
directed=False
|
| 1823 |
+
)
|
| 1824 |
+
|
| 1825 |
+
# Configure physics
|
| 1826 |
+
net.barnes_hut(
|
| 1827 |
+
gravity=-5000,
|
| 1828 |
+
central_gravity=0.3,
|
| 1829 |
+
spring_length=100,
|
| 1830 |
+
spring_strength=0.01
|
| 1831 |
+
)
|
| 1832 |
+
|
| 1833 |
+
# Add candidate node (center)
|
| 1834 |
+
cand = candidates.iloc[target_candidate]
|
| 1835 |
+
cand_label = f"Candidate #{target_candidate}"
|
| 1836 |
+
net.add_node(
|
| 1837 |
+
f'cand_{target_candidate}',
|
| 1838 |
+
label=cand_label,
|
| 1839 |
+
title=f"{cand.get('Category', 'N/A')}<br>Skills: {str(cand.get('skills', 'N/A'))[:100]}",
|
| 1840 |
+
color='#00ff00',
|
| 1841 |
+
size=40,
|
| 1842 |
+
shape='star'
|
| 1843 |
+
)
|
| 1844 |
+
|
| 1845 |
+
# Add company nodes + edges
|
| 1846 |
+
for rank, (comp_idx, score) in enumerate(matches, 1):
|
| 1847 |
+
if comp_idx >= len(companies_full):
|
| 1848 |
+
continue
|
| 1849 |
+
|
| 1850 |
+
company = companies_full.iloc[comp_idx]
|
| 1851 |
+
comp_name = company.get('name', f'Company {comp_idx}')[:30]
|
| 1852 |
+
|
| 1853 |
+
# Color by score
|
| 1854 |
+
if score > 0.7:
|
| 1855 |
+
color = '#ff0000' # Red (strong match)
|
| 1856 |
+
elif score > 0.5:
|
| 1857 |
+
color = '#ff6b6b' # Light red (good match)
|
| 1858 |
+
else:
|
| 1859 |
+
color = '#ffaaaa' # Pink (weak match)
|
| 1860 |
+
|
| 1861 |
+
# Add company node
|
| 1862 |
+
net.add_node(
|
| 1863 |
+
f'comp_{comp_idx}',
|
| 1864 |
+
label=f"#{rank}. {comp_name}",
|
| 1865 |
+
title=f"Score: {score:.3f}<br>Industries: {str(company.get('industries_list', 'N/A'))[:50]}<br>Required: {str(company.get('required_skills', 'N/A'))[:100]}",
|
| 1866 |
+
color=color,
|
| 1867 |
+
size=20 + (score * 20) # Size by score
|
| 1868 |
+
)
|
| 1869 |
+
|
| 1870 |
+
# Add edge
|
| 1871 |
+
net.add_edge(
|
| 1872 |
+
f'cand_{target_candidate}',
|
| 1873 |
+
f'comp_{comp_idx}',
|
| 1874 |
+
value=float(score),
|
| 1875 |
+
title=f"Similarity: {score:.3f}",
|
| 1876 |
+
color='yellow'
|
| 1877 |
+
)
|
| 1878 |
+
|
| 1879 |
+
# Save
|
| 1880 |
+
output_file = f'{Config.RESULTS_PATH}network_graph.html'
|
| 1881 |
+
net.save_graph(output_file)
|
| 1882 |
+
|
| 1883 |
+
print(f"✅ Network graph created!")
|
| 1884 |
+
print(f"📄 Saved: {output_file}")
|
| 1885 |
+
print(f"\n💡 LEGEND:")
|
| 1886 |
+
print(f" ⭐ Green star = Candidate #{target_candidate}")
|
| 1887 |
+
print(f" 🔴 Red nodes = Companies (size = match score)")
|
| 1888 |
+
print(f" 💛 Yellow edges = Connections")
|
| 1889 |
+
print(f"\nℹ️ Hover over nodes to see details")
|
| 1890 |
+
print(f" Drag nodes to rearrange")
|
| 1891 |
+
print(f" Zoom with mouse wheel\n")
|
| 1892 |
+
|
| 1893 |
+
# Display in notebook
|
| 1894 |
+
from IPython.display import IFrame
|
| 1895 |
+
IFrame(output_file, width=1000, height=800)
|
| 1896 |
+
|
| 1897 |
+
# %% [markdown]
|
| 1898 |
+
# ### 📊 Network Node Data
|
| 1899 |
+
#
|
| 1900 |
+
# Detailed information about nodes and connections
|
| 1901 |
+
|
| 1902 |
+
# %%
|
| 1903 |
+
# ============================================================================
|
| 1904 |
+
# DISPLAY NODE DATA
|
| 1905 |
+
# ============================================================================
|
| 1906 |
+
|
| 1907 |
+
print("📊 NETWORK DATA SUMMARY")
|
| 1908 |
+
print("=" * 80)
|
| 1909 |
+
print(f"\nTotal nodes: {1 + len(matches)}")
|
| 1910 |
+
print(f" - 1 candidate node (green star)")
|
| 1911 |
+
print(f" - {len(matches)} company nodes (red circles)")
|
| 1912 |
+
print(f"\nTotal edges: {len(matches)}")
|
| 1913 |
+
print(f"\n" + "=" * 80)
|
| 1914 |
+
|
| 1915 |
+
# Show node details
|
| 1916 |
+
print(f"\n🎯 CANDIDATE NODE:")
|
| 1917 |
+
print(f" ID: cand_{target_candidate}")
|
| 1918 |
+
print(f" Category: {cand.get('Category', 'N/A')}")
|
| 1919 |
+
print(f" Skills: {str(cand.get('skills', 'N/A'))[:100]}...")
|
| 1920 |
+
|
| 1921 |
+
print(f"\n🏢 COMPANY NODES (Top 5):")
|
| 1922 |
+
for rank, (comp_idx, score) in enumerate(matches[:5], 1):
|
| 1923 |
+
if comp_idx < len(companies_full):
|
| 1924 |
+
company = companies_full.iloc[comp_idx]
|
| 1925 |
+
print(f"\n #{rank}. {company.get('name', 'N/A')[:40]}")
|
| 1926 |
+
print(f" ID: comp_{comp_idx}")
|
| 1927 |
+
print(f" Score: {score:.4f}")
|
| 1928 |
+
print(f" Industries: {str(company.get('industries_list', 'N/A'))[:60]}...")
|
| 1929 |
+
|
| 1930 |
+
print(f"\n" + "=" * 80)
|
| 1931 |
+
|
| 1932 |
+
# %% [markdown]
|
| 1933 |
+
# ---
|
| 1934 |
+
# ## 🔍 Visualization 4: Display Node Data
|
| 1935 |
+
#
|
| 1936 |
+
# Inspect detailed information about candidates and companies
|
| 1937 |
+
|
| 1938 |
+
# %%
|
| 1939 |
+
# ============================================================================
|
| 1940 |
+
# DISPLAY NODE DATA - See what's behind the graph
|
| 1941 |
+
# ============================================================================
|
| 1942 |
+
|
| 1943 |
+
def display_node_data(node_id):
|
| 1944 |
+
print("=" * 80)
|
| 1945 |
+
|
| 1946 |
+
if node_id.startswith('C'):
|
| 1947 |
+
# CANDIDATE
|
| 1948 |
+
cand_idx = int(node_id[1:])
|
| 1949 |
+
|
| 1950 |
+
if cand_idx >= len(candidates):
|
| 1951 |
+
print(f"❌ Candidate {cand_idx} not found!")
|
| 1952 |
+
return
|
| 1953 |
+
|
| 1954 |
+
candidate = candidates.iloc[cand_idx]
|
| 1955 |
+
|
| 1956 |
+
print(f"🟢 CANDIDATE #{cand_idx}")
|
| 1957 |
+
print("=" * 80)
|
| 1958 |
+
print(f"\n📊 KEY INFORMATION:\n")
|
| 1959 |
+
print(f"Resume ID: {candidate.get('Resume_ID', 'N/A')}")
|
| 1960 |
+
print(f"Category: {candidate.get('Category', 'N/A')}")
|
| 1961 |
+
print(f"Skills: {str(candidate.get('skills', 'N/A'))[:200]}")
|
| 1962 |
+
print(f"Career Objective: {str(candidate.get('career_objective', 'N/A'))[:200]}")
|
| 1963 |
+
|
| 1964 |
+
elif node_id.startswith('J'):
|
| 1965 |
+
# COMPANY
|
| 1966 |
+
comp_idx = int(node_id[1:])
|
| 1967 |
+
|
| 1968 |
+
if comp_idx >= len(companies_full):
|
| 1969 |
+
print(f"❌ Company {comp_idx} not found!")
|
| 1970 |
+
return
|
| 1971 |
+
|
| 1972 |
+
company = companies_full.iloc[comp_idx]
|
| 1973 |
+
|
| 1974 |
+
print(f"🔴 COMPANY #{comp_idx}")
|
| 1975 |
+
print("=" * 80)
|
| 1976 |
+
print(f"\n📊 COMPANY INFORMATION:\n")
|
| 1977 |
+
print(f"Name: {company.get('name', 'N/A')}")
|
| 1978 |
+
print(f"Industries: {str(company.get('industries_list', 'N/A'))[:200]}")
|
| 1979 |
+
print(f"Required Skills: {str(company.get('required_skills', 'N/A'))[:200]}")
|
| 1980 |
+
print(f"Posted Jobs: {str(company.get('posted_job_titles', 'N/A'))[:200]}")
|
| 1981 |
+
|
| 1982 |
+
print("\n" + "=" * 80 + "\n")
|
| 1983 |
+
|
| 1984 |
+
def display_node_with_connections(node_id, top_k=10):
|
| 1985 |
+
display_node_data(node_id)
|
| 1986 |
+
|
| 1987 |
+
if node_id.startswith('C'):
|
| 1988 |
+
cand_idx = int(node_id[1:])
|
| 1989 |
+
|
| 1990 |
+
print(f"🎯 TOP {top_k} MATCHES:")
|
| 1991 |
+
print("=" * 80)
|
| 1992 |
+
|
| 1993 |
+
matches = find_top_matches(cand_idx, top_k=top_k)
|
| 1994 |
+
|
| 1995 |
+
# FIXED: Validate indices before accessing
|
| 1996 |
+
valid_matches = 0
|
| 1997 |
+
for rank, (comp_idx, score) in enumerate(matches, 1):
|
| 1998 |
+
# Check if index is valid
|
| 1999 |
+
if comp_idx >= len(companies_full):
|
| 2000 |
+
print(f"⚠️ Match #{rank}: Index {comp_idx} out of range (skipping)")
|
| 2001 |
+
continue
|
| 2002 |
+
|
| 2003 |
+
company = companies_full.iloc[comp_idx]
|
| 2004 |
+
print(f"#{rank}. {company.get('name', 'N/A')[:40]} (Score: {score:.4f})")
|
| 2005 |
+
valid_matches += 1
|
| 2006 |
+
|
| 2007 |
+
if valid_matches == 0:
|
| 2008 |
+
print("⚠️ No valid matches found (all indices out of bounds)")
|
| 2009 |
+
print("\n💡 SOLUTION: Regenerate embeddings after deduplication!")
|
| 2010 |
+
|
| 2011 |
+
print("\n" + "=" * 80)
|
| 2012 |
+
|
| 2013 |
+
# Example usage
|
| 2014 |
+
display_node_with_connections('C0', top_k=5)
|
| 2015 |
+
|
| 2016 |
+
# %% [markdown]
|
| 2017 |
+
# ---
|
| 2018 |
+
# ## 🕸️ Visualization 5: NetworkX Graph
|
| 2019 |
+
#
|
| 2020 |
+
# Network graph using NetworkX + Plotly with force-directed layout
|
| 2021 |
+
|
| 2022 |
+
# %%
|
| 2023 |
+
# ============================================================================
|
| 2024 |
+
# NETWORK GRAPH WITH NETWORKX + PLOTLY
|
| 2025 |
+
# ============================================================================
|
| 2026 |
+
|
| 2027 |
+
import networkx as nx
|
| 2028 |
+
|
| 2029 |
+
print("🕸️ Creating NETWORK GRAPH...\n")
|
| 2030 |
+
|
| 2031 |
+
# Create graph
|
| 2032 |
+
G = nx.Graph()
|
| 2033 |
+
|
| 2034 |
+
# Sample
|
| 2035 |
+
n_cand_sample = min(20, len(candidates))
|
| 2036 |
+
top_k_per_cand = 5
|
| 2037 |
+
|
| 2038 |
+
print(f"📊 Network size:")
|
| 2039 |
+
print(f" • {n_cand_sample} candidates")
|
| 2040 |
+
print(f" • {top_k_per_cand} companies per candidate\n")
|
| 2041 |
+
|
| 2042 |
+
# Add nodes + edges
|
| 2043 |
+
companies_in_graph = set()
|
| 2044 |
+
|
| 2045 |
+
for i in range(n_cand_sample):
|
| 2046 |
+
G.add_node(f"C{i}", node_type='candidate', label=f"C{i}")
|
| 2047 |
+
|
| 2048 |
+
matches = find_top_matches(i, top_k=top_k_per_cand)
|
| 2049 |
+
|
| 2050 |
+
for comp_idx, score in matches:
|
| 2051 |
+
comp_id = f"J{comp_idx}"
|
| 2052 |
+
|
| 2053 |
+
if comp_id not in companies_in_graph:
|
| 2054 |
+
company_name = companies_full.iloc[comp_idx].get('name', 'N/A')[:20]
|
| 2055 |
+
G.add_node(comp_id, node_type='company', label=company_name)
|
| 2056 |
+
companies_in_graph.add(comp_id)
|
| 2057 |
+
|
| 2058 |
+
G.add_edge(f"C{i}", comp_id, weight=float(score))
|
| 2059 |
+
|
| 2060 |
+
print(f"✅ Network created!")
|
| 2061 |
+
print(f" Nodes: {G.number_of_nodes()}")
|
| 2062 |
+
print(f" Edges: {G.number_of_edges()}\n")
|
| 2063 |
+
|
| 2064 |
+
# Calculate layout
|
| 2065 |
+
print("🔄 Calculating layout...")
|
| 2066 |
+
pos = nx.spring_layout(G, k=2, iterations=50, seed=42)
|
| 2067 |
+
print("✅ Layout done!\n")
|
| 2068 |
+
|
| 2069 |
+
# Create edge traces
|
| 2070 |
+
edge_trace = []
|
| 2071 |
+
for edge in G.edges(data=True):
|
| 2072 |
+
x0, y0 = pos[edge[0]]
|
| 2073 |
+
x1, y1 = pos[edge[1]]
|
| 2074 |
+
weight = edge[2]['weight']
|
| 2075 |
+
|
| 2076 |
+
edge_trace.append(go.Scatter(
|
| 2077 |
+
x=[x0, x1, None],
|
| 2078 |
+
y=[y0, y1, None],
|
| 2079 |
+
mode='lines',
|
| 2080 |
+
line=dict(width=weight*3, color='rgba(255,255,255,0.3)'),
|
| 2081 |
+
hoverinfo='none',
|
| 2082 |
+
showlegend=False
|
| 2083 |
+
))
|
| 2084 |
+
|
| 2085 |
+
# Candidate nodes
|
| 2086 |
+
cand_nodes = [n for n, d in G.nodes(data=True) if d['node_type']=='candidate']
|
| 2087 |
+
cand_x = [pos[n][0] for n in cand_nodes]
|
| 2088 |
+
cand_y = [pos[n][1] for n in cand_nodes]
|
| 2089 |
+
cand_labels = [G.nodes[n]['label'] for n in cand_nodes]
|
| 2090 |
+
|
| 2091 |
+
candidate_trace = go.Scatter(
|
| 2092 |
+
x=cand_x, y=cand_y,
|
| 2093 |
+
mode='markers+text',
|
| 2094 |
+
name='Candidates',
|
| 2095 |
+
marker=dict(size=25, color='#00ff00', line=dict(width=2, color='white')),
|
| 2096 |
+
text=cand_labels,
|
| 2097 |
+
textposition='top center',
|
| 2098 |
+
hovertemplate='<b>%{text}</b><extra></extra>'
|
| 2099 |
+
)
|
| 2100 |
+
|
| 2101 |
+
# Company nodes
|
| 2102 |
+
comp_nodes = [n for n, d in G.nodes(data=True) if d['node_type']=='company']
|
| 2103 |
+
comp_x = [pos[n][0] for n in comp_nodes]
|
| 2104 |
+
comp_y = [pos[n][1] for n in comp_nodes]
|
| 2105 |
+
comp_labels = [G.nodes[n]['label'] for n in comp_nodes]
|
| 2106 |
+
|
| 2107 |
+
company_trace = go.Scatter(
|
| 2108 |
+
x=comp_x, y=comp_y,
|
| 2109 |
+
mode='markers+text',
|
| 2110 |
+
name='Companies',
|
| 2111 |
+
marker=dict(size=15, color='#ff6b6b', symbol='square'),
|
| 2112 |
+
text=comp_labels,
|
| 2113 |
+
textposition='top center',
|
| 2114 |
+
hovertemplate='<b>%{text}</b><extra></extra>'
|
| 2115 |
+
)
|
| 2116 |
+
|
| 2117 |
+
# Create figure
|
| 2118 |
+
fig = go.Figure(data=edge_trace + [candidate_trace, company_trace])
|
| 2119 |
+
|
| 2120 |
+
fig.update_layout(
|
| 2121 |
+
title='Network Graph: Candidates ↔ Companies',
|
| 2122 |
+
showlegend=True,
|
| 2123 |
+
width=1400, height=900,
|
| 2124 |
+
plot_bgcolor='#1a1a1a',
|
| 2125 |
+
paper_bgcolor='#0d0d0d',
|
| 2126 |
+
font=dict(color='white'),
|
| 2127 |
+
xaxis=dict(showgrid=False, zeroline=False, showticklabels=False),
|
| 2128 |
+
yaxis=dict(showgrid=False, zeroline=False, showticklabels=False)
|
| 2129 |
+
)
|
| 2130 |
+
|
| 2131 |
+
fig.show()
|
| 2132 |
+
|
| 2133 |
+
print("✅ NetworkX graph created!")
|
| 2134 |
+
print(" 🟢 Green = Candidates")
|
| 2135 |
+
print(" 🔴 Red = Companies")
|
| 2136 |
+
print(" Lines = Connections (thicker = stronger)\n")
|
| 2137 |
+
|
| 2138 |
+
# %% [markdown]
|
| 2139 |
+
# ---
|
| 2140 |
+
# ## 🐛 DEBUG: Why aren't candidates & companies overlapping?
|
| 2141 |
+
#
|
| 2142 |
+
# Investigating the embedding space alignment
|
| 2143 |
+
|
| 2144 |
+
# %%
|
| 2145 |
+
# ============================================================================
|
| 2146 |
+
# DEBUG: CHECK EMBEDDING ALIGNMENT
|
| 2147 |
+
# ============================================================================
|
| 2148 |
+
|
| 2149 |
+
print("🐛 DEBUGGING EMBEDDING SPACE")
|
| 2150 |
+
print("=" * 80)
|
| 2151 |
+
|
| 2152 |
+
# 1. Check if vectors loaded correctly
|
| 2153 |
+
print(f"\n1️⃣ VECTOR SHAPES:")
|
| 2154 |
+
print(f" Candidates: {cand_vectors.shape}")
|
| 2155 |
+
print(f" Companies: {comp_vectors.shape}")
|
| 2156 |
+
|
| 2157 |
+
# 2. Check vector norms
|
| 2158 |
+
print(f"\n2️⃣ VECTOR NORMS (should be ~1.0 if normalized):")
|
| 2159 |
+
cand_norms = np.linalg.norm(cand_vectors, axis=1)
|
| 2160 |
+
comp_norms = np.linalg.norm(comp_vectors, axis=1)
|
| 2161 |
+
print(f" Candidates: mean={cand_norms.mean():.4f}, min={cand_norms.min():.4f}, max={cand_norms.max():.4f}")
|
| 2162 |
+
print(f" Companies: mean={comp_norms.mean():.4f}, min={comp_norms.min():.4f}, max={comp_norms.max():.4f}")
|
| 2163 |
+
|
| 2164 |
+
# 3. Sample similarity
|
| 2165 |
+
print(f"\n3️⃣ SAMPLE SIMILARITIES:")
|
| 2166 |
+
sample_cand = 0
|
| 2167 |
+
matches = find_top_matches(sample_cand, top_k=5)
|
| 2168 |
+
print(f" Candidate #{sample_cand} top 5 matches:")
|
| 2169 |
+
for rank, (comp_idx, score) in enumerate(matches, 1):
|
| 2170 |
+
print(f" #{rank}. Company {comp_idx}: {score:.4f}")
|
| 2171 |
+
|
| 2172 |
+
# 4. Check text representations
|
| 2173 |
+
print(f"\n4️⃣ TEXT REPRESENTATION SAMPLES:")
|
| 2174 |
+
print(f"\n 📋 CANDIDATE #{sample_cand}:")
|
| 2175 |
+
cand = candidates.iloc[sample_cand]
|
| 2176 |
+
print(f" Skills: {str(cand.get('skills', 'N/A'))[:100]}")
|
| 2177 |
+
print(f" Category: {cand.get('Category', 'N/A')}")
|
| 2178 |
+
|
| 2179 |
+
top_company_idx = matches[0][0]
|
| 2180 |
+
print(f"\n 🏢 TOP MATCH COMPANY #{top_company_idx}:")
|
| 2181 |
+
company = companies_full.iloc[top_company_idx]
|
| 2182 |
+
print(f" Name: {company.get('name', 'N/A')}")
|
| 2183 |
+
print(f" Required Skills: {str(company.get('required_skills', 'N/A'))[:100]}")
|
| 2184 |
+
print(f" Industries: {str(company.get('industries_list', 'N/A'))[:100]}")
|
| 2185 |
+
|
| 2186 |
+
# 5. Check if postings enrichment worked
|
| 2187 |
+
print(f"\n5️⃣ POSTINGS ENRICHMENT CHECK:")
|
| 2188 |
+
companies_with_postings = companies_full[companies_full['required_skills'] != ''].shape[0]
|
| 2189 |
+
companies_without = companies_full[companies_full['required_skills'] == ''].shape[0]
|
| 2190 |
+
print(f" WITH postings: {companies_with_postings:,} ({companies_with_postings/len(companies_full)*100:.1f}%)")
|
| 2191 |
+
print(f" WITHOUT postings: {companies_without:,}")
|
| 2192 |
+
|
| 2193 |
+
# 6. HYPOTHESIS
|
| 2194 |
+
print(f"\n❓ HYPOTHESIS:")
|
| 2195 |
+
if companies_without > companies_with_postings:
|
| 2196 |
+
print(f" ⚠️ Most companies DON'T have postings!")
|
| 2197 |
+
print(f" ⚠️ They only have: industries, specialties, description")
|
| 2198 |
+
print(f" ⚠️ This creates DIFFERENT language than candidates")
|
| 2199 |
+
print(f"\n 💡 SOLUTION:")
|
| 2200 |
+
print(f" Option A: Filter to only companies WITH postings")
|
| 2201 |
+
print(f" Option B: Use LLM to translate industries → skills")
|
| 2202 |
+
else:
|
| 2203 |
+
print(f" ✅ Most companies have postings")
|
| 2204 |
+
print(f" ❓ Need to check if embeddings were generated AFTER enrichment")
|
| 2205 |
+
|
| 2206 |
+
print(f"\n" + "=" * 80)
|
| 2207 |
+
|
| 2208 |
+
# %% [markdown]
|
| 2209 |
+
# ---
|
| 2210 |
+
# ## 📊 Step 19: Summary
|
| 2211 |
+
#
|
| 2212 |
+
# ### What We Built
|
| 2213 |
+
|
| 2214 |
+
# %%
|
| 2215 |
+
print("="*70)
|
| 2216 |
+
print("🎯 HRHUB v2.1 - SUMMARY")
|
| 2217 |
+
print("="*70)
|
| 2218 |
+
print("")
|
| 2219 |
+
print("✅ IMPLEMENTED:")
|
| 2220 |
+
print(" 1. Zero-Shot Job Classification (Entry/Mid/Senior/Executive)")
|
| 2221 |
+
print(" 2. Few-Shot Learning with Examples")
|
| 2222 |
+
print(" 3. Structured Skills Extraction (Pydantic schemas)")
|
| 2223 |
+
print(" 4. Match Explainability (LLM-generated reasoning)")
|
| 2224 |
+
print(" 5. FREE LLM Integration (Hugging Face)")
|
| 2225 |
+
print(" 6. Flexible Data Loading (Upload OR Google Drive)")
|
| 2226 |
+
print("")
|
| 2227 |
+
print("💰 COST: $0.00 (completely free!)")
|
| 2228 |
+
print("")
|
| 2229 |
+
print("📈 COURSE ALIGNMENT:")
|
| 2230 |
+
print(" ✅ LLMs for structured output")
|
| 2231 |
+
print(" ✅ Pydantic schemas")
|
| 2232 |
+
print(" ✅ Classification pipelines")
|
| 2233 |
+
print(" ✅ Zero-shot & few-shot learning")
|
| 2234 |
+
print(" ✅ JSON extraction")
|
| 2235 |
+
print(" ✅ Transformer architecture (embeddings)")
|
| 2236 |
+
print(" ✅ API deployment strategies")
|
| 2237 |
+
print("")
|
| 2238 |
+
print("="*70)
|
| 2239 |
+
print("🚀 READY TO MOVE TO VS CODE!")
|
| 2240 |
+
print("="*70)
|
| 2241 |
+
|
| 2242 |
+
# %%
|
| 2243 |
+
# ═══════════════════════════════════════════════════════════════════
|
| 2244 |
+
# CELL 10: t-SNE Visualization (Interactive Plotly)
|
| 2245 |
+
# ═══════════════════════════════════════════════════════════════════
|
| 2246 |
+
|
| 2247 |
+
from sklearn.manifold import TSNE
|
| 2248 |
+
import plotly.graph_objects as go
|
| 2249 |
+
|
| 2250 |
+
print("🌌 GENERATING t-SNE VISUALIZATION...")
|
| 2251 |
+
print("=" * 80)
|
| 2252 |
+
|
| 2253 |
+
# Sample for speed (full dataset takes too long)
|
| 2254 |
+
n_sample = min(2000, len(cand_vectors))
|
| 2255 |
+
sample_cands = cand_vectors[:n_sample]
|
| 2256 |
+
sample_comps = comp_vectors[:n_sample]
|
| 2257 |
+
|
| 2258 |
+
print(f"\n📊 Sampling:")
|
| 2259 |
+
print(f" Candidates: {len(sample_cands):,}")
|
| 2260 |
+
print(f" Companies: {len(sample_comps):,}")
|
| 2261 |
+
|
| 2262 |
+
# Combine
|
| 2263 |
+
all_vectors = np.vstack([sample_cands, sample_comps])
|
| 2264 |
+
labels = ['Candidate'] * len(sample_cands) + ['Company'] * len(sample_comps)
|
| 2265 |
+
|
| 2266 |
+
print(f"\n🔄 Running t-SNE (this takes ~2-3 min)...")
|
| 2267 |
+
|
| 2268 |
+
tsne = TSNE(
|
| 2269 |
+
n_components=2,
|
| 2270 |
+
random_state=42,
|
| 2271 |
+
perplexity=30,
|
| 2272 |
+
n_iter=1000,
|
| 2273 |
+
verbose=1
|
| 2274 |
+
)
|
| 2275 |
+
|
| 2276 |
+
coords_2d = tsne.fit_transform(all_vectors)
|
| 2277 |
+
|
| 2278 |
+
print(f"\n✅ t-SNE complete! Shape: {coords_2d.shape}")
|
| 2279 |
+
|
| 2280 |
+
# Split back
|
| 2281 |
+
cand_coords = coords_2d[:len(sample_cands)]
|
| 2282 |
+
comp_coords = coords_2d[len(sample_cands):]
|
| 2283 |
+
|
| 2284 |
+
# Create interactive plot
|
| 2285 |
+
fig = go.Figure()
|
| 2286 |
+
|
| 2287 |
+
# Candidates (green)
|
| 2288 |
+
fig.add_trace(go.Scatter(
|
| 2289 |
+
x=cand_coords[:, 0],
|
| 2290 |
+
y=cand_coords[:, 1],
|
| 2291 |
+
mode='markers',
|
| 2292 |
+
name='Candidates',
|
| 2293 |
+
marker=dict(
|
| 2294 |
+
size=6,
|
| 2295 |
+
color='#2ecc71',
|
| 2296 |
+
opacity=0.6,
|
| 2297 |
+
line=dict(width=0)
|
| 2298 |
+
),
|
| 2299 |
+
text=[f"Candidate {i}<br>{candidates.iloc[i].get('Category', 'N/A')}"
|
| 2300 |
+
for i in range(len(sample_cands))],
|
| 2301 |
+
hovertemplate='%{text}<extra></extra>'
|
| 2302 |
+
))
|
| 2303 |
+
|
| 2304 |
+
# Companies (red)
|
| 2305 |
+
fig.add_trace(go.Scatter(
|
| 2306 |
+
x=comp_coords[:, 0],
|
| 2307 |
+
y=comp_coords[:, 1],
|
| 2308 |
+
mode='markers',
|
| 2309 |
+
name='Companies',
|
| 2310 |
+
marker=dict(
|
| 2311 |
+
size=6,
|
| 2312 |
+
color='#e74c3c',
|
| 2313 |
+
opacity=0.6,
|
| 2314 |
+
line=dict(width=0)
|
| 2315 |
+
),
|
| 2316 |
+
text=[f"Company: {companies_full.iloc[i].get('name', 'N/A')}<br>Industry: {companies_full.iloc[i].get('industries_list', 'N/A')[:50]}"
|
| 2317 |
+
for i in range(len(sample_comps))],
|
| 2318 |
+
hovertemplate='%{text}<extra></extra>'
|
| 2319 |
+
))
|
| 2320 |
+
|
| 2321 |
+
fig.update_layout(
|
| 2322 |
+
title='🌌 HRHUB v2.1 - Candidate-Company Embedding Space (t-SNE)',
|
| 2323 |
+
xaxis_title='t-SNE Dimension 1',
|
| 2324 |
+
yaxis_title='t-SNE Dimension 2',
|
| 2325 |
+
width=1200,
|
| 2326 |
+
height=800,
|
| 2327 |
+
template='plotly_dark',
|
| 2328 |
+
hovermode='closest'
|
| 2329 |
+
)
|
| 2330 |
+
|
| 2331 |
+
# Save HTML
|
| 2332 |
+
tsne_path = f'{Config.RESULTS_PATH}tsne_interactive.html'
|
| 2333 |
+
fig.write_html(tsne_path)
|
| 2334 |
+
|
| 2335 |
+
print(f"\n💾 Saved: {tsne_path}")
|
| 2336 |
+
print(f"\n🎯 KEY INSIGHT:")
|
| 2337 |
+
print(" If job posting bridge works → candidates & companies should overlap!")
|
| 2338 |
+
print("=" * 80)
|
| 2339 |
+
|
| 2340 |
+
# Show in notebook
|
| 2341 |
+
fig.show()
|
| 2342 |
+
|
| 2343 |
+
# %%
|
| 2344 |
+
# ═══════════════════════════════════════════════════════════════════
|
| 2345 |
+
# CELL 11: PyVis Interactive Network (Drag & Drop Graph)
|
| 2346 |
+
# ═══════════════════════════════════════════════════════════════════
|
| 2347 |
+
|
| 2348 |
+
from pyvis.network import Network
|
| 2349 |
+
import random
|
| 2350 |
+
|
| 2351 |
+
print("🕸️ GENERATING PYVIS INTERACTIVE NETWORK...")
|
| 2352 |
+
print("=" * 80)
|
| 2353 |
+
|
| 2354 |
+
# Sample for visualization (too many = slow)
|
| 2355 |
+
n_candidates = min(50, len(candidates))
|
| 2356 |
+
n_companies = min(100, len(companies_full))
|
| 2357 |
+
|
| 2358 |
+
print(f"\n📊 Network size:")
|
| 2359 |
+
print(f" Candidates: {n_candidates}")
|
| 2360 |
+
print(f" Companies: {n_companies}")
|
| 2361 |
+
print(f" Max edges: {n_candidates * 5} (top 5 per candidate)")
|
| 2362 |
+
|
| 2363 |
+
# Initialize network
|
| 2364 |
+
net = Network(
|
| 2365 |
+
height='800px',
|
| 2366 |
+
width='100%',
|
| 2367 |
+
bgcolor='#1a1a1a',
|
| 2368 |
+
font_color='white',
|
| 2369 |
+
notebook=True
|
| 2370 |
+
)
|
| 2371 |
+
|
| 2372 |
+
# Physics settings for nice layout
|
| 2373 |
+
net.set_options("""
|
| 2374 |
+
{
|
| 2375 |
+
"physics": {
|
| 2376 |
+
"forceAtlas2Based": {
|
| 2377 |
+
"gravitationalConstant": -50,
|
| 2378 |
+
"centralGravity": 0.01,
|
| 2379 |
+
"springLength": 100,
|
| 2380 |
+
"springConstant": 0.08
|
| 2381 |
+
},
|
| 2382 |
+
"maxVelocity": 50,
|
| 2383 |
+
"solver": "forceAtlas2Based",
|
| 2384 |
+
"timestep": 0.35,
|
| 2385 |
+
"stabilization": {"iterations": 150}
|
| 2386 |
+
}
|
| 2387 |
+
}
|
| 2388 |
+
""")
|
| 2389 |
+
|
| 2390 |
+
print(f"\n🔵 Adding candidate nodes...")
|
| 2391 |
+
|
| 2392 |
+
# Add candidate nodes (green)
|
| 2393 |
+
for i in range(n_candidates):
|
| 2394 |
+
cand = candidates.iloc[i]
|
| 2395 |
+
node_id = f"C{i}"
|
| 2396 |
+
|
| 2397 |
+
skills = str(cand.get('skills', 'N/A'))[:100]
|
| 2398 |
+
category = cand.get('Category', 'Unknown')
|
| 2399 |
+
|
| 2400 |
+
net.add_node(
|
| 2401 |
+
node_id,
|
| 2402 |
+
label=f"Candidate {i}",
|
| 2403 |
+
title=f"<b>Candidate {i}</b><br>Category: {category}<br>Skills: {skills}...",
|
| 2404 |
+
color='#2ecc71',
|
| 2405 |
+
size=20,
|
| 2406 |
+
shape='dot'
|
| 2407 |
+
)
|
| 2408 |
+
|
| 2409 |
+
print(f"🔴 Adding company nodes...")
|
| 2410 |
+
|
| 2411 |
+
# Add company nodes (red)
|
| 2412 |
+
for i in range(n_companies):
|
| 2413 |
+
comp = companies_full.iloc[i]
|
| 2414 |
+
node_id = f"CO{i}"
|
| 2415 |
+
|
| 2416 |
+
name = comp.get('name', 'Unknown')
|
| 2417 |
+
industry = str(comp.get('industries_list', 'N/A'))[:100]
|
| 2418 |
+
|
| 2419 |
+
net.add_node(
|
| 2420 |
+
node_id,
|
| 2421 |
+
label=name[:20],
|
| 2422 |
+
title=f"<b>{name}</b><br>Industry: {industry}...",
|
| 2423 |
+
color='#e74c3c',
|
| 2424 |
+
size=15,
|
| 2425 |
+
shape='dot'
|
| 2426 |
+
)
|
| 2427 |
+
|
| 2428 |
+
print(f"🔗 Adding edges (matches)...")
|
| 2429 |
+
|
| 2430 |
+
# Add edges (top 5 matches per candidate)
|
| 2431 |
+
edge_count = 0
|
| 2432 |
+
for cand_idx in range(n_candidates):
|
| 2433 |
+
matches = find_top_matches(cand_idx, top_k=5)
|
| 2434 |
+
|
| 2435 |
+
for comp_idx, score in matches:
|
| 2436 |
+
if comp_idx < n_companies: # Only if company in sample
|
| 2437 |
+
net.add_edge(
|
| 2438 |
+
f"C{cand_idx}",
|
| 2439 |
+
f"CO{comp_idx}",
|
| 2440 |
+
value=float(score * 10), # Thickness based on score
|
| 2441 |
+
title=f"Match Score: {score:.3f}",
|
| 2442 |
+
color={'color': '#95a5a6', 'opacity': 0.3}
|
| 2443 |
+
)
|
| 2444 |
+
edge_count += 1
|
| 2445 |
+
|
| 2446 |
+
print(f"\n✅ Network built!")
|
| 2447 |
+
print(f" Nodes: {n_candidates + n_companies}")
|
| 2448 |
+
print(f" Edges: {edge_count}")
|
| 2449 |
+
|
| 2450 |
+
# Save HTML
|
| 2451 |
+
network_path = f'{Config.RESULTS_PATH}network_interactive.html'
|
| 2452 |
+
net.save_graph(network_path)
|
| 2453 |
+
|
| 2454 |
+
print(f"\n💾 Saved: {network_path}")
|
| 2455 |
+
print(f"\n🎯 USAGE:")
|
| 2456 |
+
print(" - Drag nodes to rearrange")
|
| 2457 |
+
print(" - Hover for details")
|
| 2458 |
+
print(" - Zoom with mouse wheel")
|
| 2459 |
+
print(" - Green = Candidates, Red = Companies")
|
| 2460 |
+
print("=" * 80)
|
| 2461 |
+
|
| 2462 |
+
# Show in notebook
|
| 2463 |
+
net.show(network_path)
|
| 2464 |
+
|
| 2465 |
+
# %%
|
| 2466 |
+
# ═══════════════════════════════════════════════════════════════════
|
| 2467 |
+
# CELL 12: Evaluation Metrics (Precision, Bilateral Fairness, Coverage)
|
| 2468 |
+
# ═══════════════════════════════════════════════════════════════════
|
| 2469 |
+
|
| 2470 |
+
print("📊 EVALUATION METRICS")
|
| 2471 |
+
print("=" * 80)
|
| 2472 |
+
|
| 2473 |
+
# ============================================================================
|
| 2474 |
+
# METRIC 1: Match Score Distribution
|
| 2475 |
+
# ============================================================================
|
| 2476 |
+
print("\n1️⃣ MATCH SCORE DISTRIBUTION")
|
| 2477 |
+
|
| 2478 |
+
# Sample matches
|
| 2479 |
+
n_sample = min(500, len(candidates))
|
| 2480 |
+
all_scores = []
|
| 2481 |
+
|
| 2482 |
+
for i in range(n_sample):
|
| 2483 |
+
matches = find_top_matches(i, top_k=10)
|
| 2484 |
+
scores = [score for _, score in matches]
|
| 2485 |
+
all_scores.extend(scores)
|
| 2486 |
+
|
| 2487 |
+
print(f" Sample size: {n_sample} candidates × 10 matches = {len(all_scores)} scores")
|
| 2488 |
+
print(f"\n Statistics:")
|
| 2489 |
+
print(f" Mean: {np.mean(all_scores):.4f}")
|
| 2490 |
+
print(f" Median: {np.median(all_scores):.4f}")
|
| 2491 |
+
print(f" Std: {np.std(all_scores):.4f}")
|
| 2492 |
+
print(f" Min: {np.min(all_scores):.4f}")
|
| 2493 |
+
print(f" Max: {np.max(all_scores):.4f}")
|
| 2494 |
+
|
| 2495 |
+
# Histogram
|
| 2496 |
+
import matplotlib.pyplot as plt
|
| 2497 |
+
|
| 2498 |
+
fig, ax = plt.subplots(figsize=(10, 6), facecolor='#1a1a1a')
|
| 2499 |
+
ax.set_facecolor('#1a1a1a')
|
| 2500 |
+
|
| 2501 |
+
ax.hist(all_scores, bins=50, color='#3498db', alpha=0.7, edgecolor='white')
|
| 2502 |
+
ax.set_xlabel('Match Score', color='white', fontsize=12)
|
| 2503 |
+
ax.set_ylabel('Frequency', color='white', fontsize=12)
|
| 2504 |
+
ax.set_title('Distribution of Match Scores', color='white', fontsize=14, fontweight='bold')
|
| 2505 |
+
ax.tick_params(colors='white')
|
| 2506 |
+
ax.grid(True, alpha=0.2)
|
| 2507 |
+
|
| 2508 |
+
plt.tight_layout()
|
| 2509 |
+
plt.savefig(f'{Config.RESULTS_PATH}score_distribution.png', facecolor='#1a1a1a', dpi=150)
|
| 2510 |
+
print(f"\n 💾 Saved: score_distribution.png")
|
| 2511 |
+
|
| 2512 |
+
# ============================================================================
|
| 2513 |
+
# METRIC 2: Bilateral Fairness Ratio
|
| 2514 |
+
# ============================================================================
|
| 2515 |
+
print(f"\n2️⃣ BILATERAL FAIRNESS RATIO")
|
| 2516 |
+
|
| 2517 |
+
# Candidate → Company scores
|
| 2518 |
+
cand_to_comp_scores = []
|
| 2519 |
+
for i in range(min(200, len(candidates))):
|
| 2520 |
+
matches = find_top_matches(i, top_k=5)
|
| 2521 |
+
avg_score = np.mean([score for _, score in matches])
|
| 2522 |
+
cand_to_comp_scores.append(avg_score)
|
| 2523 |
+
|
| 2524 |
+
# Company → Candidate scores (sample companies)
|
| 2525 |
+
comp_to_cand_scores = []
|
| 2526 |
+
for i in range(min(200, len(companies_full))):
|
| 2527 |
+
comp_vec = comp_vectors[i].reshape(1, -1)
|
| 2528 |
+
similarities = cosine_similarity(comp_vec, cand_vectors)[0]
|
| 2529 |
+
top_5_scores = np.sort(similarities)[-5:]
|
| 2530 |
+
avg_score = np.mean(top_5_scores)
|
| 2531 |
+
comp_to_cand_scores.append(avg_score)
|
| 2532 |
+
|
| 2533 |
+
cand_avg = np.mean(cand_to_comp_scores)
|
| 2534 |
+
comp_avg = np.mean(comp_to_cand_scores)
|
| 2535 |
+
|
| 2536 |
+
bilateral_fairness = min(cand_avg, comp_avg) / max(cand_avg, comp_avg)
|
| 2537 |
+
|
| 2538 |
+
print(f" Candidate → Company avg: {cand_avg:.4f}")
|
| 2539 |
+
print(f" Company → Candidate avg: {comp_avg:.4f}")
|
| 2540 |
+
print(f" Bilateral Fairness Ratio: {bilateral_fairness:.4f}")
|
| 2541 |
+
print(f" {'✅ FAIR (>0.85)' if bilateral_fairness > 0.85 else '🟡 Acceptable (>0.70)' if bilateral_fairness > 0.70 else '❌ Imbalanced'}")
|
| 2542 |
+
|
| 2543 |
+
# ============================================================================
|
| 2544 |
+
# METRIC 3: Job Posting Coverage
|
| 2545 |
+
# ============================================================================
|
| 2546 |
+
print(f"\n3️⃣ JOB POSTING COVERAGE")
|
| 2547 |
+
|
| 2548 |
+
has_real_skills = ~companies_full['required_skills'].isin(['', 'Not specified'])
|
| 2549 |
+
with_postings = has_real_skills.sum()
|
| 2550 |
+
total_companies = len(companies_full)
|
| 2551 |
+
coverage = (with_postings / total_companies) * 100
|
| 2552 |
+
|
| 2553 |
+
print(f" Total companies: {total_companies:,}")
|
| 2554 |
+
print(f" With job posting skills: {with_postings:,}")
|
| 2555 |
+
print(f" Without: {total_companies - with_postings:,}")
|
| 2556 |
+
print(f" Coverage: {coverage:.1f}%")
|
| 2557 |
+
print(f" {'✅ Excellent (>90%)' if coverage > 90 else '🟡 Good (>70%)' if coverage > 70 else '❌ Poor'}")
|
| 2558 |
+
|
| 2559 |
+
# ============================================================================
|
| 2560 |
+
# METRIC 4: Embedding Quality (Cosine Similarity Stats)
|
| 2561 |
+
# ============================================================================
|
| 2562 |
+
print(f"\n4️⃣ EMBEDDING QUALITY")
|
| 2563 |
+
|
| 2564 |
+
# Sample similarity matrix
|
| 2565 |
+
sample_size = min(100, len(cand_vectors), len(comp_vectors))
|
| 2566 |
+
sim_matrix = cosine_similarity(cand_vectors[:sample_size], comp_vectors[:sample_size])
|
| 2567 |
+
|
| 2568 |
+
print(f" Sample: {sample_size}×{sample_size} matrix")
|
| 2569 |
+
print(f" Mean similarity: {np.mean(sim_matrix):.4f}")
|
| 2570 |
+
print(f" Std: {np.std(sim_matrix):.4f}")
|
| 2571 |
+
print(f" Top 1% scores: {np.percentile(sim_matrix, 99):.4f}")
|
| 2572 |
+
print(f" {'✅ Good spread' if np.std(sim_matrix) > 0.1 else '⚠️ Low variance'}")
|
| 2573 |
+
|
| 2574 |
+
# ============================================================================
|
| 2575 |
+
# SUMMARY
|
| 2576 |
+
# ============================================================================
|
| 2577 |
+
print(f"\n{'='*80}")
|
| 2578 |
+
print("📊 METRICS SUMMARY")
|
| 2579 |
+
print(f"{'='*80}")
|
| 2580 |
+
print(f"✅ Match Score Distribution: Mean={np.mean(all_scores):.3f}, Std={np.std(all_scores):.3f}")
|
| 2581 |
+
print(f"✅ Bilateral Fairness: {bilateral_fairness:.3f} {'(FAIR)' if bilateral_fairness > 0.85 else '(ACCEPTABLE)'}")
|
| 2582 |
+
print(f"✅ Job Posting Coverage: {coverage:.1f}%")
|
| 2583 |
+
print(f"✅ Embedding Quality: Std={np.std(sim_matrix):.3f}")
|
| 2584 |
+
print(f"{'='*80}")
|
| 2585 |
+
|
| 2586 |
+
# %%
|
| 2587 |
+
# ═══════════════════════════════════════════════════════════════════
|
| 2588 |
+
# CELL 11: PyVis Interactive Network - BROWSER ONLY (Full Info)
|
| 2589 |
+
# ═══════════════════════════════════════════════════════════════════
|
| 2590 |
+
|
| 2591 |
+
from pyvis.network import Network
|
| 2592 |
+
import webbrowser
|
| 2593 |
+
import os
|
| 2594 |
+
|
| 2595 |
+
print("🕸️ CREATING INTERACTIVE NETWORK (BROWSER MODE)...")
|
| 2596 |
+
print("=" * 80)
|
| 2597 |
+
|
| 2598 |
+
# ============================================================================
|
| 2599 |
+
# Configuration
|
| 2600 |
+
# ============================================================================
|
| 2601 |
+
n_cand_sample = 20 # 20 candidates
|
| 2602 |
+
top_k_per_cand = 5 # Top 5 matches each
|
| 2603 |
+
|
| 2604 |
+
print(f"\n📊 Network configuration:")
|
| 2605 |
+
print(f" Candidates: {n_cand_sample}")
|
| 2606 |
+
print(f" Matches per candidate: {top_k_per_cand}")
|
| 2607 |
+
print(f" Target: ~{n_cand_sample * top_k_per_cand} connections")
|
| 2608 |
+
|
| 2609 |
+
# ============================================================================
|
| 2610 |
+
# Initialize PyVis Network
|
| 2611 |
+
# ============================================================================
|
| 2612 |
+
net = Network(
|
| 2613 |
+
height='900px',
|
| 2614 |
+
width='100%',
|
| 2615 |
+
bgcolor='#1a1a1a',
|
| 2616 |
+
font_color='white',
|
| 2617 |
+
notebook=False, # Browser mode
|
| 2618 |
+
cdn_resources='remote'
|
| 2619 |
+
)
|
| 2620 |
+
|
| 2621 |
+
# Physics for nice layout
|
| 2622 |
+
net.set_options("""
|
| 2623 |
+
var options = {
|
| 2624 |
+
"physics": {
|
| 2625 |
+
"forceAtlas2Based": {
|
| 2626 |
+
"gravitationalConstant": -50,
|
| 2627 |
+
"centralGravity": 0.01,
|
| 2628 |
+
"springLength": 200,
|
| 2629 |
+
"springConstant": 0.08,
|
| 2630 |
+
"avoidOverlap": 1
|
| 2631 |
+
},
|
| 2632 |
+
"maxVelocity": 30,
|
| 2633 |
+
"solver": "forceAtlas2Based",
|
| 2634 |
+
"timestep": 0.35,
|
| 2635 |
+
"stabilization": {
|
| 2636 |
+
"enabled": true,
|
| 2637 |
+
"iterations": 150
|
| 2638 |
+
}
|
| 2639 |
+
},
|
| 2640 |
+
"nodes": {
|
| 2641 |
+
"font": {
|
| 2642 |
+
"size": 16,
|
| 2643 |
+
"color": "white",
|
| 2644 |
+
"face": "arial"
|
| 2645 |
+
},
|
| 2646 |
+
"borderWidth": 2
|
| 2647 |
+
},
|
| 2648 |
+
"edges": {
|
| 2649 |
+
"smooth": {
|
| 2650 |
+
"enabled": true,
|
| 2651 |
+
"type": "continuous"
|
| 2652 |
+
},
|
| 2653 |
+
"width": 2
|
| 2654 |
+
},
|
| 2655 |
+
"interaction": {
|
| 2656 |
+
"hover": true,
|
| 2657 |
+
"tooltipDelay": 50,
|
| 2658 |
+
"navigationButtons": true,
|
| 2659 |
+
"keyboard": {
|
| 2660 |
+
"enabled": true
|
| 2661 |
+
},
|
| 2662 |
+
"zoomView": true,
|
| 2663 |
+
"dragView": true
|
| 2664 |
+
}
|
| 2665 |
+
}
|
| 2666 |
+
""")
|
| 2667 |
+
|
| 2668 |
+
print(f"\n🔵 Adding candidate nodes...")
|
| 2669 |
+
|
| 2670 |
+
# ============================================================================
|
| 2671 |
+
# Add Candidate Nodes (GREEN CIRCLES)
|
| 2672 |
+
# ============================================================================
|
| 2673 |
+
companies_added = set()
|
| 2674 |
+
|
| 2675 |
+
for i in range(min(n_cand_sample, len(candidates))):
|
| 2676 |
+
cand = candidates.iloc[i]
|
| 2677 |
+
|
| 2678 |
+
# Build rich tooltip
|
| 2679 |
+
category = cand.get('Category', 'Unknown')
|
| 2680 |
+
skills = str(cand.get('skills', 'N/A'))
|
| 2681 |
+
if isinstance(skills, list):
|
| 2682 |
+
skills = ', '.join(skills[:5]) # First 5 skills
|
| 2683 |
+
else:
|
| 2684 |
+
skills = skills[:150]
|
| 2685 |
+
|
| 2686 |
+
experience = str(cand.get('positions', 'N/A'))[:100]
|
| 2687 |
+
|
| 2688 |
+
tooltip = f"""
|
| 2689 |
+
<div style='font-family: Arial; max-width: 300px;'>
|
| 2690 |
+
<h3 style='color: #2ecc71; margin: 5px 0;'>👤 Candidate {i}</h3>
|
| 2691 |
+
<hr style='border: 1px solid #2ecc71;'>
|
| 2692 |
+
<p><b>Category:</b> {category}</p>
|
| 2693 |
+
<p><b>Top Skills:</b><br>{skills}...</p>
|
| 2694 |
+
<p><b>Experience:</b><br>{experience}...</p>
|
| 2695 |
+
</div>
|
| 2696 |
+
"""
|
| 2697 |
+
|
| 2698 |
+
net.add_node(
|
| 2699 |
+
f"C{i}",
|
| 2700 |
+
label=f"Candidate {i}",
|
| 2701 |
+
title=tooltip,
|
| 2702 |
+
color='#2ecc71',
|
| 2703 |
+
size=25,
|
| 2704 |
+
shape='dot',
|
| 2705 |
+
borderWidth=2,
|
| 2706 |
+
borderWidthSelected=4
|
| 2707 |
+
)
|
| 2708 |
+
|
| 2709 |
+
print(f"🔴 Adding company nodes & connections...")
|
| 2710 |
+
|
| 2711 |
+
# ============================================================================
|
| 2712 |
+
# Add Company Nodes (RED SQUARES) & Edges
|
| 2713 |
+
# ============================================================================
|
| 2714 |
+
edge_count = 0
|
| 2715 |
+
|
| 2716 |
+
for cand_idx in range(min(n_cand_sample, len(candidates))):
|
| 2717 |
+
matches = find_top_matches(cand_idx, top_k=top_k_per_cand)
|
| 2718 |
+
|
| 2719 |
+
for rank, (comp_idx, score) in enumerate(matches, 1):
|
| 2720 |
+
comp_id = f"CO{comp_idx}"
|
| 2721 |
+
|
| 2722 |
+
# Add company node if not added yet
|
| 2723 |
+
if comp_id not in companies_added:
|
| 2724 |
+
comp = companies_full.iloc[comp_idx]
|
| 2725 |
+
|
| 2726 |
+
name = comp.get('name', 'Unknown Company')
|
| 2727 |
+
industry = str(comp.get('industries_list', 'N/A'))[:80]
|
| 2728 |
+
specialties = str(comp.get('specialties_list', 'N/A'))[:80]
|
| 2729 |
+
required_skills = str(comp.get('required_skills', 'N/A'))[:150]
|
| 2730 |
+
total_postings = comp.get('total_postings', 0)
|
| 2731 |
+
|
| 2732 |
+
# Rich company tooltip
|
| 2733 |
+
tooltip = f"""
|
| 2734 |
+
<div style='font-family: Arial; max-width: 350px;'>
|
| 2735 |
+
<h3 style='color: #e74c3c; margin: 5px 0;'>🏢 {name}</h3>
|
| 2736 |
+
<hr style='border: 1px solid #e74c3c;'>
|
| 2737 |
+
<p><b>Industry:</b> {industry}</p>
|
| 2738 |
+
<p><b>Specialties:</b> {specialties}</p>
|
| 2739 |
+
<p><b>Required Skills:</b><br>{required_skills}...</p>
|
| 2740 |
+
<p><b>Total Job Postings:</b> {total_postings}</p>
|
| 2741 |
+
</div>
|
| 2742 |
+
"""
|
| 2743 |
+
|
| 2744 |
+
net.add_node(
|
| 2745 |
+
comp_id,
|
| 2746 |
+
label=name[:20] + ('...' if len(name) > 20 else ''),
|
| 2747 |
+
title=tooltip,
|
| 2748 |
+
color='#e74c3c',
|
| 2749 |
+
size=18,
|
| 2750 |
+
shape='box',
|
| 2751 |
+
borderWidth=2
|
| 2752 |
+
)
|
| 2753 |
+
companies_added.add(comp_id)
|
| 2754 |
+
|
| 2755 |
+
# Add edge with rich info
|
| 2756 |
+
edge_tooltip = f"""
|
| 2757 |
+
<div style='font-family: Arial;'>
|
| 2758 |
+
<b>Match Quality</b><br>
|
| 2759 |
+
Rank: #{rank}<br>
|
| 2760 |
+
Score: {score:.3f}<br>
|
| 2761 |
+
{'🔥 Excellent' if score > 0.7 else '✅ Good' if score > 0.5 else '🟡 Moderate'}
|
| 2762 |
+
</div>
|
| 2763 |
+
"""
|
| 2764 |
+
|
| 2765 |
+
net.add_edge(
|
| 2766 |
+
f"C{cand_idx}",
|
| 2767 |
+
comp_id,
|
| 2768 |
+
value=float(score * 10),
|
| 2769 |
+
title=edge_tooltip,
|
| 2770 |
+
color={'color': '#95a5a6', 'opacity': 0.6}
|
| 2771 |
+
)
|
| 2772 |
+
edge_count += 1
|
| 2773 |
+
|
| 2774 |
+
print(f"\n✅ Network complete!")
|
| 2775 |
+
print(f" Total nodes: {len(net.nodes)}")
|
| 2776 |
+
print(f" Candidates: {n_cand_sample}")
|
| 2777 |
+
print(f" Companies: {len(companies_added)}")
|
| 2778 |
+
print(f" Edges: {edge_count}")
|
| 2779 |
+
|
| 2780 |
+
# ============================================================================
|
| 2781 |
+
# Save HTML
|
| 2782 |
+
# ============================================================================
|
| 2783 |
+
html_file = f'{Config.RESULTS_PATH}network_interactive.html'
|
| 2784 |
+
net.save_graph(html_file)
|
| 2785 |
+
|
| 2786 |
+
abs_path = os.path.abspath(html_file)
|
| 2787 |
+
file_size = os.path.getsize(html_file) / 1024
|
| 2788 |
+
|
| 2789 |
+
print(f"\n💾 Saved: {html_file}")
|
| 2790 |
+
print(f" Size: {file_size:.2f} KB")
|
| 2791 |
+
print(f" Full path: {abs_path}")
|
| 2792 |
+
|
| 2793 |
+
# ============================================================================
|
| 2794 |
+
# Open in browser
|
| 2795 |
+
# ============================================================================
|
| 2796 |
+
print(f"\n🌐 Opening in default browser...")
|
| 2797 |
+
|
| 2798 |
+
try:
|
| 2799 |
+
webbrowser.open(f'file://{abs_path}')
|
| 2800 |
+
print(f"✅ Browser opened!")
|
| 2801 |
+
except Exception as e:
|
| 2802 |
+
print(f"⚠️ Auto-open failed: {e}")
|
| 2803 |
+
print(f"\n📋 Manual open:")
|
| 2804 |
+
print(f" Firefox/Chrome → Open File → {abs_path}")
|
| 2805 |
+
|
| 2806 |
+
# ============================================================================
|
| 2807 |
+
# Usage guide
|
| 2808 |
+
# ============================================================================
|
| 2809 |
+
print(f"\n{'='*80}")
|
| 2810 |
+
print("💡 HOW TO USE THE INTERACTIVE GRAPH:")
|
| 2811 |
+
print(f"{'='*80}")
|
| 2812 |
+
print(" 🖱️ DRAG nodes to rearrange the network")
|
| 2813 |
+
print(" 🔍 SCROLL to zoom in/out")
|
| 2814 |
+
print(" 👆 HOVER over nodes/edges to see detailed info")
|
| 2815 |
+
print(" 🎯 CLICK nodes to highlight connections")
|
| 2816 |
+
print(" ↔️ DRAG background to pan the view")
|
| 2817 |
+
print(" 🎮 Use NAVIGATION BUTTONS (bottom-right)")
|
| 2818 |
+
print(" ⌨️ Press 'S' to stabilize physics")
|
| 2819 |
+
print(f"\n🎨 VISUAL LEGEND:")
|
| 2820 |
+
print(" 🟢 Green circles = Candidates (25px)")
|
| 2821 |
+
print(" 🔴 Red boxes = Companies (18px)")
|
| 2822 |
+
print(" ━━━ White lines = Match connections")
|
| 2823 |
+
print(" Thicker lines = Higher match scores")
|
| 2824 |
+
print(f"\n📊 TOOLTIPS SHOW:")
|
| 2825 |
+
print(" Candidates: Category, Skills, Experience")
|
| 2826 |
+
print(" Companies: Industry, Specialties, Required Skills, Postings")
|
| 2827 |
+
print(" Edges: Match rank & score")
|
| 2828 |
+
print(f"\n💾 EXPORT:")
|
| 2829 |
+
print(" Right-click → Save image as PNG")
|
| 2830 |
+
print(" Or take screenshot for reports")
|
| 2831 |
+
print("=" * 80)
|
| 2832 |
+
|
| 2833 |
+
# %%
|
| 2834 |
+
|
| 2835 |
+
|
| 2836 |
+
|
data/processed/candidate_embeddings.npy
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 14659712
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b65cbfd59984a15040c701d335d8819adccf1083c4febb512e903f5fbed5a47e
|
| 3 |
size 14659712
|
data/processed/candidates_metadata.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:fc3c6b36cdca3bd3453f4f51d2249ebd2e1f29a6f0ea6f03970171f89fa2f5cc
|
| 3 |
+
size 2440111
|
data/processed/companies_metadata.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:950c05c4ba199a26d3d1d37c2d652ce4d2b830008bfaaece47a81645397a5ff5
|
| 3 |
+
size 30514307
|
data/processed/company_embeddings.npy
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ab8af76664992d4bc871747a3a6e1d2fe213358a0c4ff5752c2751b96ee608fd
|
| 3 |
+
size 37590656
|
data/processed/model_info.json
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model_name": "all-MiniLM-L6-v2",
|
| 3 |
+
"embedding_dim": 384,
|
| 4 |
+
"n_candidates": 9544,
|
| 5 |
+
"n_companies": 24473,
|
| 6 |
+
"bilateral_fairness": 0.7187691926956177,
|
| 7 |
+
"coverage_pct": 96.13860172434929,
|
| 8 |
+
"mean_match_score": 0.573001503944397
|
| 9 |
+
}
|
data/results/network_graph.html
CHANGED
|
@@ -88,8 +88,8 @@
|
|
| 88 |
|
| 89 |
|
| 90 |
// parsing and collecting nodes and edges from the python
|
| 91 |
-
nodes = new vis.DataSet([{"color": "#00ff00", "font": {"color": "white"}, "id": "cand_0", "label": "Candidate #0", "shape": "star", "size": 40, "title": "N/A\u003cbr\u003eSkills: [\u0027Big Data\u0027, \u0027Hadoop\u0027, \u0027Hive\u0027, \u0027Python\u0027, \u0027Mapreduce\u0027, \u0027Spark\u0027, \u0027Java\u0027, \u0027Machine Learning\u0027, \u0027Cloud\u0027, "}, {"color": "#ff0000", "font": {"color": "white"}, "id": "
|
| 92 |
-
edges = new vis.DataSet([{"color": "yellow", "from": "cand_0", "title": "Similarity: 0.
|
| 93 |
|
| 94 |
nodeColors = {};
|
| 95 |
allNodes = nodes.get({ returnType: "Object" });
|
|
|
|
| 88 |
|
| 89 |
|
| 90 |
// parsing and collecting nodes and edges from the python
|
| 91 |
+
nodes = new vis.DataSet([{"color": "#00ff00", "font": {"color": "white"}, "id": "cand_0", "label": "Candidate #0", "shape": "star", "size": 40, "title": "N/A\u003cbr\u003eSkills: [\u0027Big Data\u0027, \u0027Hadoop\u0027, \u0027Hive\u0027, \u0027Python\u0027, \u0027Mapreduce\u0027, \u0027Spark\u0027, \u0027Java\u0027, \u0027Machine Learning\u0027, \u0027Cloud\u0027, "}, {"color": "#ff0000", "font": {"color": "white"}, "id": "comp_6537", "label": "#1. Cloudera", "shape": "dot", "size": 34.21181917190552, "title": "Score: 0.711\u003cbr\u003eIndustries: Software Development\u003cbr\u003eRequired: Product Management, Marketing, Design, Art/Creative, Information Technology, Information Technology"}, {"color": "#ff6b6b", "font": {"color": "white"}, "id": "comp_6383", "label": "#2. Info Services", "shape": "dot", "size": 32.88999915122986, "title": "Score: 0.644\u003cbr\u003eIndustries: IT Services and IT Consulting\u003cbr\u003eRequired: Information Technology, Engineering, Consulting"}, {"color": "#ff6b6b", "font": {"color": "white"}, "id": "comp_20497", "label": "#3. CloudIngest", "shape": "dot", "size": 32.806055545806885, "title": "Score: 0.640\u003cbr\u003eIndustries: Software Development\u003cbr\u003eRequired: Human Resources, Engineering, Information Technology"}, {"color": "#ff6b6b", "font": {"color": "white"}, "id": "comp_739", "label": "#4. Rackspace Technology", "shape": "dot", "size": 32.638866901397705, "title": "Score: 0.632\u003cbr\u003eIndustries: IT Services and IT Consulting\u003cbr\u003eRequired: Engineering, Information Technology, Legal"}, {"color": "#ff6b6b", "font": {"color": "white"}, "id": "comp_10803", "label": "#5. DataStax", "shape": "dot", "size": 32.303223609924316, "title": "Score: 0.615\u003cbr\u003eIndustries: IT Services and IT Consulting\u003cbr\u003eRequired: Information Technology"}, {"color": "#ff6b6b", "font": {"color": "white"}, "id": "comp_18126", "label": "#6. Objectways", "shape": "dot", "size": 32.12769031524658, "title": "Score: 0.606\u003cbr\u003eIndustries: Software Development\u003cbr\u003eRequired: Engineering, Information Technology"}, {"color": "#ff6b6b", "font": {"color": "white"}, "id": "comp_20747", "label": "#7. Data Glacier", "shape": "dot", "size": 32.07703709602356, "title": "Score: 0.604\u003cbr\u003eIndustries: IT Services and IT Consulting\u003cbr\u003eRequired: Engineering, Information Technology, Information Technology"}, {"color": "#ff6b6b", "font": {"color": "white"}, "id": "comp_20373", "label": "#8. iO Associates - US", "shape": "dot", "size": 32.03827500343323, "title": "Score: 0.602\u003cbr\u003eIndustries: Staffing and Recruiting\u003cbr\u003eRequired: Information Technology, Marketing"}, {"color": "#ff6b6b", "font": {"color": "white"}, "id": "comp_16605", "label": "#9. CloudTern Solutions", "shape": "dot", "size": 32.03791856765747, "title": "Score: 0.602\u003cbr\u003eIndustries: IT Services and IT Consulting\u003cbr\u003eRequired: Project Management, Information Technology"}, {"color": "#ff6b6b", "font": {"color": "white"}, "id": "comp_6545", "label": "#10. Ascentt", "shape": "dot", "size": 32.022470235824585, "title": "Score: 0.601\u003cbr\u003eIndustries: IT Services and IT Consulting\u003cbr\u003eRequired: Information Technology, Engineering, Information Technology"}]);
|
| 92 |
+
edges = new vis.DataSet([{"color": "yellow", "from": "cand_0", "title": "Similarity: 0.711", "to": "comp_6537", "value": 0.7105909585952759}, {"color": "yellow", "from": "cand_0", "title": "Similarity: 0.644", "to": "comp_6383", "value": 0.6444999575614929}, {"color": "yellow", "from": "cand_0", "title": "Similarity: 0.640", "to": "comp_20497", "value": 0.6403027772903442}, {"color": "yellow", "from": "cand_0", "title": "Similarity: 0.632", "to": "comp_739", "value": 0.6319433450698853}, {"color": "yellow", "from": "cand_0", "title": "Similarity: 0.615", "to": "comp_10803", "value": 0.6151611804962158}, {"color": "yellow", "from": "cand_0", "title": "Similarity: 0.606", "to": "comp_18126", "value": 0.6063845157623291}, {"color": "yellow", "from": "cand_0", "title": "Similarity: 0.604", "to": "comp_20747", "value": 0.603851854801178}, {"color": "yellow", "from": "cand_0", "title": "Similarity: 0.602", "to": "comp_20373", "value": 0.6019137501716614}, {"color": "yellow", "from": "cand_0", "title": "Similarity: 0.602", "to": "comp_16605", "value": 0.6018959283828735}, {"color": "yellow", "from": "cand_0", "title": "Similarity: 0.601", "to": "comp_6545", "value": 0.6011235117912292}]);
|
| 93 |
|
| 94 |
nodeColors = {};
|
| 95 |
allNodes = nodes.get({ returnType: "Object" });
|
data/results/network_interactive.html
ADDED
|
@@ -0,0 +1,321 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<html>
|
| 2 |
+
<head>
|
| 3 |
+
<meta charset="utf-8">
|
| 4 |
+
|
| 5 |
+
<script>function neighbourhoodHighlight(params) {
|
| 6 |
+
// console.log("in nieghbourhoodhighlight");
|
| 7 |
+
allNodes = nodes.get({ returnType: "Object" });
|
| 8 |
+
// originalNodes = JSON.parse(JSON.stringify(allNodes));
|
| 9 |
+
// if something is selected:
|
| 10 |
+
if (params.nodes.length > 0) {
|
| 11 |
+
highlightActive = true;
|
| 12 |
+
var i, j;
|
| 13 |
+
var selectedNode = params.nodes[0];
|
| 14 |
+
var degrees = 2;
|
| 15 |
+
|
| 16 |
+
// mark all nodes as hard to read.
|
| 17 |
+
for (let nodeId in allNodes) {
|
| 18 |
+
// nodeColors[nodeId] = allNodes[nodeId].color;
|
| 19 |
+
allNodes[nodeId].color = "rgba(200,200,200,0.5)";
|
| 20 |
+
if (allNodes[nodeId].hiddenLabel === undefined) {
|
| 21 |
+
allNodes[nodeId].hiddenLabel = allNodes[nodeId].label;
|
| 22 |
+
allNodes[nodeId].label = undefined;
|
| 23 |
+
}
|
| 24 |
+
}
|
| 25 |
+
var connectedNodes = network.getConnectedNodes(selectedNode);
|
| 26 |
+
var allConnectedNodes = [];
|
| 27 |
+
|
| 28 |
+
// get the second degree nodes
|
| 29 |
+
for (i = 1; i < degrees; i++) {
|
| 30 |
+
for (j = 0; j < connectedNodes.length; j++) {
|
| 31 |
+
allConnectedNodes = allConnectedNodes.concat(
|
| 32 |
+
network.getConnectedNodes(connectedNodes[j])
|
| 33 |
+
);
|
| 34 |
+
}
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
// all second degree nodes get a different color and their label back
|
| 38 |
+
for (i = 0; i < allConnectedNodes.length; i++) {
|
| 39 |
+
// allNodes[allConnectedNodes[i]].color = "pink";
|
| 40 |
+
allNodes[allConnectedNodes[i]].color = "rgba(150,150,150,0.75)";
|
| 41 |
+
if (allNodes[allConnectedNodes[i]].hiddenLabel !== undefined) {
|
| 42 |
+
allNodes[allConnectedNodes[i]].label =
|
| 43 |
+
allNodes[allConnectedNodes[i]].hiddenLabel;
|
| 44 |
+
allNodes[allConnectedNodes[i]].hiddenLabel = undefined;
|
| 45 |
+
}
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
// all first degree nodes get their own color and their label back
|
| 49 |
+
for (i = 0; i < connectedNodes.length; i++) {
|
| 50 |
+
// allNodes[connectedNodes[i]].color = undefined;
|
| 51 |
+
allNodes[connectedNodes[i]].color = nodeColors[connectedNodes[i]];
|
| 52 |
+
if (allNodes[connectedNodes[i]].hiddenLabel !== undefined) {
|
| 53 |
+
allNodes[connectedNodes[i]].label =
|
| 54 |
+
allNodes[connectedNodes[i]].hiddenLabel;
|
| 55 |
+
allNodes[connectedNodes[i]].hiddenLabel = undefined;
|
| 56 |
+
}
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
// the main node gets its own color and its label back.
|
| 60 |
+
// allNodes[selectedNode].color = undefined;
|
| 61 |
+
allNodes[selectedNode].color = nodeColors[selectedNode];
|
| 62 |
+
if (allNodes[selectedNode].hiddenLabel !== undefined) {
|
| 63 |
+
allNodes[selectedNode].label = allNodes[selectedNode].hiddenLabel;
|
| 64 |
+
allNodes[selectedNode].hiddenLabel = undefined;
|
| 65 |
+
}
|
| 66 |
+
} else if (highlightActive === true) {
|
| 67 |
+
// console.log("highlightActive was true");
|
| 68 |
+
// reset all nodes
|
| 69 |
+
for (let nodeId in allNodes) {
|
| 70 |
+
// allNodes[nodeId].color = "purple";
|
| 71 |
+
allNodes[nodeId].color = nodeColors[nodeId];
|
| 72 |
+
// delete allNodes[nodeId].color;
|
| 73 |
+
if (allNodes[nodeId].hiddenLabel !== undefined) {
|
| 74 |
+
allNodes[nodeId].label = allNodes[nodeId].hiddenLabel;
|
| 75 |
+
allNodes[nodeId].hiddenLabel = undefined;
|
| 76 |
+
}
|
| 77 |
+
}
|
| 78 |
+
highlightActive = false;
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
// transform the object into an array
|
| 82 |
+
var updateArray = [];
|
| 83 |
+
if (params.nodes.length > 0) {
|
| 84 |
+
for (let nodeId in allNodes) {
|
| 85 |
+
if (allNodes.hasOwnProperty(nodeId)) {
|
| 86 |
+
// console.log(allNodes[nodeId]);
|
| 87 |
+
updateArray.push(allNodes[nodeId]);
|
| 88 |
+
}
|
| 89 |
+
}
|
| 90 |
+
nodes.update(updateArray);
|
| 91 |
+
} else {
|
| 92 |
+
// console.log("Nothing was selected");
|
| 93 |
+
for (let nodeId in allNodes) {
|
| 94 |
+
if (allNodes.hasOwnProperty(nodeId)) {
|
| 95 |
+
// console.log(allNodes[nodeId]);
|
| 96 |
+
// allNodes[nodeId].color = {};
|
| 97 |
+
updateArray.push(allNodes[nodeId]);
|
| 98 |
+
}
|
| 99 |
+
}
|
| 100 |
+
nodes.update(updateArray);
|
| 101 |
+
}
|
| 102 |
+
}
|
| 103 |
+
|
| 104 |
+
function filterHighlight(params) {
|
| 105 |
+
allNodes = nodes.get({ returnType: "Object" });
|
| 106 |
+
// if something is selected:
|
| 107 |
+
if (params.nodes.length > 0) {
|
| 108 |
+
filterActive = true;
|
| 109 |
+
let selectedNodes = params.nodes;
|
| 110 |
+
|
| 111 |
+
// hiding all nodes and saving the label
|
| 112 |
+
for (let nodeId in allNodes) {
|
| 113 |
+
allNodes[nodeId].hidden = true;
|
| 114 |
+
if (allNodes[nodeId].savedLabel === undefined) {
|
| 115 |
+
allNodes[nodeId].savedLabel = allNodes[nodeId].label;
|
| 116 |
+
allNodes[nodeId].label = undefined;
|
| 117 |
+
}
|
| 118 |
+
}
|
| 119 |
+
|
| 120 |
+
for (let i=0; i < selectedNodes.length; i++) {
|
| 121 |
+
allNodes[selectedNodes[i]].hidden = false;
|
| 122 |
+
if (allNodes[selectedNodes[i]].savedLabel !== undefined) {
|
| 123 |
+
allNodes[selectedNodes[i]].label = allNodes[selectedNodes[i]].savedLabel;
|
| 124 |
+
allNodes[selectedNodes[i]].savedLabel = undefined;
|
| 125 |
+
}
|
| 126 |
+
}
|
| 127 |
+
|
| 128 |
+
} else if (filterActive === true) {
|
| 129 |
+
// reset all nodes
|
| 130 |
+
for (let nodeId in allNodes) {
|
| 131 |
+
allNodes[nodeId].hidden = false;
|
| 132 |
+
if (allNodes[nodeId].savedLabel !== undefined) {
|
| 133 |
+
allNodes[nodeId].label = allNodes[nodeId].savedLabel;
|
| 134 |
+
allNodes[nodeId].savedLabel = undefined;
|
| 135 |
+
}
|
| 136 |
+
}
|
| 137 |
+
filterActive = false;
|
| 138 |
+
}
|
| 139 |
+
|
| 140 |
+
// transform the object into an array
|
| 141 |
+
var updateArray = [];
|
| 142 |
+
if (params.nodes.length > 0) {
|
| 143 |
+
for (let nodeId in allNodes) {
|
| 144 |
+
if (allNodes.hasOwnProperty(nodeId)) {
|
| 145 |
+
updateArray.push(allNodes[nodeId]);
|
| 146 |
+
}
|
| 147 |
+
}
|
| 148 |
+
nodes.update(updateArray);
|
| 149 |
+
} else {
|
| 150 |
+
for (let nodeId in allNodes) {
|
| 151 |
+
if (allNodes.hasOwnProperty(nodeId)) {
|
| 152 |
+
updateArray.push(allNodes[nodeId]);
|
| 153 |
+
}
|
| 154 |
+
}
|
| 155 |
+
nodes.update(updateArray);
|
| 156 |
+
}
|
| 157 |
+
}
|
| 158 |
+
|
| 159 |
+
function selectNode(nodes) {
|
| 160 |
+
network.selectNodes(nodes);
|
| 161 |
+
neighbourhoodHighlight({ nodes: nodes });
|
| 162 |
+
return nodes;
|
| 163 |
+
}
|
| 164 |
+
|
| 165 |
+
function selectNodes(nodes) {
|
| 166 |
+
network.selectNodes(nodes);
|
| 167 |
+
filterHighlight({nodes: nodes});
|
| 168 |
+
return nodes;
|
| 169 |
+
}
|
| 170 |
+
|
| 171 |
+
function highlightFilter(filter) {
|
| 172 |
+
let selectedNodes = []
|
| 173 |
+
let selectedProp = filter['property']
|
| 174 |
+
if (filter['item'] === 'node') {
|
| 175 |
+
let allNodes = nodes.get({ returnType: "Object" });
|
| 176 |
+
for (let nodeId in allNodes) {
|
| 177 |
+
if (allNodes[nodeId][selectedProp] && filter['value'].includes((allNodes[nodeId][selectedProp]).toString())) {
|
| 178 |
+
selectedNodes.push(nodeId)
|
| 179 |
+
}
|
| 180 |
+
}
|
| 181 |
+
}
|
| 182 |
+
else if (filter['item'] === 'edge'){
|
| 183 |
+
let allEdges = edges.get({returnType: 'object'});
|
| 184 |
+
// check if the selected property exists for selected edge and select the nodes connected to the edge
|
| 185 |
+
for (let edge in allEdges) {
|
| 186 |
+
if (allEdges[edge][selectedProp] && filter['value'].includes((allEdges[edge][selectedProp]).toString())) {
|
| 187 |
+
selectedNodes.push(allEdges[edge]['from'])
|
| 188 |
+
selectedNodes.push(allEdges[edge]['to'])
|
| 189 |
+
}
|
| 190 |
+
}
|
| 191 |
+
}
|
| 192 |
+
selectNodes(selectedNodes)
|
| 193 |
+
}</script>
|
| 194 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/vis-network/9.1.2/dist/dist/vis-network.min.css" integrity="sha512-WgxfT5LWjfszlPHXRmBWHkV2eceiWTOBvrKCNbdgDYTHrT2AeLCGbF4sZlZw3UMN3WtL0tGUoIAKsu8mllg/XA==" crossorigin="anonymous" referrerpolicy="no-referrer" />
|
| 195 |
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/vis-network/9.1.2/dist/vis-network.min.js" integrity="sha512-LnvoEWDFrqGHlHmDD2101OrLcbsfkrzoSpvtSQtxK3RMnRV0eOkhhBN2dXHKRrUU8p2DGRTk35n4O8nWSVe1mQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
|
| 196 |
+
|
| 197 |
+
|
| 198 |
+
|
| 199 |
+
|
| 200 |
+
|
| 201 |
+
|
| 202 |
+
|
| 203 |
+
|
| 204 |
+
<center>
|
| 205 |
+
<h1></h1>
|
| 206 |
+
</center>
|
| 207 |
+
|
| 208 |
+
<!-- <link rel="stylesheet" href="../node_modules/vis/dist/vis.min.css" type="text/css" />
|
| 209 |
+
<script type="text/javascript" src="../node_modules/vis/dist/vis.js"> </script>-->
|
| 210 |
+
<link
|
| 211 |
+
href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"
|
| 212 |
+
rel="stylesheet"
|
| 213 |
+
integrity="sha384-eOJMYsd53ii+scO/bJGFsiCZc+5NDVN2yr8+0RDqr0Ql0h+rP48ckxlpbzKgwra6"
|
| 214 |
+
crossorigin="anonymous"
|
| 215 |
+
/>
|
| 216 |
+
<script
|
| 217 |
+
src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"
|
| 218 |
+
integrity="sha384-JEW9xMcG8R+pH31jmWH6WWP0WintQrMb4s7ZOdauHnUtxwoG2vI5DkLtS3qm9Ekf"
|
| 219 |
+
crossorigin="anonymous"
|
| 220 |
+
></script>
|
| 221 |
+
|
| 222 |
+
|
| 223 |
+
<center>
|
| 224 |
+
<h1></h1>
|
| 225 |
+
</center>
|
| 226 |
+
<style type="text/css">
|
| 227 |
+
|
| 228 |
+
#mynetwork {
|
| 229 |
+
width: 100%;
|
| 230 |
+
height: 900px;
|
| 231 |
+
background-color: #1a1a1a;
|
| 232 |
+
border: 1px solid lightgray;
|
| 233 |
+
position: relative;
|
| 234 |
+
float: left;
|
| 235 |
+
}
|
| 236 |
+
|
| 237 |
+
|
| 238 |
+
|
| 239 |
+
|
| 240 |
+
|
| 241 |
+
|
| 242 |
+
</style>
|
| 243 |
+
</head>
|
| 244 |
+
|
| 245 |
+
|
| 246 |
+
<body>
|
| 247 |
+
<div class="card" style="width: 100%">
|
| 248 |
+
|
| 249 |
+
|
| 250 |
+
<div id="mynetwork" class="card-body"></div>
|
| 251 |
+
</div>
|
| 252 |
+
|
| 253 |
+
|
| 254 |
+
|
| 255 |
+
|
| 256 |
+
<script type="text/javascript">
|
| 257 |
+
|
| 258 |
+
// initialize global variables.
|
| 259 |
+
var edges;
|
| 260 |
+
var nodes;
|
| 261 |
+
var allNodes;
|
| 262 |
+
var allEdges;
|
| 263 |
+
var nodeColors;
|
| 264 |
+
var originalNodes;
|
| 265 |
+
var network;
|
| 266 |
+
var container;
|
| 267 |
+
var options, data;
|
| 268 |
+
var filter = {
|
| 269 |
+
item : '',
|
| 270 |
+
property : '',
|
| 271 |
+
value : []
|
| 272 |
+
};
|
| 273 |
+
|
| 274 |
+
|
| 275 |
+
|
| 276 |
+
|
| 277 |
+
|
| 278 |
+
// This method is responsible for drawing the graph, returns the drawn network
|
| 279 |
+
function drawGraph() {
|
| 280 |
+
var container = document.getElementById('mynetwork');
|
| 281 |
+
|
| 282 |
+
|
| 283 |
+
|
| 284 |
+
// parsing and collecting nodes and edges from the python
|
| 285 |
+
nodes = new vis.DataSet([{"color": "#2ecc71", "font": {"color": "white"}, "id": "C0", "label": "Candidate 0", "shape": "dot", "size": 25, "title": "\u003cdiv style=\u0027max-width: 300px;\u0027\u003e\n \u003ch3 style=\u0027color: #2ecc71;\u0027\u003e\ud83d\udc64 Candidate 0\u003c/h3\u003e\n \u003chr style=\u0027border: 1px solid #2ecc71;\u0027\u003e\n \u003cp\u003e\u003cb\u003eCategory:\u003c/b\u003e Unknown\u003c/p\u003e\n \u003cp\u003e\u003cb\u003eSkills:\u003c/b\u003e [\u0027Big Data\u0027, \u0027Hadoop\u0027, \u0027Hive\u0027, \u0027Python\u0027, \u0027Mapreduce\u0027, \u0027Spark\u0027, \u0027Java\u0027, \u0027Machine Learning\u0027, \u0027Cloud\u0027, \u0027Hdfs\u0027, \u0027YARN\u0027, \u0027Core Java\u0027, \u0027Data Science\u0027, \u0027C++\u0027...\u003c/p\u003e\n \u003c/div\u003e"}, {"color": "#2ecc71", "font": {"color": "white"}, "id": "C1", "label": "Candidate 1", "shape": "dot", "size": 25, "title": "\u003cdiv style=\u0027max-width: 300px;\u0027\u003e\n \u003ch3 style=\u0027color: #2ecc71;\u0027\u003e\ud83d\udc64 Candidate 1\u003c/h3\u003e\n \u003chr style=\u0027border: 1px solid #2ecc71;\u0027\u003e\n \u003cp\u003e\u003cb\u003eCategory:\u003c/b\u003e Unknown\u003c/p\u003e\n \u003cp\u003e\u003cb\u003eSkills:\u003c/b\u003e [\u0027Data Analysis\u0027, \u0027Data Analytics\u0027, \u0027Business Analysis\u0027, \u0027R\u0027, \u0027SAS\u0027, \u0027PowerBi\u0027, \u0027Tableau\u0027, \u0027Data Visualization\u0027, \u0027Business Analytics\u0027, \u0027Machine Learni...\u003c/p\u003e\n \u003c/div\u003e"}, {"color": "#2ecc71", "font": {"color": "white"}, "id": "C2", "label": "Candidate 2", "shape": "dot", "size": 25, "title": "\u003cdiv style=\u0027max-width: 300px;\u0027\u003e\n \u003ch3 style=\u0027color: #2ecc71;\u0027\u003e\ud83d\udc64 Candidate 2\u003c/h3\u003e\n \u003chr style=\u0027border: 1px solid #2ecc71;\u0027\u003e\n \u003cp\u003e\u003cb\u003eCategory:\u003c/b\u003e Unknown\u003c/p\u003e\n \u003cp\u003e\u003cb\u003eSkills:\u003c/b\u003e [\u0027Software Development\u0027, \u0027Machine Learning\u0027, \u0027Deep Learning\u0027, \u0027Risk Assessment\u0027, \u0027Requirement Gathering\u0027, \u0027Application Support\u0027, \u0027JavaScript\u0027, \u0027Python...\u003c/p\u003e\n \u003c/div\u003e"}, {"color": "#2ecc71", "font": {"color": "white"}, "id": "C3", "label": "Candidate 3", "shape": "dot", "size": 25, "title": "\u003cdiv style=\u0027max-width: 300px;\u0027\u003e\n \u003ch3 style=\u0027color: #2ecc71;\u0027\u003e\ud83d\udc64 Candidate 3\u003c/h3\u003e\n \u003chr style=\u0027border: 1px solid #2ecc71;\u0027\u003e\n \u003cp\u003e\u003cb\u003eCategory:\u003c/b\u003e Unknown\u003c/p\u003e\n \u003cp\u003e\u003cb\u003eSkills:\u003c/b\u003e [\u0027accounts payables\u0027, \u0027accounts receivables\u0027, \u0027Accounts Payable\u0027, \u0027Accounts Receivable\u0027, \u0027administrative functions\u0027, \u0027trial balance\u0027, \u0027banking\u0027, \u0027budg...\u003c/p\u003e\n \u003c/div\u003e"}, {"color": "#2ecc71", "font": {"color": "white"}, "id": "C4", "label": "Candidate 4", "shape": "dot", "size": 25, "title": "\u003cdiv style=\u0027max-width: 300px;\u0027\u003e\n \u003ch3 style=\u0027color: #2ecc71;\u0027\u003e\ud83d\udc64 Candidate 4\u003c/h3\u003e\n \u003chr style=\u0027border: 1px solid #2ecc71;\u0027\u003e\n \u003cp\u003e\u003cb\u003eCategory:\u003c/b\u003e Unknown\u003c/p\u003e\n \u003cp\u003e\u003cb\u003eSkills:\u003c/b\u003e [\u0027Analytical reasoning\u0027, \u0027Compliance testing knowledge\u0027, \u0027Effective time management\u0027, \u0027Public and private accounting\u0027, \u0027accounting\u0027, \u0027accounting syste...\u003c/p\u003e\n \u003c/div\u003e"}, {"color": "#2ecc71", "font": {"color": "white"}, "id": "C5", "label": "Candidate 5", "shape": "dot", "size": 25, "title": "\u003cdiv style=\u0027max-width: 300px;\u0027\u003e\n \u003ch3 style=\u0027color: #2ecc71;\u0027\u003e\ud83d\udc64 Candidate 5\u003c/h3\u003e\n \u003chr style=\u0027border: 1px solid #2ecc71;\u0027\u003e\n \u003cp\u003e\u003cb\u003eCategory:\u003c/b\u003e Unknown\u003c/p\u003e\n \u003cp\u003e\u003cb\u003eSkills:\u003c/b\u003e [\u0027Microsoft Applications\u0027, \u0027Network Security\u0027, \u0027Networking\u0027, \u0027PC hardware and software installation, configuration, and troubleshooting\u0027, \u0027Remote Desk...\u003c/p\u003e\n \u003c/div\u003e"}, {"color": "#2ecc71", "font": {"color": "white"}, "id": "C6", "label": "Candidate 6", "shape": "dot", "size": 25, "title": "\u003cdiv style=\u0027max-width: 300px;\u0027\u003e\n \u003ch3 style=\u0027color: #2ecc71;\u0027\u003e\ud83d\udc64 Candidate 6\u003c/h3\u003e\n \u003chr style=\u0027border: 1px solid #2ecc71;\u0027\u003e\n \u003cp\u003e\u003cb\u003eCategory:\u003c/b\u003e Unknown\u003c/p\u003e\n \u003cp\u003e\u003cb\u003eSkills:\u003c/b\u003e [\u0027Machine Learning\u0027, \u0027Linear Regression\u0027, \u0027Ridge Regression\u0027, \u0027Lasso Regression\u0027, \u0027Tableau\u0027, \u0027Time Series Analysis\u0027]...\u003c/p\u003e\n \u003c/div\u003e"}, {"color": "#2ecc71", "font": {"color": "white"}, "id": "C7", "label": "Candidate 7", "shape": "dot", "size": 25, "title": "\u003cdiv style=\u0027max-width: 300px;\u0027\u003e\n \u003ch3 style=\u0027color: #2ecc71;\u0027\u003e\ud83d\udc64 Candidate 7\u003c/h3\u003e\n \u003chr style=\u0027border: 1px solid #2ecc71;\u0027\u003e\n \u003cp\u003e\u003cb\u003eCategory:\u003c/b\u003e Unknown\u003c/p\u003e\n \u003cp\u003e\u003cb\u003eSkills:\u003c/b\u003e [\u0027Maintenance\u0027, \u0027Corrective Maintenance\u0027, \u0027Documentation\u0027, \u0027Industrial Machinery\u0027, \u0027Preventive Maintenance\u0027, \u0027Sensors\u0027, \u0027Biotechnology\u0027, \u0027Electrical M...\u003c/p\u003e\n \u003c/div\u003e"}, {"color": "#2ecc71", "font": {"color": "white"}, "id": "C8", "label": "Candidate 8", "shape": "dot", "size": 25, "title": "\u003cdiv style=\u0027max-width: 300px;\u0027\u003e\n \u003ch3 style=\u0027color: #2ecc71;\u0027\u003e\ud83d\udc64 Candidate 8\u003c/h3\u003e\n \u003chr style=\u0027border: 1px solid #2ecc71;\u0027\u003e\n \u003cp\u003e\u003cb\u003eCategory:\u003c/b\u003e Unknown\u003c/p\u003e\n \u003cp\u003e\u003cb\u003eSkills:\u003c/b\u003e [\u0027Python\u0027, \u0027Machine Learning\u0027, \u0027MySQL\u0027, \u0027Data Mining\u0027, \u0027Deep Learning\u0027, \u0027Data Analysis\u0027, \u0027Computer Vision\u0027, \u0027Flask API\u0027, \u0027Predictive Modeling\u0027, \u0027AWS\u0027,...\u003c/p\u003e\n \u003c/div\u003e"}, {"color": "#2ecc71", "font": {"color": "white"}, "id": "C9", "label": "Candidate 9", "shape": "dot", "size": 25, "title": "\u003cdiv style=\u0027max-width: 300px;\u0027\u003e\n \u003ch3 style=\u0027color: #2ecc71;\u0027\u003e\ud83d\udc64 Candidate 9\u003c/h3\u003e\n \u003chr style=\u0027border: 1px solid #2ecc71;\u0027\u003e\n \u003cp\u003e\u003cb\u003eCategory:\u003c/b\u003e Unknown\u003c/p\u003e\n \u003cp\u003e\u003cb\u003eSkills:\u003c/b\u003e [\u0027Django\u0027, \u0027Python\u0027, \u0027Relational databases\u0027, \u0027RestAPI\u0027, \u0027Github\u0027, \u0027Jira\u0027, \u0027PostgreSQL\u0027, \u0027Software development\u0027, \u0027Debugging\u0027, \u0027Machine learning\u0027, \u0027Natu...\u003c/p\u003e\n \u003c/div\u003e"}, {"color": "#2ecc71", "font": {"color": "white"}, "id": "C10", "label": "Candidate 10", "shape": "dot", "size": 25, "title": "\u003cdiv style=\u0027max-width: 300px;\u0027\u003e\n \u003ch3 style=\u0027color: #2ecc71;\u0027\u003e\ud83d\udc64 Candidate 10\u003c/h3\u003e\n \u003chr style=\u0027border: 1px solid #2ecc71;\u0027\u003e\n \u003cp\u003e\u003cb\u003eCategory:\u003c/b\u003e Unknown\u003c/p\u003e\n \u003cp\u003e\u003cb\u003eSkills:\u003c/b\u003e [\u0027Microsoft Office Suite\u0027, \u0027VideoScribe Software\u0027, \u0027PeopleSoft Finance Applications\u0027, \u0027Accounting\u0027, \u0027billing\u0027, \u0027Change Management\u0027, \u0027contracts\u0027, \u0027Clie...\u003c/p\u003e\n \u003c/div\u003e"}, {"color": "#2ecc71", "font": {"color": "white"}, "id": "C11", "label": "Candidate 11", "shape": "dot", "size": 25, "title": "\u003cdiv style=\u0027max-width: 300px;\u0027\u003e\n \u003ch3 style=\u0027color: #2ecc71;\u0027\u003e\ud83d\udc64 Candidate 11\u003c/h3\u003e\n \u003chr style=\u0027border: 1px solid #2ecc71;\u0027\u003e\n \u003cp\u003e\u003cb\u003eCategory:\u003c/b\u003e Unknown\u003c/p\u003e\n \u003cp\u003e\u003cb\u003eSkills:\u003c/b\u003e [\u0027R\u0027, \u0027Python\u0027, \u0027Tableau\u0027, \u0027Power BI\u0027, \u0027SQL\u0027, \u0027SAS\u0027, \u0027Deep Learning\u0027, \u0027Neural Networks\u0027, \u0027Artificial Intelligence\u0027]...\u003c/p\u003e\n \u003c/div\u003e"}, {"color": "#2ecc71", "font": {"color": "white"}, "id": "C12", "label": "Candidate 12", "shape": "dot", "size": 25, "title": "\u003cdiv style=\u0027max-width: 300px;\u0027\u003e\n \u003ch3 style=\u0027color: #2ecc71;\u0027\u003e\ud83d\udc64 Candidate 12\u003c/h3\u003e\n \u003chr style=\u0027border: 1px solid #2ecc71;\u0027\u003e\n \u003cp\u003e\u003cb\u003eCategory:\u003c/b\u003e Unknown\u003c/p\u003e\n \u003cp\u003e\u003cb\u003eSkills:\u003c/b\u003e [\u0027Data Analytics\u0027, \u0027Linear Regression\u0027, \u0027Logistic Regression\u0027, \u0027Business Intelligence\u0027, \u0027Business Analysis\u0027, \u0027GraphQL\u0027, \u0027Python\u0027]...\u003c/p\u003e\n \u003c/div\u003e"}, {"color": "#2ecc71", "font": {"color": "white"}, "id": "C13", "label": "Candidate 13", "shape": "dot", "size": 25, "title": "\u003cdiv style=\u0027max-width: 300px;\u0027\u003e\n \u003ch3 style=\u0027color: #2ecc71;\u0027\u003e\ud83d\udc64 Candidate 13\u003c/h3\u003e\n \u003chr style=\u0027border: 1px solid #2ecc71;\u0027\u003e\n \u003cp\u003e\u003cb\u003eCategory:\u003c/b\u003e Unknown\u003c/p\u003e\n \u003cp\u003e\u003cb\u003eSkills:\u003c/b\u003e [\u0027C\u0027, \u0027C++\u0027, \u0027Python\u0027, \u0027JAVA\u0027, \u0027HTML\u0027, \u0027CSS\u0027, \u0027JavaScript\u0027, \u0027Data Structures\u0027, \u0027SQL\u0027, \u0027PyCharm\u0027, \u0027Jupyter Notebook\u0027, \u0027Google Colab\u0027, \u0027Code Blocks\u0027, \u0027M...\u003c/p\u003e\n \u003c/div\u003e"}, {"color": "#2ecc71", "font": {"color": "white"}, "id": "C14", "label": "Candidate 14", "shape": "dot", "size": 25, "title": "\u003cdiv style=\u0027max-width: 300px;\u0027\u003e\n \u003ch3 style=\u0027color: #2ecc71;\u0027\u003e\ud83d\udc64 Candidate 14\u003c/h3\u003e\n \u003chr style=\u0027border: 1px solid #2ecc71;\u0027\u003e\n \u003cp\u003e\u003cb\u003eCategory:\u003c/b\u003e Unknown\u003c/p\u003e\n \u003cp\u003e\u003cb\u003eSkills:\u003c/b\u003e [\u0027Java\u0027, \u0027Spring\u0027, \u0027Javascript\u0027, \u0027CSS\u0027, \u0027HTML\u0027, \u0027REST APIs\u0027, \u0027React Native\u0027, \u0027Kotlin\u0027, \u0027PostgreSQL\u0027, \u0027MySQL\u0027]...\u003c/p\u003e\n \u003c/div\u003e"}, {"color": "#2ecc71", "font": {"color": "white"}, "id": "C15", "label": "Candidate 15", "shape": "dot", "size": 25, "title": "\u003cdiv style=\u0027max-width: 300px;\u0027\u003e\n \u003ch3 style=\u0027color: #2ecc71;\u0027\u003e\ud83d\udc64 Candidate 15\u003c/h3\u003e\n \u003chr style=\u0027border: 1px solid #2ecc71;\u0027\u003e\n \u003cp\u003e\u003cb\u003eCategory:\u003c/b\u003e Unknown\u003c/p\u003e\n \u003cp\u003e\u003cb\u003eSkills:\u003c/b\u003e [\u0027Machine Learning\u0027, \u0027Method Development\u0027, \u0027Artificial Intelligence\u0027, \u0027Data Modeling\u0027, \u0027Data Visualization\u0027, \u0027Data Validation\u0027, \u0027Deep Learning\u0027, \u0027MySQ...\u003c/p\u003e\n \u003c/div\u003e"}, {"color": "#2ecc71", "font": {"color": "white"}, "id": "C16", "label": "Candidate 16", "shape": "dot", "size": 25, "title": "\u003cdiv style=\u0027max-width: 300px;\u0027\u003e\n \u003ch3 style=\u0027color: #2ecc71;\u0027\u003e\ud83d\udc64 Candidate 16\u003c/h3\u003e\n \u003chr style=\u0027border: 1px solid #2ecc71;\u0027\u003e\n \u003cp\u003e\u003cb\u003eCategory:\u003c/b\u003e Unknown\u003c/p\u003e\n \u003cp\u003e\u003cb\u003eSkills:\u003c/b\u003e [\u0027budget\u0027, \u0027hardware\u0027, \u0027network systems\u0027, \u0027database\u0027, \u0027Dec\u0027, \u0027documentation\u0027, \u0027inspection\u0027, \u0027logistics\u0027, \u0027meetings\u0027, \u0027MS Excel\u0027, \u0027Microsoft Office\u0027, \u0027...\u003c/p\u003e\n \u003c/div\u003e"}, {"color": "#2ecc71", "font": {"color": "white"}, "id": "C17", "label": "Candidate 17", "shape": "dot", "size": 25, "title": "\u003cdiv style=\u0027max-width: 300px;\u0027\u003e\n \u003ch3 style=\u0027color: #2ecc71;\u0027\u003e\ud83d\udc64 Candidate 17\u003c/h3\u003e\n \u003chr style=\u0027border: 1px solid #2ecc71;\u0027\u003e\n \u003cp\u003e\u003cb\u003eCategory:\u003c/b\u003e Unknown\u003c/p\u003e\n \u003cp\u003e\u003cb\u003eSkills:\u003c/b\u003e [\u0027Artificial Intelligence\u0027, \u0027Deep Learning\u0027, \u0027Reinforcement Learning\u0027, \u0027Tensorflow Keras\u0027, \u0027Scikit learn\u0027, \u0027Numpy\u0027, \u0027Pandas\u0027, \u0027Matplotlib\u0027]...\u003c/p\u003e\n \u003c/div\u003e"}, {"color": "#2ecc71", "font": {"color": "white"}, "id": "C18", "label": "Candidate 18", "shape": "dot", "size": 25, "title": "\u003cdiv style=\u0027max-width: 300px;\u0027\u003e\n \u003ch3 style=\u0027color: #2ecc71;\u0027\u003e\ud83d\udc64 Candidate 18\u003c/h3\u003e\n \u003chr style=\u0027border: 1px solid #2ecc71;\u0027\u003e\n \u003cp\u003e\u003cb\u003eCategory:\u003c/b\u003e Unknown\u003c/p\u003e\n \u003cp\u003e\u003cb\u003eSkills:\u003c/b\u003e [\u0027Java\u0027, \u0027Spring\u0027, \u0027Javascript\u0027, \u0027CSS\u0027, \u0027HTML\u0027, \u0027REST APIs\u0027, \u0027React Native\u0027, \u0027Kotlin\u0027, \u0027PostgreSQL\u0027, \u0027MySQL\u0027]...\u003c/p\u003e\n \u003c/div\u003e"}, {"color": "#2ecc71", "font": {"color": "white"}, "id": "C19", "label": "Candidate 19", "shape": "dot", "size": 25, "title": "\u003cdiv style=\u0027max-width: 300px;\u0027\u003e\n \u003ch3 style=\u0027color: #2ecc71;\u0027\u003e\ud83d\udc64 Candidate 19\u003c/h3\u003e\n \u003chr style=\u0027border: 1px solid #2ecc71;\u0027\u003e\n \u003cp\u003e\u003cb\u003eCategory:\u003c/b\u003e Unknown\u003c/p\u003e\n \u003cp\u003e\u003cb\u003eSkills:\u003c/b\u003e [\u0027Machine learning\u0027, \u0027Data Science\u0027, \u0027Deep Learning\u0027, \u0027Decision Trees\u0027, \u0027Random Forest\u0027, \u0027XGBoost\u0027, \u0027CATBoost\u0027, \u0027Classification\u0027, \u0027Regression\u0027, \u0027Sciki...\u003c/p\u003e\n \u003c/div\u003e"}, {"color": "#e74c3c", "font": {"color": "white"}, "id": "CO6537", "label": "Cloudera", "shape": "box", "size": 18, "title": "\u003cdiv style=\u0027max-width: 350px;\u0027\u003e\n \u003ch3 style=\u0027color: #e74c3c;\u0027\u003e\ud83c\udfe2 Cloudera\u003c/h3\u003e\n \u003chr style=\u0027border: 1px solid #e74c3c;\u0027\u003e\n \u003cp\u003e\u003cb\u003eIndustry:\u003c/b\u003e Software Development\u003c/p\u003e\n \u003cp\u003e\u003cb\u003eSkills:\u003c/b\u003e Product Management, Marketing, Design, Art/Creative, Information Technology, Information Technology...\u003c/p\u003e\n \u003c/div\u003e"}, {"color": "#e74c3c", "font": {"color": "white"}, "id": "CO6383", "label": "Info Services", "shape": "box", "size": 18, "title": "\u003cdiv style=\u0027max-width: 350px;\u0027\u003e\n \u003ch3 style=\u0027color: #e74c3c;\u0027\u003e\ud83c\udfe2 Info Services\u003c/h3\u003e\n \u003chr style=\u0027border: 1px solid #e74c3c;\u0027\u003e\n \u003cp\u003e\u003cb\u003eIndustry:\u003c/b\u003e IT Services and IT Consulting\u003c/p\u003e\n \u003cp\u003e\u003cb\u003eSkills:\u003c/b\u003e Information Technology, Engineering, Consulting...\u003c/p\u003e\n \u003c/div\u003e"}, {"color": "#e74c3c", "font": {"color": "white"}, "id": "CO20497", "label": "CloudIngest", "shape": "box", "size": 18, "title": "\u003cdiv style=\u0027max-width: 350px;\u0027\u003e\n \u003ch3 style=\u0027color: #e74c3c;\u0027\u003e\ud83c\udfe2 CloudIngest\u003c/h3\u003e\n \u003chr style=\u0027border: 1px solid #e74c3c;\u0027\u003e\n \u003cp\u003e\u003cb\u003eIndustry:\u003c/b\u003e Software Development\u003c/p\u003e\n \u003cp\u003e\u003cb\u003eSkills:\u003c/b\u003e Human Resources, Engineering, Information Technology...\u003c/p\u003e\n \u003c/div\u003e"}, {"color": "#e74c3c", "font": {"color": "white"}, "id": "CO739", "label": "Rackspace Technology", "shape": "box", "size": 18, "title": "\u003cdiv style=\u0027max-width: 350px;\u0027\u003e\n \u003ch3 style=\u0027color: #e74c3c;\u0027\u003e\ud83c\udfe2 Rackspace Technology\u003c/h3\u003e\n \u003chr style=\u0027border: 1px solid #e74c3c;\u0027\u003e\n \u003cp\u003e\u003cb\u003eIndustry:\u003c/b\u003e IT Services and IT Consulting\u003c/p\u003e\n \u003cp\u003e\u003cb\u003eSkills:\u003c/b\u003e Engineering, Information Technology, Legal...\u003c/p\u003e\n \u003c/div\u003e"}, {"color": "#e74c3c", "font": {"color": "white"}, "id": "CO10803", "label": "DataStax", "shape": "box", "size": 18, "title": "\u003cdiv style=\u0027max-width: 350px;\u0027\u003e\n \u003ch3 style=\u0027color: #e74c3c;\u0027\u003e\ud83c\udfe2 DataStax\u003c/h3\u003e\n \u003chr style=\u0027border: 1px solid #e74c3c;\u0027\u003e\n \u003cp\u003e\u003cb\u003eIndustry:\u003c/b\u003e IT Services and IT Consulting\u003c/p\u003e\n \u003cp\u003e\u003cb\u003eSkills:\u003c/b\u003e Information Technology...\u003c/p\u003e\n \u003c/div\u003e"}, {"color": "#e74c3c", "font": {"color": "white"}, "id": "CO4917", "label": "Analytic Recruiting ", "shape": "box", "size": 18, "title": "\u003cdiv style=\u0027max-width: 350px;\u0027\u003e\n \u003ch3 style=\u0027color: #e74c3c;\u0027\u003e\ud83c\udfe2 Analytic Recruiting Inc.\u003c/h3\u003e\n \u003chr style=\u0027border: 1px solid #e74c3c;\u0027\u003e\n \u003cp\u003e\u003cb\u003eIndustry:\u003c/b\u003e Staffing and Recruiting\u003c/p\u003e\n \u003cp\u003e\u003cb\u003eSkills:\u003c/b\u003e Analyst, Finance, Information Technology, Information Technology, Analyst, Finance, Analyst, Writing/Editing...\u003c/p\u003e\n \u003c/div\u003e"}, {"color": "#e74c3c", "font": {"color": "white"}, "id": "CO84", "label": "SAS", "shape": "box", "size": 18, "title": "\u003cdiv style=\u0027max-width: 350px;\u0027\u003e\n \u003ch3 style=\u0027color: #e74c3c;\u0027\u003e\ud83c\udfe2 SAS\u003c/h3\u003e\n \u003chr style=\u0027border: 1px solid #e74c3c;\u0027\u003e\n \u003cp\u003e\u003cb\u003eIndustry:\u003c/b\u003e Software Development\u003c/p\u003e\n \u003cp\u003e\u003cb\u003eSkills:\u003c/b\u003e Purchasing, Supply Chain, General Business, Information Technology, Engineering, Sales, Business Development...\u003c/p\u003e\n \u003c/div\u003e"}, {"color": "#e74c3c", "font": {"color": "white"}, "id": "CO387", "label": "Salesforce", "shape": "box", "size": 18, "title": "\u003cdiv style=\u0027max-width: 350px;\u0027\u003e\n \u003ch3 style=\u0027color: #e74c3c;\u0027\u003e\ud83c\udfe2 Salesforce\u003c/h3\u003e\n \u003chr style=\u0027border: 1px solid #e74c3c;\u0027\u003e\n \u003cp\u003e\u003cb\u003eIndustry:\u003c/b\u003e Software Development\u003c/p\u003e\n \u003cp\u003e\u003cb\u003eSkills:\u003c/b\u003e Sales, Business Development, Information Technology, Research, Analyst, Information Technology, Marketing, Public Relations, Writing/Editing, Design, ...\u003c/p\u003e\n \u003c/div\u003e"}, {"color": "#e74c3c", "font": {"color": "white"}, "id": "CO6684", "label": "ICE", "shape": "box", "size": 18, "title": "\u003cdiv style=\u0027max-width: 350px;\u0027\u003e\n \u003ch3 style=\u0027color: #e74c3c;\u0027\u003e\ud83c\udfe2 ICE\u003c/h3\u003e\n \u003chr style=\u0027border: 1px solid #e74c3c;\u0027\u003e\n \u003cp\u003e\u003cb\u003eIndustry:\u003c/b\u003e Financial Services\u003c/p\u003e\n \u003cp\u003e\u003cb\u003eSkills:\u003c/b\u003e Information Technology, Finance, Information Technology, Engineering, Information Technology, Sales, Business Development, Management, Manufacturing, ...\u003c/p\u003e\n \u003c/div\u003e"}, {"color": "#e74c3c", "font": {"color": "white"}, "id": "CO16692", "label": "Confidential", "shape": "box", "size": 18, "title": "\u003cdiv style=\u0027max-width: 350px;\u0027\u003e\n \u003ch3 style=\u0027color: #e74c3c;\u0027\u003e\ud83c\udfe2 Confidential\u003c/h3\u003e\n \u003chr style=\u0027border: 1px solid #e74c3c;\u0027\u003e\n \u003cp\u003e\u003cb\u003eIndustry:\u003c/b\u003e General\u003c/p\u003e\n \u003cp\u003e\u003cb\u003eSkills:\u003c/b\u003e Administrative, Project Management, Customer Service, Manufacturing, Supply Chain, Strategy/Planning, Human Resources, Information Technology, Sales, ...\u003c/p\u003e\n \u003c/div\u003e"}, {"color": "#e74c3c", "font": {"color": "white"}, "id": "CO23528", "label": "DataAnnotation", "shape": "box", "size": 18, "title": "\u003cdiv style=\u0027max-width: 350px;\u0027\u003e\n \u003ch3 style=\u0027color: #e74c3c;\u0027\u003e\ud83c\udfe2 DataAnnotation\u003c/h3\u003e\n \u003chr style=\u0027border: 1px solid #e74c3c;\u0027\u003e\n \u003cp\u003e\u003cb\u003eIndustry:\u003c/b\u003e Software Development\u003c/p\u003e\n \u003cp\u003e\u003cb\u003eSkills:\u003c/b\u003e Engineering, Research, Analyst, Research, Analyst, Writing/Editing, Writing/Editing, Research, Analyst, Engineering, Analyst, Research, Engineering, R...\u003c/p\u003e\n \u003c/div\u003e"}, {"color": "#e74c3c", "font": {"color": "white"}, "id": "CO19247", "label": "Advanced Sciences an", "shape": "box", "size": 18, "title": "\u003cdiv style=\u0027max-width: 350px;\u0027\u003e\n \u003ch3 style=\u0027color: #e74c3c;\u0027\u003e\ud83c\udfe2 Advanced Sciences and Technologies\u003c/h3\u003e\n \u003chr style=\u0027border: 1px solid #e74c3c;\u0027\u003e\n \u003cp\u003e\u003cb\u003eIndustry:\u003c/b\u003e Government Administration\u003c/p\u003e\n \u003cp\u003e\u003cb\u003eSkills:\u003c/b\u003e Accounting/Auditing, Finance, Administrative...\u003c/p\u003e\n \u003c/div\u003e"}, {"color": "#e74c3c", "font": {"color": "white"}, "id": "CO22619", "label": "Hire Python Develope", "shape": "box", "size": 18, "title": "\u003cdiv style=\u0027max-width: 350px;\u0027\u003e\n \u003ch3 style=\u0027color: #e74c3c;\u0027\u003e\ud83c\udfe2 Hire Python Developer\u003c/h3\u003e\n \u003chr style=\u0027border: 1px solid #e74c3c;\u0027\u003e\n \u003cp\u003e\u003cb\u003eIndustry:\u003c/b\u003e Software Development\u003c/p\u003e\n \u003cp\u003e\u003cb\u003eSkills:\u003c/b\u003e Engineering, Information Technology...\u003c/p\u003e\n \u003c/div\u003e"}, {"color": "#e74c3c", "font": {"color": "white"}, "id": "CO9694", "label": "Family Office", "shape": "box", "size": 18, "title": "\u003cdiv style=\u0027max-width: 350px;\u0027\u003e\n \u003ch3 style=\u0027color: #e74c3c;\u0027\u003e\ud83c\udfe2 Family Office\u003c/h3\u003e\n \u003chr style=\u0027border: 1px solid #e74c3c;\u0027\u003e\n \u003cp\u003e\u003cb\u003eIndustry:\u003c/b\u003e Investment Banking\u003c/p\u003e\n \u003cp\u003e\u003cb\u003eSkills:\u003c/b\u003e Accounting/Auditing, Finance...\u003c/p\u003e\n \u003c/div\u003e"}, {"color": "#e74c3c", "font": {"color": "white"}, "id": "CO11295", "label": "Confidential", "shape": "box", "size": 18, "title": "\u003cdiv style=\u0027max-width: 350px;\u0027\u003e\n \u003ch3 style=\u0027color: #e74c3c;\u0027\u003e\ud83c\udfe2 Confidential\u003c/h3\u003e\n \u003chr style=\u0027border: 1px solid #e74c3c;\u0027\u003e\n \u003cp\u003e\u003cb\u003eIndustry:\u003c/b\u003e Automation Machinery Manufacturing\u003c/p\u003e\n \u003cp\u003e\u003cb\u003eSkills:\u003c/b\u003e Administrative, Project Management, Sales, Business Development, Administrative, Finance, Accounting/Auditing, Supply Chain, Management, Legal, Other,...\u003c/p\u003e\n \u003c/div\u003e"}, {"color": "#e74c3c", "font": {"color": "white"}, "id": "CO73", "label": "ADP", "shape": "box", "size": 18, "title": "\u003cdiv style=\u0027max-width: 350px;\u0027\u003e\n \u003ch3 style=\u0027color: #e74c3c;\u0027\u003e\ud83c\udfe2 ADP\u003c/h3\u003e\n \u003chr style=\u0027border: 1px solid #e74c3c;\u0027\u003e\n \u003cp\u003e\u003cb\u003eIndustry:\u003c/b\u003e Human Resources Services\u003c/p\u003e\n \u003cp\u003e\u003cb\u003eSkills:\u003c/b\u003e Sales, Business Development, Customer Service, Accounting/Auditing, Finance, Analyst, Accounting/Auditing, Other, Legal, Engineering, Information Tech...\u003c/p\u003e\n \u003c/div\u003e"}, {"color": "#e74c3c", "font": {"color": "white"}, "id": "CO21043", "label": "The Accounting Lab ", "shape": "box", "size": 18, "title": "\u003cdiv style=\u0027max-width: 350px;\u0027\u003e\n \u003ch3 style=\u0027color: #e74c3c;\u0027\u003e\ud83c\udfe2 The Accounting Lab \u003c/h3\u003e\n \u003chr style=\u0027border: 1px solid #e74c3c;\u0027\u003e\n \u003cp\u003e\u003cb\u003eIndustry:\u003c/b\u003e Accounting\u003c/p\u003e\n \u003cp\u003e\u003cb\u003eSkills:\u003c/b\u003e Accounting/Auditing...\u003c/p\u003e\n \u003c/div\u003e"}, {"color": "#e74c3c", "font": {"color": "white"}, "id": "CO20282", "label": "TrueBooks CPA", "shape": "box", "size": 18, "title": "\u003cdiv style=\u0027max-width: 350px;\u0027\u003e\n \u003ch3 style=\u0027color: #e74c3c;\u0027\u003e\ud83c\udfe2 TrueBooks CPA\u003c/h3\u003e\n \u003chr style=\u0027border: 1px solid #e74c3c;\u0027\u003e\n \u003cp\u003e\u003cb\u003eIndustry:\u003c/b\u003e Accounting\u003c/p\u003e\n \u003cp\u003e\u003cb\u003eSkills:\u003c/b\u003e Accounting/Auditing, Finance...\u003c/p\u003e\n \u003c/div\u003e"}, {"color": "#e74c3c", "font": {"color": "white"}, "id": "CO21674", "label": "Aniles \u0026 Company CPA", "shape": "box", "size": 18, "title": "\u003cdiv style=\u0027max-width: 350px;\u0027\u003e\n \u003ch3 style=\u0027color: #e74c3c;\u0027\u003e\ud83c\udfe2 Aniles \u0026 Company CPA Firm\u003c/h3\u003e\n \u003chr style=\u0027border: 1px solid #e74c3c;\u0027\u003e\n \u003cp\u003e\u003cb\u003eIndustry:\u003c/b\u003e Accounting\u003c/p\u003e\n \u003cp\u003e\u003cb\u003eSkills:\u003c/b\u003e Accounting/Auditing, Finance...\u003c/p\u003e\n \u003c/div\u003e"}, {"color": "#e74c3c", "font": {"color": "white"}, "id": "CO2", "label": "Hewlett Packard Ente", "shape": "box", "size": 18, "title": "\u003cdiv style=\u0027max-width: 350px;\u0027\u003e\n \u003ch3 style=\u0027color: #e74c3c;\u0027\u003e\ud83c\udfe2 Hewlett Packard Enterprise\u003c/h3\u003e\n \u003chr style=\u0027border: 1px solid #e74c3c;\u0027\u003e\n \u003cp\u003e\u003cb\u003eIndustry:\u003c/b\u003e IT Services and IT Consulting\u003c/p\u003e\n \u003cp\u003e\u003cb\u003eSkills:\u003c/b\u003e Information Technology, Project Management, Information Technology, Sales, Business Development, Business Development, Sales, Product Management, Mark...\u003c/p\u003e\n \u003c/div\u003e"}, {"color": "#e74c3c", "font": {"color": "white"}, "id": "CO7663", "label": "Codeworks IT Careers", "shape": "box", "size": 18, "title": "\u003cdiv style=\u0027max-width: 350px;\u0027\u003e\n \u003ch3 style=\u0027color: #e74c3c;\u0027\u003e\ud83c\udfe2 Codeworks IT Careers \u003c/h3\u003e\n \u003chr style=\u0027border: 1px solid #e74c3c;\u0027\u003e\n \u003cp\u003e\u003cb\u003eIndustry:\u003c/b\u003e IT Services and IT Consulting\u003c/p\u003e\n \u003cp\u003e\u003cb\u003eSkills:\u003c/b\u003e Information Technology...\u003c/p\u003e\n \u003c/div\u003e"}, {"color": "#e74c3c", "font": {"color": "white"}, "id": "CO3633", "label": "Charter Global", "shape": "box", "size": 18, "title": "\u003cdiv style=\u0027max-width: 350px;\u0027\u003e\n \u003ch3 style=\u0027color: #e74c3c;\u0027\u003e\ud83c\udfe2 Charter Global\u003c/h3\u003e\n \u003chr style=\u0027border: 1px solid #e74c3c;\u0027\u003e\n \u003cp\u003e\u003cb\u003eIndustry:\u003c/b\u003e IT Services and IT Consulting\u003c/p\u003e\n \u003cp\u003e\u003cb\u003eSkills:\u003c/b\u003e Information Technology, Consulting, Project Management, Management, Information Technology, Project Management, Management, Finance...\u003c/p\u003e\n \u003c/div\u003e"}, {"color": "#e74c3c", "font": {"color": "white"}, "id": "CO21755", "label": "Talent Strap", "shape": "box", "size": 18, "title": "\u003cdiv style=\u0027max-width: 350px;\u0027\u003e\n \u003ch3 style=\u0027color: #e74c3c;\u0027\u003e\ud83c\udfe2 Talent Strap\u003c/h3\u003e\n \u003chr style=\u0027border: 1px solid #e74c3c;\u0027\u003e\n \u003cp\u003e\u003cb\u003eIndustry:\u003c/b\u003e Software Development\u003c/p\u003e\n \u003cp\u003e\u003cb\u003eSkills:\u003c/b\u003e Engineering...\u003c/p\u003e\n \u003c/div\u003e"}, {"color": "#e74c3c", "font": {"color": "white"}, "id": "CO18853", "label": "Workera", "shape": "box", "size": 18, "title": "\u003cdiv style=\u0027max-width: 350px;\u0027\u003e\n \u003ch3 style=\u0027color: #e74c3c;\u0027\u003e\ud83c\udfe2 Workera\u003c/h3\u003e\n \u003chr style=\u0027border: 1px solid #e74c3c;\u0027\u003e\n \u003cp\u003e\u003cb\u003eIndustry:\u003c/b\u003e Software Development\u003c/p\u003e\n \u003cp\u003e\u003cb\u003eSkills:\u003c/b\u003e Sales, Business Development...\u003c/p\u003e\n \u003c/div\u003e"}, {"color": "#e74c3c", "font": {"color": "white"}, "id": "CO4653", "label": "Pluralsight", "shape": "box", "size": 18, "title": "\u003cdiv style=\u0027max-width: 350px;\u0027\u003e\n \u003ch3 style=\u0027color: #e74c3c;\u0027\u003e\ud83c\udfe2 Pluralsight\u003c/h3\u003e\n \u003chr style=\u0027border: 1px solid #e74c3c;\u0027\u003e\n \u003cp\u003e\u003cb\u003eIndustry:\u003c/b\u003e E-Learning Providers\u003c/p\u003e\n \u003cp\u003e\u003cb\u003eSkills:\u003c/b\u003e Engineering, Information Technology, Sales, Business Development, Administrative, Human Resources, Product Management, Marketing...\u003c/p\u003e\n \u003c/div\u003e"}, {"color": "#e74c3c", "font": {"color": "white"}, "id": "CO878", "label": "Advantage Technical", "shape": "box", "size": 18, "title": "\u003cdiv style=\u0027max-width: 350px;\u0027\u003e\n \u003ch3 style=\u0027color: #e74c3c;\u0027\u003e\ud83c\udfe2 Advantage Technical\u003c/h3\u003e\n \u003chr style=\u0027border: 1px solid #e74c3c;\u0027\u003e\n \u003cp\u003e\u003cb\u003eIndustry:\u003c/b\u003e Staffing and Recruiting\u003c/p\u003e\n \u003cp\u003e\u003cb\u003eSkills:\u003c/b\u003e Engineering, Manufacturing, Engineering, Other, Management, Manufacturing, Information Technology, Manufacturing, Other, Analyst, Finance, Manufacturi...\u003c/p\u003e\n \u003c/div\u003e"}, {"color": "#e74c3c", "font": {"color": "white"}, "id": "CO22408", "label": "Path Engineering", "shape": "box", "size": 18, "title": "\u003cdiv style=\u0027max-width: 350px;\u0027\u003e\n \u003ch3 style=\u0027color: #e74c3c;\u0027\u003e\ud83c\udfe2 Path Engineering\u003c/h3\u003e\n \u003chr style=\u0027border: 1px solid #e74c3c;\u0027\u003e\n \u003cp\u003e\u003cb\u003eIndustry:\u003c/b\u003e Industrial Machinery Manufacturing\u003c/p\u003e\n \u003cp\u003e\u003cb\u003eSkills:\u003c/b\u003e Management, Manufacturing, Engineering, Information Technology, Sales, Business Development, Design, Art/Creative, Information Technology, Other...\u003c/p\u003e\n \u003c/div\u003e"}, {"color": "#e74c3c", "font": {"color": "white"}, "id": "CO5143", "label": "Control System Integ", "shape": "box", "size": 18, "title": "\u003cdiv style=\u0027max-width: 350px;\u0027\u003e\n \u003ch3 style=\u0027color: #e74c3c;\u0027\u003e\ud83c\udfe2 Control System Integrators\u003c/h3\u003e\n \u003chr style=\u0027border: 1px solid #e74c3c;\u0027\u003e\n \u003cp\u003e\u003cb\u003eIndustry:\u003c/b\u003e Automation Machinery Manufacturing\u003c/p\u003e\n \u003cp\u003e\u003cb\u003eSkills:\u003c/b\u003e Engineering, Information Technology...\u003c/p\u003e\n \u003c/div\u003e"}, {"color": "#e74c3c", "font": {"color": "white"}, "id": "CO20380", "label": "Kelly Science, Engin", "shape": "box", "size": 18, "title": "\u003cdiv style=\u0027max-width: 350px;\u0027\u003e\n \u003ch3 style=\u0027color: #e74c3c;\u0027\u003e\ud83c\udfe2 Kelly Science, Engineering, Technology \u0026 Telecom\u003c/h3\u003e\n \u003chr style=\u0027border: 1px solid #e74c3c;\u0027\u003e\n \u003cp\u003e\u003cb\u003eIndustry:\u003c/b\u003e Staffing and Recruiting\u003c/p\u003e\n \u003cp\u003e\u003cb\u003eSkills:\u003c/b\u003e Manufacturing, Supply Chain, Manufacturing, Purchasing, Management, Research, Science, Science, Production, Manufacturing, Supply Chain, Information T...\u003c/p\u003e\n \u003c/div\u003e"}, {"color": "#e74c3c", "font": {"color": "white"}, "id": "CO16602", "label": "US IT Staffing ", "shape": "box", "size": 18, "title": "\u003cdiv style=\u0027max-width: 350px;\u0027\u003e\n \u003ch3 style=\u0027color: #e74c3c;\u0027\u003e\ud83c\udfe2 US IT Staffing \u003c/h3\u003e\n \u003chr style=\u0027border: 1px solid #e74c3c;\u0027\u003e\n \u003cp\u003e\u003cb\u003eIndustry:\u003c/b\u003e Staffing and Recruiting\u003c/p\u003e\n \u003cp\u003e\u003cb\u003eSkills:\u003c/b\u003e Engineering...\u003c/p\u003e\n \u003c/div\u003e"}, {"color": "#e74c3c", "font": {"color": "white"}, "id": "CO21571", "label": "CNA Search", "shape": "box", "size": 18, "title": "\u003cdiv style=\u0027max-width: 350px;\u0027\u003e\n \u003ch3 style=\u0027color: #e74c3c;\u0027\u003e\ud83c\udfe2 CNA Search\u003c/h3\u003e\n \u003chr style=\u0027border: 1px solid #e74c3c;\u0027\u003e\n \u003cp\u003e\u003cb\u003eIndustry:\u003c/b\u003e Staffing and Recruiting\u003c/p\u003e\n \u003cp\u003e\u003cb\u003eSkills:\u003c/b\u003e Sales, Business Development, Information Technology, Engineering, Information Technology, Other, Sales, Business Development, Management, Manufacturin...\u003c/p\u003e\n \u003c/div\u003e"}, {"color": "#e74c3c", "font": {"color": "white"}, "id": "CO21391", "label": "AtekIT", "shape": "box", "size": 18, "title": "\u003cdiv style=\u0027max-width: 350px;\u0027\u003e\n \u003ch3 style=\u0027color: #e74c3c;\u0027\u003e\ud83c\udfe2 AtekIT\u003c/h3\u003e\n \u003chr style=\u0027border: 1px solid #e74c3c;\u0027\u003e\n \u003cp\u003e\u003cb\u003eIndustry:\u003c/b\u003e IT Services and IT Consulting\u003c/p\u003e\n \u003cp\u003e\u003cb\u003eSkills:\u003c/b\u003e Information Technology...\u003c/p\u003e\n \u003c/div\u003e"}, {"color": "#e74c3c", "font": {"color": "white"}, "id": "CO20747", "label": "Data Glacier", "shape": "box", "size": 18, "title": "\u003cdiv style=\u0027max-width: 350px;\u0027\u003e\n \u003ch3 style=\u0027color: #e74c3c;\u0027\u003e\ud83c\udfe2 Data Glacier\u003c/h3\u003e\n \u003chr style=\u0027border: 1px solid #e74c3c;\u0027\u003e\n \u003cp\u003e\u003cb\u003eIndustry:\u003c/b\u003e IT Services and IT Consulting\u003c/p\u003e\n \u003cp\u003e\u003cb\u003eSkills:\u003c/b\u003e Engineering, Information Technology, Information Technology...\u003c/p\u003e\n \u003c/div\u003e"}, {"color": "#e74c3c", "font": {"color": "white"}, "id": "CO24115", "label": "Trustless Engineerin", "shape": "box", "size": 18, "title": "\u003cdiv style=\u0027max-width: 350px;\u0027\u003e\n \u003ch3 style=\u0027color: #e74c3c;\u0027\u003e\ud83c\udfe2 Trustless Engineering Corp\u003c/h3\u003e\n \u003chr style=\u0027border: 1px solid #e74c3c;\u0027\u003e\n \u003cp\u003e\u003cb\u003eIndustry:\u003c/b\u003e Software Development\u003c/p\u003e\n \u003cp\u003e\u003cb\u003eSkills:\u003c/b\u003e Engineering, Information Technology...\u003c/p\u003e\n \u003c/div\u003e"}, {"color": "#e74c3c", "font": {"color": "white"}, "id": "CO21236", "label": "MCubeSoft", "shape": "box", "size": 18, "title": "\u003cdiv style=\u0027max-width: 350px;\u0027\u003e\n \u003ch3 style=\u0027color: #e74c3c;\u0027\u003e\ud83c\udfe2 MCubeSoft\u003c/h3\u003e\n \u003chr style=\u0027border: 1px solid #e74c3c;\u0027\u003e\n \u003cp\u003e\u003cb\u003eIndustry:\u003c/b\u003e IT Services and IT Consulting\u003c/p\u003e\n \u003cp\u003e\u003cb\u003eSkills:\u003c/b\u003e Finance, Sales, Engineering, Information Technology, Information Technology...\u003c/p\u003e\n \u003c/div\u003e"}, {"color": "#e74c3c", "font": {"color": "white"}, "id": "CO20505", "label": "Array", "shape": "box", "size": 18, "title": "\u003cdiv style=\u0027max-width: 350px;\u0027\u003e\n \u003ch3 style=\u0027color: #e74c3c;\u0027\u003e\ud83c\udfe2 Array\u003c/h3\u003e\n \u003chr style=\u0027border: 1px solid #e74c3c;\u0027\u003e\n \u003cp\u003e\u003cb\u003eIndustry:\u003c/b\u003e Software Development\u003c/p\u003e\n \u003cp\u003e\u003cb\u003eSkills:\u003c/b\u003e Human Resources, Sales, Business Development...\u003c/p\u003e\n \u003c/div\u003e"}, {"color": "#e74c3c", "font": {"color": "white"}, "id": "CO6414", "label": "Noblesoft Solutions", "shape": "box", "size": 18, "title": "\u003cdiv style=\u0027max-width: 350px;\u0027\u003e\n \u003ch3 style=\u0027color: #e74c3c;\u0027\u003e\ud83c\udfe2 Noblesoft Solutions\u003c/h3\u003e\n \u003chr style=\u0027border: 1px solid #e74c3c;\u0027\u003e\n \u003cp\u003e\u003cb\u003eIndustry:\u003c/b\u003e IT Services and IT Consulting\u003c/p\u003e\n \u003cp\u003e\u003cb\u003eSkills:\u003c/b\u003e Information Technology, Project Management, Information Technology, Health Care Provider, Engineering, Other, Administrative...\u003c/p\u003e\n \u003c/div\u003e"}, {"color": "#e74c3c", "font": {"color": "white"}, "id": "CO16352", "label": "Peraton Labs", "shape": "box", "size": 18, "title": "\u003cdiv style=\u0027max-width: 350px;\u0027\u003e\n \u003ch3 style=\u0027color: #e74c3c;\u0027\u003e\ud83c\udfe2 Peraton Labs\u003c/h3\u003e\n \u003chr style=\u0027border: 1px solid #e74c3c;\u0027\u003e\n \u003cp\u003e\u003cb\u003eIndustry:\u003c/b\u003e Defense and Space Manufacturing\u003c/p\u003e\n \u003cp\u003e\u003cb\u003eSkills:\u003c/b\u003e Other, Information Technology...\u003c/p\u003e\n \u003c/div\u003e"}, {"color": "#e74c3c", "font": {"color": "white"}, "id": "CO23088", "label": "eduPhoria.ai", "shape": "box", "size": 18, "title": "\u003cdiv style=\u0027max-width: 350px;\u0027\u003e\n \u003ch3 style=\u0027color: #e74c3c;\u0027\u003e\ud83c\udfe2 eduPhoria.ai\u003c/h3\u003e\n \u003chr style=\u0027border: 1px solid #e74c3c;\u0027\u003e\n \u003cp\u003e\u003cb\u003eIndustry:\u003c/b\u003e Higher Education\u003c/p\u003e\n \u003cp\u003e\u003cb\u003eSkills:\u003c/b\u003e Engineering, Information Technology...\u003c/p\u003e\n \u003c/div\u003e"}, {"color": "#e74c3c", "font": {"color": "white"}, "id": "CO19071", "label": "Eleos Labs", "shape": "box", "size": 18, "title": "\u003cdiv style=\u0027max-width: 350px;\u0027\u003e\n \u003ch3 style=\u0027color: #e74c3c;\u0027\u003e\ud83c\udfe2 Eleos Labs\u003c/h3\u003e\n \u003chr style=\u0027border: 1px solid #e74c3c;\u0027\u003e\n \u003cp\u003e\u003cb\u003eIndustry:\u003c/b\u003e Software Development\u003c/p\u003e\n \u003cp\u003e\u003cb\u003eSkills:\u003c/b\u003e Engineering, Information Technology...\u003c/p\u003e\n \u003c/div\u003e"}, {"color": "#e74c3c", "font": {"color": "white"}, "id": "CO23220", "label": "Cross Platform Devel", "shape": "box", "size": 18, "title": "\u003cdiv style=\u0027max-width: 350px;\u0027\u003e\n \u003ch3 style=\u0027color: #e74c3c;\u0027\u003e\ud83c\udfe2 Cross Platform Developer\u003c/h3\u003e\n \u003chr style=\u0027border: 1px solid #e74c3c;\u0027\u003e\n \u003cp\u003e\u003cb\u003eIndustry:\u003c/b\u003e Software Development\u003c/p\u003e\n \u003cp\u003e\u003cb\u003eSkills:\u003c/b\u003e Engineering, Information Technology...\u003c/p\u003e\n \u003c/div\u003e"}, {"color": "#e74c3c", "font": {"color": "white"}, "id": "CO20328", "label": "bERZZANI", "shape": "box", "size": 18, "title": "\u003cdiv style=\u0027max-width: 350px;\u0027\u003e\n \u003ch3 style=\u0027color: #e74c3c;\u0027\u003e\ud83c\udfe2 bERZZANI\u003c/h3\u003e\n \u003chr style=\u0027border: 1px solid #e74c3c;\u0027\u003e\n \u003cp\u003e\u003cb\u003eIndustry:\u003c/b\u003e Software Development\u003c/p\u003e\n \u003cp\u003e\u003cb\u003eSkills:\u003c/b\u003e Engineering, Information Technology...\u003c/p\u003e\n \u003c/div\u003e"}, {"color": "#e74c3c", "font": {"color": "white"}, "id": "CO22775", "label": "iCode Technologies", "shape": "box", "size": 18, "title": "\u003cdiv style=\u0027max-width: 350px;\u0027\u003e\n \u003ch3 style=\u0027color: #e74c3c;\u0027\u003e\ud83c\udfe2 iCode Technologies\u003c/h3\u003e\n \u003chr style=\u0027border: 1px solid #e74c3c;\u0027\u003e\n \u003cp\u003e\u003cb\u003eIndustry:\u003c/b\u003e Software Development\u003c/p\u003e\n \u003cp\u003e\u003cb\u003eSkills:\u003c/b\u003e Legal, Engineering, Information Technology...\u003c/p\u003e\n \u003c/div\u003e"}, {"color": "#e74c3c", "font": {"color": "white"}, "id": "CO22852", "label": "AspiringIT", "shape": "box", "size": 18, "title": "\u003cdiv style=\u0027max-width: 350px;\u0027\u003e\n \u003ch3 style=\u0027color: #e74c3c;\u0027\u003e\ud83c\udfe2 AspiringIT\u003c/h3\u003e\n \u003chr style=\u0027border: 1px solid #e74c3c;\u0027\u003e\n \u003cp\u003e\u003cb\u003eIndustry:\u003c/b\u003e IT Services and IT Consulting\u003c/p\u003e\n \u003cp\u003e\u003cb\u003eSkills:\u003c/b\u003e Engineering, Information Technology, Information Technology, Project Management, Information Technology, Research, Analyst, Information Technology, Hu...\u003c/p\u003e\n \u003c/div\u003e"}, {"color": "#e74c3c", "font": {"color": "white"}, "id": "CO22688", "label": "Aorton Inc", "shape": "box", "size": 18, "title": "\u003cdiv style=\u0027max-width: 350px;\u0027\u003e\n \u003ch3 style=\u0027color: #e74c3c;\u0027\u003e\ud83c\udfe2 Aorton Inc\u003c/h3\u003e\n \u003chr style=\u0027border: 1px solid #e74c3c;\u0027\u003e\n \u003cp\u003e\u003cb\u003eIndustry:\u003c/b\u003e Software Development\u003c/p\u003e\n \u003cp\u003e\u003cb\u003eSkills:\u003c/b\u003e Engineering, Information Technology, Information Technology...\u003c/p\u003e\n \u003c/div\u003e"}, {"color": "#e74c3c", "font": {"color": "white"}, "id": "CO23041", "label": "Chroma", "shape": "box", "size": 18, "title": "\u003cdiv style=\u0027max-width: 350px;\u0027\u003e\n \u003ch3 style=\u0027color: #e74c3c;\u0027\u003e\ud83c\udfe2 Chroma\u003c/h3\u003e\n \u003chr style=\u0027border: 1px solid #e74c3c;\u0027\u003e\n \u003cp\u003e\u003cb\u003eIndustry:\u003c/b\u003e Software Development\u003c/p\u003e\n \u003cp\u003e\u003cb\u003eSkills:\u003c/b\u003e Engineering, Information Technology...\u003c/p\u003e\n \u003c/div\u003e"}, {"color": "#e74c3c", "font": {"color": "white"}, "id": "CO18069", "label": "Commit: AI Career Ag", "shape": "box", "size": 18, "title": "\u003cdiv style=\u0027max-width: 350px;\u0027\u003e\n \u003ch3 style=\u0027color: #e74c3c;\u0027\u003e\ud83c\udfe2 Commit: AI Career Agents for Developers\u003c/h3\u003e\n \u003chr style=\u0027border: 1px solid #e74c3c;\u0027\u003e\n \u003cp\u003e\u003cb\u003eIndustry:\u003c/b\u003e Technology, Information and Internet\u003c/p\u003e\n \u003cp\u003e\u003cb\u003eSkills:\u003c/b\u003e Engineering...\u003c/p\u003e\n \u003c/div\u003e"}, {"color": "#e74c3c", "font": {"color": "white"}, "id": "CO23906", "label": "Tranquility AI", "shape": "box", "size": 18, "title": "\u003cdiv style=\u0027max-width: 350px;\u0027\u003e\n \u003ch3 style=\u0027color: #e74c3c;\u0027\u003e\ud83c\udfe2 Tranquility AI\u003c/h3\u003e\n \u003chr style=\u0027border: 1px solid #e74c3c;\u0027\u003e\n \u003cp\u003e\u003cb\u003eIndustry:\u003c/b\u003e Software Development\u003c/p\u003e\n \u003cp\u003e\u003cb\u003eSkills:\u003c/b\u003e Design, Art/Creative, Information Technology...\u003c/p\u003e\n \u003c/div\u003e"}]);
|
| 286 |
+
edges = new vis.DataSet([{"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C0", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #1\u003cbr\u003e\n Score: 0.711", "to": "CO6537", "value": 7.105909585952759}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C0", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #2\u003cbr\u003e\n Score: 0.644", "to": "CO6383", "value": 6.444999575614929}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C0", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #3\u003cbr\u003e\n Score: 0.640", "to": "CO20497", "value": 6.403027772903442}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C0", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #4\u003cbr\u003e\n Score: 0.632", "to": "CO739", "value": 6.3194334506988525}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C0", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #5\u003cbr\u003e\n Score: 0.615", "to": "CO10803", "value": 6.151611804962158}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C1", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #1\u003cbr\u003e\n Score: 0.633", "to": "CO4917", "value": 6.333393454551697}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C1", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #2\u003cbr\u003e\n Score: 0.602", "to": "CO84", "value": 6.021978259086609}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C1", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #3\u003cbr\u003e\n Score: 0.581", "to": "CO387", "value": 5.814119577407837}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C1", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #4\u003cbr\u003e\n Score: 0.564", "to": "CO6684", "value": 5.638968348503113}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C1", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #5\u003cbr\u003e\n Score: 0.559", "to": "CO16692", "value": 5.591837167739868}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C2", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #1\u003cbr\u003e\n Score: 0.621", "to": "CO16692", "value": 6.208059787750244}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C2", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #2\u003cbr\u003e\n Score: 0.590", "to": "CO23528", "value": 5.900249481201172}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C2", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #3\u003cbr\u003e\n Score: 0.575", "to": "CO387", "value": 5.7489073276519775}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C2", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #4\u003cbr\u003e\n Score: 0.568", "to": "CO19247", "value": 5.684380531311035}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C2", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #5\u003cbr\u003e\n Score: 0.561", "to": "CO22619", "value": 5.606639981269836}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C3", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #1\u003cbr\u003e\n Score: 0.654", "to": "CO16692", "value": 6.537457704544067}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C3", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #2\u003cbr\u003e\n Score: 0.606", "to": "CO9694", "value": 6.055644750595093}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C3", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #3\u003cbr\u003e\n Score: 0.604", "to": "CO387", "value": 6.039410829544067}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C3", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #4\u003cbr\u003e\n Score: 0.603", "to": "CO11295", "value": 6.025882363319397}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C3", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #5\u003cbr\u003e\n Score: 0.600", "to": "CO73", "value": 6.002045273780823}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C4", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #1\u003cbr\u003e\n Score: 0.650", "to": "CO21043", "value": 6.503530144691467}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C4", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #2\u003cbr\u003e\n Score: 0.639", "to": "CO9694", "value": 6.394152641296387}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C4", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #3\u003cbr\u003e\n Score: 0.630", "to": "CO20282", "value": 6.296863555908203}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C4", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #4\u003cbr\u003e\n Score: 0.624", "to": "CO21674", "value": 6.240169405937195}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C4", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #5\u003cbr\u003e\n Score: 0.622", "to": "CO19247", "value": 6.2223416566848755}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C5", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #1\u003cbr\u003e\n Score: 0.649", "to": "CO16692", "value": 6.489924788475037}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C5", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #2\u003cbr\u003e\n Score: 0.621", "to": "CO2", "value": 6.20557963848114}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C5", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #3\u003cbr\u003e\n Score: 0.613", "to": "CO7663", "value": 6.126346588134766}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C5", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #4\u003cbr\u003e\n Score: 0.608", "to": "CO3633", "value": 6.080694198608398}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C5", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #5\u003cbr\u003e\n Score: 0.603", "to": "CO387", "value": 6.02503776550293}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C6", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #1\u003cbr\u003e\n Score: 0.548", "to": "CO23528", "value": 5.478517413139343}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C6", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #2\u003cbr\u003e\n Score: 0.509", "to": "CO21755", "value": 5.086046457290649}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C6", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #3\u003cbr\u003e\n Score: 0.501", "to": "CO18853", "value": 5.005985498428345}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C6", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #4\u003cbr\u003e\n Score: 0.496", "to": "CO84", "value": 4.962232708930969}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C6", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #5\u003cbr\u003e\n Score: 0.483", "to": "CO4653", "value": 4.82915997505188}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C7", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #1\u003cbr\u003e\n Score: 0.650", "to": "CO878", "value": 6.49905264377594}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C7", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #2\u003cbr\u003e\n Score: 0.617", "to": "CO22408", "value": 6.171855330467224}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C7", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #3\u003cbr\u003e\n Score: 0.588", "to": "CO5143", "value": 5.883540511131287}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C7", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #4\u003cbr\u003e\n Score: 0.582", "to": "CO20380", "value": 5.823123455047607}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C7", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #5\u003cbr\u003e\n Score: 0.580", "to": "CO16602", "value": 5.799773931503296}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C8", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #1\u003cbr\u003e\n Score: 0.521", "to": "CO23528", "value": 5.207852721214294}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C8", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #2\u003cbr\u003e\n Score: 0.515", "to": "CO21571", "value": 5.1490819454193115}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C8", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #3\u003cbr\u003e\n Score: 0.505", "to": "CO6684", "value": 5.051515698432922}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C8", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #4\u003cbr\u003e\n Score: 0.504", "to": "CO21391", "value": 5.037369132041931}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C8", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #5\u003cbr\u003e\n Score: 0.501", "to": "CO20747", "value": 5.007866621017456}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C9", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #1\u003cbr\u003e\n Score: 0.616", "to": "CO22619", "value": 6.156595945358276}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C9", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #2\u003cbr\u003e\n Score: 0.611", "to": "CO16692", "value": 6.109399795532227}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C9", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #3\u003cbr\u003e\n Score: 0.598", "to": "CO387", "value": 5.97770094871521}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C9", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #4\u003cbr\u003e\n Score: 0.591", "to": "CO23528", "value": 5.911911725997925}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C9", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #5\u003cbr\u003e\n Score: 0.586", "to": "CO24115", "value": 5.86316704750061}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C10", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #1\u003cbr\u003e\n Score: 0.648", "to": "CO21236", "value": 6.480913162231445}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C10", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #2\u003cbr\u003e\n Score: 0.647", "to": "CO16692", "value": 6.46884560585022}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C10", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #3\u003cbr\u003e\n Score: 0.614", "to": "CO20505", "value": 6.144018173217773}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C10", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #4\u003cbr\u003e\n Score: 0.613", "to": "CO6414", "value": 6.13012969493866}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C10", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #5\u003cbr\u003e\n Score: 0.611", "to": "CO387", "value": 6.1073267459869385}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C11", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #1\u003cbr\u003e\n Score: 0.626", "to": "CO16692", "value": 6.257445216178894}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C11", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #2\u003cbr\u003e\n Score: 0.607", "to": "CO23528", "value": 6.066656708717346}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C11", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #3\u003cbr\u003e\n Score: 0.604", "to": "CO6684", "value": 6.0389769077301025}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C11", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #4\u003cbr\u003e\n Score: 0.598", "to": "CO19247", "value": 5.982406139373779}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C11", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #5\u003cbr\u003e\n Score: 0.578", "to": "CO387", "value": 5.778516530990601}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C12", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #1\u003cbr\u003e\n Score: 0.619", "to": "CO4917", "value": 6.189342737197876}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C12", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #2\u003cbr\u003e\n Score: 0.612", "to": "CO23528", "value": 6.117350459098816}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C12", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #3\u003cbr\u003e\n Score: 0.595", "to": "CO387", "value": 5.9526848793029785}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C12", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #4\u003cbr\u003e\n Score: 0.591", "to": "CO84", "value": 5.9125590324401855}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C12", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #5\u003cbr\u003e\n Score: 0.590", "to": "CO6684", "value": 5.8978986740112305}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C13", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #1\u003cbr\u003e\n Score: 0.561", "to": "CO16352", "value": 5.606294274330139}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C13", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #2\u003cbr\u003e\n Score: 0.560", "to": "CO23088", "value": 5.601434111595154}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C13", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #3\u003cbr\u003e\n Score: 0.557", "to": "CO24115", "value": 5.573226809501648}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C13", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #4\u003cbr\u003e\n Score: 0.557", "to": "CO16692", "value": 5.570058822631836}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C13", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #5\u003cbr\u003e\n Score: 0.554", "to": "CO19071", "value": 5.538139343261719}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C14", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #1\u003cbr\u003e\n Score: 0.584", "to": "CO23220", "value": 5.842660665512085}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C14", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #2\u003cbr\u003e\n Score: 0.540", "to": "CO20328", "value": 5.398102402687073}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C14", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #3\u003cbr\u003e\n Score: 0.539", "to": "CO22775", "value": 5.3861260414123535}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C14", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #4\u003cbr\u003e\n Score: 0.531", "to": "CO22852", "value": 5.31338632106781}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C14", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #5\u003cbr\u003e\n Score: 0.520", "to": "CO22688", "value": 5.2049994468688965}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C15", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #1\u003cbr\u003e\n Score: 0.610", "to": "CO23528", "value": 6.096929311752319}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C15", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #2\u003cbr\u003e\n Score: 0.563", "to": "CO24115", "value": 5.634749531745911}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C15", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #3\u003cbr\u003e\n Score: 0.557", "to": "CO387", "value": 5.566153526306152}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C15", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #4\u003cbr\u003e\n Score: 0.546", "to": "CO23041", "value": 5.456312298774719}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C15", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #5\u003cbr\u003e\n Score: 0.538", "to": "CO16692", "value": 5.383263826370239}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C16", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #1\u003cbr\u003e\n Score: 0.724", "to": "CO16692", "value": 7.24058985710144}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C16", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #2\u003cbr\u003e\n Score: 0.655", "to": "CO11295", "value": 6.54738187789917}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C16", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #3\u003cbr\u003e\n Score: 0.648", "to": "CO387", "value": 6.480828523635864}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C16", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #4\u003cbr\u003e\n Score: 0.642", "to": "CO19247", "value": 6.418501138687134}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C16", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #5\u003cbr\u003e\n Score: 0.640", "to": "CO21236", "value": 6.401845216751099}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C17", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #1\u003cbr\u003e\n Score: 0.560", "to": "CO23528", "value": 5.6036365032196045}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C17", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #2\u003cbr\u003e\n Score: 0.556", "to": "CO22619", "value": 5.561906099319458}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C17", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #3\u003cbr\u003e\n Score: 0.546", "to": "CO21755", "value": 5.464118719100952}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C17", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #4\u003cbr\u003e\n Score: 0.545", "to": "CO18069", "value": 5.451418161392212}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C17", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #5\u003cbr\u003e\n Score: 0.539", "to": "CO23906", "value": 5.389403700828552}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C18", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #1\u003cbr\u003e\n Score: 0.584", "to": "CO23220", "value": 5.842660665512085}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C18", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #2\u003cbr\u003e\n Score: 0.540", "to": "CO20328", "value": 5.398102402687073}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C18", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #3\u003cbr\u003e\n Score: 0.539", "to": "CO22775", "value": 5.3861260414123535}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C18", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #4\u003cbr\u003e\n Score: 0.531", "to": "CO22852", "value": 5.31338632106781}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C18", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #5\u003cbr\u003e\n Score: 0.520", "to": "CO22688", "value": 5.2049994468688965}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C19", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #1\u003cbr\u003e\n Score: 0.554", "to": "CO23528", "value": 5.539727210998535}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C19", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #2\u003cbr\u003e\n Score: 0.513", "to": "CO24115", "value": 5.12693464756012}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C19", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #3\u003cbr\u003e\n Score: 0.506", "to": "CO23088", "value": 5.055974125862122}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C19", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #4\u003cbr\u003e\n Score: 0.505", "to": "CO16352", "value": 5.0547802448272705}, {"color": {"color": "#95a5a6", "opacity": 0.6}, "from": "C19", "title": "\u003cb\u003eMatch Quality\u003c/b\u003e\u003cbr\u003e\n Rank: #5\u003cbr\u003e\n Score: 0.501", "to": "CO22619", "value": 5.013402700424194}]);
|
| 287 |
+
|
| 288 |
+
nodeColors = {};
|
| 289 |
+
allNodes = nodes.get({ returnType: "Object" });
|
| 290 |
+
for (nodeId in allNodes) {
|
| 291 |
+
nodeColors[nodeId] = allNodes[nodeId].color;
|
| 292 |
+
}
|
| 293 |
+
allEdges = edges.get({ returnType: "Object" });
|
| 294 |
+
// adding nodes and edges to the graph
|
| 295 |
+
data = {nodes: nodes, edges: edges};
|
| 296 |
+
|
| 297 |
+
var options = {"physics": {"forceAtlas2Based": {"gravitationalConstant": -50, "centralGravity": 0.01, "springLength": 200, "springConstant": 0.08, "avoidOverlap": 1}, "maxVelocity": 30, "solver": "forceAtlas2Based", "stabilization": {"iterations": 150}}, "interaction": {"hover": true, "navigationButtons": true}};
|
| 298 |
+
|
| 299 |
+
|
| 300 |
+
|
| 301 |
+
|
| 302 |
+
|
| 303 |
+
|
| 304 |
+
network = new vis.Network(container, data, options);
|
| 305 |
+
|
| 306 |
+
|
| 307 |
+
|
| 308 |
+
|
| 309 |
+
|
| 310 |
+
|
| 311 |
+
|
| 312 |
+
|
| 313 |
+
|
| 314 |
+
|
| 315 |
+
return network;
|
| 316 |
+
|
| 317 |
+
}
|
| 318 |
+
drawGraph();
|
| 319 |
+
</script>
|
| 320 |
+
</body>
|
| 321 |
+
</html>
|
data/results/score_distribution.png
ADDED
|
data/results/tsne_interactive.html
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|