Skip to content

Commit

Permalink
Remove category label case-insensitiveness (#8)
Browse files Browse the repository at this point in the history
Category labels are no longer case insensitive.

Plus, the following folders were renamed:
  pyss3/resources/visual_classifier/ -> pyss3/resources/live_test/
  pyss3/resources/model_evaluation/ -> pyss3/resources/evaluation_plot/

Resolves: #8
  • Loading branch information
sergioburdisso committed May 17, 2020
1 parent 79f1e9d commit 4ec009a
Show file tree
Hide file tree
Showing 31 changed files with 4 additions and 8 deletions.
4 changes: 0 additions & 4 deletions pyss3/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -567,8 +567,6 @@ def __get_category__(self, name):
If category name doesn't exist, creates a new one.
"""
if isinstance(name, str):
name = name.lower()
try:
return self.__categories_index__[name]
except KeyError:
Expand Down Expand Up @@ -1239,8 +1237,6 @@ def get_category_index(self, name):
:rtype: int
"""
try:
if isinstance(name, str):
name = name.lower()
return self.__categories_index__[name]
except KeyError:
return IDX_UNKNOWN_CATEGORY
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
2 changes: 1 addition & 1 deletion pyss3/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
}

ENCODING = "utf-8"
BASE_PATH = path.join(path.dirname(__file__), "resources/visual_classifier")
BASE_PATH = path.join(path.dirname(__file__), "resources/live_test")


def main():
Expand Down
2 changes: 1 addition & 1 deletion pyss3/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def multilabel_confusion_matrix(*args):
REGEX_DOTS_CHAINED = re.compile(r"(?:(#[a-zA-Z0-9]+)(\s)*(?=#))")

EVAL_HTML_OUT_FILE = "ss3_model_evaluation[%s].html"
EVAL_HTML_SRC_FOLDER = "resources/model_evaluation/"
EVAL_HTML_SRC_FOLDER = "resources/evaluation_plot/"
EVAL_CACHE_EXT = ".ss3ev"

STR_ACCURACY, STR_PRECISION = "accuracy", "precision"
Expand Down
4 changes: 2 additions & 2 deletions tests/test_pyss3.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ def perform_tests_with(clf, cv_test, stopwords=True):
most_prob_cat = clf.get_most_probable_category()
most_prob_cat_idx = clf.__get_most_probable_category__()

# category names case-insensitiveness check
assert clf.get_category_index("SpOrTs") == clf.get_category_index("sports")
# category names case-sensitiveness check
assert clf.get_category_index("SpOrTs") == -1

# predict
y_pred = clf.predict(x_test)
Expand Down

0 comments on commit 4ec009a

Please sign in to comment.