Tools · Computational Biology
Thompson Sampling
On this page
Prices, workflows, and method papersOpen in the app
Run it from the API
Submit with Submit a job and the job_type below. Price it first with Estimate job reservation cost: submitting reserves that amount from your wallet, and the charge settles at the actual runtime.
Thompson Sampling thompsonsampling
- Job type
thompsonsampling- Hardware
cpu(default)- Typical runtime
- 30 min on CPU
Payload
Provide at least one of: reagents, reagent_lists.
| Field | Type | Description |
|---|---|---|
reaction_smartsrequired | string | Limits: |
reagents[] | reagent_component[] | Limits: |
reagents.smiles[] | string[] | Limits: |
reagents.file | file_payload | |
reagents.file.filenamerequired | string | Limits: |
reagents.file.content | string | Limits: |
reagents.file.content_base64 | string | Limits: |
reagent_lists[] | string[][] | Legacy alias for reagents as SMILES lists. Limits: |
num_warmup_trialsrequired | integer | Limits: |
num_ts_iterations | integer | Default: |
evaluator_class_namerequired | string | One of: |
evaluator_arg | object | |
evaluator_arg.query_smiles | string | Limits: |
evaluator_arg.ref_colname | string | Limits: |
ts_moderequired | string | One of: |
max_reagents_per_component | integer | Default: |
model_file | file_payload | |
model_file.filenamerequired | string | Limits: |
model_file.content | string | Limits: |
model_file.content_base64 | string | Limits: |
lookup_file | file_payload | |
lookup_file.filenamerequired | string | Limits: |
lookup_file.content | string | Limits: |
lookup_file.content_base64 | string | Limits: |
known_std | number | |
minimum_uncertainty | number |
Example
from cognichem_client import CogniChem
client = CogniChem.from_env() # reads COGNICHEM_API_KEY
payload = {
"reaction_smarts": "[NH2:2][#6:1].[#6:4][C:3]([OH])=O>>[NH:2]([#6:1])[C:3]([#6:4])=O",
"reagents": [
{
"smiles": [
"CNC(=O)c1n[nH]c(N)n1",
"N=C(N)CN1CC[C@H](O)C1",
"COC[C@@H](O)CN",
"NC(=O)CN1CCOCC1",
"CNC(=S)NC(=N)N",
"… 5 more",
],
},
{
"smiles": [
"N=C(N)NC[C@@H](N)C(=O)O",
"CN(C)C[C@@H](N)C(=O)O",
"Nc1nnn(CC(=O)O)n1",
"COC(=O)[C@@H](O)CC(=O)O",
"N=C(N)NC[C@H](N)C(=O)O",
"… 5 more",
],
},
],
"num_warmup_trials": 3,
"num_ts_iterations": 25,
"evaluator_class_name": "FPEvaluator",
"evaluator_arg": {"query_smiles": "CCc1cccc2c(=O)n(C3CNC3)c([C@@H](C)N)nc12"},
"ts_mode": "maximize",
}
estimate = client.jobs.estimate(job_type="thompsonsampling", payload=payload, resource="cpu")
print(f"Reserves ${estimate.cost:.2f}")
job = client.jobs.submit(
job_name="my-thompsonsampling-run",
job_type="thompsonsampling",
payload=payload,
resource="cpu",
)
status = client.jobs.wait(job.process_id)
if status.status == "completed":
client.jobs.result(job.process_id, save_path=".")curl -X POST "https://api.cognichem.com/api/v1/jobs/submit" \
-H "X-Api-Key: $COGNICHEM_API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{
"job_name": "my-thompsonsampling-run",
"job_type": "thompsonsampling",
"payload": {
"reaction_smarts": "[NH2:2][#6:1].[#6:4][C:3]([OH])=O>>[NH:2]([#6:1])[C:3]([#6:4])=O",
"reagents": [
{
"smiles": [
"CNC(=O)c1n[nH]c(N)n1",
"N=C(N)CN1CC[C@H](O)C1",
"COC[C@@H](O)CN",
"NC(=O)CN1CCOCC1",
"CNC(=S)NC(=N)N",
"… 5 more"
]
},
{
"smiles": [
"N=C(N)NC[C@@H](N)C(=O)O",
"CN(C)C[C@@H](N)C(=O)O",
"Nc1nnn(CC(=O)O)n1",
"COC(=O)[C@@H](O)CC(=O)O",
"N=C(N)NC[C@H](N)C(=O)O",
"… 5 more"
]
}
],
"num_warmup_trials": 3,
"num_ts_iterations": 25,
"evaluator_class_name": "FPEvaluator",
"evaluator_arg": {
"query_smiles": "CCc1cccc2c(=O)n(C3CNC3)c([C@@H](C)N)nc12"
},
"ts_mode": "maximize"
},
"resource": "cpu"
}'{
"reaction_smarts": "[NH2:2][#6:1].[#6:4][C:3]([OH])=O>>[NH:2]([#6:1])[C:3]([#6:4])=O",
"reagents": [
{
"smiles": [
"CNC(=O)c1n[nH]c(N)n1",
"N=C(N)CN1CC[C@H](O)C1",
"COC[C@@H](O)CN",
"NC(=O)CN1CCOCC1",
"CNC(=S)NC(=N)N",
"… 5 more"
]
},
{
"smiles": [
"N=C(N)NC[C@@H](N)C(=O)O",
"CN(C)C[C@@H](N)C(=O)O",
"Nc1nnn(CC(=O)O)n1",
"COC(=O)[C@@H](O)CC(=O)O",
"N=C(N)NC[C@H](N)C(=O)O",
"… 5 more"
]
}
],
"num_warmup_trials": 3,
"num_ts_iterations": 25,
"evaluator_class_name": "FPEvaluator",
"evaluator_arg": {
"query_smiles": "CCc1cccc2c(=O)n(C3CNC3)c([C@@H](C)N)nc12"
},
"ts_mode": "maximize"
}Sample data from the job catalog; long values are shortened here. Each job_name must be unique among your jobs.
Workflow inputs
None
Workflow outputs
- ArchiveZIP
- MoleculesSMILES