Skip to content

Commit

Permalink
removing warning since it isn't working
Browse files Browse the repository at this point in the history
  • Loading branch information
YSaxon committed Nov 12, 2020
1 parent dbc224d commit c477ee5
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions nbs/05_data.transforms.ipynb
Expand Up @@ -679,7 +679,7 @@
"outputs": [],
"source": [
"# export\n",
"def GroupedSplitter(groupkey,valid_pct=0.2,seed=None,n_tries=3,suppress_warning=False):\n",
"def GroupedSplitter(groupkey,valid_pct=0.2,seed=None,n_tries=3):\n",
" \"Splits groups of items between train/val randomly, such that val should have close to `valid_pct` of the total number of items (similar to RandomSplitter). Groups are defined by a `groupkey`, which is a callable to apply to individual items to get the groupname, or a column name if `o` is a DataFrame\"\n",
" def _inner(o):\n",
" if callable(groupkey):\n",
Expand Down Expand Up @@ -714,10 +714,6 @@
" shuffled_gk['is_valid']=([True] * valid_rows + \n",
" [False]*(len(shuffled_gk) - valid_rows))\n",
" split_df=ids.join(shuffled_gk.loc[:,'is_valid'],on=keycol)\n",
" if ~suppress_warning and -split_goodness/desired_valid>.25:\n",
" import warnings\n",
" actual_split=split_df.groupby('is_valid').count()[0].to_string(header=False,index=False).replace('\\n','/').replace(' ','')\n",
" warnings.warn(f'actual train/val split {actual_split} is significantly different from `valid_pct` requested, consider raising `best_split_of`, but if you have very few categories this may be unavoidable. This warning is suppressable with `suppress_warning`') \n",
" return ColSplitter()(split_df)\n",
" return _inner"
]
Expand Down

0 comments on commit c477ee5

Please sign in to comment.