Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
Explanation Interface
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
S4XAI
Explanation Interface
Commits
19eefe7c
Commit
19eefe7c
authored
1 year ago
by
Matthieu BELLUCCI
Browse files
Options
Downloads
Patches
Plain Diff
added assertions display
parent
74901592
Branches
Branches containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/Prediction.js
+18
-9
18 additions, 9 deletions
src/Prediction.js
src/data_test.json
+4
-4
4 additions, 4 deletions
src/data_test.json
src/index.js
+1
-1
1 addition, 1 deletion
src/index.js
with
23 additions
and
14 deletions
src/Prediction.js
+
18
−
9
View file @
19eefe7c
...
...
@@ -15,32 +15,41 @@ function TextExplanation(props) {
<
p
>
The
model
saw
a
<
b
>
{
predictedClass
}
<
/b> and it is <b>{isConsistent
?
"consistent" : "not consistent"}</
b
>
with
the
observed
properties
.
<
/p
>
{
isConsistent
?
consistentExplanation
:
<
PropertiesExplanation
properties
=
{
props
.
properties
}
/>
}
<
PropertiesExplanation
properties
=
{
props
.
properties
}
consistent
=
{
isConsistent
}
/
>
<
/div
>
)
}
function
PropertiesExplanation
(
props
)
{
function
PropertiesExplanation
(
props
,
isConsistent
)
{
var
inconsistentProps
=
[];
var
consistentProps
=
[];
for
(
let
i
=
0
;
i
<
props
.
properties
.
length
;
i
++
){
var
property
=
props
.
properties
[
i
];
if
(
property
[
0
]
==
"
class
"
){
continue
;}
if
(
property
[
0
]
==
"
Global
"
){
continue
;}
var
propertyName
=
property
[
0
];
var
propertyResults
=
Object
.
entries
(
property
[
1
].
results
);
for
(
let
j
=
0
;
j
<
propertyResults
.
length
;
j
++
){
var
currentProp
=
propertyResults
[
j
];
if
(
currentProp
[
1
].
consistency
!=
null
&&
!
currentProp
[
1
].
consistency
){
if
(
currentProp
[
1
].
consistency
!=
null
){
var
addedProperty
=
(
currentProp
[
1
].
not
?
"
Not
"
:
""
)
+
propertyName
;
if
(
currentProp
[
1
].
consistency
){
consistentProps
.
push
([
addedProperty
,
currentProp
[
0
]]);
}
else
{
inconsistentProps
.
push
([
addedProperty
,
currentProp
[
0
]]);
}
}
}
}
return
(
<
p
>
The
following
properties
are
inconsistent
:
{
React
.
Children
.
toArray
(
inconsistentProps
.
map
(
x
=>
<
li
>
{
x
[
0
]}
{
x
[
1
]}
<
/li>
))
}
<
/p
>
<><
p
>
The
following
properties
were
observed
:
{
React
.
Children
.
toArray
(
consistentProps
.
map
(
x
=>
<
li
>
{
x
[
0
]}
{
x
[
1
]}
<
/li>
))
}
<
/p><p
>
The
following
properties
are
inconsistent
:
{
React
.
Children
.
toArray
(
inconsistentProps
.
map
(
x
=>
<
li
>
{
x
[
0
]}
{
x
[
1
]}
<
/li>
))
}
<
/p></
>
)
}
...
...
@@ -49,7 +58,7 @@ function Prediction(props) {
const
tabList
=
properties
.
map
(
function
(
x
)
{
return
{
name
:
x
[
0
],
content
:
<
BarChart
data
=
{
x
[
1
]}
/>};}
)
;
const
allTab
=
{
name
:
"
Global view
"
,
content
:
<
GlobalBarChart
data
=
{
properties
}
/>}
;
tabList
.
push
(
allTab
);
const
img
=
require
(
'
./
.
\\
data
\\
images
\\
Bassoon
\\
253.jpg
'
)
const
img
=
require
(
'
./data
/
images
/
Bassoon
/
253.jpg
'
)
const
label
=
props
.
data
.
predictedClass
return
(
<
div
className
=
"
Prediction
"
>
...
...
This diff is collapsed.
Click to expand it.
src/data_test.json
+
4
−
4
View file @
19eefe7c
...
...
@@ -4,7 +4,7 @@
"trueClass"
:
"Trombone"
,
"isConsistent"
:
false
,
"properties"
:
{
"
Class
"
:
{
"
Global
"
:
{
"thresholdPos"
:
70
,
"thresholdNeg"
:
30
,
"functionnal"
:
true
,
...
...
@@ -15,7 +15,7 @@
"Oboe"
:
{
"probability"
:
2
,
"consistency"
:
null
,
"not"
:
false
}
}
},
"Mechanism"
:
{
"
has
Mechanism"
:
{
"thresholdPos"
:
70
,
"thresholdNeg"
:
30
,
"functionnal"
:
true
,
...
...
@@ -26,7 +26,7 @@
"Keys"
:
{
"probability"
:
10
,
"consistency"
:
false
,
"not"
:
true
}
}
},
"Texture"
:
{
"
has
Texture"
:
{
"thresholdPos"
:
70
,
"thresholdNeg"
:
20
,
"functionnal"
:
false
,
...
...
@@ -36,7 +36,7 @@
"Wood"
:
{
"probability"
:
70
,
"consistency"
:
false
,
"not"
:
false
}
}
},
"Mouthpiece"
:
{
"
has
Mouthpiece"
:
{
"thresholdPos"
:
60
,
"thresholdNeg"
:
20
,
"functionnal"
:
true
,
...
...
This diff is collapsed.
Click to expand it.
src/index.js
+
1
−
1
View file @
19eefe7c
...
...
@@ -3,7 +3,7 @@ import ReactDOM from 'react-dom';
import
Prediction
from
'
./Prediction
'
;
const
data
=
require
(
'
./data.json
'
)
const
data
=
require
(
'
./data
_test
.json
'
)
const
root
=
document
.
getElementById
(
'
root
'
);
const
pred
=
<
Prediction
data
=
{
data
}
/
>
ReactDOM
.
render
(
pred
,
root
);
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
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