{ "cells": [ { "cell_type": "markdown", "id": "eb2cd418", "metadata": {}, "source": [ "# The Search Space\n", "\n", "The [`SearchSpace`](../cpp_api/search_space.html) holds the terminals and operators used to define programs, and includes utilities for creating programs and modifying them. \n", "It has a few basic components:\n", "\n", "- `node_map`: this object maps function signatures to specific node types. It is a nested map, made to most quickly match on return types first, then full signatures. It is structured this way to mutations and crossover lookups fast. \n", "- `terminal_map`: same as `node_map` but for terminals. \n", "\n", "Both of these maps have associated weights that are used to weight the probabilities of each operator/terminal being sampled. \n", "Users can optionally provide these weights." ] }, { "cell_type": "markdown", "id": "429d810b", "metadata": {}, "source": [ "## Initializing\n", "\n", "At a minimum, initializing the search space requires that a `Dataset` is already defined, so that `SearchSpace` knows how to define the terminals. " ] }, { "cell_type": "code", "execution_count": 1, "id": "b667948a", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | id | \n", "sex | \n", "race | \n", "target | \n", "
---|---|---|---|---|
count | \n", "993.00000 | \n", "993.000000 | \n", "993.000000 | \n", "993.000000 | \n", "
mean | \n", "496.00000 | \n", "0.487412 | \n", "2.625378 | \n", "8.219092 | \n", "
std | \n", "286.79871 | \n", "0.500093 | \n", "1.725240 | \n", "1.101319 | \n", "
min | \n", "0.00000 | \n", "0.000000 | \n", "0.000000 | \n", "1.337280 | \n", "
25% | \n", "248.00000 | \n", "0.000000 | \n", "1.000000 | \n", "7.836757 | \n", "
50% | \n", "496.00000 | \n", "0.000000 | \n", "3.000000 | \n", "8.404038 | \n", "
75% | \n", "744.00000 | \n", "1.000000 | \n", "4.000000 | \n", "8.810710 | \n", "
max | \n", "992.00000 | \n", "1.000000 | \n", "5.000000 | \n", "11.410597 | \n", "