Knowledge-Graph-Hub / kg-covid-19

An instance of KG Hub to produce a knowledge graph for COVID-19 response.
https://github.com/Knowledge-Graph-Hub/kg-covid-19/wiki
BSD 3-Clause "New" or "Revised" License
78 stars 26 forks source link

Classifier #435

Closed shainaraza closed 2 years ago

shainaraza commented 2 years ago

(Note: this template is for requesting new features in the software, not new datasets to ingest. Use the "Dataset request" for that.)

Describe the desired behavior

I read in the paper for the downstream tasks especially the classifiers, am I missing this part from the documentation, please advise?

Additional context

justaddcoffee commented 2 years ago

@shainaraza thanks for the ticket. What sort of classifier are you interested in using, and for what ML task? KG-COVID-19 is tightly integrated with Embiggen, so building a classifier is pretty painless these days. You could do something like this for example:

pip install embiggen
pip install ensmallen
python3
>>> from embiggen.node_prediction import GraphConvolutionalNeuralNetwork
>>> from ensmallen.datasets.kghub import KGCOVID19
>>> kg = KGCOVID19()
>>> train, test = kg.node_label_holdout(0.8, use_stratification=True)
>>> model = GraphConvolutionalNeuralNetwork(
    kg,
    node_features_number=50,
    num_split=2
)
>>> history = model.fit(
    train,
    validation_graph=test,
)
# now do some classification
shainaraza commented 2 years ago

Thanks @justaddcoffee
its very useful information, thanks for sharing a code snippet. One question, does I need to work with elasticsearch only to have kg, I am running on Colab and do not have much resources for now. I might be missing some part of documentation?

thanks

justaddcoffee commented 2 years ago

No problem @shainaraza

You shouldn't need elasticsearch at all for this project. To run the code above you might need access to a GPU. Colab may work, depending on the resources available when you run this

justaddcoffee commented 2 years ago

Closing this, but feel free to reopen if we can help