# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

# This notebook checks to make sure the pickled model is working properly.

import pickle
import gensim
import pandas as pd

# Load the pickled model from disk
model = pickle.load(open('model.p', 'rb'))

# Select a sample job description
js = "'\nData Scientist\n\nat Brightidea\n\nSan Francisco\n\nThe Role\n\nWe are seeking machine learning developers with natural language processing experience.\n\nIn general, we are looking for people who are self-motivated and passionate about the field of machine learning and the vast applications of it. These folks will have the ability to work with / understand / and build on top of an existing code base using their deep knowledge of various machine learning algorithms (e.g. neural networks, bayesian methods, etc).\n\nKey responsibilities include, but not limited to:\n\n\nBuild on top of an existing text processing/classification system\nWrite, maintain, and develop python machine learning modules & repos\nRun hyperparameter optimizations + collect, analyze, visualize, and present results\n\nWhat You Need to Succeed\n\nBS or MS in computer science, mathematics, physics or other hard science/engineering discipline\nProgramming in Python ~ 2+ years\nNumpy, scipy, pandas, Jupyter, and scikit-learn background\nData visualization (e.g. matplotlib, seaborn, bokeh, mpld3, etc)\nAbility to implement machine learning algorithms from scratch\nExperience with full machine learning pipeline: from data preprocessing, to building/training various models, to hyperparameter optimization, testing, and visualization of results.\nBackground in deep learning preferred but not required\n\nIn Your Application Please Include\n\n\n\nA past machine learning project you worked on in which highlights your skills, including: What tools/models did you use? What were some problems you encountered along the way, and how did you solve them?"

# Preprocess the job description
doc = gensim.utils.simple_preprocess(js)

# Vectorize the job description
vector = model.infer_vector(doc)

# Extract the most similar docs from the model
sims = model.docvecs.most_similar([vector])
sims

# Read in the course data
course_df = pd.read_csv('../Data/Course_Data/Coursera_Catalog.csv')
course_df.head(2)

# Extract course ids from the similar doc list
course_ids = [sim[0] for sim in sims]

# Display the names of the most similar courses
course_df.loc[course_ids, 'name']



StarcoderdataJupyterScriptsDedupFiltered