Skip to content

Fix inconsistent model training approach in trian_and_predict function #71

@sohampirale

Description

@sohampirale

Problem

The trian_and_predict function in app/services/gaze_tracker.py had inconsistent logic for determining which models should use GridSearchCV with hyperparameters versus simple model fitting:

  • "Elastic Net" and "Support Vector Regressor" had hyperparameters defined in config.py but were using simple model fitting
  • "Random Forest Regressor" had no hyperparameters defined in config.py but was attempting to use GridSearchCV

Solution

Update the conditional logic in trian_and_predict to properly align model usage with hyperparameter availability:

  • Models without hyperparameters (Linear Regression, Random Forest Regressor) now use simple fitting
  • Models with hyperparameters (Elastic Net, SVR, Ridge, Lasso, Bayesian Ridge, SGD) now use GridSearchCV

Impact

This change ensures that:

  1. Models with hyperparameter configurations properly utilize GridSearchCV for optimization
  2. Models without hyperparameter configurations use efficient simple fitting

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions