Skip to content
Merged
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
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks

default_stages: [commit, manual]
default_stages: [pre-commit, manual]

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.2.3
rev: v6.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
Expand All @@ -16,7 +16,7 @@ repos:
- id: check-merge-conflict # Check for files that contain merge conflict strings.
- id: debug-statements # Check for debugger imports and py37+ `breakpoint()` calls in python source.
- repo: https://github.com/psf/black
rev: 22.8.0
rev: 24.10.0
hooks:
- id: black
- repo: local
Expand Down
7 changes: 6 additions & 1 deletion RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# RELEASE NOTES

## Version 0.5.5
## Version 0.5.7

* Support for Python 3.13
* Update to dev dependencies

## Version 0.5.6

* Add support for Weibull and HalfNormal Distributions

Expand Down
4 changes: 1 addition & 3 deletions examples/simulations/regression_sim.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@

X_train, X_test = (
X[:1000, :],
X[
1000:,
],
X[1000:,],
)
Y_train, Y_test = Y[:1000], Y[1000:]

Expand Down
1 change: 1 addition & 0 deletions examples/user-guide/scripts/clean.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""A helper script to "clean up" all of your generated markdown and HTML files."""

import shutil as sh
from pathlib import Path

Expand Down
2 changes: 1 addition & 1 deletion figures/vis_crps.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
grads_y = np.zeros((20, 20))
crps = np.zeros((20, 20))

for (i, j) in tqdm(itertools.product(np.arange(20), np.arange(20)), total=400):
for i, j in tqdm(itertools.product(np.arange(20), np.arange(20)), total=400):
H = np.linalg.inv(metric_fn([loc[i, j], scale[i, j]]))
g = np.array(grad_fn([loc[i, j], scale[i, j]]))
gf = (H @ g).squeeze()
Expand Down
2 changes: 1 addition & 1 deletion figures/vis_mle.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
grads_y = np.zeros((20, 20))
nlls = np.zeros((20, 20))

for (i, j) in tqdm(itertools.product(np.arange(20), np.arange(20)), total=400):
for i, j in tqdm(itertools.product(np.arange(20), np.arange(20)), total=400):
H = np.linalg.inv(fisher_fn([loc[i, j], scale[i, j]]))
g = np.array(grad_fn([loc[i, j], scale[i, j]]))
gf = (H @ g).squeeze()
Expand Down
1 change: 1 addition & 0 deletions ngboost/distns/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""NGBoost distributions"""

from .categorical import Bernoulli, k_categorical
from .cauchy import Cauchy
from .distn import ClassificationDistn, Distn, RegressionDistn
Expand Down
1 change: 1 addition & 0 deletions ngboost/distns/categorical.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""The NGBoost categorial distribution and scores"""

# pylint: disable=invalid-unary-operand-type, unused-argument
import numpy as np
import scipy as sp
Expand Down
1 change: 1 addition & 0 deletions ngboost/distns/cauchy.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""The NGBoost Cauchy distribution and scores"""

from ngboost.distns.t import (
TFixedDf,
TFixedDfFixedVar,
Expand Down
1 change: 1 addition & 0 deletions ngboost/distns/distn.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""The NGBoost base distribution"""

from warnings import warn

import numpy as np
Expand Down
1 change: 1 addition & 0 deletions ngboost/distns/exponential.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""The NGBoost Exponential distribution and scores"""

import numpy as np
import scipy as sp
from scipy.stats import expon as dist
Expand Down
1 change: 1 addition & 0 deletions ngboost/distns/gamma.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""The NGBoost Gamma distribution and scores"""

import numpy as np
import scipy as sp
from scipy.stats import gamma as dist
Expand Down
1 change: 1 addition & 0 deletions ngboost/distns/halfnormal.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""The NGBoost Half-Normal distribution and scores"""

import numpy as np
from scipy.stats import halfnorm as dist

Expand Down
1 change: 1 addition & 0 deletions ngboost/distns/laplace.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""The NGBoost Laplace distribution and scores"""

import numpy as np
from scipy.stats import laplace as dist

Expand Down
2 changes: 1 addition & 1 deletion ngboost/distns/lognormal.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""The NGBoost LogNormal distribution and scores"""

import numpy as np
import scipy as sp
from scipy.stats import lognorm as dist
Expand Down Expand Up @@ -89,7 +90,6 @@ def metric(self):


class LogNormal(RegressionDistn):

"""
Implements the log-normal distribution for NGBoost.
Expand Down
1 change: 0 additions & 1 deletion ngboost/distns/multivariate_normal.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ def d_score(self, Y):
return gradient

def metric(self):

"""
Formulas for this part are not in the the paper mentioned.
Obtained by taking the expectation of the Hessian.
Expand Down
1 change: 1 addition & 0 deletions ngboost/distns/normal.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""The NGBoost Normal distribution and scores"""

import numpy as np
import scipy as sp
from scipy.stats import norm as dist
Expand Down
1 change: 1 addition & 0 deletions ngboost/distns/poisson.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""The NGBoost Poisson distribution and scores"""

import numpy as np
from scipy.optimize import Bounds, minimize
from scipy.stats import poisson as dist
Expand Down
1 change: 1 addition & 0 deletions ngboost/distns/t.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""The NGBoost Student T distribution and scores"""

import numpy as np
from scipy.special import digamma
from scipy.stats import t as dist
Expand Down
1 change: 1 addition & 0 deletions ngboost/distns/utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Extra functions useful for Distns
"""

from ngboost.distns import RegressionDistn

# pylint: disable=too-few-public-methods
Expand Down
1 change: 1 addition & 0 deletions ngboost/distns/weibull.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""The NGBoost Weibull distribution and scores"""

import numpy as np
from scipy.stats import weibull_min as dist

Expand Down
42 changes: 30 additions & 12 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "ngboost"
version = "0.5.6dev"
version = "0.5.7dev"
description = "Library for probabilistic predictions via gradient boosting."
authors = ["Stanford ML Group <[email protected]>"]
readme = "README.md"
Expand All @@ -16,29 +16,47 @@ license = "Apache License 2.0"
python = ">=3.9, <3.14"
scikit-learn = "^1.6"
numpy = [
{version = ">=1.21.2", python = ">=3.9,<3.13"},
{version = ">=2.1.0", python = ">=3.13"}
{version = ">=1.21.2", markers = "python_version < '3.13'"},
{version = ">=2.1.0", markers = "python_version >= '3.13'"}
]
scipy = [
{version = ">=1.7.2", python = ">=3.9,<3.13"},
{version = ">=1.14.1", python = ">=3.13"}
{version = ">=1.7.2", markers = "python_version < '3.13'"},
{version = ">=1.14.1", markers = "python_version >= '3.13'"}
]
tqdm = ">=4.3"
lifelines = ">=0.25"

[tool.poetry.dev-dependencies]
pytest = "^6.1.2"
black = "^22.8.0"
pre-commit = "^2.0"
isort = "^5.6.4"
pylint = "^3.0.3"
flake8 = "^7.0.0"
[tool.poetry.group.dev.dependencies]
pytest = "^8.0.0"
black = "^24.0.0"
pre-commit = "^4.0.0"
isort = "^5.13.0"
pylint = "^3.2.0"
flake8 = "^7.1.0"


[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

[tool.black]
line-length = 88
target-version = ['py39', 'py310', 'py311']
include = '\.pyi?$'
extend-exclude = '''
/(
# directories
\.eggs
| \.git
| \.hg
| \.mypy_cache
| \.tox
| \.venv
| build
| dist
)/
'''

[tool.isort]
multi_line_output = 3
include_trailing_comma = true
Expand Down
1 change: 1 addition & 0 deletions tests/test_distns.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
Tuple4Array = Tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray]
Tuple5Array = Tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray]


# pylint: disable=redefined-outer-name
@pytest.fixture(scope="module")
def regression_data():
Expand Down