Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
ExplainGNNWithHighLevelConcepts
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ajay Umakanth
ExplainGNNWithHighLevelConcepts
Commits
67f2e923
There was an error fetching the commit references. Please try again later.
Commit
67f2e923
authored
5 months ago
by
AjUm-HEIDI
Browse files
Options
Downloads
Patches
Plain Diff
Add penalty
parent
27296f36
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
ConceptLearner/DiscriminativeExplainer.py
+18
-2
18 additions, 2 deletions
ConceptLearner/DiscriminativeExplainer.py
with
18 additions
and
2 deletions
ConceptLearner/DiscriminativeExplainer.py
+
18
−
2
View file @
67f2e923
...
...
@@ -17,6 +17,20 @@ from ontolearn.owlapy.model import OWLNamedIndividual, IRI, OWLObjectIntersectio
OWLObjectSomeValuesFrom
,
OWLClass
,
OWLNothing
import
re
class
LinearPressureFitness
():
"""
Linear parametric parsimony pressure.
"""
__slots__
=
'
gain
'
,
'
penalty
'
def
__init__
(
self
,
gain
:
float
=
2048.0
,
penalty
:
float
=
1.0
):
self
.
gain
=
gain
self
.
penalty
=
penalty
def
apply
(
self
,
individual
):
quality
=
individual
.
quality
.
values
[
0
]
fitness
=
self
.
gain
*
quality
-
self
.
penalty
*
len
(
individual
)
individual
.
fitness
.
values
=
(
round
(
fitness
,
5
),)
class
DiscriminativeExplainer
:
"""
An abstract class that represents a model explainer for a Graph Neural Network (GNN).
...
...
@@ -98,7 +112,8 @@ class DiscriminativeExplainer:
debug
:
Optional
[
bool
]
=
False
,
max_runtime
:
Optional
[
int
]
=
60
,
num_generations
:
Optional
[
int
]
=
600
,
quality_func
:
Optional
[
AbstractScorer
]
=
None
):
quality_func
:
Optional
[
AbstractScorer
]
=
None
,
penalty
=
1.0
):
"""
Generates an explanation for the given label using the GNN and dataset.
Args:
...
...
@@ -121,7 +136,8 @@ class DiscriminativeExplainer:
max_runtime
=
max_runtime
,
num_generations
=
num_generations
,
quality_func
=
quality_func
,
population_size
=
1000
population_size
=
1000
,
fitness_func
=
LinearPressureFitness
(
penalty
=
penalty
)
)
positive_examples
=
[]
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment