Problem Types ============================== .. py:module:: evalml.problem_types .. autoapi-nested-parse:: The supported types of machine learning problems. Submodules ---------- .. toctree:: :titlesonly: :maxdepth: 1 problem_types/index.rst utils/index.rst Package Contents ---------------- Classes Summary ~~~~~~~~~~~~~~~ .. autoapisummary:: evalml.problem_types.ProblemTypes Functions ~~~~~~~~~ .. autoapisummary:: :nosignatures: evalml.problem_types.detect_problem_type evalml.problem_types.handle_problem_types evalml.problem_types.is_binary evalml.problem_types.is_classification evalml.problem_types.is_multiclass evalml.problem_types.is_multiseries evalml.problem_types.is_regression evalml.problem_types.is_time_series Contents ~~~~~~~~~~~~~~~~~~~ .. py:function:: detect_problem_type(y) Determine the type of problem is being solved based on the targets (binary vs multiclass classification, regression). Ignores missing and null data. :param y: The target labels to predict. :type y: pd.Series :returns: ProblemType Enum :rtype: ProblemType .. rubric:: Examples >>> y = pd.Series([0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1]) >>> assert detect_problem_type(y) == ProblemTypes.BINARY ... >>> y = pd.Series([1, 2, 3, 2, 1, 1, 1, 2, 2, 3, 3]) >>> assert detect_problem_type(y) == ProblemTypes.MULTICLASS ... >>> y = pd.Series([1.6, 4.2, 3.3, 2.9, 4, 1, 5.5, 2, -2, -3.2, 3]) >>> assert detect_problem_type(y) == ProblemTypes.REGRESSION :raises ValueError: If the input has less than two classes. .. py:function:: handle_problem_types(problem_type) Handles problem_type by either returning the ProblemTypes or converting from a str. :param problem_type: Problem type that needs to be handled. :type problem_type: str or ProblemTypes :returns: ProblemTypes enum :raises KeyError: If input is not a valid ProblemTypes enum value. :raises ValueError: If input is not a string or ProblemTypes object. .. rubric:: Examples >>> assert handle_problem_types("regression") == ProblemTypes.REGRESSION >>> assert handle_problem_types("TIME SERIES BINARY") == ProblemTypes.TIME_SERIES_BINARY >>> assert handle_problem_types("Multiclass") == ProblemTypes.MULTICLASS .. py:function:: is_binary(problem_type) Determines if the provided problem_type is a binary classification problem type. :param problem_type: type of supervised learning problem. See evalml.problem_types.ProblemType.all_problem_types for a full list. :type problem_type: str or ProblemTypes :returns: Whether or not the provided problem_type is a binary classification problem type. :rtype: bool .. rubric:: Examples >>> assert is_binary("Binary") >>> assert is_binary(ProblemTypes.BINARY) >>> assert is_binary(ProblemTypes.TIME_SERIES_BINARY) .. py:function:: is_classification(problem_type) Determines if the provided problem_type is a classification problem type. :param problem_type: type of supervised learning problem. See evalml.problem_types.ProblemType.all_problem_types for a full list. :type problem_type: str or ProblemTypes :returns: Whether or not the provided problem_type is a classification problem type. :rtype: bool .. rubric:: Examples >>> assert is_classification("Multiclass") >>> assert is_classification(ProblemTypes.TIME_SERIES_BINARY) >>> assert not is_classification(ProblemTypes.REGRESSION) .. py:function:: is_multiclass(problem_type) Determines if the provided problem_type is a multiclass classification problem type. :param problem_type: type of supervised learning problem. See evalml.problem_types.ProblemType.all_problem_types for a full list. :type problem_type: str or ProblemTypes :returns: Whether or not the provided problem_type is a multiclass classification problem type. :rtype: bool .. rubric:: Examples >>> assert is_multiclass("Multiclass") >>> assert is_multiclass(ProblemTypes.MULTICLASS) >>> assert is_multiclass(ProblemTypes.TIME_SERIES_MULTICLASS) .. py:function:: is_multiseries(problem_type) Determines if the provided problem_type is a multiseries time series problem type. :param problem_type: type of supervised learning problem. See evalml.problem_types.ProblemType.all_problem_types for a full list. :type problem_type: str or ProblemTypes :returns: Whether or not the provided problem_type is a multiseries time series problem type. :rtype: bool .. py:function:: is_regression(problem_type) Determines if the provided problem_type is a regression problem type. :param problem_type: type of supervised learning problem. See evalml.problem_types.ProblemType.all_problem_types for a full list. :type problem_type: str or ProblemTypes :returns: Whether or not the provided problem_type is a regression problem type. :rtype: bool .. rubric:: Examples >>> assert is_regression("Regression") >>> assert is_regression(ProblemTypes.REGRESSION) >>> assert is_regression(ProblemTypes.TIME_SERIES_REGRESSION) .. py:function:: is_time_series(problem_type) Determines if the provided problem_type is a time series problem type. :param problem_type: type of supervised learning problem. See evalml.problem_types.ProblemType.all_problem_types for a full list. :type problem_type: str or ProblemTypes :returns: Whether or not the provided problem_type is a time series problem type. :rtype: bool .. rubric:: Examples >>> assert is_time_series("time series regression") >>> assert is_time_series(ProblemTypes.TIME_SERIES_BINARY) >>> assert not is_time_series(ProblemTypes.REGRESSION) .. py:class:: ProblemTypes Enum defining the supported types of machine learning problems. **Attributes** .. list-table:: :widths: 15 85 :header-rows: 0 * - **BINARY** - Binary classification problem. * - **MULTICLASS** - Multiclass classification problem. * - **MULTISERIES_TIME_SERIES_REGRESSION** - Multiseries time series regression problem. * - **REGRESSION** - Regression problem. * - **TIME_SERIES_BINARY** - Time series binary classification problem. * - **TIME_SERIES_MULTICLASS** - Time series multiclass classification problem. * - **TIME_SERIES_REGRESSION** - Time series regression problem. **Methods** .. autoapisummary:: :nosignatures: evalml.problem_types.ProblemTypes.all_problem_types evalml.problem_types.ProblemTypes.name evalml.problem_types.ProblemTypes.value .. py:method:: all_problem_types(cls) Get a list of all defined problem types. :returns: List of all defined problem types. :rtype: list(ProblemTypes) .. py:method:: name(self) The name of the Enum member. .. py:method:: value(self) The value of the Enum member.