← Selected Work

AI & ML · ML web app

DiscreteSolver

Solves combinatorics word problems. A trained classifier names the problem type, a parser pulls out the numbers, and the answer comes back as a step-by-step formula.

classifies the problem type
SVC
step-by-step answers
KaTeX

Why I built it

In the winter semester I took Discrete Structures II, which had the trickiest permutation and combination word problems. I was into problem solving and wanted to learn machine learning, so I built this with my teammate Krish.

We didn't like how twisted the questions were, but after a lot of practice, permutations and combinations became one of my favourite topics.

Problem

Combinatorics word problems are phrased in endless ways, so fixed rules break easily, while sending every question to a large language model adds delay and cost for what is often a single formula.

Approach

A Flask app with a scikit-learn Support Vector Classifier that sorts each question into a problem type, such as a combination or a permutation. A regular-expression parser extracts the values of n and r, including numbers written as words, and the matching formula is rendered step by step with KaTeX.

Results

Covered by a PyTest suite, and it runs in Docker. Because the model is small and runs on the server, answers come back without any paid API call.

What's next

Krish and I are planning to make it robust for discrete structures word problems in general.