Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
amaiya committed Aug 18, 2020
2 parents 4093275 + 545c253 commit de3ffc9
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 10 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,18 @@ Most recent releases are shown at the top. Each release shows:
- **Changed**: Additional parameters, changes to inputs or outputs, etc
- **Fixed**: Bug fixes that don't change documented behaviour

## 0.19.9 (2020-08-17)

### New:
- N/A

### Changed
- N/A

### Fixed:
- In `texts_from_array`, check `class_names` only after preprocessing before printing classification vs. regression status.


## 0.19.8 (2020-08-17)

### New:
Expand Down
2 changes: 1 addition & 1 deletion ktrain/tests/test_linkpred.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from ktrain import graph as gr
from ktrain.imports import ACC_NAME, VAL_ACC_NAME

class TestNodeClassification(TestCase):
class TestLinkPrediction(TestCase):


def test_cora(self):
Expand Down
9 changes: 8 additions & 1 deletion ktrain/tests/test_transformers.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,16 @@ def setUp(self):
y_train = train_b.target
x_test = test_b.data
y_test = test_b.target

# convert to string labels
y_train = [train_b.target_names[y] for y in y_train]
y_test = [train_b.target_names[y] for y in y_test]

# setup
self.trn = (x_train, y_train)
self.val = (x_test, y_test)
self.classes = train_b.target_names
#self.classes = train_b.target_names
self.classes = [] # discover from string labels



Expand Down
11 changes: 4 additions & 7 deletions ktrain/text/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,13 +330,6 @@ def texts_from_array(x_train, y_train, x_test=None, y_test=None,
verbose (boolean): verbosity
"""
U.check_array(x_train, y=y_train, X_name='x_train', y_name='y_train')
if not class_names and verbose:
#classes = list(set(y_train))
#classes.sort()
#class_names = ["%s" % (c) for c in classes]
print('task: text regression (supply class_names argument if this is supposed to be classification task)')
else:
print('task: text classification')

if x_test is None or y_test is None:
x_train, x_test, y_train, y_test = train_test_split(x_train, y_train,
Expand Down Expand Up @@ -369,6 +362,10 @@ def texts_from_array(x_train, y_train, x_test=None, y_test=None,
lang=lang, ngram_range=ngram_range)
trn = preproc.preprocess_train(x_train, y_train, verbose=verbose)
val = preproc.preprocess_test(x_test, y_test, verbose=verbose)
if not preproc.get_classes() and verbose:
print('task: text regression (supply class_names argument if this is supposed to be classification task)')
else:
print('task: text classification')
return (trn, val, preproc)


Expand Down
2 changes: 1 addition & 1 deletion ktrain/version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__all__ = ['__version__']
__version__ = '0.19.8'
__version__ = '0.19.9'

0 comments on commit de3ffc9

Please sign in to comment.