Reputation:
I have been new to Machine Learning and I'm trying to implement a Knowledge Graph and use it for search purposes (Just like Google and Bing does). This is my approach to it. I have some text documents with me. I'm familiar with python.
Steps:
After extracting triples and loading them in csv, my data looks something like this:
Subject relation predicate
New Delhi IS_CAPITAL India
India Gate IS_LOCATED New Delhi
India HAS_STATES 29
Hyderabad IS_CAPITAL Telangana
Charminar IS_LOCATED Telangana
2. Import the dataset to python and train it according to any model like TransH, TransE, ComplEx etc. 3.Then train it using Tensorflow and Ampligraph library (Ampligraph Example).
Now once i get the embedded model, How can i use it to answer a search query? How can i store my model in a database and what database should i use for this purpose?
Thank you.
Ps. You can visit the link of "Ampligraph Example" to know what kind of model is generated after training.
Upvotes: 2
Views: 1729
Reputation: 20
In my experience, people find neo4j to be one of the easier graph databases to get started with. Neo uses a property graph model, so you can add properties to your nodes and edges.
In the AmpliGraph example, it shows output like:
statement | rank | score | prob |
---|---|---|---|
Daenerys Targaryen SPOUSE Craster | 4090 | -2.750880 | 0.060037 |
For this data, Daenerys Targaryen
would be connected to Craster
with a SPOUSE
edge. Rank, score, and prob could be included as properties on edge.
Neo has a tutorial for loading CSVs here using the desktop tool. I also found this python neo driver but I'm not familiar with its capabilities.
To query the database, neo uses a query language called cypher. You don't say if you are looking for a natural language query but if you'd probably need to build that as a separate part of the system--parse natural language and build the cypher query.
RDF graphs are another option but those tools are a bit more complicated. In particular, adding properties to edges will involve more complex modeling. If you're new to graph databases, Neo is a good place to start.
Upvotes: 0