Extend GLM Families
- Dominant language
- Python
- Stars
- 78
- Forks
- 47
- PR merge metrics
- No merged PRs in 30d
Description
So far in https://github.com/dask/dask-glm/blob/master/dask_glm/families.py we have families for linear/normal and logistic that look like the following:
```python
class Logistic(object):
@staticmethod
def loglike(Xbeta, y):
eXbeta = exp(Xbeta)
return (log1p(eXbeta)).sum() - dot(y, Xbeta)
@staticmethod
def pointwise_loss(beta, X, y):
'''Logistic Loss, evaluated point-wise.'''
beta, y = beta.ravel(), y.ravel()
Xbeta = X.dot(beta)
return Logistic.loglike(Xbeta, y)
@staticmethod
def pointwise_gradient(beta, X, y):
'''Logistic gradient, evaluated point-wise.'''
beta, y = beta.ravel(), y.ravel()
Xbeta = X.dot(beta)
return Logistic.gradient(Xbeta, X, y)
@staticmethod
def gradient(Xbeta, X, y):
p = sigmoid(Xbeta)
return dot(X.T, p - y)
@staticmethod
def hessian(Xbeta, X):
p = sigmoid(Xbeta)
return dot(p * (1 - p) * X.T, X)
```
- Do we want to extend these to other GLM families?
- If so then what other options are most useful?
- Is the current interface sufficient and ideal?
Contributor guide
Assessment
This issue has not been assessed yet.