Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

Yiwzh/fix cv #62

Merged
merged 3 commits into from
Nov 28, 2018
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 17 additions & 8 deletions src/python/nimbusml/model_selection/cv.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from pandas import DataFrame

from .. import Pipeline
from .. import Pipeline, FileDataStream
from ..internal.entrypoints.models_crossvalidator import \
models_crossvalidator
from ..internal.entrypoints.transforms_manyheterogeneousmodelcombiner \
Expand Down Expand Up @@ -450,13 +450,22 @@ def fit(
# Need to infer from group_id, bug 284886
groups = groups or group_id
if groups is not None:
if groups not in cv_aux_info[0]['data_import'][0].inputs[
'CustomSchema']:
raise Exception(
'Default stratification column: ' +
str(groups) +
' cannot be found in the origin data, please specify '
'groups in .fit() function.')
if isinstance(X, FileDataStream):
if groups not in cv_aux_info[0]['data_import'][0].inputs[
'CustomSchema']:
raise Exception(
'Default stratification column: ' +
str(groups) +
' cannot be found in the origin data, please specify '
'groups in .fit() function.')
elif isinstance(X, DataFrame):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

elif isinstance(X, DataFrame): [](start = 12, length = 30)

please also add a test that covers this new path.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. Let me add that~

if groups not in X.columns:
raise Exception(
'Default stratification column: ' +
str(groups) +
' cannot be found in the origin data, please specify '
'groups in .fit() function.')


split_index = self._process_split_start(split_start)
graph_sections = cv_aux_info.graph_sections
Expand Down