After looking at the available Modzy models, I was interested in exploring Graphs with Graphs Embbedings, and I started to think that the Game of Thrones Network of characters would be an excellent case to study as I am a big fan of the books and series. In this way, it would be possible to identify if the models were doing good predictions. So I decided to implement a web app where we could revisit the GOT characters and their interactions.

What it does

From the Game of Thrones characters network in the first book "A song of Ice and Fire", this app identifies clusters based on their relationships. It succeeds in identifying groups of characters that are known for any fan as related among them, for example, the people around Daenerys like Drogo or the Dothraki ones, or the people in the Wall, etc. The app also builds a word cloud for a given character from information in a paragraph extracted from Wikipedia. The word cloud uses information of tokenized words corresponding to locations, persons. The resulting word cloud is an excellent way to have a glimpse of the character.

How we built it

I used Modzy, streamlit and python libraries like Pyvis, Plotly, Sci-kit learn and Wordcloud. The data was obtained from Kaggle and its format was adapted to be properly read by "Graphs Embeddings". The text describing the characters was extracted from Wikipedia using the Wikipedia library, though in this project only the resulting text is used, and was slightly modified to be properly read by "Named Entity Recognition". If you explore the app in the link provided bellow, you will see that the app has a main page with some expanders and also a sidebar, where you can control and change the inputs:

Streamlit App

There are two main results, the first is a TSNE plot build using the vectors obtained with Graphs Embeddings. It also shows in colors the different clusters that a KNN model finds: In the sidebar, you can change the number of clusters that the KNN model is going to seek. These combined models work pretty well as the clusters are easily recognized as valid.

The second main result is the wordcloud. For this, we need to feed with a name in the "Select node" expander (sidebar). Notice that the name may be copied from the cluster dataframes (click on "Show cluster dataframe" in the sidebar) and pasted in the "Enter a name" field. Doing this the app will generate a wordcloud like this (you may click "Show results"):

Beware that some names are hardest for the modzy model, and it may take from a few seconds to a minute to finish. In case of any problem just rerun the app hitting Ctrl+R (Cmd+R in Mac) or refreshing the browser.

Challenges we ran into

I didn't knew Modzy, and at the beginning, I was not sure how to use the Api's.

Accomplishments that we're proud of

To make something cool.

What we learned

To call Modzy from a python script.

What's next for Modzi Hack a Throne Web App

I would like to include more books and also to try to build the relationships network from the tokens in a paragraph. In the beginning, I was thinking of using text directly from the book, but I was concerned about using copyrighted material (so I decided to use text from Wikipedia), but I think that it would be an interesting feature.

Built With

Share this project: