Skip to content

Commit

Permalink
Add is_classifier() and is_regressor() // Not fully implemented
Browse files Browse the repository at this point in the history
  • Loading branch information
chuvalniy committed Jan 17, 2024
1 parent 151dc1c commit dea4066
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/base/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
from .model import *
from .model import *
from .tools import *
19 changes: 19 additions & 0 deletions src/base/tools.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from .model import Model


def is_classifier(model: Model) -> bool:
"""
Check if estimator is classifier.
:param model: Machine learning model.
:return: True if classifier else False.
"""
return getattr(model, '_model_type') == 'classifier'


def is_regressor(model: Model) -> bool:
"""
Check if estimator is regressor.
:param model: Machine learning model.
:return: True if regressor else False.
"""
return getattr(model, '_model_type') == 'regressor'

0 comments on commit dea4066

Please sign in to comment.