redmod-team / profit

Probabilistic Response mOdel Fitting with Interactive Tools
https://profit.readthedocs.io
MIT License
14 stars 9 forks source link

UI: excluding output variables not working #170

Open Rykath opened 2 years ago

Rykath commented 2 years ago

When excluding (extra) output variables, the UI throws the error:

The relevant encoder is: Exclude(Constant, b, steps, time)

Traceback (most recent call last):
  File "/home/oswell/ThreeSidedDie/venv/lib/python3.9/site-packages/flask/app.py", line 2077, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/oswell/ThreeSidedDie/venv/lib/python3.9/site-packages/flask/app.py", line 1525, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/oswell/ThreeSidedDie/venv/lib/python3.9/site-packages/flask/app.py", line 1523, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/oswell/ThreeSidedDie/venv/lib/python3.9/site-packages/flask/app.py", line 1509, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
  File "/home/oswell/ThreeSidedDie/venv/lib/python3.9/site-packages/dash/dash.py", line 1472, in dispatch
    response.set_data(func(*args, outputs_list=outputs_list))
  File "/home/oswell/ThreeSidedDie/venv/lib/python3.9/site-packages/dash/_callback.py", line 151, in add_context
    output_value = func(*func_args, **func_kwargs)  # %% callback invoked %%
  File "/home/oswell/profit/profit/ui/app.py", line 572, in update_figure
    mesh_in, mesh_out, mesh_out_std, fit_dd_values = mesh_fit(param_slider, id_type, fit_dd, fit_num,
  File "/home/oswell/profit/profit/ui/app.py", line 857, in mesh_fit
    fit_data, fit_var = sur.predict(x_pred, add_noise_var == ['add']) # generate fit data and variance
  File "/home/oswell/profit/profit/sur/gp/gpy_surrogate.py", line 57, in predict
    ymean, yvar = self.decode_predict_data(ymean, yvar)
  File "/home/oswell/profit/profit/sur/sur.py", line 105, in decode_predict_data
    ym = enc.decode(ym)
  File "/home/oswell/profit/profit/sur/encoders.py", line 112, in decode
    x = np.insert(x, col, insert_x, axis=1)
  File "<__array_function__ internals>", line 180, in insert
  File "/home/oswell/ThreeSidedDie/venv/lib/python3.9/site-packages/numpy/lib/function_base.py", line 5351, in insert
    new[tuple(slobj)] = values
ValueError: could not broadcast input array from shape (13,1) into shape (50,1)

if the fit is run on the same data without the extra encoder (and all four outputs are fitted individually), everything works as expected.