Skip to main content

A lightweight multi-objective tool package for Bgolearn

Project description

BgoKit

BgoKit is a lightweight utility package for multi-objective candidate selection with Bgolearn. It provides tools for two-objective Pareto-front search, hypervolume-based selection, and score-distribution visualization.

Author: Dr.Bin Cao
Website: https://bin-cao.github.io/
Documentation: https://bgolearn.netlify.app/
Repository: https://github.com/Bin-Cao/Bgolearn

Installation

Install the package from PyPI:

pip install BgoKit

Install or upgrade from a local source tree:

pip install -U .

Requirements

BgoKit requires Python 3.7 or later and depends on:

  • numpy
  • matplotlib
  • MultiBgolearn

Quick Start

The following example shows how to combine two Bgolearn score arrays and recommend a candidate from the Pareto front.

import pandas as pd
import Bgolearn.BGOsampling as BGOS
from BgoKit import ToolKit

# Load measured data and virtual samples.
data = pd.read_csv("./data/data.csv")
vs = pd.read_csv("./data/Visual_samples.csv")

# Use the first columns as input features and the final two columns as targets.
x = data.iloc[:, :-2]
y_t = data.iloc[:, -2]
y_e = data.iloc[:, -1]

# Run Bgolearn for two target properties.
bgolearn = BGOS.Bgolearn()

model_t = bgolearn.fit(
    data_matrix=x,
    Measured_response=y_t,
    virtual_samples=vs,
    min_search=False,
)
score_t, rec_t = model_t.UCB()

model_e = bgolearn.fit(
    data_matrix=x,
    Measured_response=y_e,
    virtual_samples=vs,
    min_search=False,
)
score_e, rec_e = model_e.UCB()

# Run BgoKit for multi-objective candidate selection.
model = ToolKit.MultiOpt(vs, [score_t, score_e], names=["Strength", "Elongation"])
candidate = model.BiSearch()
model.plot_distribution()

Main API

ToolKit.MultiOpt(vs, scores, names=None)

Create a multi-objective optimization helper.

  • vs: virtual samples or candidate feature matrix.
  • scores: list of score arrays, typically [score_1, score_2].
  • names: optional objective names used in plot labels.

MultiOpt.BiSearch()

Normalize two score arrays, identify the Pareto front, save Pareto data to ./Bgolearn/Paretodata.txt, generate Pareto-front figures, and return the selected candidate.

MultiOpt.HVSearch(y)

Perform hypervolume-improvement candidate selection for the UCB workflow.

MultiOpt.HVSearch_user(y)

Perform the educational hypervolume-improvement workflow designed for expected improvement and probability improvement examples.

MultiOpt.plot_distribution()

Plot normalized score distributions for each objective.

Generated Files

Depending on the selected workflow, BgoKit may create:

  • ./Bgolearn/Paretodata.txt
  • ParetoF.png and ParetoF.svg
  • HV_UCB.png and HV_UCB.svg
  • HV_UCB_NOcandidates.png and HV_UCB_NOcandidates.svg
  • HV_EIorPi.png and HV_EIorPi.svg
  • HV_EIorPi_NOcandidates.png and HV_EIorPi_NOcandidates.svg
  • distribution.png and distribution.svg

Citation

If BgoKit or Bgolearn supports your research, please cite the related publication:

npj Computational Materials: https://doi.org/10.1038/s41524-026-02226-3

License

This project is released under the MIT License.

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

bgokit-0.1.1.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

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

bgokit-0.1.1-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file bgokit-0.1.1.tar.gz.

File metadata

  • Download URL: bgokit-0.1.1.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.19

File hashes

Hashes for bgokit-0.1.1.tar.gz
Algorithm Hash digest
SHA256 a03ae5a93cb674e2bf9640812302bb41fd50a0c95c090788957370933f9d7a5b
MD5 decc442ee1fa745ca928633e297821db
BLAKE2b-256 6cccb59e258278a0c88aae624d0503f39e1e8516e333e2457586e1ab87b74d33

See more details on using hashes here.

File details

Details for the file bgokit-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: bgokit-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.19

File hashes

Hashes for bgokit-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a919f9931270ed884d0c9d174bad065f8a6e5ff913a894b9065f8f1920f0dbe8
MD5 5f59783add003cc517ca5bd99bb90cfa
BLAKE2b-256 9b1acc63280bff779166ab8cb99b0a7d436adf2d71eccb9bb7e297ac4f10fd3c

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