Automl/new features#6
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
This PR introduces a new base abstract class for AutoML implementations that provides a standardized interface and shared utilities for tracking model performance, managing leaderboards, and handling time budgets.
Changes:
- Added
BaseAutoMLabstract class with core AutoML functionality - Implemented
LeaderboardEntrydataclass for tracking model performance - Provided utility methods for time management, experiment tracking, and model comparison
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| # Time state | ||
| self._start_time: Optional[datetime] = None | ||
| self._end_time: Optional[datetime] = None | ||
|
|
||
| # Best model state | ||
| self.best_model_: Optional[Any] = None | ||
| self.best_model_name_: Optional[str] = None | ||
| self.best_score_: Optional[float] = None | ||
| self.best_params_: Dict[str, Any] = {} |
There was a problem hiding this comment.
Missing spaces around colons and equals signs in variable assignments. Should follow PEP 8 style guidelines with proper spacing: "self.best_model_: Optional[Any] = None", "self.best_model_name_: Optional[str] = None", "self.best_score_: Optional[float] = None", "self.best_params_: Dict[str, Any] = {}", "self.leaderboard_: List[LeaderboardEntry] = []", "self.is_fitted_: bool = False".
| return None | ||
| end = self._end_time or datetime.now() | ||
| return (end - self._start_time).total_seconds() | ||
|
|
There was a problem hiding this comment.
Missing space around equals sign. Should be "self.tracker = tracker" according to PEP 8 style guidelines.
| framework: str, | ||
| score: float, | ||
| params: Dict[str, Any], | ||
| duration_seconds: float, |
There was a problem hiding this comment.
Missing space around equals sign. Should be "extra = extra or {}" according to PEP 8 style guidelines.
| **kwargs: Additional arguments | ||
|
|
||
| Returns: | ||
| self |
There was a problem hiding this comment.
Missing spaces around colons in function parameter type annotations. Should be "def predict(self, X: np.ndarray) -> np.ndarray:" according to PEP 8 style guidelines.
| def _time_budget_seconds(self) -> Optional[float]: | ||
| # Get time budget in seconds | ||
| if self.time_budget_minutes is None: | ||
| return None |
There was a problem hiding this comment.
Missing spaces around colons in function signature. Should be "def _elapsed_seconds(self) -> float:" according to PEP 8 style guidelines.
| def _elapsed_seconds(self) -> float: | ||
| # Get elapsed time since start. | ||
| if self._start_time is None: | ||
| return 0.0 |
There was a problem hiding this comment.
Missing spaces around colons in function signature. Should be "def _remaining_seconds(self) -> Optional[float]:" according to PEP 8 style guidelines.
| # One row in the AutoML leaderboard. | ||
| model_name: str | ||
| framework: str | ||
| score: float | ||
| params: Dict[str, Any] | ||
| duration_seconds: float |
There was a problem hiding this comment.
Missing spaces around colons in dataclass field annotations. Should be "model_name: str", "framework: str", etc., according to PEP 8 style guidelines for type annotations.
| # Get remaining time budget in seconds. | ||
| budget = self._time_budget_seconds() | ||
| if budget is None: | ||
| return None |
There was a problem hiding this comment.
Missing spaces around colons in function signature. Should be "def _time_budget_exceeded(self) -> bool:" according to PEP 8 style guidelines.
| if self.tracker is None: | ||
| return |
There was a problem hiding this comment.
Missing spaces around colons in variable annotation and inconsistent spacing in for loop. Should be "clean: Dict[str, float] = {}" and "for k, v in metrics.items():" according to PEP 8 style guidelines.
Defines the interface and shared utilities for AutoML implementations.
Tracks best model, best score, best params, and maintains a leaderboard.