Skip to main content

Agent code for the Autonomous Formulation Lab

Project description

AFL-agent: Autonomous Active Learning Agent for Material Science

Documentation

AFL-agent is a Python library that implements the autonomous active learning agent described in the manuscript "Autonomous Small-Angle Scattering for Accelerated Soft Material Formulation Optimization". The library is designed to autonomously guide experimental measurement campaigns to efficiently map phase boundaries in soft material formulations using advanced machine learning techniques.

Overview

The AFL-agent library offers robust tools for building autonomous active learning agents tailored for material science applications. It integrates machine learning techniques with experimental design strategies to optimize experimental campaigns and efficiently map phase boundaries and optimize material properties in soft material formulations.

Key Features:

  • Library of machine learning operations that can be composed into pipelines
  • Pipelines are modular, visualizable, serializable, and self-documenting
  • Trivial support for multimodal data processing
  • All intermediate pipeline operations are stored in a xarray-based data model
  • Rich visualization tools for analyzing calculations

Installation

pip install git+https://github.com/usnistgov/afl-agent

Quick Start

Below is an example showcasing how to build a pipeline for choosing a sample composition

from AFL.double_agent import *
import numpy as np
import xarray as xr

with Pipeline() as pipeline:

    SavgolFilter(
        input_variable='measurement', 
        output_variable='derivative', 
        dim='x', 
        derivative=1
        )

    Similarity(
        input_variable='derivative', 
        output_variable='similarity', 
        params={'metric': 'cosine'}
        )

    SpectralClustering(
        input_variable='similarity',
        output_variable='labels',
        )

    GaussianProcessClassifier(
        feature_input_variable='composition',
        predictor_input_variable='labels',
        output_prefix='extrap',
    )

    MaxValueAF(
        input_variable='extrap_variance',
        output_variable='next_sample'
    )



# Generate synthetic data
n_samples = 10
n_points = 100
x = np.linspace(0, 10, n_points)
measurements = ... # data from your measurement
compositions = ... # composition of your samples

# Create dataset
ds = xr.Dataset(
    data_vars={
        'measurement': (['sample', 'x'], measurements),
        'composition': (['sample', 'components'], compositions)
    },
    coords={
        'x': x,
        'components': ['A', 'B', 'C']
    }
)

# Run the pipeline
ds_out = pipeline.calculate(ds)

#ds_out contains the following variables:
# - measurement: the original measurement data
# - derivative: the first derivative of the measurement data
# - similarity: the similarity between the samples
# - labels: the labels assigned to the samples
# - extrap_variance: the variance of the Gaussian process prediction
# - next_sample: the next sample to measure

Citation

If you use AFL-agent in your research, please cite the manuscript:

"Autonomous Small-Angle Scattering for Accelerated Soft Material Formulation Optimization" (under review)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

afl_agent-1.3.1.tar.gz (366.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

afl_agent-1.3.1-py3-none-any.whl (401.4 kB view details)

Uploaded Python 3

File details

Details for the file afl_agent-1.3.1.tar.gz.

File metadata

  • Download URL: afl_agent-1.3.1.tar.gz
  • Upload date:
  • Size: 366.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for afl_agent-1.3.1.tar.gz
Algorithm Hash digest
SHA256 e9a650c40cbc1cc6f2f7ffae29eec08225103e2e8c4310d0f58d53d3e5368591
MD5 f28925e3173a77333e2cf8c0bcce818a
BLAKE2b-256 ed234a032c01501183a96e2f0a51710633ee736d9e90bf9ca075af3fc03c4d17

See more details on using hashes here.

Provenance

The following attestation bundles were made for afl_agent-1.3.1.tar.gz:

Publisher: publish_pypi.yml on usnistgov/AFL-agent

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file afl_agent-1.3.1-py3-none-any.whl.

File metadata

  • Download URL: afl_agent-1.3.1-py3-none-any.whl
  • Upload date:
  • Size: 401.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for afl_agent-1.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 32e22224f466fa2b678576e0b5561647629780ada46e3f8d7f8305abd12ade7b
MD5 eeb7aba15d26321292027aa385c9cf64
BLAKE2b-256 0f27e5685607f10793177c71c005170a2fa69c1e9f3be21d6fdf36702dfc0a62

See more details on using hashes here.

Provenance

The following attestation bundles were made for afl_agent-1.3.1-py3-none-any.whl:

Publisher: publish_pypi.yml on usnistgov/AFL-agent

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page