vaticle / typedb-ml

TypeDB-ML is the Machine Learning integrations library for TypeDB
https://vaticle.com
Apache License 2.0
552 stars 93 forks source link

Adds weighted loss to the kgcn learner #123

Closed TNO-Knowledge-Based-Systems closed 1 year ago

TNO-Knowledge-Based-Systems commented 4 years ago

What is the goal of this PR?

The goal of this PR is to be able to use weighted (to the label prevalence) loss for the kgcn learner. This is especially valuable if the labels are not equally distributed.

What are the changes implemented in this PR?

These changes only affect the two loss functions: loss_ops_preexisting_no_penalty and loss_ops_from_difference we calculate the label prevalence and calculate a weight from the prevalence using this function: weights = (1 / (label_prevalence + 1) this results in a balanced weighing of the label weights. The default functionality is set to not using weighted loss so this should not impact others.

jmsfltchr commented 4 years ago

I had the thought that this should be something that TensorFlow supports, and it seems that is somewhat the case, we could look at doing it that as described here and here rather than our own implementation

jmsfltchr commented 1 year ago

We have radically changed the repo since this point and deprecated the KGCN, so I'm closing this in favour of https://github.com/vaticle/typedb-ml/pull/161.