Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Add new analysis method for symbolic explanation #1118

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

bouthilx
Copy link
Member

@bouthilx bouthilx commented Sep 16, 2023

Add new analysis method for symbolic explanation, coming from https://openreview.net/forum?id=JQwAc91sg_x

This is still work in progress. Need to validate how sensitive the method is to the choice of population size, number of generations and parsimony coefficient.

The visualization reuses a lot of the code of the partial dependencies as a boilerplate. I would need to refactor the code to be able to reuse it instead of duplicating it.

Needs to add unit-tests.

It can be tested manually using the following snippet of code:

from orion.analysis.symbolic_explanation import SymbolicRegressorParams
from orion.client import workon


def function_a(x):
    return 2 * x**2


def function_b(x, y):
    return 2 * x**2 + x * y + 3 * y**2


def function_c(x, y, z):
    return 1.5 * x**2 * y + z**2 / 2


def function_d(x, y, z, w):
    return 2 * x**2 + 3 * y**2 + z**2 + w**2


for function, space in [
    (function_a, {"x": "uniform(-5, 5)"}),
    (function_b, {"x": "uniform(-5, 5)", "y": "uniform(-5,5)"}),
    (
        function_c,
        {"x": "uniform(-5, 5)", "y": "uniform(-5,5)", "z": "uniform(-5, 5)"},
    ),
    (
        function_d,
        {
            "x": "uniform(-5, 5)",
            "y": "uniform(-5,5)",
            "z": "uniform(-5, 5)",
            "w": "uniform(-5, 5)",
        },
    ),
]:
    experiment = workon(function, space, name=f"{len(space)}-dims", max_trials=200)
    fig = experiment.plot.symbolic_explanation(
        n_samples=200,
        symbolic_regressor_params=SymbolicRegressorParams(
            population_size=10000,
            generations=20,
            parsimony_coefficient=0.1,
        ),
    )
    fig.write_html(
        f"test_symbolic_pd_ndims_{len(experiment.space)}.html",
        include_mathjax="cdn",
    )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant