From 7e2777b1a5477ad513006fb49b754460fa91188d Mon Sep 17 00:00:00 2001 From: Dario Date: Tue, 28 Feb 2023 23:11:17 +0100 Subject: [PATCH] Add Python 3.9 compatibility, bump sklearn (#898) --- .travis.yml | 4 ++++ CHANGELOG.md | 7 +++++++ setup.py | 3 ++- snips_nlu/__about__.py | 2 +- snips_nlu/intent_classifier/log_reg_classifier.py | 2 +- tox.ini | 2 +- 6 files changed, 16 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6efeb194e..8017895b4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,6 +4,10 @@ language: python matrix: include: + - python: 3.9 + env: TOXENV=py39 + dist: xenial + sudo: true - python: 3.8 env: TOXENV=py38 dist: xenial diff --git a/CHANGELOG.md b/CHANGELOG.md index f36036dd6..5ed104d77 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,13 @@ # Changelog All notable changes to this project will be documented in this file. +## [0.20.3] - Under development +### Added +- Support for Python 3.9 + +### Fixed +- Fixed sklearn compatibility + ## [0.20.2] - 2020-01-15 ### Added - Add intents filter parameter in parsing CLI [#858](https://github.com/snipsco/snips-nlu/pull/858) diff --git a/setup.py b/setup.py index 67b731749..6d4226114 100644 --- a/setup.py +++ b/setup.py @@ -27,7 +27,7 @@ "pyaml>=17.0,<20.0", "requests>=2.0,<3.0", "scikit-learn>=0.20,<0.21; python_version<'3.5'", - "scikit-learn>=0.21.1,<0.23; python_version>='3.5'", + "scikit-learn>=0.21.1,<1.0; python_version>='3.5'", "scipy>=1.0,<2.0", "sklearn-crfsuite>=0.3.6,<0.4", "snips-nlu-parsers>=0.3.1,<0.5", @@ -76,6 +76,7 @@ "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", "Topic :: Scientific/Engineering :: Artificial Intelligence", ], keywords="nlu nlp language machine learning text processing intent", diff --git a/snips_nlu/__about__.py b/snips_nlu/__about__.py index 29ad106ed..421831a01 100644 --- a/snips_nlu/__about__.py +++ b/snips_nlu/__about__.py @@ -13,7 +13,7 @@ __email__ = "clement.doumouro@snips.ai, adrien.ball@snips.ai" __license__ = "Apache License, Version 2.0" -__version__ = "0.20.2" +__version__ = "0.20.3" __model_version__ = "0.20.0" __download_url__ = "https://github.com/snipsco/snips-nlu-language-resources/releases/download" diff --git a/snips_nlu/intent_classifier/log_reg_classifier.py b/snips_nlu/intent_classifier/log_reg_classifier.py index 137ccae49..8773df50b 100644 --- a/snips_nlu/intent_classifier/log_reg_classifier.py +++ b/snips_nlu/intent_classifier/log_reg_classifier.py @@ -104,7 +104,7 @@ def fit(self, dataset): alpha = get_regularization_factor(dataset) class_weights_arr = compute_class_weight( - "balanced", range(none_class + 1), classes) + "balanced", classes=range(none_class + 1), y=classes) # Re-weight the noise class class_weights_arr[-1] *= self.config.noise_reweight_factor class_weight = {idx: w for idx, w in enumerate(class_weights_arr)} diff --git a/tox.ini b/tox.ini index da75d41ff..f612afd14 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py27, py35, py36, py37, py38, integration-test, codecov, docs-html +envlist = py27, py35, py36, py37, py38, py3.9, integration-test, codecov, docs-html [testenv] skip_install = true