Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New functionality for bounding LR systems #108

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open

New functionality for bounding LR systems #108

wants to merge 10 commits into from

Conversation

LvdHam
Copy link

@LvdHam LvdHam commented Jan 28, 2025

Based on a novel publication by I. Alberink et al. that is being submitted for publication.

…I. Alberink et al. that is being submitted for publication.
@LvdHam LvdHam requested a review from wowtor January 28, 2025 14:18
Copy link
Contributor

@wowtor wowtor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Om te beginnen, super dat jullie al een PR hebben voor deze functionaliteit, en goed om dit in LIR te hebben.

Wat nog ontbreekt is een manier om het in een LIR pipeline te passen. Je kan dat doen door er een calibrator van te maken, met een fit() en transform() en zo. Zie bijvoorbeeld ELUBbounder. Daar kan hij naast staan. Hoe noemen jullie deze manier van bounding?

lir/bounding.py Outdated Show resolved Hide resolved
lir/bounding.py Outdated Show resolved Hide resolved
lir/bounding.py Outdated Show resolved Hide resolved
lir/bounding.py Outdated Show resolved Hide resolved
lir/bounding.py Show resolved Hide resolved
lir/bounding.py Outdated Show resolved Hide resolved
lir/bounding.py Outdated Show resolved Hide resolved
lir/bounding.py Outdated Show resolved Hide resolved
lir/bounding.py Outdated Show resolved Hide resolved
lir/bounding.py Outdated Show resolved Hide resolved
lir/bounding.py Outdated Show resolved Hide resolved
lir/bounding.py Outdated Show resolved Hide resolved
@property
def p0(self):
return self.first_step_calibrator.p0
if self.also_fit_calibrator:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deze attribute also_fit_calibrator is gedefinieerd binnen de super class, maar wordt alleen in de sub class gebruikt. Dat is niet overzichtelijk. Er zijn meerdere opties:

  • de attribute verplaatsen naar de sub class
  • deze code verplaatsen naar de super class, en dan hier: super().fit(X, y)
  • deze method fit() helemaal naar de super class en daar ook een abstract method calculate_bounds() toevoegen die dan hier geimplementeerd wordt

Die laatste vind ik denk ik het mooist omdat dat het duidelijkst de scheiding aanbrengt in verantwoordelijkheden tussen de super class en de sub class.

def fit(self, X, y):
"""
assuming that y=1 corresponds to Hp, y=0 to Hd
"""
if self.also_fit_calibrator:
self.first_step_calibrator.fit(X,y)
lrs = self.first_step_calibrator.transform(X)
self.first_step_calibrator.fit(X, y)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

zelfde comment als bij de andere bounder

def p1(self):
return self.first_step_calibrator.p1
y = np.asarray(y).squeeze()
self._lower_lr_bound, self._upper_lr_bound = calculate_invariance_bounds(lrs, y)[:2]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dit is een goede oplossing. Een andere optie om aan te geven dat je de laatste twee waarden niet wil gebruiken is dit:

self._lower_lr_bound, self._upper_lr_bound, _, _ = calculate_invariance_bounds(lrs, y)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants