Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
CHILD INTELLIGENT ASSESSMENT TOOL
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
2020-046
CHILD INTELLIGENT ASSESSMENT TOOL
Commits
73f97268
Commit
73f97268
authored
Oct 19, 2020
by
MithilaGunasinghe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
giving class label from probabilities
parent
c9e43f40
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
0 deletions
+21
-0
CNNmodel/myutil.py
CNNmodel/myutil.py
+21
-0
No files found.
CNNmodel/myutil.py
0 → 100644
View file @
73f97268
#!/usr/bin/env python
'''
Author : Gunasinghe M.D.
IT NUM : IT17043342
'''
# Giving class label from probabilities
from
keras.utils
import
np_utils
import
numpy
as
np
def
probas_to_classes
(
y_pred
):
if
len
(
y_pred
.
shape
)
>
1
and
y_pred
.
shape
[
1
]
>
1
:
return
categorical_probas_to_classes
(
y_pred
)
return
np
.
array
([
1
if
p
>
0.5
else
0
for
p
in
y_pred
])
def
categorical_probas_to_classes
(
p
):
return
np
.
argmax
(
p
,
axis
=
1
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment