Back to All Blogs
NLP & Machine Learning Engine

Course Recommendation System — Discovery Engine

An intelligent content-based course discovery platform delivering personalized learning pathways across 3,424+ curated online courses. Built using Natural Language Processing (TF-IDF vectorization, Cosine Similarity, and N-gram tokenization) coupled with diversity-aware ranking and a robust Flask RESTful API.

3,424+ Online Courses
TF-IDF Vectorization
Flask RESTful Engine
Playwright E2E Verification

Machine Learning Pipeline & Architecture

NLP Feature Extraction & Similarity

  • Text preprocessing: tokenization, lowercasing, stop-word removal, and punctuation stripping.
  • TF-IDF Vectorization over course titles, syllabi, technical skills taught, and provider metadata.
  • High-dimensional vector dot product calculating pairwise Cosine Similarity matrices in real time.
  • Diversity-aware candidate filtering to balance similarity scores and prevent institutional clustering.

System Architecture & Testing

  • Flask 3.0.3 backend exposing clean RESTful endpoints: /courses, /recommend, /api/health.
  • Interactive search interface featuring real-time client-side autocomplete and live course counters.
  • Unit and integration test suites implemented with pytest and pytest-cov.
  • End-to-end automated UI verification executed using Playwright test suites.

Model Recommendation Pipeline Snippet

# TF-IDF Feature Extraction & Cosine Similarity Calculation
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.metrics.pairwise import cosine_similarity

tfidf = TfidfVectorizer(stop_words='english', max_features=5000, ngram_range=(1, 2))
tfidf_matrix = tfidf.fit_transform(courses['combined_features'])

def get_recommendations(course_idx, top_n=5):
    # Compute similarity between selected course and all courses
    sim_scores = cosine_similarity(tfidf_matrix[course_idx], tfidf_matrix).flatten()
    related_indices = sim_scores.argsort()[-(top_n + 1):-1][::-1]
    return courses.iloc[related_indices][['Course Name', 'University', 'Difficulty Level', 'Course Rating']]