Skip to content

Commit

Permalink
Test changes
Browse files Browse the repository at this point in the history
  • Loading branch information
christopherbunn committed Oct 30, 2023
1 parent 4720493 commit 8b0e464
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 20 deletions.
8 changes: 6 additions & 2 deletions evalml/pipelines/multiseries_regression_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,12 @@ def predict_in_sample(
self.input_target_name,
)
# Order series ID columns to be same as X_train
y_unstacked = y_unstacked[y_train_unstacked.columns]
X_unstacked = X_unstacked[X_train_unstacked.columns]
y_unstacked = y_unstacked[
y_train_unstacked.columns.intersection(y_unstacked.columns)
]
X_unstacked = X_unstacked[
X_train_unstacked.columns.intersection(X_unstacked.columns)
]

X_train_unstacked = infer_feature_types(X_train_unstacked)
y_train_unstacked = infer_feature_types(y_train_unstacked)
Expand Down
4 changes: 2 additions & 2 deletions evalml/pipelines/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,9 +299,9 @@ def _get_preprocessing_components(
"""
if is_multiseries(problem_type):
if include_decomposer:
components_functions = [_get_imputer, _get_decomposer]
components_functions = [_get_decomposer]
else:
components_functions = [_get_imputer]
return []

elif is_time_series(problem_type):
components_functions = [
Expand Down
6 changes: 3 additions & 3 deletions evalml/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -1094,12 +1094,12 @@ def multiseries_ts_data_stacked():

@pytest.fixture
def multiseries_ts_data_unstacked():
feature_a = pd.DataFrame({f"feature_a_{i}": range(i, 100, 5) for i in range(5)})
feature_a = pd.DataFrame({f"feature_a|{i}": range(i, 100, 5) for i in range(5)})

Check warning on line 1097 in evalml/tests/conftest.py

View check run for this annotation

Codecov / codecov/patch

evalml/tests/conftest.py#L1097

Added line #L1097 was not covered by tests
feature_b = pd.DataFrame(
{f"feature_b_{i}": range(99 - i, -1, -5) for i in range(5)},
{f"feature_b|{i}": range(99 - i, -1, -5) for i in range(5)},
)
X = pd.concat([feature_a, feature_b], axis=1)
y = pd.DataFrame({f"target_{i}": range(i, 100, 5) for i in range(5)})
y = pd.DataFrame({f"target|{i}": range(i, 100, 5) for i in range(5)})

Check warning on line 1102 in evalml/tests/conftest.py

View check run for this annotation

Codecov / codecov/patch

evalml/tests/conftest.py#L1102

Added line #L1102 was not covered by tests

X["date"] = pd.date_range(start="1/1/2018", periods=20)
return X, y
Expand Down
2 changes: 1 addition & 1 deletion evalml/tests/pipeline_tests/test_pipeline_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1404,7 +1404,7 @@ def test_unstack_multiseries(
X_unstacked, y_unstacked = multiseries_ts_data_unstacked
y.name = target_name
y_unstacked.columns = [
f"{target_name}_{i}" for i in range(len(y_unstacked.columns))
f"{target_name}|{i}" for i in range(len(y_unstacked.columns))
]

X_unstacked_transformed, y_unstacked_transformed = unstack_multiseries(
Expand Down
31 changes: 19 additions & 12 deletions evalml/utils/woodwork_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,21 +106,28 @@ def _schema_is_equal(first, other):
Returns:
bool: Whether or not the two schemas are equal
"""
first_types_index = first.types.index.tolist()
other_types_index = other.types.index.tolist()
first_types_index.sort()
other_types_index.sort()
if first_types_index != other_types_index:
# first_types_index = first.types.index.tolist()
# other_types_index = other.types.index.tolist()
# first_types_index.sort()
# other_types_index.sort()
# if first_types_index != other_types_index:
if first.types.index.tolist() != other.types.index.tolist():
return False
first_logical_types = first.types["Logical Type"].astype(str).tolist()
other_logical_types = other.types["Logical Type"].astype(str).tolist()
first_logical_types.sort()
other_logical_types.sort()
logical = [x if x != "Integer" else "Double" for x in first_logical_types] == [
x if x != "Integer" else "Double" for x in other_logical_types
# first_logical_types = first.types["Logical Type"].astype(str).tolist()
# other_logical_types = other.types["Logical Type"].astype(str).tolist()
# first_logical_types.sort()
# other_logical_types.sort()
# logical = [x if x != "Integer" else "Double" for x in first_logical_types] == [
# x if x != "Integer" else "Double" for x in other_logical_types
# ]
logical = [
x if x != "Integer" else "Double"
for x in first.types["Logical Type"].astype(str).tolist()
] == [
x if x != "Integer" else "Double"
for x in other.types["Logical Type"].astype(str).tolist()
]
semantic = first.semantic_tags == other.semantic_tags
print("log:", logical, "sem:", semantic)
return logical and semantic


Expand Down

0 comments on commit 8b0e464

Please sign in to comment.