encoding fashion rules into mathematical data structures (part one)

As we build our fashion recommendation engine, we seek rules to populate it with. With few exceptions (e.g. [1]), we find these rules encoded in prose or infographic form, rather than a semantic web form suitable for computation. For example, [2] provides written advice on dressing fabulously for a “rectangular” women’s body type. The writers meant this document for a human reader, not a computer program.

However, we can’t scale a process consisting of manual extraction of rules to the level we would like to achieve in this project, so we turn to natural language processing to extract rules from texts in an automated fashion. We begin by identifying parts of speech and the syntax relationships between words in sentences. For example, consider the following two fashion rules from [2]:

  • If you are a heavy or tall rectangle, choose a big bag.
  • If you are a petite rectangle, choose a petite bag.

We then create a directed graph with words as nodes, each with an attribute indicating its part of speech, and edges indicating the syntactic relationships between the nodes (e.g., “heavy” is a modifier of “rectangle”). We also add edges to specify the direction of sentence flow. Visualizing the above two sentences in this form using Neo4j [3] yields:

Next Steps

In the next phase, we plan to automatically derive computationally useful IFTHENELSE rules from such mappings. For example, the above two sentences express in IFTHENELSE form as:

  • IF rectangle AND (heavy OR tall) THEN choose a big bag
  • IF rectangle AND petite THEN choose a petite bag

Once we form a comprehensive set of such rules, we will load them into an expert system or related system to enable fuzzy reasoning on the rules, enabling custom fashion recommendations!

After this, we will come up with a way to reconcile similar recommendations. For example, suppose we find the following two IFTHENELSE rules from two different sources:

  • IF rectangle AND (heavy OR tall) THEN choose a big bag
  • IF rectangle AND (heavy set OR tall) THEN select a big bag

These say the same thing. We will devise a way to combine them into one recommendation such that the weight (value) of the recommendation doubles due to its backing by two distinct sources.


  1. Vogiatzis, D. Pierrakos, G. Paliouras, S. Jenkyn-Jones, B.J.H.H.A. Possen, Expert and community based style advice, Expert Systems with Applications, Volume 39, Issue 12, 2012, Pages 10647-10655, ISSN 0957-4174, https://doi.org/10.1016/j.eswa.2012.02.178. (http://www.sciencedirect.com/science/article/pii/S0957417412004411) Keywords: Style advice; Recommender system; Fashion ontology; User modeling
  2. http://www.styled247.com/rectangle-body-shape
  3. https://neo4j.com

Leave a Reply

Your email address will not be published.