I understand. Now it works (as it does randomly sometimes).
Unsure if I can create a minimum example since this is a part of a pipeline that uses csv inputs etc.
but basically it crashes during the fit_transform (Running UMAP fit… is printed but never Done with UMAP").
def _umap(self, n_components=2, n_neighbors=15, min_dist=0.1, metric='euclidean'):
"""Uniform Manifold Approximation and Projection (UMAP)."""
print("Running UMAP...")
try:
model = UMAP(
n_components=n_components,
n_neighbors=n_neighbors,
min_dist=min_dist,
metric=metric,
)
except Exception as e:
print("Error in creation of UMAP object:", e)
return None
try:
print("Running UMAP fit...")
result = model.fit_transform(self.X)
print("Done with UMAP fit", result)
except Exception as e:
print("Error occured in UMAP fit:", e)
return None
return result
the inputs for this huge merged callback are:
@dash.callback(
[
Output(“dr-transformed-data”, “data”), # Store computed DR data
Output(“dr-x-dropdown”, “options”),
Output(“dr-x-dropdown”, “value”),
Output(“dr-x-dropdown”, “style”),
Output(“dr-y-dropdown”, “options”),
Output(“dr-y-dropdown”, “value”),
Output(“dr-y-dropdown”, “style”),
Output(“dr-z-dropdown”, “options”),
Output(“dr-z-dropdown”, “value”),
Output(“dr-z-dropdown”, “style”),
Output(“dr-dimension”, “options”),
Output(“dr-dimension”, “value”),
Output(“dr-dimension”, “style”),
Output(“dr-plot”, “figure”),
],
[
Input(“compute-dr-btn”, “n_clicks”), # Trigger DR computation
Input(“dr-x-dropdown”, “value”), # Selected x-axis
Input(“dr-y-dropdown”, “value”), # Selected y-axis
Input(“dr-z-dropdown”, “value”), # Selected z-axis
Input(“dr-dimension”, “value”), # 2D/3D switch
Input(“feature-relevance-graph”, “clickData”),
# a click on the feature relevance graph
],
[
State(“target-variable-dropdown”, “value”), # Target variable for coloring
State(“dr-methods-dropdown”, “value”), # DR method
State(
{“type”: “dr-param-input”, “method”: ALL, “param”: ALL}, “value”
), # DR parameters
State(
{“type”: “dr-param-input”, “method”: ALL, “param”: ALL}, “id”
), # DR parameter IDs
State(“selected-columns-feature-relevance”, “data”), # Selected features
State(“filename-data”, “data”), # Clean data
State(“dr-transformed-data”, “data”),
],
prevent_initial_call=True,
timeout=600000,
background_callback_manager=background_callback_manager,
on_error=update_output_error_handler
)
def merged_DR_callback(
Maybe that Could be an issue? That the callback inputs/states are so many? I have no experience in Dash projects and do not know the limitations.
I use things like:
Blockquote
if triggered_id == “compute-dr-btn”:
print(“We pressed the compute-dr-btn”)
if not selected_method or not feature_relevance_selected_data or not clean_data:
raise dash.exceptions.PreventUpdate
to handle what should happen based on which input that is triggered based of
ctx = dash.callback_context
triggered_id = ctx.triggered[0]["prop_id"].split(".")[0] if ctx.triggered else None