Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding type check for model_type #109

Merged
merged 4 commits into from Sep 30, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion evalml/pipelines/utils.py
Expand Up @@ -25,6 +25,8 @@ def get_pipelines(problem_type, model_types=None):
pipelines, list of all pipeline

"""
if model_types is not None and not isinstance(model_types, list):
raise TypeError("model_types parameter is not a list.")

problem_pipelines = []

Expand All @@ -39,7 +41,7 @@ def get_pipelines(problem_type, model_types=None):
all_model_types = list_model_types(problem_type)
for model_type in model_types:
if model_type not in all_model_types:
raise RuntimeError("Unrecognized model type for problem type %s: %s f" % (problem_type, model_type))
raise RuntimeError("Unrecognized model type for problem type %s: %s" % (problem_type, model_type))
angela97lin marked this conversation as resolved.
Show resolved Hide resolved

pipelines = []

Expand Down
7 changes: 7 additions & 0 deletions evalml/tests/automl_tests/test_autoclassifier.py
@@ -1,5 +1,6 @@
import numpy as np
import pandas as pd
import pytest
from sklearn.model_selection import StratifiedKFold, TimeSeriesSplit

from evalml import AutoClassifier
Expand Down Expand Up @@ -216,4 +217,10 @@ def test_describe_pipeline_objective_ordered(X_y, capsys):
assert err == ''
assert expected_objective_order in out_stripped


def test_model_types_as_list():
with pytest.raises(TypeError, match="model_types parameter is not a list."):
AutoClassifier(objective='AUC', model_types='linear_model', max_pipelines=2)


# def test_serialization(trained_model)