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

Feedback #1

Open
wants to merge 10 commits into
base: feedback
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
97 changes: 97 additions & 0 deletions BO_hackaton_example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@

from baybe import Campaign
from baybe.objective import Objective
from baybe.parameters import NumericalDiscreteParameter, SubstanceParameter
from baybe.searchspace import SearchSpace
from baybe.targets import NumericalTarget
from baybe.utils.dataframe import add_fake_results



### Setup

# defining ranges of volumes v_i for each precursor
NUM_PRECURSORS = 6

parameters = [
NumericalContinuousParameter(
name=f"v_{k+1}",
bounds=(0, 60),
)
for k in range(NUM_PRECURSORS)
]

# defining the constraint that the sum of all volumes wont exceed 60uL

constraints = [ContinuousLinearEqualityConstraint(
parameters= [f"v_{k+1}" for k in range(NUM_PRECURSORS)], coefficients=[1.0 for k in range(NUM_PRECURSORS)], rhs=60.0
)]


searchspace = SearchSpace.from_product(parameters=parameters, constraints=constraints)


### Defining the targets

Target_1 = NumericalTarget(
name="G1", mode="MATCH", bounds=(900, 1100), transformation="LINEAR"
)
Target_2 = NumericalTarget(
name="G2", mode="MATCH", bounds=(400, 600), transformation="LINEAR"
)

Target_3 = NumericalTarget(
name="relaxation_time", mode=TargetMode.MAX,
)

# Note that the `MATCH` mode seeks to have the target at the mean between the two bounds.
# For example, choosing 95 and 105 will lead the algorithm seeking 100 as the optimal value.
# Thus, using the bounds, it is possible to control both the match target and
# the range around this target that is considered viable.


### Creating the objective

# Now to work with these three targets the objective object must be properly created.
# The mode is set to `DESIRABILITY` and the targets are described in a list.

targets = [Target_1, Target_2, Target_3]

objective = Objective(
mode="DESIRABILITY",
targets=targets,
combine_func="MEAN",
)

### Construct the campaign and run some iterations
campaign = Campaign(
searchspace=searchspace,
objective=objective,
)


### Load the existing data

#data = pd.read_csv("./data.csv")
#campaign.add_measurements(data)

### Generation of recommendations
batch_size=96
rec = campaign.recommend(batch_size = batch_size)


### Example with fake data
N_ITERATIONS = 3
for kIter in range(N_ITERATIONS):
print(f"\n\n#### ITERATION {kIter+1} ####")

rec = campaign.recommend(batch_size = batch_size)
print("\nRecommended measurements:\n", rec)

add_fake_results(rec, campaign)
print("\nRecommended measurements with fake measured results:\n", rec)

campaign.add_measurements(rec)

print("\n\nInternal measurement dataframe computational representation Y:\n")
print(campaign._measurements_targets_comp)
Binary file added PROJECT_POSTER.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Presentation_PDF.pdf
Binary file not shown.
18 changes: 15 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
# <Your Project Name>
[![Open in Codespaces](https://classroom.github.com/assets/launch-codespace-7f7980b617ed060a017424585567c406b6ee15c891e84e1186181d67ecf80aa0.svg)](https://classroom.github.com/open-in-codespaces?assignment_repo_id=14512004)
# Project Optimystics

<Short description of your project>
Closed loop optimization of hydrogel formulations using dynamic light scattering

## Overview

<Long description of your project>
Hydrogels are hydrophilic crosslinked polymer networks with applications in cell cultures, drug delivery, and tissue engineering. Hydrogels' mechanical and rheological properties depend on the application and are a function of the hydrogel formulation, which consists of water, polymer, crosslinking agents, and other additives – which firmly control gelation. The convoluted interplay between the input parameters severely limits the ability to synthesise hydrogels with desired properties. Thus, a self-driving lab with machine-learning-assisted optimisation of the input parameters could optimise the gel formulation to synthesise gels with properties customised for specific applications. Unfortunately, the automated processing of soft, fragile hydrogels is challenging and further established gelation monitoring techniques are data-intensive and often unreliable. Herein, we propose using high-throughput compatible dynamic light scattering (DLS) to monitor gelation. The concentrations of various components and the crosslinking parameters can be varied using Bayesian optimisation to ‘discover’ the hydrogel formulations with the target mechanical and rheological properties using DLS.

## Youtube Video
https://youtu.be/Qbvq7uolQr8?si=ywHLhoCG1i3bCDJO

## Other Files
<b>Video Script.docx</b> - Script for the youtube video <br>
<b>PROJECT_POSTER.png</b> - Poster for the project <br>
<b>hydrogel background.docx</b> - Background research <br>
<b>BO_hackathon_example.py</b> - Example code for integration <br>
<b>Presentation_PDF.pdf</b> - The presentation slides (plus some extra) for the video


## Setup command

Expand Down
Binary file added Video Script.docx
Binary file not shown.
Binary file added hydrogel background.docx
Binary file not shown.