dice-group / Ontolearn

Ontolearn is an open-source software library for explainable structured machine learning in Python. It learns OWL class expressions from positive and negative examples.
https://ontolearn-docs-dice-group.netlify.app/index.html
MIT License
39 stars 9 forks source link

Error in Implementation of CELOE Heuristic #62

Closed heindorf closed 3 years ago

heindorf commented 3 years ago

https://github.com/dice-group/OntoPy/blob/19c523d3a2ad3989a8ac68058ecacc6637c37e8b/ontolearn/heuristics.py#L28

Shouldn't the statement be the other way round?

heuristic_val += (node.quality - parent_node.quality) * self.gainBonusFactor

Compare: https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.654.5403&rep=rep1&type=pdf Page 36

Example:

So an increase in the quality by 0.8 compared to the parent would be punished by -0.8*self.gainBonusFactor.

Demirrr commented 3 years ago

@heindorf, please be sure that you read even the whole section that you cited. The page 36 declares nothing pertaining to CELOE but OCEL. The definition of CELOE heuristic is provided page 92 definition 5.1 in [1]. [1] http://jens-lehmann.org/files/2010/phd_thesis.pdf

Demirrr commented 3 years ago

@SimonBin, @heindorf. Could you please point out where the error lies ?

heuristic_val = 0
heuristic_val += node.quality
heuristic_val += (parent_node.quality - node.quality) * self.gainBonusFactor
# penalty for horizontal expansion
heuristic_val -= node.h_exp * self.expansionPenaltyFactor
# // penalty for having many child nodes (stuck prevention)
heuristic_val -= node.refinement_count * self.nodeRefinementPenalty
node.heuristic = round(heuristic_val, 5)
SimonBin commented 3 years ago

the CELOE heuristic score calculation is mostly similar

the gain should be node - parent

C is the current concept and C' is the parent concept.

So I think there is a small bug in the code

Demirrr commented 3 years ago

Oh I see. @heindorf and @SimonBin both of you are right. Thank you @heindorf for pointing out !

Demirrr commented 3 years ago

During pushing changes, I obtained the following error.

remote: Resolving deltas: 100% (6/6), completed with 5 local objects.
remote: error: GH006: Protected branch update failed for refs/heads/develop.
remote: error: Required status check "test" is expected.
To https://github.com/dice-group/OntoPy.git
 ! [remote rejected] develop -> develop (protected branch hook declined)
error: failed to push some refs to 'https://github.com/dice-group/OntoPy.git'
SimonBin commented 3 years ago

I believe @heindorf configured the repository in such a way, that you must push to a fix/celoe branch first and then begin a Pull Request through the UI

Demirrr commented 3 years ago

I see. Then, I won't be able to fix this issue until I am back from vacation. Moreover, I am not aware of and not informed of such configurations. Where can I find documentation of such configurations? @heindorf

SimonBin commented 3 years ago

since you have fixed it already, just type this command:

git push origin develop:fix/celoe

:-)

and then please stop working until your vacation has ended :laughing:

Demirrr commented 3 years ago

@SimonBin, it worked like a charm, cheers!

You are right, my heuristic function to quantity the difference between work and hobby is ill-defined :)

Demirrr commented 3 years ago

JOKE ALERT: After seeing this same issue in here https://github.com/SmartDataAnalytics/DL-Learner/issues/62, it is safe to blame Lorenz :D