parameters: (self, input_placeholder, output_placeholder)
return_statement: return _feed_dict_fn
docstring: Returns a function, that will sample data and provide it to placeholders.
  
      Args:
        input_placeholder: tf.Placeholder for input features mini batch.
        output_placeholder: tf.Placeholder for output targets.
  
      Returns:
        A function that when called samples a random subset of batch size
        from x and y.
docstring_summary: Returns a function, that will sample data and provide it to placeholders.
docstring_tokens: Returns a function that will sample data and provide it to placeholders .
function: def get_feed_dict_fn(self, input_placeholder, output_placeholder):
      """Returns a function, that will sample data and provide it to placeholders.
  
      Args:
        input_placeholder: tf.Placeholder for input features mini batch.
        output_placeholder: tf.Placeholder for output targets.
  
      Returns:
        A function that when called samples a random subset of batch size
        from x and y.
      """
      def _feed_dict_fn():
        """Samples data and provides it to placeholders."""
        # TODO(ipolosukhin): option for with/without replacement (dev version of
        # dask)
        sample = self.df.random_split(
            [self.sample_fraction, 1 - self.sample_fraction],
            random_state=self.random_state)
        inp = extract_pandas_matrix(sample[0][self._x_columns].compute()).tolist()
        out = extract_pandas_matrix(sample[0][self._y_columns].compute())
        # convert to correct dtype
        inp = np.array(inp, dtype=self._input_dtype)
        # one-hot encode out for each class for cross entropy loss
        if HAS_PANDAS:
          import pandas as pd  # pylint: disable=g-import-not-at-top
          if not isinstance(out, pd.Series):
            out = out.flatten()
        out_max = self._y.max().compute().values[0]
        encoded_out = np.zeros((out.size, out_max + 1), dtype=self._output_dtype)
        encoded_out[np.arange(out.size), out] = 1
        return {input_placeholder.name: inp,
                output_placeholder.name: encoded_out}
      return _feed_dict_fn
function_tokens: def get_feed_dict_fn ( self , input_placeholder , output_placeholder ) : def _feed_dict_fn ( ) : """Samples data and provides it to placeholders.""" # TODO(ipolosukhin): option for with/without replacement (dev version of # dask) sample = self . df . random_split ( [ self . sample_fraction , 1 - self . sample_fraction ] , random_state = self . random_state ) inp = extract_pandas_matrix ( sample [ 0 ] [ self . _x_columns ] . compute ( ) ) . tolist ( ) out = extract_pandas_matrix ( sample [ 0 ] [ self . _y_columns ] . compute ( ) ) # convert to correct dtype inp = np . array ( inp , dtype = self . _input_dtype ) # one-hot encode out for each class for cross entropy loss if HAS_PANDAS : import pandas as pd # pylint: disable=g-import-not-at-top if not isinstance ( out , pd . Series ) : out = out . flatten ( ) out_max = self . _y . max ( ) . compute ( ) . values [ 0 ] encoded_out = np . zeros ( ( out . size , out_max + 1 ) , dtype = self . _output_dtype ) encoded_out [ np . arange ( out . size ) , out ] = 1 return { input_placeholder . name : inp , output_placeholder . name : encoded_out } return _feed_dict_fn