Skip to content

Fix prediction target encoded#322

Merged
cristian-tamblay merged 6 commits into
developfrom
fix/prediction-target-encoded
Oct 8, 2025
Merged

Fix prediction target encoded#322
cristian-tamblay merged 6 commits into
developfrom
fix/prediction-target-encoded

Conversation

@Irozuku
Copy link
Copy Markdown
Collaborator

@Irozuku Irozuku commented Oct 3, 2025

This pull request refactors how predictions are processed across different machine learning tasks in the DashAI backend. It introduces a unified process_predictions method in the base task class, implements task-specific logic for classification tasks, and updates related endpoints and job logic to use this new structure. The changes improve code modularity, make prediction handling more consistent, and simplify the addition of new task types.

Task Abstraction and Prediction Processing

  • Added an abstract process_predictions method to BaseTask, requiring all tasks to define how predictions are processed.
  • Implemented process_predictions in ClassificationTask, converting model outputs to class labels using dataset metadata, and updated all classification task types (ImageClassificationTask, TabularClassificationTask, TextClassificationTask) to inherit from ClassificationTask instead of BaseTask. [1] [2] [3] [4]
  • Implemented process_predictions for regression and translation tasks to simply return predictions as-is, maintaining compatibility. [1] [2]

Dataset Utilities and Label Encoding

  • Added the encode_labels utility to encode categorical columns into numerical labels and generate a ClassLabel feature, used by classification tasks for prediction processing. [1] [2]

Prediction Job and API Endpoint Updates

  • Updated the prediction job logic to use the new process_predictions method, loading the appropriate task from the registry and handling dataset loading errors more robustly. [1] [2]
  • Refactored the /predict_summary API endpoint to extract prediction metadata, determine output data types using the task class, and compute class distributions for classification tasks using the updated structure. [1] [2]

Before
image

After
image

@cristian-tamblay cristian-tamblay merged commit 4ee5df7 into develop Oct 8, 2025
5 checks passed
@cristian-tamblay cristian-tamblay deleted the fix/prediction-target-encoded branch October 8, 2025 18:49
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.

2 participants