Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
f2b9c98
WIP QR updating
dswah Jul 22, 2018
60ab228
more qr updating
dswah Jul 23, 2018
130d815
wooo blockwise QR!
dswah Jul 23, 2018
5cf0bf4
blockwise PIRLS!
dswah Jul 23, 2018
bea43c2
callbacks working
dswah Jul 23, 2018
d06f4ad
pirls is incremental, begin blockwise decorator
dswah Jul 23, 2018
4be3b0b
improve docs
dswah Jul 23, 2018
3fb3f63
add gamma scaling to constructor
dswah Jul 23, 2018
80ce027
extend blocks to all models
dswah Jul 23, 2018
751baff
improve blockwise decorator
dswah Jul 23, 2018
177b3f7
all statistics run, also naive_pirls
dswah Jul 23, 2018
9767cc2
improve blockwise decorator for args and kwargs
dswah Jul 23, 2018
35dc9e1
sample method also partitions X
dswah Jul 23, 2018
c388b32
partial_dep also partitions X
dswah Jul 23, 2018
d51cae2
formatting
dswah Jul 24, 2018
7ab929d
parralelizable version of incremental QR!
dswah Jul 24, 2018
90dffdd
adding parrallel for loop
Jul 29, 2018
73ffe06
add progress bar for out of core progress
dswah Aug 20, 2018
ad68c80
reduce memory footprint
dswah Aug 20, 2018
39b67be
reduce memory footprint
dswah Aug 20, 2018
f156f5c
use np.asanyarray to reduce memory footprint
dswah Aug 20, 2018
1a73a58
Merge branch 'master' into bam
dswah Oct 19, 2018
f602784
Merge branch 'bam' into bam
dswah Oct 19, 2018
6a6d0f5
lots of bug fixes
dswah Oct 19, 2018
abd2bff
lots of little fixes
dswah Oct 19, 2018
530fe3c
Merge branch 'bam' into bam
dswah Oct 21, 2018
d13f92d
reintroduce missing lines....
dswah Oct 21, 2018
020b96b
get rid of reference to `None.__ne__`
dswah Nov 2, 2018
04fa49b
Merge pull request #189 from maorn/bam
dswah Nov 2, 2018
50d14ae
add joblib parallel execution
dswah Nov 2, 2018
b986ec5
add joblib to requirements
dswah Nov 2, 2018
03898ea
Merge branch 'master' into bam
dswah Nov 2, 2018
0da2e65
fix BAM
dswah Nov 19, 2025
92baffc
remove reffs to joblib
dswah Nov 19, 2025
5cb10ea
typo
dswah Nov 19, 2025
234de92
allow shuffled batches
dswah Nov 19, 2025
de4b180
linting
dswah Nov 19, 2025
75c6e5f
linting
dswah Nov 20, 2025
2c2fd9c
improve stability
dswah Nov 20, 2025
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
18 changes: 10 additions & 8 deletions pygam/links.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

from pygam.core import Core

EPS = np.finfo(np.float64).eps # machine epsilon


class Link(Core):
def __init__(self, name=None):
Expand Down Expand Up @@ -145,13 +147,13 @@ def gradient(self, mu, dist):
-------
grad : np.array of length n
"""
return dist.levels / (mu * (dist.levels - mu))
return dist.levels / (mu * (dist.levels - mu) + EPS)


class LogLink(Link):
def __init__(self):
"""
Creates an instance of a LogitLink object.
Creates an instance of a LogLink object.

Parameters
----------
Expand All @@ -177,7 +179,7 @@ def link(self, mu, dist):
-------
lp : np.array of length n
"""
return np.log(mu)
return np.log(mu + EPS)

def mu(self, lp, dist):
"""
Expand Down Expand Up @@ -208,7 +210,7 @@ def gradient(self, mu, dist):
-------
grad : np.array of length n
"""
return 1.0 / mu
return 1.0 / (mu + EPS)


class InverseLink(Link):
Expand Down Expand Up @@ -240,7 +242,7 @@ def link(self, mu, dist):
-------
lp : np.array of length n
"""
return mu**-1.0
return 1 / (mu + EPS)

def mu(self, lp, dist):
"""
Expand All @@ -256,7 +258,7 @@ def mu(self, lp, dist):
-------
mu : np.array of length n
"""
return lp**-1.0
return 1 / (lp + EPS)

def gradient(self, mu, dist):
"""
Expand All @@ -271,7 +273,7 @@ def gradient(self, mu, dist):
-------
grad : np.array of length n
"""
return -1 * mu**-2.0
return -1 / (mu**2 + EPS)


class InvSquaredLink(Link):
Expand Down Expand Up @@ -303,7 +305,7 @@ def link(self, mu, dist):
-------
lp : np.array of length n
"""
return mu**-2.0
return 1 / (mu**2 + EPS)

def mu(self, lp, dist):
"""
Expand Down
Loading