Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Knowledge Graphs --Enter--> The Hype Cycle (PyData 2019)

So you have heard the hype about knowledge graphs? How can Pythonistas join forces with Fashionistas to form an authoritative single source of truth for fashion e-commerce, benefiting applications such as Search, Discovery, and Personalisation. This talk will give you a unique insight into how knowledge graphs can provide powerful ways to analyse and emphasise relationships in data.


At Farfetch, we are building a Fashion Knowledge Graph to form a rich, authoritative source of fashion knowledge to enhance applications such as search. In this talk, we describe the directions we are investigating in building and using such a graph, including using Python in harvesting product knowledge from the web, human-in-the-loop knowledge learning, and graph-enhanced search. This talk will present our progress in these directions, explore the challenges in an enterprise environment, and show the exciting research opportunities.

  • Be the first to comment

Knowledge Graphs --Enter--> The Hype Cycle (PyData 2019)

  1. 1. Knowledge Graphs --Enter--> The Hype Cycle @GeorgeCushen PyData London 2019
  2. 2. Image: HBO
  3. 3. 4 The Hype Cycle Proof Mr Porter Eminem P Diddy DJ Khaled Notorious B.I.G. DJ Khaled Image: Meghan Roberts Rihanna collaborated_with wants_to_collaborate_with
  4. 4. Image: Paramount Pictures
  5. 5. 6 Outfit available from
  6. 6. Farfetch at a glance 7 > 3,000* Employees across 13 countries $1.4 Billion* Gross Merchandise Value > 3,000* Brands available for consumers to shop > 1,000** Luxury sellers on the Marketplace $601** AOV on Marketplace > 2.9 Million* Orders on Marketplace 1.7 million** Active Marketplace consumers $307 Billion Size of personal luxury good industry (Bain estimates) *Correct for full year 2018 **As at Q1 2019 15** Marketplace language sites
  7. 7. 8 What is this graph thing? “Hey, I’ve got this lit bar graph visualization for you! It’s 🔥🔥🔥!”
  8. 8. A New Perspective: Emphasising Relationships ● Businesses and their products/services are all about Entities and Relationships ● Examples of entities and relationships in industry: Farfetch Consumer searches Product with Terms Amazon Seller sells Product to Consumer Uber Driver provides Trip to Rider Facebook Person shares Status with Friend ● How can we represent, analyse, and visualise this kind of data?
  9. 9. 10 What is a knowledge graph? A knowledge graph can describe ● a collection of nodes (entities) representing business and fashion entities has_term ● and with labeled relationships between the nodes Product D&G tote bag Attribute Leopard Print Attribute Leopard Spots Attribute Animal Print Properties: Language = “EN” ● each containing information (properties) Properties: ProductID = 123
  10. 10. 11 Dots and Lines
  11. 11. Image: ICIJ
  12. 12. The Panama Papers 14
  13. 13. 16 Discovering the pearl DELFINA DELETTREZ 'Trillion' earring
  14. 14. 17 Discovering the diamond JIMMY CHOO Diamond sneakers
  15. 15. 18 Generic vs Domain Specific Knowledge Graphs Generic vs Domain Specific Generic Domain Specific: Fashion Products Products Brands Categories Editorials ... Attributes Synonyms Colours Materials Concepts ... Customers Orders Payments Promotions Reviews ...
  16. 16. 19 Example Use Cases Free Text Search Increase product discovery with synonyms and rich attributes for material, occasion (e.g. skiing), etc. Semantic Search Increase product discovery based by using graph to understand consumer’s intent Ranking Leverage rich product connections to increase relevance on listing pages Recommendations Increase relevance based on richer product attributes and deep graph relationships
  17. 17. 20 Building the fashion knowledge graph Search Recommendations ... F-Graph (Associates taxonomy entities with business entities) AI Knowledge cleaning Entity resolution Schema mapping Applications Taxonomy & Graph Construction Knowledge Collection Expert Knowledge Data-Driven Insights
  18. 18. Skinny 21 Universal Fashion Taxonomy Fashion Taxonomy Synonyms Descriptive attributes Brand DNA Materials ColoursTrends Editorial, emotive, seasonal concepts Textile Cotton Denim Product 2 Swedish Design Acne Glastonbury Festival Summer Product 1 PrintsSnake Blue Light Blue
  19. 19. Synonym Enrichment Padded coat Down coat Duvet coat Quilted coat Puffer jacket Down-filled jacket Down jacket Quilted jacket Duvet jacket Down-filled coat Padded jacket Puffer coat
  20. 20. Techniques 📷 CV/DL + 📖 NLP + ✔️ Conflation + 👙 Inference + 👥 Crowdsourcing 23
  21. 21. 24 Richer Product Data Existing catalog External Enrichment Internal Enrichment
  22. 22. 25 Richer Product Data Existing catalog data AI predicts richer and more diverse attributes The fashion knowledge graph, F-Graph, connects and enriches entities Qualityof ProductDNA
  23. 23. 26 Building a simple graph in Python import networkx as nx import matplotlib.pyplot as plt graph = nx.DiGraph() graph.add_node(0, name='Product A'), graph.add_node(1), graph.add_node(2), graph.add_node(3), graph.add_node(4) graph.add_edge(0, 1, weight=0.75), graph.add_edge(0, 4),graph.add_edge(1, 2), graph.add_edge(0, 2),graph.add_edge(1, 4), graph.add_edge(1, 3), graph.add_edge(3, 2), graph.add_edge(3,1), graph.add_edge(4,3) nx.draw(graph, with_labels=True, font_weight='bold') $ pipenv install networkx matplotlib
  24. 24. 27 Graph databases ● Neo4j ○ Packages: neo4j, py2neo ● AWS Neptune ○ Package: gremlinpython ● Azure Cosmos ○ Package: gremlinpython
  25. 25. 28 Demo Image: Epic Games
  26. 26. 29
  27. 27. 30
  28. 28. 31
  29. 29. 32 Why use Pyenv + Pipenv for your projects? Pipenv ● Officially recommended way of managing project dependencies ● No requirements.txt and managing virtualenvs ● Instead a Pipfile in your project that performs this stuff automatically $ pip install -U pipenv # Install Pipenv $ cd my_project # Go to your project $ pipenv install # Initialize Pipenv $ pipenv install neo4j # Install a package $ pipenv shell # Enter virtual env $ python # Run a script Image: xkcd
  30. 30. 33 Communicating a graph Product Managers “How can we improve the customer experience?” “How much can the knowledge graph impact GMV?” Data Scientists “Wow, looks like a NN, hold my Pandas 🐼🐼🐼, I’m onboard!!” Backend Engineers “Why do we need a graph?” “Which graph database meets the requirements?” Data Engineers “Is your Airflow dizzy? It’s traversing through cyclic connections?!”
  31. 31. 34 Where do I see most value with the knowledge graph? ● Improving customer experience such as by understanding consumer intent in search queries ● Connecting further business entities (e.g. content) for hyper-personalisation ● Deriving new knowledge via graph analysis and graph-based AI ● Enabling new, innovative applications
  32. 32. 35 Research
  33. 33. Image: Kim Albrecht
  34. 34. 37 Why use a knowledge graph? ● Have naturally highly connected-data ● Derive new insights with Graph Analysis & Graph-based AI ● Enable stakeholders to easily visualise relationships and make informed decisions ● Flexible schema to facilitate evolution to expand business entities ● Optimized for storing and querying graphs ○ Significantly faster than SQL databases for querying relationships ○ Relationships are a fundamental structure, so following relationships is a single lookup, making this operation blazingly fast
  35. 35. 38 The future
  36. 36. 39 Bonus
  37. 37. The Tool to Create Professional Websites From Markdown, Jupyter, and RStudio 40 100,000+ websites. 2,000+ GitHub Stars. 80+ Contributors. 40+ Widgets, Themes, and Languages. Used by academics and labs at Stanford, MIT, Cambridge. Featured on GitHub’s Blog.
  38. 38. 41
  39. 39. 42 Install Hugo as Prerequisite ● Windows ○ choco install hugo-extended -confirm ● Mac ○ brew update && brew install hugo ● Linux ○ sudo snap install hugo --channel=extended/stable
  40. 40. 43 Build your site with Academic 1. Fork 2. Setup and view your site locally: a. git clone<YOUR-USERNAME>/academic-kickstart.git My_Website b. cd My_Website c. git submodule update --init --recursive d. cp -av themes/academic/exampleSite/* . e. hugo server 3. Edit your Markdown content in Jupyter Labs, Visual Studio Code, or Typora 4. Commit and push your changes to GitHub 5. Go to and select the repository to publish
  41. 41. 44 Questions @GeorgeCushen We’re hiring!