Interactive Evolutionary Computation in PythonHuman, simulated and AI evaluators. The easyiec toolbox

Appendix A
API reference

This appendix lists every public class and function of easyiec, module by module, with the first sentence of its docstring. The lists are generated from the __all__ attribute of each module by book/build_api_appendix.py, so they are complete by construction; the full signatures, parameters, and attributes are in the online documentation and in the docstrings (help(easyiec.Session)). The conventions of the API are described in sections 2.5, 3.1 and 5.1, the notation of the docstrings in table 2.1.

A.1 easyiec.core: Core: spaces, queries, feedback, sessions

Name

Kind

Description

Box

class

Axis-aligned box [𝐥,𝐮] with typed, named genes

Individual

class

A candidate solution shown to an evaluator

IdFactory

class

Monotone integer identifiers shared by a strategy and its session

Query

class

A request for evaluation

Feedback

class

An evaluator’s answer to a Query

KINDS

constant

tuple constant

NeedsHuman

class

Raised by an evaluator that must hand the query over to a person

information_bits

function

Upper bound of the information (bits) one answer to query can carry

Problem

class

Base class of interactive optimization problems

Session

class

An interactive evolutionary computation session

Budget

class

Stopping rules of a session (any satisfied rule stops it)

Result

class

Outcome of run

run

function

One-line interactive run: easyiec.run(problem, strategy, evaluator, generations=20)

SessionLog

class

Complete, serializable history of a session

Record

class

One query–answer exchange

A.2 easyiec.strategies: Interactive strategies

Name

Kind

Description

Strategy

class

Base class of interactive strategies

InteractiveGA

class

Interactive genetic algorithm (IGA; Takagi, 2001)

InteractiveES

class

Interactive evolution strategy with self-adaptive step sizes

EasyIEC

class

The EASY-IEC algorithm of the MATLAB toolbox (Madár, Abonyi and Szeifert, 2005)

Watchmaker

class

Dawkins’s Blind Watchmaker scheme (Dawkins, 1986)

RandomSearch

class

Baseline: a fresh random gallery every generation; remembers the best choice

InteractiveCMAES

class

Interactive covariance matrix adaptation evolution strategy

InteractivePSO

class

Interactive particle swarm optimization (IPSO; Madár, Abonyi and Szeifert, 2005)

InteractiveDE

class

Interactive differential evolution with pairwise trial-versus-target duels

InteractiveMAPElites

class

Interactive MAP-Elites

NoveltyIEC

class

Interactive evolution with a novelty filter

InteractiveNSGA2

class

NSGA-II whose diversity preservation is steered by the evaluator’s choices

PreferentialBO

class

Preferential Bayesian optimization with duels against the incumbent

SequentialLineSearch

class

Sequential line search (Koyama, Sato, Sakamoto and Igarashi, 2017)

SequentialGallery

class

Sequential gallery (Koyama, Sato and Goto, 2020)

SurrogateAssisted

class

Wrap a strategy with a preference-model pre-screen

STRATEGIES

constant

dict constant

A.3 easyiec.preference: Preference learning

Name

Kind

Description

PreferenceModel

class

Interface of preference models

LinearBT

class

Bradley–Terry model with a linear utility u(𝐱)= 𝐰⊤𝐱

KernelBT

class

Nonlinear Bradley–Terry model on random Fourier features (Rahimi and Recht, 2007)

GPPreference

class

Gaussian-process preference learning with a probit likelihood (Chu and Ghahramani, 2005)

dataset_from_log

function

Item matrix and index pairs from a SessionLog

pairs_to_arrays

function

Pairs → (winner idx, loser idx, weights) arrays, dropping self-pairs

bt_scores

function

Bradley–Terry strengths by the MM algorithm (Hunter, 2004)

copeland

function

Copeland score: wins minus losses of pairwise majority contests

borda

function

Borda count of (possibly partial) rankings; unranked items share the remaining points

kemeny

function

Kemeny–Young consensus ranking (exact up to exact_max items, else Borda + local search)

elo

function

Sequential Elo ratings (Elo, 1978) in the order the comparisons were made

aggregate_rankings

function

Consensus order of several rankings (borda, kemeny, bt, copeland)

win_matrix

function

W[i, j] = total weight of items[i] beating items[j]

cyclic_triads

function

Number of intransitive (cyclic) triads and Kendall–Babington Smith consistency ζ

A.4 easyiec.evaluators: Evaluators

Name

Kind

Description

Evaluator

class

Base class: evaluate(query) -> Feedback

CallbackEvaluator

class

Wrap a function query -> Feedback (custom GUIs, web services, experiments)

MetricEvaluator

class

Deterministic evaluator from a numeric criterion (computational aesthetics, KPIs)

RecordingEvaluator

class

Pass-through that records every query–answer pair (for replays and audits)

ReplayEvaluator

class

Answer queries from a recorded list (deterministic re-runs and tests)

feedback_from_scores

function

Answer query from perceived scores {id: score in [0, 1]}

SimulatedUser

class

A user model with a hidden target

make_crowd

function

Heterogeneous simulated users whose targets scatter around a common one

LLMJudge

class

An LLM/VLM acting as the evaluator of an IEC session

MockJudgeClient

class

Scorer-driven fake LLM

AnthropicClient

class

Claude through the Anthropic Messages API

OpenAIClient

class

OpenAI Chat Completions (and compatible endpoints through base_url)

GeminiClient

class

Google Gemini generateContent with inline PNG data and JSON responses

OllamaClient

class

A local model served by Ollama (http://localhost:11434)

CachedClient

class

Disk cache in front of any client: identical requests are answered from file

make_client

function

Create a client: make_client("anthropic", "claude-haiku-5-5", cache=".cache")

Panel

class

Ask several evaluators and aggregate

PersonaPanel

class

A panel of LLM judges sharing one client but differing in persona

kendall_w

function

Kendall’s coefficient of concordance of m rankers × n items (ranks 1..n)

EscalationEvaluator

class

Answer with an AI evaluator; escalate uncertain queries to a person

disagreement

function

Protocol-aware disagreement in [0, 1] between two answers to query

HumanProxy

class

Stands for a person in an event-driven front end: raises NeedsHuman

ConsoleEvaluator

class

Terminal front end: saves the gallery as a PNG and reads the answer from input()

VerbalSteering

class

Convert comments into unit-cube directions

A.5 easyiec.problems: Problems

Name

Kind

Description

PROBLEMS

constant

dict constant

make

function

Instantiate a problem by registry name: make("julia")

list_problems

function

Overview table (pandas) of the problem library

SyntheticPreference

class

A hidden utility over [0,1]d for fast algorithm benchmarks

CurveMatching

class

Match a hidden target curve; the phenotype is a plotted Fourier series

PIDTuning

class

PID control of a first-order-plus-dead-time process G(s)=Ke−𝜃s∕(τs+1)

CSTRControl

class

Temperature control of an exothermic continuous stirred-tank reactor

BeerFermentation

class

Design of a fermentation temperature profile

FuzzyPartitionDesign

class

Interpretable fuzzy partitions of a variable (five linguistic terms on [0, 1])

PathPlanning

class

A robot path through a field of circular obstacles

ImageEnhancement

class

Photo colour grading with an eleven-parameter pipeline

ImageSegmentation

class

Threshold-and-morphology segmentation of a synthetic microscopy scene with known ground truth

JuliaSet

class

Filled Julia sets z↦z2+c with smooth escape-time colouring

StrangeAttractor

class

Clifford and Peter de Jong attractors rendered as log-density images

IFSFractal

class

Iterated function systems (Hutchinson, 1981; Barnsley, 1988) drawn by the chaos game

FractalFlame

class

Fractal flames (Draves and Reckase, 2008): nonlinear IFS with log-density colouring

CPPNArt

class

Images from compositional pattern-producing networks (Stanley, 2007), as in Picbreeder

Harmonograph

class

Harmonograph drawings: two damped pendulums per axis

Biomorph

class

Dawkins’s biomorphs (The Blind Watchmaker, 1986)

LSystemPlant

class

Bracketed L-system plants (Prusinkiewicz and Lindenmayer, 1990, Fig

CellularAutomaton

class

One-dimensional, three-state totalistic cellular automata (Wolfram, 1984) as space–time images

SuperShape

class

Nested superformula shapes (Gielis, 2003)

ColorPalette

class

Five-colour palettes previewed on a dashboard card

ChartStyle

class

Styles of a small line/bar chart (colours, widths, grid, fonts, chart type)

ChernoffFace

class

Chernoff faces (Chernoff, 1973): facial features as design variables

GraphLayout

class

Aesthetic drawing of a network (Zachary’s karate club, Zachary 1977, via networkx)

Melody

class

Sixteen-step melodies in a chosen scale

TextDesign

class

Short texts (slogans, taglines) for a given topic

response_metrics

function

IAE, overshoot (%), settling time and input total variation of a setpoint response on [t0, t1)

contrast_ratio

function

WCAG 2.1 contrast ratio (L1+0.05)∕(L2+0.05) (1 to 21)

relative_luminance

function

WCAG 2.1 relative luminance of an sRGB colour in [0, 1]

synthetic_cells

function

A microscopy-like scene with its true mask

synthetic_photo

function

A procedurally generated landscape (sky, sun, hills, lake, trees) in [0, 1]

TemplateText

class

Offline representation of short texts (template generation, lexical operators)

LLMText

class

LLM-based generation, mutation and crossover of texts (with an offline fallback)

A.6 easyiec.validation: Evaluation and validation

Name

Kind

Description

kendall_tau

function

Kendall’s τ-b between two score vectors (ties handled)

spearman_rho

function

rbo

function

Rank-biased overlap of two (possibly partial) rankings (Webber, Moffat and Zobel, 2010), extrapolated

topk_overlap

function

Jaccard overlap of the top-k items of two rankings

cohen_kappa

function

Cohen’s κ; weights="linear" or "quadratic" for ordinal labels

fleiss_kappa

function

Fleiss’ κ from an items × categories count table (equal raters per item)

krippendorff_alpha

function

Krippendorff’s α for a raters × units array with NaN for missing values

kendall_w

function

Kendall’s coefficient of concordance of m rankers × n items (ranks 1..n)

icc

function

Intraclass correlation of a units × raters matrix (Shrout and Fleiss, 1979)

feedback_agreement

function

Agreement in [0, 1] of two answers to the same query (1 − protocol-aware disagreement)

pairwise_agreement_matrix

function

Mean answer agreement between evaluators

position_consistency

function

Swap test on random pairs

position_bias

function

Choice rate by display position in a session log, with a χ2 test of uniformity

self_consistency

function

Mean pairwise agreement of repeated answers to the same queries

transitivity

function

Round-robin duels among n_items candidates; cyclic triads and consistency ζ

psychometric_audit

function

Measure how well an evaluator discriminates a controlled attribute

PsychometricResult

class

Fitted 2AFC psychometric function (Weibull with lapse rate; Wichmann and Hill, 2001)

calibration

function

Expected calibration error and the reliability table of self-reported confidence

scale_usage

function

How an evaluator uses a rating scale: entropy (bits, normalized), range used, mean and spread

audit_judge

function

Swap test, transitivity, self-consistency and (optionally) a psychometric audit in one call

JudgeAudit

class

Results of audit_judge

make_individuals

function

Wrap genomes as individuals with fresh identifiers (for audits outside sessions)

alt_test

function

The alternative annotator test

AltTestResult

class

AltTestResult(omega: ’float’, rho: ’float’, passed: ’bool’, epsilon: ’float’, table: ’object’)

benjamini_yekutieli

function

Rejections of the Benjamini–Yekutieli step-up procedure (valid under arbitrary dependence)

ppi_mean

function

Prediction-powered estimate and confidence interval of a population mean

labels_from_records

function

Item-level labels of evaluator name from [(query, {name: Feedback})]

curve_frame

function

Long table of best-so-far oracle utility vs. effort for many results

aggregate_curves

function

Mean and bootstrap confidence band of step-interpolated curves on a common effort grid

evaluations_to_threshold

function

Effort needed to show a candidate with oracle utility ≥ threshold (inf if never)

area_under_curve

function

Normalized area under the best-so-far curve on [0, budget] (1 = optimum from the start)

burden

function

Effort of the evaluator: queries, items viewed, elementary decisions, information bits, human answers, cost

diversity

function

Mean pairwise normalized distance of the candidates of each query (genome or phenotype features)

convergence_speed

function

Distance (unit cube) between the centroids of consecutive queries

run_summary

function

One row per result: final best utility, effort, AUC and effort-to-threshold

bootstrap_ci

function

Point estimate and percentile bootstrap interval of fn(x)

a12

function

Vargha–Delaney A12=P(X>Y)+12P(X=Y) (0.5 = no effect; 0.56/0.64/0.71 small/medium/large)

wilcoxon_paired

function

Two-sided Wilcoxon signed-rank p-value of paired samples (1.0 if all differences vanish)

mann_whitney

function

holm

function

Holm step-down adjusted p-values

friedman

function

Friedman test on an N blocks × k algorithms matrix (larger = better); average ranks included

nemenyi_cd

function

Nemenyi critical difference of average ranks, qαk(k+1)∕(6N) (alpha = 0.05)

compare_groups

function

Pairwise comparison table of groups (mean, CI, A12 and Holm-adjusted p-values vs. a reference)

run_benchmark

function

Run a factorial benchmark

BenchmarkResult

class

BenchmarkResult(results: ’list’, curves: ’object’, summary: ’object’, seconds: ’float’)

compare_evaluators

function

Ask the same random queries to several evaluators and compare their answers

EvaluatorComparison

class

Outcome of compare_evaluators

auroc

function

Area under the ROC curve of scores for binary labels (Mann–Whitney formulation)

A.7 easyiec.viz: Visualization

Name

Kind

Description

plot_gallery

function

Grid of phenotypes; chosen candidates framed in vermilion, kept ones in green, edited ones in purple

plot_history

function

One row per answered query: the candidates shown, the chosen ones framed (a session ’film strip’)

plot_genealogy

function

Genealogy as a layered graph: generations left to right, parent → child edges, nodes coloured by the variation operator; chosen individuals enlarged and framed

plot_lineage

function

Thumbnails along the ancestry of an individual (default: the session’s best)

lineage

function

Ancestry of an individual (first parent chain) from the initial population to ident

plot_embedding

function

2-D map (PCA, MDS or t-SNE) of every shown individual; chosen ones outlined; the path of the chosen centroids shows how the search moved

plot_anytime

function

Best-so-far ground-truth utility of one run, with the utilities of all shown candidates

plot_convergence

function

Mean best-so-far curves with bootstrap bands of several strategies/evaluators

plot_gene_trajectories

function

Normalized gene values of the chosen individuals over the queries (parallel lines over time)

plot_utility_by_step

function

Distribution of the ground-truth utility of the shown candidates per query; chosen ones in vermilion

plot_diversity

function

Diversity of the shown candidates per query (mean normalized pairwise distance)

plot_preference_landscape

function

2-D slice of a learned utility (mean or std) through base (default: centre), with observed items

plot_pareto

function

Objective-space scatter with the non-dominated set highlighted and the chosen candidates framed

plot_strategy_state

function

Strategy-specific internal state: CMA-ES step size and mean, ES step sizes, PSO swarm, MAP-Elites archive

animate_session

function

GIF animation: one frame per query, chosen candidates framed (Pillow)

plot_agreement

function

Heatmap of a pairwise agreement matrix (pandas DataFrame)

plot_psychometric

function

Psychometric curves (proportion correct vs. attribute difference) with fitted functions and 75 % thresholds

plot_position_bias

function

Choice rate by display position (from position_bias)

plot_escalation

function

Uncertainty of the AI answers, the escalation threshold τ and the escalated queries over time

plot_calibration

function

Reliability diagram of self-reported confidence (from calibration)

plot_judge_audit

function

Dashboard comparing judges: position consistency, first-position win rate, transitivity, self-consistency

plot_burden

function

Bar chart of evaluator effort (from a run-summary table)

plot_critical_difference

function

Critical-difference diagram (Demšar, 2006): average ranks with bars joining groups not significantly different

plot_member_votes

function

Vote shares of panel members per candidate for a select answer of a Panel

session_report

function

Write an HTML report of a finished session (Result or Session) and return its path

A.8 easyiec.ui: User interfaces

Name

Kind

Description

GalleryController

class

Interactive answer under construction

MatplotlibGallery

class

Blocking desktop gallery

edit_handles_dialog

function

Drag the problem’s handles; returns the edited genome (None if cancelled)

JupyterGallery

class

An event-driven IEC application in a notebook cell

A.9 easyiec.compat: MATLAB compatibility

Name

Kind

Description

popu_init

function

Initialize a population structure as in the EASY-IEC help

ies_main

function

Run the interactive loop on a popu structure; returns the resulting population

UserFunctionProblem

class

Wrap a MATLAB-style user function userfun(chrom, axes) as a problem

popu_from_strategy

function

A.10 easyiec.imaging: Imaging helpers

Name

Kind

Description

fig_to_array

function

Rasterize a matplotlib figure into a uint8 RGB array

to_uint8

function

Float image in [0, 1] (or uint8) → uint8 RGB array (H, W, 3)

png_bytes

function

Encode an image as PNG bytes (Pillow)

png_base64

function

decode_png

function

PNG (bytes or base64 string) → uint8 RGB array

resize

function

Resize to size (int → square, or (w, h)) with Lanczos filtering

compose_grid

function

Tile images into one labelled gallery image (used for VLM judges and reports)

image_features

function

The IMAGE_FEATURES vector of an image (all roughly in [0, 1])

IMAGE_FEATURES

constant

list constant

hsv_to_rgb

function

Vectorized HSV → RGB (all in [0, 1]); returns an array (..., 3)

rgb_to_hsv

function

luminance

function

Relative luminance in [0, 1] (BT.709 weights on gamma-encoded values)

text_card

function

Render short text on a card (for text-valued phenotypes in galleries)