Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 37 additions & 11 deletions docs/example_notebooks/Examples Green Taxi.ipynb

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions nannyml/drift/multivariate/domain_classifier/calculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ def _calculate_chunk(self, chunk: Chunk):
# Ingore lightgbm's UserWarning: Using categorical_feature in Dataset.
# We explicitly use that feature, don't spam the user
warnings.filterwarnings("ignore", message="Using categorical_feature in Dataset.")
model = LGBMClassifier(**self.hyperparameters)
model = LGBMClassifier(**(self.hyperparameters or {}))
model.fit(_trx, _try, categorical_feature=self.categorical_column_names)
preds = model.predict_proba(_tsx)[:, 1]
all_preds.append(preds)
Expand Down Expand Up @@ -385,7 +385,7 @@ def tune_hyperparams(self, X: pd.DataFrame, y: np.ndarray):
automl.fit(
X,
y,
**self.hyperparameter_tuning_config,
**(self.hyperparameter_tuning_config or {}),
categorical_feature=self.categorical_column_names,
)
self.hyperparameters = {**automl.model.estimator.get_params()}
Expand Down
7,036 changes: 0 additions & 7,036 deletions poetry.lock

This file was deleted.

179 changes: 88 additions & 91 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,102 +1,105 @@
[tool]
[tool.poetry]
[project]
name = "nannyml"
version = "0.13.1"
homepage = "https://github.com/nannyml/nannyml"
description = "NannyML, Your library for monitoring model performance."
authors = ["Niels Nuyttens <niels@nannyml.com>"]
authors = [{ name = "Niels Nuyttens", email = "niels@nannyml.com" }]
requires-python = ">=3.9,<3.13"
readme = "README.md"
license = "Apache-2.0"
classifiers=[
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'License :: OSI Approved :: Apache Software License',
'Natural Language :: English',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
license = "Apache-2.0"
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Natural Language :: English",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
]
packages = [
{ include = "nannyml" },
# { include = "tests", format = "sdist" },
dependencies = [
"numpy>=1.23",
"scipy>=1.9.2",
"pandas>=1.4,<3",
"scikit-learn>=1.3",
"pyarrow>=13.0",
"python-dateutil~=2.8",
"joblib~=1.1",
"category-encoders~=2.3",
"matplotlib~=3.7",
"plotly>=6.1,<7",
"seaborn>=0.13,<0.14",
"gcsfs>=2022.5",
"pydantic>=2.7",
"rich>=12.5",
"click~=8.1",
"PyYAML~=6.0",
"Jinja2>=3.1",
"pyfiglet>=0.8.post1,<0.9",
"lightgbm>=3.3,<4.6",
"FLAML[automl]>=2.3.3,<3",
"s3fs>=2022.8",
"APScheduler~=3.9",
"segment-analytics-python~=2.3",
"python-dotenv>=1.0,<2.0",
]

[tool.poetry.scripts]
nml = "nannyml.cli.cli:cli"
nannyml = "nannyml.cli.cli:cli"

[tool.poetry.dependencies]
python = ">=3.9,<3.13"

numpy = ">=1.23"

scipy = ">=1.9.2"

pandas = ">=1.4"

scikit-learn = ">=1.3"
[project.optional-dependencies]
db = [
"sqlmodel>=0.0,<0.1",
"psycopg2-binary~=2.9",
]

pyarrow = ">=13.0"
[project.urls]
Homepage = "https://github.com/nannyml/nannyml"

python-dateutil = "^2.8"
joblib = "^1.1"
category-encoders = "^2.3"
matplotlib = "^3.7"
plotly = "^5.6"
seaborn = "^0.13"
kaleido = "^0.2"
[project.scripts]
nml = "nannyml.cli.cli:cli"
nannyml = "nannyml.cli.cli:cli"

gcsfs = ">=2022.5"
pydantic = ">=2.7"
rich = ">=12.5"
click = "^8.1"
PyYAML = "^6.0"
Jinja2 = ">=3.1"
pyfiglet = "^0.8.post1"
lightgbm = ">=3.3,<4.6"
FLAML = {extras = ["automl"], version = "^2.3.3"}
s3fs = ">=2022.8"
sqlmodel = {version = "^0.0", optional = true}
APScheduler = "^3.9"
psycopg2-binary = {version = "^2.9", optional = true}
segment-analytics-python = "^2.3"
python-dotenv = ">=1.0,<2.0"
[dependency-groups]
dev = [
"black>=22.3.0,<23",
"isort>=5.8.0,<6",
"flake8>=3.9.2,<4",
"flake8-docstrings>=1.6.0,<2",
"flake8-typing-imports>=1.12.0,<2",
"mypy~=1.0",
"pytest>=6.2.4,<7",
"pytest-cov>=2.12.0,<3",
"pytest-mock>=3.7.0,<4",
"tox>=3.20.1,<4",
"virtualenv>=20.2.2,<21",
"pip>=20.3.1,<22.0.0",
"twine>=3.3.0,<4",
"pre-commit>=2.12.0,<3",
"toml>=0.10.2,<0.11",
"bump2version>=1.0.1,<2",
"kaleido>=1.0",
# "jupyterlab>=3.2.9,<4",
"sphinx>=5.0.2,<6",
"sphinx-rtd-theme>=1.0.0,<2",
"sphinx-toggleprompt>=0.6.0",
"sphinx-copybutton>=0.5.0,<0.6",
"typing-extensions>=4.4.0,<5",
"sphinx-toolbox>=3.2.0,<4",
"pytest-lazy-fixture>=0.6.3,<0.7",
"types-click>=7.1.8,<8",
"types-requests>=2.31.0.3,<3",
"types-pyyaml>=6.0.12.8,<7",
"types-python-dateutil>=2.8.19.10,<3",
]

[tool.poetry.extras]
db = ["sqlmodel", "psycopg2-binary"]
[tool.hatch.build.targets.sdist]
include = ["nannyml"]

[tool.poetry.group.dev.dependencies]
black = "^22.3.0"
isort = "^5.8.0"
flake8 = "^3.9.2"
flake8-docstrings = "^1.6.0"
flake8-typing-imports = "^1.12.0"
mypy = "^1.0"
pytest = "^6.2.4"
pytest-cov = "^2.12.0"
pytest-mock = "^3.7.0"
tox = "^3.20.1"
virtualenv = "^20.2.2"
pip = ">=20.3.1,<22.0.0"
twine = "^3.3.0"
pre-commit = "^2.12.0"
toml = "^0.10.2"
bump2version = "^1.0.1"
jupyterlab = "^3.2.9"
sphinx = "^5.0.2"
sphinx-rtd-theme = "^1.0.0"
sphinx-toggleprompt = ">=0.6.0"
sphinx-copybutton = "^0.5.0"
typing-extensions = "^4.4.0"
sphinx-toolbox = "^3.2.0"
pytest-lazy-fixture = "^0.6.3"
types-click = "^7.1.8"
types-requests = "^2.31.0.3"
types-pyyaml = "^6.0.12.8"
types-python-dateutil = "^2.8.19.10"
[tool.hatch.build.targets.wheel]
include = ["nannyml"]

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.black]
line-length = 120
Expand Down Expand Up @@ -126,9 +129,3 @@ use_parentheses = true
ensure_newline_before_comments = true
line_length = 120
skip_gitignore = true
# you can skip files as below
#skip_glob = docs/conf.py

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
5 changes: 3 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,14 @@ commands =
[testenv:build]
skip_install = true
allowlist_externals =
poetry
uv
twine
deps=
uv
twine
extras =
doc
dev
commands =
poetry build
uv build
twine check dist/*
8 changes: 2 additions & 6 deletions tests/performance_estimation/CBPE/test_cbpe.py
Original file line number Diff line number Diff line change
Expand Up @@ -581,9 +581,7 @@ def test_cbpe_for_binary_classification_chunked_by_period_should_include_variabl
results = estimator.estimate(analysis).filter(period="analysis")
sut = results.to_df()
assert (metric, "sampling_error") in sut.columns
assert np.array_equal(
np.round(sut.loc[:, (metric, "sampling_error")], 4), np.round(sampling_error, 4)
)
assert np.allclose(sut.loc[:, (metric, "sampling_error")], sampling_error, atol=1e-3)


@pytest.mark.parametrize(
Expand Down Expand Up @@ -654,9 +652,7 @@ def test_cbpe_for_multiclass_classification_chunked_by_period_should_include_var
sut = results.filter(period="analysis").to_df()

assert (metric, "sampling_error") in sut.columns
assert np.array_equal(
np.round(sut.loc[:, (metric, "sampling_error")], 4), np.round(sampling_error, 4)
)
assert np.allclose(sut.loc[:, (metric, "sampling_error")], sampling_error, atol=1e-3)


def test_cbpe_returns_distinct_but_consistent_results_when_reused(
Expand Down
4 changes: 2 additions & 2 deletions tests/performance_estimation/CBPE/test_cbpe_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -2899,7 +2899,7 @@ def test_cbpe_for_binary_classification_with_timestamps(calculator_opts, expecte
"estimated_business_value",
]

pd.testing.assert_frame_equal(expected, sut)
pd.testing.assert_frame_equal(expected, sut, atol=1e-3)


@pytest.mark.parametrize(
Expand Down Expand Up @@ -3907,7 +3907,7 @@ def test_cbpe_for_multiclass_classification_with_timestamps(calculator_opts, exp
"estimated_true_upmarket_card_pred_upmarket_card",
]

pd.testing.assert_frame_equal(expected, sut)
pd.testing.assert_frame_equal(expected, sut, atol=1e-3)


@pytest.mark.parametrize(
Expand Down
Loading
Loading