Skip to content

Commit

Permalink
added dictionary sorting #28
Browse files Browse the repository at this point in the history
  • Loading branch information
davidberenstein1957 committed Feb 27, 2023
1 parent 3eece98 commit 58fb254
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 7 deletions.
7 changes: 5 additions & 2 deletions classy_classification/classifiers/classy_skeleton.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import collections
import importlib.util
from typing import List, Union

Expand Down Expand Up @@ -48,9 +49,11 @@ def __init__(
"max_cross_validation_folds": 5
}.
"""

self.multi_label = multi_label

self.data = data
self.data = collections.OrderedDict(sorted(data.items()))

self.name = name
self.nlp = nlp
self.verbose = verbose
Expand Down Expand Up @@ -125,7 +128,7 @@ def set_config(self, config: Union[dict, None] = None):
if len(self.label_list) > 1:
config = {
"C": [1, 2, 5, 10, 20, 50, 100],
"kernel": ["linear"],
"kernel": ["linear", "rbf", "poly", "sigmoid"],
"max_cross_validation_folds": 5,
"seed": None,
}
Expand Down
3 changes: 2 additions & 1 deletion classy_classification/classifiers/classy_standalone.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import collections
from typing import List, Union

from .classy_spacy import ClassyExternal, ClassySkeletonFewShot
Expand Down Expand Up @@ -59,7 +60,7 @@ def __init__(
}.
"""
self.multi_label = multi_label
self.data = data
self.data = collections.OrderedDict(sorted(data.items()))
self.model = model
self.device = device
self.verbose = verbose
Expand Down
20 changes: 16 additions & 4 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ sentence-transformers = "^2.0"
scikit-learn = "^1.0"
pandas = "^1.4"
fast-sentence-transformers = { version = "^0.4.1", optional = true }
InstructorEmbedding = "^1.0.0"

[tool.poetry.extras]
onnx = ["fast-sentence-transformers"]
Expand Down

0 comments on commit 58fb254

Please sign in to comment.