ngboost 0.5.1__tar.gz → 0.5.2.dev0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. {ngboost-0.5.1 → ngboost-0.5.2.dev0}/PKG-INFO +1 -1
  2. {ngboost-0.5.1 → ngboost-0.5.2.dev0}/ngboost/api.py +7 -0
  3. {ngboost-0.5.1 → ngboost-0.5.2.dev0}/ngboost/ngboost.py +4 -0
  4. {ngboost-0.5.1 → ngboost-0.5.2.dev0}/ngboost/scores.py +1 -1
  5. {ngboost-0.5.1 → ngboost-0.5.2.dev0}/pyproject.toml +1 -1
  6. {ngboost-0.5.1 → ngboost-0.5.2.dev0}/setup.py +1 -1
  7. {ngboost-0.5.1 → ngboost-0.5.2.dev0}/LICENSE +0 -0
  8. {ngboost-0.5.1 → ngboost-0.5.2.dev0}/README.md +0 -0
  9. {ngboost-0.5.1 → ngboost-0.5.2.dev0}/ngboost/__init__.py +0 -0
  10. {ngboost-0.5.1 → ngboost-0.5.2.dev0}/ngboost/distns/__init__.py +0 -0
  11. {ngboost-0.5.1 → ngboost-0.5.2.dev0}/ngboost/distns/categorical.py +0 -0
  12. {ngboost-0.5.1 → ngboost-0.5.2.dev0}/ngboost/distns/cauchy.py +0 -0
  13. {ngboost-0.5.1 → ngboost-0.5.2.dev0}/ngboost/distns/distn.py +0 -0
  14. {ngboost-0.5.1 → ngboost-0.5.2.dev0}/ngboost/distns/exponential.py +0 -0
  15. {ngboost-0.5.1 → ngboost-0.5.2.dev0}/ngboost/distns/gamma.py +0 -0
  16. {ngboost-0.5.1 → ngboost-0.5.2.dev0}/ngboost/distns/laplace.py +0 -0
  17. {ngboost-0.5.1 → ngboost-0.5.2.dev0}/ngboost/distns/lognormal.py +0 -0
  18. {ngboost-0.5.1 → ngboost-0.5.2.dev0}/ngboost/distns/multivariate_normal.py +0 -0
  19. {ngboost-0.5.1 → ngboost-0.5.2.dev0}/ngboost/distns/normal.py +0 -0
  20. {ngboost-0.5.1 → ngboost-0.5.2.dev0}/ngboost/distns/poisson.py +0 -0
  21. {ngboost-0.5.1 → ngboost-0.5.2.dev0}/ngboost/distns/t.py +0 -0
  22. {ngboost-0.5.1 → ngboost-0.5.2.dev0}/ngboost/distns/utils.py +0 -0
  23. {ngboost-0.5.1 → ngboost-0.5.2.dev0}/ngboost/evaluation.py +0 -0
  24. {ngboost-0.5.1 → ngboost-0.5.2.dev0}/ngboost/helpers.py +0 -0
  25. {ngboost-0.5.1 → ngboost-0.5.2.dev0}/ngboost/learners.py +0 -0
  26. {ngboost-0.5.1 → ngboost-0.5.2.dev0}/ngboost/manifold.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ngboost
3
- Version: 0.5.1
3
+ Version: 0.5.2.dev0
4
4
  Summary: Library for probabilistic predictions via gradient boosting.
5
5
  Home-page: https://github.com/stanfordmlgroup/ngboost
6
6
  License: Apache-2.0
@@ -54,6 +54,7 @@ class NGBRegressor(NGBoost, BaseEstimator):
54
54
  An NGBRegressor object that can be fit.
55
55
  """
56
56
 
57
+ # pylint: disable=too-many-positional-arguments
57
58
  def __init__(
58
59
  self,
59
60
  Dist=Normal,
@@ -97,6 +98,8 @@ class NGBRegressor(NGBoost, BaseEstimator):
97
98
  early_stopping_rounds,
98
99
  )
99
100
 
101
+ self._estimator_type = "regressor"
102
+
100
103
  def __getstate__(self):
101
104
  state = super().__getstate__()
102
105
  # Remove the unpicklable entries.
@@ -140,6 +143,7 @@ class NGBClassifier(NGBoost, BaseEstimator):
140
143
  An NGBClassifier object that can be fit.
141
144
  """
142
145
 
146
+ # pylint: disable=too-many-positional-arguments
143
147
  def __init__(
144
148
  self,
145
149
  Dist=Bernoulli,
@@ -172,6 +176,7 @@ class NGBClassifier(NGBoost, BaseEstimator):
172
176
  tol,
173
177
  random_state,
174
178
  )
179
+ self._estimator_type = "classifier"
175
180
 
176
181
  def predict_proba(self, X, max_iter=None):
177
182
  """
@@ -232,6 +237,7 @@ class NGBSurvival(NGBoost, BaseEstimator):
232
237
  An NGBSurvival object that can be fit.
233
238
  """
234
239
 
240
+ # pylint: disable=too-many-positional-arguments
235
241
  def __init__(
236
242
  self,
237
243
  Dist=LogNormal,
@@ -290,6 +296,7 @@ class NGBSurvival(NGBoost, BaseEstimator):
290
296
  state_dict["Manifold"] = manifold(state_dict["Score"], state_dict["Dist"])
291
297
  self.__dict__ = state_dict
292
298
 
299
+ # pylint: disable=too-many-positional-arguments
293
300
  def fit(self, X, T, E, X_val=None, T_val=None, E_val=None, **kwargs):
294
301
  """Fits an NGBoost survival model to the data.
295
302
  For additional parameters see ngboost.NGboost.fit
@@ -50,6 +50,7 @@ class NGBoost:
50
50
  An NGBRegressor object that can be fit.
51
51
  """
52
52
 
53
+ # pylint: disable=too-many-positional-arguments
53
54
  def __init__(
54
55
  self,
55
56
  Dist=Normal,
@@ -172,6 +173,7 @@ class NGBoost:
172
173
  self.base_models.append(models)
173
174
  return fitted
174
175
 
176
+ # pylint: disable=too-many-positional-arguments
175
177
  def line_search(self, resids, start, Y, sample_weight=None, scale_init=1):
176
178
  D_init = self.Manifold(start.T)
177
179
  loss_init = D_init.total_score(Y, sample_weight)
@@ -201,6 +203,7 @@ class NGBoost:
201
203
  self.scalings.append(scale)
202
204
  return scale
203
205
 
206
+ # pylint: disable=too-many-positional-arguments
204
207
  def fit(
205
208
  self,
206
209
  X,
@@ -259,6 +262,7 @@ class NGBoost:
259
262
  early_stopping_rounds=early_stopping_rounds,
260
263
  )
261
264
 
265
+ # pylint: disable=too-many-positional-arguments
262
266
  def partial_fit(
263
267
  self,
264
268
  X,
@@ -9,7 +9,7 @@ class Score:
9
9
  grad = self.d_score(Y)
10
10
  if natural:
11
11
  metric = self.metric()
12
- grad = np.linalg.solve(metric, grad)
12
+ grad = np.linalg.solve(metric, grad[..., None])[..., 0]
13
13
  return grad
14
14
 
15
15
 
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "ngboost"
3
- version = "0.5.1"
3
+ version = "0.5.2dev"
4
4
  description = "Library for probabilistic predictions via gradient boosting."
5
5
  authors = ["Stanford ML Group <avati@cs.stanford.edu>"]
6
6
  readme = "README.md"
@@ -16,7 +16,7 @@ install_requires = \
16
16
 
17
17
  setup_kwargs = {
18
18
  'name': 'ngboost',
19
- 'version': '0.5.1',
19
+ 'version': '0.5.2.dev0',
20
20
  'description': 'Library for probabilistic predictions via gradient boosting.',
21
21
  'long_description': '# NGBoost: Natural Gradient Boosting for Probabilistic Prediction\n\n<h4 align="center">\n\n![Python package](https://github.com/stanfordmlgroup/ngboost/workflows/Python%20package/badge.svg)\n[![GitHub Repo Size](https://img.shields.io/github/repo-size/stanfordmlgroup/ngboost?label=Repo+Size)](https://github.com/stanfordmlgroup/ngboost/graphs/contributors)\n[![Github License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n[![PyPI](https://img.shields.io/pypi/v/ngboost?logo=pypi&logoColor=white)](https://pypi.org/project/ngboost)\n[![PyPI Downloads](https://img.shields.io/pypi/dm/ngboost?logo=icloud&logoColor=white)](https://pypistats.org/packages/ngboost)\n\n</h4>\n\nngboost is a Python library that implements Natural Gradient Boosting, as described in ["NGBoost: Natural Gradient Boosting for Probabilistic Prediction"](https://stanfordmlgroup.github.io/projects/ngboost/). It is built on top of [Scikit-Learn](https://scikit-learn.org/stable/), and is designed to be scalable and modular with respect to choice of proper scoring rule, distribution, and base learner. A didactic introduction to the methodology underlying NGBoost is available in this [slide deck](https://docs.google.com/presentation/d/1Tn23Su0ygR6z11jy3xVNiLGv0ggiUQue/edit?usp=share_link&ouid=102290675300480810195&rtpof=true&sd=true).\n\n## Installation\n\n```sh\nvia pip\n\npip install --upgrade ngboost\n\nvia conda-forge\n\nconda install -c conda-forge ngboost\n```\n\n## Usage\n\nProbabilistic regression example on the Boston housing dataset:\n\n```python\nfrom ngboost import NGBRegressor\n\nfrom sklearn.model_selection import train_test_split\nfrom sklearn.metrics import mean_squared_error\n\n#Load Boston housing dataset\ndata_url = "http://lib.stat.cmu.edu/datasets/boston"\nraw_df = pd.read_csv(data_url, sep="\\s+", skiprows=22, header=None)\nX = np.hstack([raw_df.values[::2, :], raw_df.values[1::2, :2]])\nY = raw_df.values[1::2, 2]\n\nX_train, X_test, Y_train, Y_test = train_test_split(X, Y, test_size=0.2)\n\nngb = NGBRegressor().fit(X_train, Y_train)\nY_preds = ngb.predict(X_test)\nY_dists = ngb.pred_dist(X_test)\n\n# test Mean Squared Error\ntest_MSE = mean_squared_error(Y_preds, Y_test)\nprint(\'Test MSE\', test_MSE)\n\n# test Negative Log Likelihood\ntest_NLL = -Y_dists.logpdf(Y_test).mean()\nprint(\'Test NLL\', test_NLL)\n```\n\nDetails on available distributions, scoring rules, learners, tuning, and model interpretation are available in our [user guide](https://stanfordmlgroup.github.io/ngboost/intro.html), which also includes numerous usage examples and information on how to add new distributions or scores to NGBoost.\n\n## License\n\n[Apache License 2.0](https://github.com/stanfordmlgroup/ngboost/blob/master/LICENSE).\n\n## Reference\n\nTony Duan, Anand Avati, Daisy Yi Ding, Khanh K. Thai, Sanjay Basu, Andrew Y. Ng, Alejandro Schuler. 2019.\nNGBoost: Natural Gradient Boosting for Probabilistic Prediction.\n[arXiv](https://arxiv.org/abs/1910.03225)\n',
22
22
  'author': 'Stanford ML Group',
File without changes
File without changes
File without changes