Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
inovisao
pynovisao
Commits
dd7fed36
Commit
dd7fed36
authored
Oct 07, 2016
by
Alessandro dos Santos Ferreira
Browse files
Pynovisao - Experimenter All
parent
94859823
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
58 additions
and
0 deletions
+58
-0
src/classification/classifier.py
src/classification/classifier.py
+3
-0
src/classification/weka_alias.py
src/classification/weka_alias.py
+4
-0
src/classification/weka_classifiers.py
src/classification/weka_classifiers.py
+28
-0
src/interface/tk_interface.py
src/interface/tk_interface.py
+4
-0
src/main.py
src/main.py
+1
-0
src/pynovisao.py
src/pynovisao.py
+18
-0
No files found.
src/classification/classifier.py
View file @
dd7fed36
...
...
@@ -56,6 +56,9 @@ class Classifier(object):
def
cross_validate
(
self
,
detail
=
True
):
pass
def
experimenter
(
self
):
pass
@
abstractmethod
def
reset
(
self
):
...
...
src/classification/weka_alias.py
View file @
dd7fed36
...
...
@@ -181,3 +181,7 @@ class WekaAlias(object):
raise
IException
(
'Invalid classifier'
)
@
staticmethod
def
get_aliases
():
return
_weka_alias
src/classification/weka_classifiers.py
View file @
dd7fed36
...
...
@@ -142,6 +142,34 @@ class WekaClassifiers(Classifier):
return
info
def
experimenter
(
self
):
info
=
""
aliases
=
sorted
(
WekaAlias
.
get_aliases
())
for
alias
in
aliases
:
try
:
if
alias
==
"MultilayerPerceptron"
:
continue
start_time
=
TimeUtils
.
get_time
()
classifier
=
WClassifier
(
classname
=
WekaAlias
.
get_classifier
(
alias
))
info
+=
"Scheme:
\t
%s %s
\n
"
%
(
str
(
classifier
.
classname
)
,
" "
.
join
([
str
(
option
)
for
option
in
classifier
.
options
]))
evl
=
WEvaluation
(
self
.
data
)
evl
.
crossvalidate_model
(
classifier
,
self
.
data
,
10
,
WRandom
(
1
))
info
+=
"Correctly Classified Instances: %0.4f%%
\n
"
%
(
evl
.
percent_correct
)
info
+=
"Time taken to build model: %0.5f seconds
\n\n
"
%
(
TimeUtils
.
get_time
()
-
start_time
)
except
Exception
as
e
:
if
str
(
e
)
!=
'Object does not implement or subclass weka.classifiers.Classifier: __builtin__.NoneType'
:
info
+=
"Exception in %s: %s
\n\n
"
%
(
WekaAlias
.
get_aliases
()[
alias
],
str
(
e
))
return
info
def
reset
(
self
):
self
.
data
=
None
self
.
classifier
=
None
src/interface/tk_interface.py
View file @
dd7fed36
...
...
@@ -199,6 +199,10 @@ class TkInterface(Interface):
def
show_warning
(
self
,
fmt
,
*
args
):
tkMessageBox
.
showwarning
(
"Warning"
,
fmt
%
args
)
def
ask_ok_cancel
(
self
,
title
,
question
):
return
tkMessageBox
.
askokcancel
(
title
,
question
)
def
show
(
self
):
...
...
src/main.py
View file @
dd7fed36
...
...
@@ -67,6 +67,7 @@ if __name__ == "__main__":
tk
.
add_command
(
"Configure"
,
act
.
configure_classifier
)
tk
.
add_separator
()
tk
.
add_command
(
"Cross Validation"
,
act
.
cross_validation
,
'X'
)
tk
.
add_command
(
"Experimenter All"
,
act
.
experimenter_all
,
'p'
)
tk
.
add_separator
()
tk
.
add_command
(
"Execute"
,
act
.
run_classifier
,
'C'
)
...
...
src/pynovisao.py
View file @
dd7fed36
...
...
@@ -431,6 +431,24 @@ class Act(object):
popup_info
=
self
.
classifier
.
cross_validate
()
self
.
tk
.
append_log
(
"Cross Validation finished"
)
self
.
tk
.
popup
(
popup_info
)
def
experimenter_all
(
self
):
if
self
.
classifier
is
None
:
raise
IException
(
"You must install python-weka-wrapper"
)
if
self
.
tk
.
ask_ok_cancel
(
"Experimenter All"
,
"This may take several minutes to complete. Are you sure?"
):
if
self
.
classifier
.
must_train
():
self
.
tk
.
write_log
(
"Creating training data..."
)
fextractor
=
FeatureExtractor
(
self
.
extractors
)
output_file
,
run_time
=
fextractor
.
extract_all
(
self
.
dataset
,
"training"
,
overwrite
=
False
)
self
.
classifier
.
train
(
self
.
dataset
,
"training"
)
self
.
tk
.
write_log
(
"Running Experimenter All on %s..."
,
self
.
classifier
.
get_name
())
popup_info
=
self
.
classifier
.
experimenter
()
self
.
tk
.
append_log
(
"
\n
Experimenter All finished"
)
self
.
tk
.
popup
(
popup_info
)
def
func_not_available
(
self
):
...
...
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