Skip to main content

A Python package for topographical analysis of machine learning models and physical systems

Project description

TopSearch

This project is currently migrating to open source. Please check back regularly as more functionality is being added and updated

Introduction

The TopSearch package provides functionality to map the topography of surfaces, and can be used to map the solution space of machine learning algorithms. Many machine learning algorithms have non-convex loss (or cost) functions, and the aim of fitting is usually to locate low-valued or diverse solutions. An understanding of the solution space organisation provides key understanding about the reproducibility, explainability and performance of ML methods.

The methodology derives from the field of chemical physics, and is agnostic to the given surface, allowing application to a wide range of machine learning algorithms. Leveraging ideas from chemical physics we can assess the performance and reliability of neural networks, Gaussian processes, Bayesian optimisation, clustering algorithms and understand the effect of dataset roughness on model performance. Application of the same framework to many different machine learning paradigms provides a route for transferable understanding, and its application to machine learning is reviewed in this paper.

Overview

The topographical mapping is performed using the energy landscape framework. The energy landscape framework, developed in chemical physics, encodes surfaces as a network of stationary points. These stationary points, points with zero gradient, can be either local minima or transition states. Transition states are maximal in a single direction and local minimisation along that given direction (both forwards and backwards) locates two connected minima. Each transition state gives the lowest barrier between its two connected minima, and provides information about the intermediate behaviour of the function. In the network, each minimum is a node and edges exist between minima connected by a transition state. The complete network of minima and transition states constitutes the solution landscape, and we show an example landscape below.

Top: A contour plot of the original surface with the stationary points, and their connections, overlaid. The minima are given in green, the transition states in red, and the connections between them with solid black lines. Bottom: The corresponding network abstraction of the surface. Here, the separation between connected nodes is specified by the height of the transition state between them.

Topographical mapping of surfaces involves two main steps:

  • Global optimisation → location of the global minimum and other low-valued local minima of the surface
  • Landscape exploration → attempt transition state searches between pairs of minima to generate a fully connected set of minima

Global optimisation is usually performed using the basin-hopping algorithm within TopSearch. Basin-hopping is a modified Monte Carlo approach that includes local minimisation at each step to efficiently optimise complex solution spaces. During global optimisation we store all unique minima that we encounter, which gives us the initial set of minima that will be connected by transition state searches.

Landscape exploration involves selecting pairs of minima and attempting to find transition states between them. Transition state location is usually performed using a combination of double-ended and single-ended transition state searches. Double-ended searches aim to locate the lowest-valued path between a given pair of minima, and we use the nudged elastic band algorithm within TopSearch. Single-ended methods start from a single point and follow the lowest eigenmode towards the nearest transition state, and this is performed using hybrid eigenvector-following. The nudged elastic band algorithm locates an approximate minimum energy path between two chosen minima, and the maxima on this path are refined to true transition states using hybrid eigenvector-following. There are a variety of schemes to decide which pairs of minima should be selected for transition state connections, all of which aim to produce a fully connected network of minima and explore important regions of solution space.

For more details of the methodology please refer to common_citations.md.

Installation

Instructions are for installation into a conda environment. First create the conda environment

conda create -n topsearch_env python
conda activate topsearch_env

The package is available on PyPI and can be installed using pip

pip install topsearch

or directly from the git source using

pip install git+https://github.com/IBM/topography-searcher

For those not importing the package directly you can set up the proper enivornment from the pyproject.toml file with

poetry install

We can test the environment build by running

pytest

within the tests directory. For a successful build we should have all tests pass. By default we do not test for the molecular_potentials as the dependencies are not shipped by default due to the large size. If this is the case then enjoy using TopSearch!

Examples

We provide several examples to illustrate the tasks that TopSearch can perform in examples. These examples are provided as both an annotated Jupyter notebook or a python script (the scripts are further separated for ease), and each example has a detailed description of its content within the README. example_function as a notebook or scripts are the best place to start for an introduction to the methodology, where we apply it to some simple test functions.

Contributors

This package is written and maintained by Luke Dicks at IBM Research as part of the AI-Enriched Simulation team. Please contact Luke (luke.dicks@ibm.com) or Edward Pyzer-Knapp (EPyzerK3@uk.ibm.com) for questions about how to use and/or contribute.

License

TopSearch is an open-source software licensed under the MIT License. Check the details in the LICENSE file.

Citations

If you use this package please cite it appropriately using the 'Cite this repository' dropdown in the right sidebar. Moreover, we also provide a bibliography of previous relevant work in common_citations.md. This file provides references to energy landscape algorithms and their applications to different fields of machine learning, each given as a bibtex entry with the handle providing a summary of the content.

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

topsearch-0.0.1.tar.gz (123.4 kB view details)

Uploaded Source

Built Distribution

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

topsearch-0.0.1-py3-none-any.whl (68.2 kB view details)

Uploaded Python 3

File details

Details for the file topsearch-0.0.1.tar.gz.

File metadata

  • Download URL: topsearch-0.0.1.tar.gz
  • Upload date:
  • Size: 123.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.13

File hashes

Hashes for topsearch-0.0.1.tar.gz
Algorithm Hash digest
SHA256 d416e9bafa12feff783965829184ecc38b9be9e81e77b686690653f8a2f6a1e2
MD5 1eda6e775031df248716f8c6f905d92f
BLAKE2b-256 d104cd763acfaecf4e9c41767996005ec287fa28cd9f182fc8b6f06ec93bb1fd

See more details on using hashes here.

File details

Details for the file topsearch-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: topsearch-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 68.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.13

File hashes

Hashes for topsearch-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 45a3b2db09cce9352949f9e3307c5ba07515f1a30c515e3de707c9d1fd64537c
MD5 f213790b88c5d6e849b22677488d0dbe
BLAKE2b-256 a80adcc0af886c8605735408f26c0f83b4ffc547f264e952545d3afa4f31b8ed

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