Skip to content

Commit

Permalink
32-bit floating point warnings. (#278)
Browse files Browse the repository at this point in the history
* 32-bit floating point warnings.

* Add conditioning causes comment to readme.
  • Loading branch information
tbenthompson authored Jul 28, 2020
1 parent d3836a6 commit 93ab9cb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ print('Model log-likelihood', get_obj_val(dat, 'poisson', 0.0, 0.0, model.interc

[This is a brief tutorial on Tweedie Regression with L2 regularization from sklearn. `quantcore.glm` has many more features and capabilities but it can also replicate everything done here.](https://scikit-learn.org/stable/modules/linear_model.html#generalized-linear-regression)

## A quick note on 32-bit floating point precision
Note that a float32 data matrix is acceptable and will result in the entire algorithm being run in 32-bit precision. However, for problems that are poorly conditioned, this might result in poor convergence or flawed parameter estimates. Poor conditioning can be caused by a large number of features with few observations, highly collinear features and by light regularization. In spite of this risk, it's common to see 1.5-2x improvements in runtime with 32-bit data.

# Testing/Continuous integration

## Golden master tests
Expand Down
5 changes: 4 additions & 1 deletion src/quantcore/glm/_glm.py
Original file line number Diff line number Diff line change
Expand Up @@ -1685,7 +1685,10 @@ def fit(
Parameters
----------
X : {array-like, sparse matrix}, shape (n_samples, n_features)
Training data.
Training data. Note that a float32 matrix is acceptable and will
result in the entire algorithm being run in 32-bit precision.
However, for problems that are poorly conditioned, this might result
in poor convergence or flawed parameter estimates.
y : array-like, shape (n_samples,)
Target values.
Expand Down

0 comments on commit 93ab9cb

Please sign in to comment.