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

v0.2.0 #48

Draft
wants to merge 35 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
c8d75ed
added support to new chatmodels
maykcaldas Mar 12, 2024
cf3f0b8
Ignored paper directory to avoid commiting datasets by mistake
maykcaldas Mar 12, 2024
b12b182
Fixed imports to be compatible with the new version of langchain
maykcaldas Mar 12, 2024
6a5dd70
fixed typo in vectostores
maykcaldas Mar 12, 2024
06fb237
Implemented LLM model clases and made them independent from the AskTe…
maykcaldas Mar 13, 2024
85ccb76
Updated system messages, pulled in MMR lambda parameter.
smichtavy Apr 10, 2024
7f805ef
Implement LLM classes (#37)
maykcaldas Apr 10, 2024
c0193f1
Improves inverse design prompt (#38)
maykcaldas Apr 10, 2024
fb46d2c
Merge branch 'dev' into inverse_lambda
smichtavy Apr 10, 2024
8dc5ffe
removed duplicated argument in ask
maykcaldas Apr 10, 2024
54619b5
Merge pull request #39 from ur-whitelab/inverse_lambda
smichtavy Apr 10, 2024
9e50012
updated gitignore file (#40)
maykcaldas Apr 10, 2024
8d1128e
Expose ChatModel system_message (#42)
maykcaldas Apr 15, 2024
156d99c
updated import for openai_callback
maykcaldas Apr 15, 2024
17bbafa
added system_message files
maykcaldas Apr 22, 2024
e6fcec5
Bias free datasets and corresponding system messages
smichtavy Apr 23, 2024
004a4b7
implemented label similarity search (#44)
maykcaldas May 3, 2024
e0a5bcd
Log ei (#43)
maykcaldas May 3, 2024
fdc4cfd
Added anyscale implementation
maykcaldas May 6, 2024
1d24492
cleaned deprecated parsing code
maykcaldas May 21, 2024
c96c561
updated acq., sys messages, transfer learning options
smichtavy May 27, 2024
0d782d3
Updated chat models to use logprobs (#45)
maykcaldas Jun 10, 2024
f163434
Update tests (#46)
maykcaldas Jun 11, 2024
191a51a
Refactor asktell (#47)
maykcaldas Jun 24, 2024
e141a34
Added an option to use logprobs or not
maykcaldas Aug 7, 2024
0829eb2
Updated the LIFT routine to use mols on OCM instead of percentages
maykcaldas Aug 7, 2024
f53c071
Removed subpool creationg from ask in AskTellGPR
maykcaldas Aug 7, 2024
9090312
Changed asktelfinetuning filename to asktellFinetuning
maykcaldas Aug 7, 2024
4f05758
updated experiment notebooks
maykcaldas Aug 7, 2024
6426b62
Updated gitignore
maykcaldas Aug 7, 2024
f9def5b
Changed the typeHinting syntax to use Union. Python3.9 support
maykcaldas Aug 7, 2024
3e85fc3
Updated AskTellFinetuning (#49)
maykcaldas Aug 13, 2024
e34cc30
Update OCM results (#52)
maykcaldas Sep 30, 2024
6764907
Updating dev with code used for new exps (#53)
maykcaldas Oct 14, 2024
8827eca
Implemented anthropic support (#54)
maykcaldas Oct 25, 2024
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
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,13 @@ __pycache__/
# C extensions
*.so

# Local files
IBMPlexMono-Regular.ttf
.vscode
**.DS_Store
**paper
*.png
*.ipynb

# Distribution / packaging
.Python
Expand Down
2 changes: 1 addition & 1 deletion bolift/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from .version import __version__
from .asktell import AskTellFewShotMulti, AskTellFewShotTopk
from .asktellfinetuning import AskTellFinetuning
from .asktellFinetuning import AskTellFinetuning

try:
from .asktellGPR import AskTellGPR
Expand Down
26 changes: 26 additions & 0 deletions bolift/aqfxns.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,20 @@ def expected_improvement(dist, best):
elif isinstance(dist, GaussDist):
return expected_improvement_g(dist.mean(), dist.std(), best)

def log_expected_improvement(dist, best):
"""Log Expected improvement for the given discrete distribution"""
if isinstance(dist, DiscreteDist):
return log_expected_improvement_d(dist.probs, dist.values, best)
elif isinstance(dist, GaussDist):
return log_expected_improvement_g(dist.mean(), dist.std(), best)

# I think it's just taking the log of the final EI computation. Will test this later
# def log_expected_improvement(dist, best):
# """Log Expected improvement for the given discrete distribution"""
# if isinstance(dist, DiscreteDist):
# return np.log(expected_improvement_d(dist.probs, dist.values, best))
# elif isinstance(dist, GaussDist):
# return np.log(expected_improvement_g(dist.mean(), dist.std(), best))

def probability_of_improvement(dist, best):
"""Probability of improvement for the given discrete distribution"""
Expand Down Expand Up @@ -40,6 +54,11 @@ def expected_improvement_d(probs, values, best):
ei = np.sum(np.maximum(values - best, 0) * probs)
return ei

def log_expected_improvement_d(probs, values, best):
"""Log Expected improvement for the given discrete distribution"""
# ei = np.sum(np.maximum(values - best, 0) * probs)
log_ei = np.log(np.sum(np.maximum(values - best, 0) * probs)+1e-15)
return log_ei

def probability_of_improvement_d(probs, values, best):
"""Probability of improvement for the given discrete distribution"""
Expand All @@ -65,6 +84,13 @@ def expected_improvement_g(mean, std, best):
ei = (mean - best) * norm.cdf(z) + std * norm.pdf(z)
return ei

def log_expected_improvement_g(mean, std, best):
"""Log Expected improvement for the given Gaussian distribution"""
z = (mean - best) / std
# ei = std * h(z)
# ei = std * (norm.pdf(z) + z * norm.cdf(z))
log_ei = np.log(std) + np.log((norm.pdf(z) + z * norm.cdf(z)))
return log_ei

def probability_of_improvement_g(mean, std, best):
"""Probability of improvement for the given Gaussian distribution"""
Expand Down
Loading
Loading