BoostV / process-optimizer-frontend

A web frontend for ProcessOptimizer
BSD 3-Clause "New" or "Revised" License
10 stars 3 forks source link

Front-end does not support purely categorical factors #210

Open dk-teknologisk-mon opened 1 year ago

dk-teknologisk-mon commented 1 year ago

Describe the bug If you create an experiment where you only add categorical choices, you get an error when you try to run the experiment. I'm pretty sure this is simply caused by the fact that you cannot use base_estimator="GP" in the call of Optimizer in the back-end with purely categorical factors. Instead, you need to call Optimizer with base_estimator="RF".

To Reproduce Steps to reproduce the behavior:

  1. I have attached a .json from the front-end with the setup that produced the error in the first place. Github won't accept the .json format, so I converted it to a .txt file instead Example categorial DOE.txt

  2. I can also force an error in the back-end like so: If I define this parameter space: space = [["A", "B"],["C", "D", "E"],["F", "G"]] and then try to build an Optimizer in the pure back-end with this call: opt = Optimizer(space,base_estimator="GP",acq_func="EI",n_initial_points=5,), then I get the following error:

    Traceback (most recent call last):
    File "C:\Users\mon\AppData\Local\Temp/ipykernel_4320/2372620011.py", line 1, in <cell line: 1>
    opt = Optimizer(space,base_estimator="GP",acq_func="EI",n_initial_points=5,)
    File "c:\users\mon\documents\processoptimizer\ProcessOptimizer\optimizer\optimizer.py", line 294, in __init__
    raise ValueError(
    ValueError: GaussianProcessRegressor on a purely categorical space is not supported. Please use another base estimator

    If you change base_estimator to "RF", everything works as expected.

Expected behavior The front-end should support this type of setup and work in the same manner as for all other experiments. The simple fix is to check whether all factors are categorical, and if true, then change base_estimator from "GP" to "RF".

Desktop (please complete the following information):