parameters: (
      dataframe, base_input_keys_with_defaults, feature_keys)
return_statement: return new_feature_series_dict, feature_specs
docstring: Create an alternate universe assuming that the base series are defined.
  
    The resulting graph will be used with an `input_fn` that provides exactly
    those features.
  
    Args:
      dataframe: the underlying `DataFrame`
      base_input_keys_with_defaults: a `dict` from the names of columns to
        considered base features to their default values.
      feature_keys: the names of columns to be used as features (including base
        features and derived features).
  
    Returns:
      A `dict` mapping names to rebuilt `Series`.
docstring_summary: Create an alternate universe assuming that the base series are defined.
docstring_tokens: Create an alternate universe assuming that the base series are defined .
function: def _build_alternate_universe(
      dataframe, base_input_keys_with_defaults, feature_keys):
    """Create an alternate universe assuming that the base series are defined.
  
    The resulting graph will be used with an `input_fn` that provides exactly
    those features.
  
    Args:
      dataframe: the underlying `DataFrame`
      base_input_keys_with_defaults: a `dict` from the names of columns to
        considered base features to their default values.
      feature_keys: the names of columns to be used as features (including base
        features and derived features).
  
    Returns:
      A `dict` mapping names to rebuilt `Series`.
    """
    feature_specs = _infer_feature_specs(dataframe, base_input_keys_with_defaults)
  
    alternate_universe_map = {
        dataframe[name]: ss.PredefinedSeries(name, feature_specs[name])
        for name in base_input_keys_with_defaults.keys()
    }
  
    def _in_alternate_universe(orig_series):
      # pylint: disable=protected-access
      # Map Series in the original DataFrame to series rebuilt assuming base_keys.
      try:
        return alternate_universe_map[orig_series]
      except KeyError:
        rebuilt_inputs = []
        for i in orig_series._input_series:
          rebuilt_inputs.append(_in_alternate_universe(i))
        rebuilt_series = ss.TransformedSeries(rebuilt_inputs,
                                              orig_series._transform,
                                              orig_series._output_name)
        alternate_universe_map[orig_series] = rebuilt_series
        return rebuilt_series
  
    orig_feature_series_dict = {fk: dataframe[fk] for fk in feature_keys}
    new_feature_series_dict = ({name: _in_alternate_universe(x)
                                for name, x in orig_feature_series_dict.items()})
    return new_feature_series_dict, feature_specs
function_tokens: def _build_alternate_universe ( dataframe , base_input_keys_with_defaults , feature_keys ) : feature_specs = _infer_feature_specs ( dataframe , base_input_keys_with_defaults ) alternate_universe_map = { dataframe [ name ] : ss . PredefinedSeries ( name , feature_specs [ name ] ) for name in base_input_keys_with_defaults . keys ( ) } def _in_alternate_universe ( orig_series ) : # pylint: disable=protected-access # Map Series in the original DataFrame to series rebuilt assuming base_keys. try : return alternate_universe_map [ orig_series ] except KeyError : rebuilt_inputs = [ ] for i in orig_series . _input_series : rebuilt_inputs . append ( _in_alternate_universe ( i ) ) rebuilt_series = ss . TransformedSeries ( rebuilt_inputs , orig_series . _transform , orig_series . _output_name ) alternate_universe_map [ orig_series ] = rebuilt_series return rebuilt_series orig_feature_series_dict = { fk : dataframe [ fk ] for fk in feature_keys } new_feature_series_dict = ( { name : _in_alternate_universe ( x ) for name , x in orig_feature_series_dict . items ( ) } ) return new_feature_series_dict , feature_specs