Skip to content

Commit 5223ecc

Browse files
authored
Merge pull request RasaHQ#1635 from RasaHQ/sklearn_badinputshape
Increase scikit-learn version
2 parents cf06db2 + 62f4851 commit 5223ecc

File tree

5 files changed

+8
-6
lines changed

5 files changed

+8
-6
lines changed

CHANGELOG.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ Changed
2626
- replaced ``yaml`` with ``ruamel.yaml``
2727
- updated spacy version to 2.0.18
2828
- updated TensorFlow version to 1.12.0
29+
- updated scikit-learn version to 0.20.2
2930

3031
Removed
3132
-------
@@ -44,6 +45,7 @@ Fixed
4445
- Updated CORS support for the server.
4546
Added the ``Access-Control-Allow-Headers`` and ``Content-Type`` headers for nlu server
4647
- parsing of emojis which are sent within jsons
48+
- Bad input shape error from ``sklearn_intent_classifier`` when using ``scikit-learn==0.20.2``
4749

4850
[0.13.8] - 2018-11-21
4951
^^^^^^^^^^^^^^^^^^^^^

alt_requirements/requirements_spacy_sklearn.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
-r requirements_bare.txt
33

44
spacy==2.0.18
5-
scikit-learn==0.19.1
5+
scikit-learn==0.20.2
66
scipy==1.1.0
77
sklearn-crfsuite==0.3.6
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Minimum Install Requirements
22
-r requirements_bare.txt
33

4-
scikit-learn==0.19.1
4+
scikit-learn==0.20.2
55
tensorflow==1.12.0
66
scipy==1.1.0
77
sklearn-crfsuite==0.3.6

rasa_nlu/classifiers/sklearn_intent_classifier.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,10 +178,10 @@ def process(self, message, **kwargs):
178178
else:
179179
X = message.get("text_features").reshape(1, -1)
180180
intent_ids, probabilities = self.predict(X)
181-
intents = self.transform_labels_num2str(intent_ids)
181+
intents = self.transform_labels_num2str(np.ravel(intent_ids))
182182
# `predict` returns a matrix as it is supposed
183183
# to work for multiple examples as well, hence we need to flatten
184-
intents, probabilities = intents.flatten(), probabilities.flatten()
184+
probabilities = probabilities.flatten()
185185

186186
if intents.size > 0 and probabilities.size > 0:
187187
ranking = list(zip(list(intents),

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,12 @@
4444

4545
extras_requires = {
4646
'test': tests_requires,
47-
'spacy': ["scikit-learn<0.20",
47+
'spacy': ["scikit-learn~=0.20.2",
4848
"sklearn-crfsuite~=0.3.6",
4949
"scipy~=1.1",
5050
"spacy<=2.0.18,>2.0",
5151
],
52-
'tensorflow': ["scikit-learn<0.20",
52+
'tensorflow': ["scikit-learn~=0.20.2",
5353
"sklearn-crfsuite~=0.3.6",
5454
"scipy~=1.1",
5555
"tensorflow~=1.12"

0 commit comments

Comments
 (0)