Commit 2056b1bb authored by Alessandro dos Santos Ferreira's avatar Alessandro dos Santos Ferreira
Browse files

Pynovisao - Corrigindo verificacao de python-weka-wrapper

parent 3878d015
from .classifier import Classifier from .classifier import Classifier
from .weka_classifiers import WekaClassifiers
try: try:
import weka.core.jvm as jvm import weka.core.jvm as jvm
jvm.start() jvm.start()
weka_is_defined = True from .weka_classifiers import WekaClassifiers
except: except:
weka_is_defined = False WekaClassifiers = None
__all__ = ["classifier", __all__ = ["classifier",
"weka_classifiers"] "weka_classifiers"]
...@@ -18,8 +17,8 @@ from util.config import Config ...@@ -18,8 +17,8 @@ from util.config import Config
_classifier_list = OrderedDict( [ _classifier_list = OrderedDict( [
["weka_classifiers", Config(WekaClassifiers().get_name(), weka_is_defined, bool, meta=WekaClassifiers, hidden=not weka_is_defined)], ["weka_classifiers", Config("Invalid" if WekaClassifiers is None else WekaClassifiers().get_name(),
["invalid", Config("Invalid", True, bool, meta=None, hidden=True)] WekaClassifiers is not None, bool, meta=WekaClassifiers, hidden=WekaClassifiers is None)]
] ) ] )
def get_classifier_config(): def get_classifier_config():
......
...@@ -281,7 +281,7 @@ class Act(object): ...@@ -281,7 +281,7 @@ class Act(object):
self.tk.append_log("%s", '\n'.join([extraction._extractor_list[extractor].label for extractor in extraction._extractor_list self.tk.append_log("%s", '\n'.join([extraction._extractor_list[extractor].label for extractor in extraction._extractor_list
if extraction._extractor_list[extractor].value == True ])) if extraction._extractor_list[extractor].value == True ]))
output_file, run_time = fextractor.extract_all(self.dataset, "trainning") output_file, run_time = fextractor.extract_all(self.dataset, "training")
self.tk.append_log("\nOutput file saved in %s", output_file) self.tk.append_log("\nOutput file saved in %s", output_file)
self.tk.append_log("Time elapsed: %0.3f seconds", run_time) self.tk.append_log("Time elapsed: %0.3f seconds", run_time)
...@@ -345,14 +345,14 @@ class Act(object): ...@@ -345,14 +345,14 @@ class Act(object):
list_segments = self.segmenter.get_list_segments() list_segments = self.segmenter.get_list_segments()
if self.classifier.must_train(): if self.classifier.must_train():
self.tk.append_log("Creating trainning data... (%0.3f seconds)", (TimeUtils.get_time() - start_time)) self.tk.append_log("Creating training data... (%0.3f seconds)", (TimeUtils.get_time() - start_time))
fextractor = FeatureExtractor(self.extractors) fextractor = FeatureExtractor(self.extractors)
output_file, run_time = fextractor.extract_all(self.dataset, "trainning", overwrite = False) output_file, run_time = fextractor.extract_all(self.dataset, "training", overwrite = False)
self.tk.append_log("Training classifier... (%0.3f seconds)", (TimeUtils.get_time() - start_time)) self.tk.append_log("Training classifier... (%0.3f seconds)", (TimeUtils.get_time() - start_time))
self.classifier.train(self.dataset, "trainning") self.classifier.train(self.dataset, "training")
self._image = self._const_image self._image = self._const_image
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment