Skip to main content

Autonomous Research Assistant (AutoRA) is a framework for automating steps of the empirical research process.

Project description

Automated Research Assistant

PyPI GitHub Workflow Status PyPI - Downloads Link to docs License: MIT GitHub Discussions

BRAINSTORM Program     BRAINSTORM Program

AutoRA (Automated Research Assistant) is an open-source framework for automating multiple stages of the empirical research process, including model discovery, experimental design, data collection, and documentation for open science.

AutoRA was initially intended for accelerating research in the behavioral and brain sciences. However, AutoRA is designed as a general framework that enables automation of the research processes in other empirical sciences, such as material science or physics.

Autonomous Empirical Research Paradigm

Installation

We recommend using a Python environment manager like virtualenv. You may refer to the Development Guide on how to set up a virtual environment.

Before installing the PyPI autora package, you may activate your environment. To install the PyPI autora package, run the following command:

pip install "autora"

Documentation

Check out tutorials and documentation at https://autoresearch.github.io/autora. If you run into any issues or questions regarding the use of AutoRA, please reach out to us at the AutoRA forum.

Example

The following example demonstrates how to use AutoRA to automate the process of model discovery, experimental design, and data collection.

The discovery problem is defined by a single independent variable $x \in [0, 2 \pi]$ and dependent variable $y$. The experiment amounts to a simple sine wave, $y = \sin(x)$, which is the model we are trying to discover.

Th discovery cycle iterates between the experimentalist, experiment runner, and theorist. Here, we us a "random" experimentalist, which samples novel experimental conditions for $x$ every cycle. The experiment runner then collects data for the corresponding $y$ values. Finally, the theorist uses a Bayesian Machine Scientist (BMS; Guimerà et al., in Science Advances) to identify a scientific model that explains the data.

The workflow relies on the StandardState object, which stores the current state of the discovery process, such as conditions, experiment_data, or models. The state is passed between the experimentalist, experiment runner, and theorist.

####################################################################################
## Import statements
####################################################################################

import pandas as pd 
import numpy as np
import sympy as sp

from autora.variable import Variable, ValueType, VariableCollection

from autora.experimentalist.random import random_pool
from autora.experiment_runner.synthetic.abstract.equation import equation_experiment
from autora.theorist.bms import BMSRegressor

from autora.state import StandardState, on_state, estimator_on_state

####################################################################################
## Define initial data
####################################################################################

#### Define variable data ####
iv = Variable(name="x", value_range=(0, 2 * np.pi), allowed_values=np.linspace(0, 2 * np.pi, 30))
dv = Variable(name="y", type=ValueType.REAL)
variables = VariableCollection(independent_variables=[iv],dependent_variables=[dv])

#### Define seed condition data ####
conditions = random_pool(variables, num_samples=10, random_state=0)

####################################################################################
## Define experimentalist
####################################################################################

experimentalist = on_state(random_pool, output=["conditions"])

####################################################################################
## Define experiment runner
####################################################################################

sin_experiment = equation_experiment(sp.simplify('sin(x)'), variables.independent_variables, variables.dependent_variables[0])
sin_runner = sin_experiment.experiment_runner

experiment_runner = on_state(sin_runner, output=["experiment_data"])

####################################################################################
## Define theorist
####################################################################################

theorist = estimator_on_state(BMSRegressor(epochs=100))

####################################################################################
## Define state
####################################################################################

s = StandardState(
    variables = variables,
    conditions = conditions,
    experiment_data = pd.DataFrame(columns=["x","y"])
)

####################################################################################
## Cycle through the state
####################################################################################

print('Pre-Defined State:')
print(f"Number of datapoints collected: {len(s['experiment_data'])}")
print(f"Derived models: {s['models']}")
print('\n')

for i in range(5):
    s = experimentalist(s, num_samples=10, random_state=42)
    s = experiment_runner(s, added_noise=1.0, random_state=42)
    s = theorist(s)
    print(f"\nCycle {i+1} Results:")
    print(f"Number of datapoints collected: {len(s['experiment_data'])}")
    print(f"Derived models: {s['models']}")
    print('\n')

Contributions

We welcome contributions to the AutoRA project. Please refer to the contributor guide for more information. Also, feel free to ask any questions or provide any feedback regarding core contributions on the AutoRA forum.

About

This project is in active development by the Autonomous Empirical Research Group, in collaboration with the Center for Computation and Visualization at Brown University.

The development of this package is supported by Schmidt Science Fellows, in partnership with the Rhodes Trust, as well as the Carney BRAINSTORM program at Brown University.

Read More

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

autora-4.0.0.tar.gz (4.2 MB view details)

Uploaded Source

Built Distribution

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

autora-4.0.0-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file autora-4.0.0.tar.gz.

File metadata

  • Download URL: autora-4.0.0.tar.gz
  • Upload date:
  • Size: 4.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for autora-4.0.0.tar.gz
Algorithm Hash digest
SHA256 b1b58421678c5de2534ebb230e955a84d2111611ae74d19c356abca340e6328f
MD5 7d1413cbe1abffbed1a4bc70b9d0b044
BLAKE2b-256 f2b96ea5f891e59e5b50d1b5738d810b5b23d74f1ec32d43ff5647dd97197540

See more details on using hashes here.

File details

Details for the file autora-4.0.0-py3-none-any.whl.

File metadata

  • Download URL: autora-4.0.0-py3-none-any.whl
  • Upload date:
  • Size: 5.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for autora-4.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 227fe6e79439c93a67b13bec678eeecfbf1d90234a9b1f1c3b4020460e7d73ca
MD5 cce5e0842b9924bf3d7e390929631812
BLAKE2b-256 76e774aef63e19788727f20edbf693ba00487c15b8eba3bfc39363af4f33bd0f

See more details on using hashes here.

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