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.
Abstract
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.
4. 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
7. 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
8. 8
What is this graph thing?
“Hey, I’ve got this lit bar graph visualization for you! It’s 🔥🔥🔥!”
9. 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?
10. 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
18. 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
...
19. 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
20. 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
25. 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
26. 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')
plt.show()
$ pipenv install networkx matplotlib
32. 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 my_script.py # Run a script
Image: xkcd
33. 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?!”
34. 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
37. 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
40. The Tool to Create Professional Websites
From Markdown, Jupyter, and RStudio
https://github.com/gcushen/hugo-academic
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.
42. 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
43. 43
Build your site with Academic
1. Fork https://github.com/sourcethemes/academic-kickstart
2. Setup and view your site locally:
a. git clone https://github.com/<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 Netlify.com and select the repository to publish