class_docstr: Bootstrap using stratified resampling.
  
  Supports numpy arrays. Data returned has the same type as the input data.
  Data entered using keyword arguments is directly accessibly as an attribute.
  
  To ensure a reproducible bootstrap, you must set the `random_state`
  attribute after the bootstrap has been created. See the example below.
  Note that `random_state` is a reserved keyword and any variable
  passed using this keyword must be an instance of `RandomState`.
  
  Examples
  --------
  Data can be accessed in a number of ways.  Positional data is retained in
  the same order as it was entered when the bootstrap was initialized.
  Keyword data is available both as an attribute or using a dictionary syntax
  on kw_data.
  
  >>> from rliable.library import StratifiedBootstrap
  >>> from numpy.random import standard_normal
  >>> x = standard_normal((5, 50))
  >>> bs = StratifiedBootstrap(x)
  >>> for data in bs.bootstrap(100):
  ...     bs_x = data[0][0]
  >>> bs.conf_int(np.mean, method='percentile', reps=50000)  # 95% CIs for mean
  
  Set the random_state if reproducibility is required.
  
  >>> from numpy.random import RandomState
  >>> rs = RandomState(1234)
  >>> bs = StratifiedBootstrap(x, random_state=rs)
  
  See also: `arch.bootstrap.IIDBootstrap`
  
  Attributes:
    data: tuple, Two-element tuple with the pos_data in the first position and
      kw_data in the second (pos_data, kw_data). Derived from `IIDBootstrap`.
    pos_data: tuple, Tuple containing the positional arguments (in the order
      entered). Derived from `IIDBootstrap`.
    kw_data: dict, Dictionary containing the keyword arguments. Derived from
      `IIDBootstrap`.
class_docstr_tok: ["Bootstrap","using","stratified","resampling",".","Supports","numpy","arrays",".","Data","returned","has","the","same","type","as","the","input","data",".","Data","entered","using","keyword","arguments","is","directly","accessibly","as","an","attribute",".","To","ensure","a","reproducible","bootstrap",",","you","must","set","the","`","random_state","`","attribute","after","the","bootstrap","has","been","created",".","See","the","example","below",".","Note","that","`","random_state","`","is","a","reserved","keyword","and","any","variable","passed","using","this","keyword","must","be","an","instance","of","`","RandomState","`",".","Examples","--","--","--","--","Data","can","be","accessed","in","a","number","of","ways",".","Positional","data","is","retained","in","the","same","order","as","it","was","entered","when","the","bootstrap","was","initialized",".","Keyword","data","is","available","both","as","an","attribute","or","using","a","dictionary","syntax","on","kw_data",".",">",">",">","from","rliable.library","import","StratifiedBootstrap",">",">",">","from","numpy.random","import","standard_normal",">",">",">","x","=","standard_normal","(","(","5",",","50",")",")",">",">",">","bs","=","StratifiedBootstrap","(","x",")",">",">",">","for","data","in","bs.bootstrap","(","100",")",":","...","bs_x","=","data","[","0","]","[","0","]",">",">",">","bs.conf_int","(","np.mean",",","method='percentile","'",",","reps=50000",")","#","95","%","CIs","for","mean","Set","the","random_state","if","reproducibility","is","required",".",">",">",">","from","numpy.random","import","RandomState",">",">",">","rs","=","RandomState","(","1234",")",">",">",">","bs","=","StratifiedBootstrap","(","x",",","random_state=rs",")","See","also",":","`","arch.bootstrap.IIDBootstrap","`","Attributes",":","data",":","tuple",",","Two-element","tuple","with","the","pos_data","in","the","first","position","and","kw_data","in","the","second","(","pos_data",",","kw_data",")",".","Derived","from","`","IIDBootstrap","`",".","pos_data",":","tuple",",","Tuple","containing","the","positional","arguments","(","in","the","order","entered",")",".","Derived","from","`","IIDBootstrap","`",".","kw_data",":","dict",",","Dictionary","containing","the","keyword","arguments",".","Derived","from","`","IIDBootstrap","`","."]
docstr: Initializes StratifiedBootstrap.
  
  Args:
    *args: Positional arguments to bootstrap. Typically used for the
      performance on a suite of tasks with multiple runs/episodes. The inputs
      are assumed to be of the shape `(num_runs, num_tasks, ..)`.
    random_state: If specified, ensures reproducibility in uncertainty
      estimates.
    task_bootstrap: Whether to perform bootstrapping (a) over runs or (b) over
      both runs and tasks. Defaults to False which corresponds to (a). (a)
      captures the statistical uncertainty in the aggregate performance if the
      experiment is repeated using a different set of runs (e.g., changing
      seeds) on the same set of tasks. (b) captures the sensitivity of the
      aggregate performance to a given task and provides the performance
      estimate if we had used a larger unknown population of tasks.
    **kwargs: Keyword arguments, passed directly to `IIDBootstrap`.
docstr_tok: ["Initializes","StratifiedBootstrap",".","Args",":","*","args",":","Positional","arguments","to","bootstrap",".","Typically","used","for","the","performance","on","a","suite","of","tasks","with","multiple","runs\/episodes",".","The","inputs","are","assumed","to","be","of","the","shape","`","(","num_runs",",","num_tasks",",","..",")","`",".","random_state",":","If","specified",",","ensures","reproducibility","in","uncertainty","estimates",".","task_bootstrap",":","Whether","to","perform","bootstrapping","(","a",")","over","runs","or","(","b",")","over","both","runs","and","tasks",".","Defaults","to","False","which","corresponds","to","(","a",")",".","(","a",")","captures","the","statistical","uncertainty","in","the","aggregate","performance","if","the","experiment","is","repeated","using","a","different","set","of","runs","(","e.g.",",","changing","seeds",")","on","the","same","set","of","tasks",".","(","b",")","captures","the","sensitivity","of","the","aggregate","performance","to","a","given","task","and","provides","the","performance","estimate","if","we","had","used","a","larger","unknown","population","of","tasks",".","*","*","kwargs",":","Keyword","arguments",",","passed","directly","to","`","IIDBootstrap","`","."]
code: def __init__(
      self,
      *args: np.ndarray,
      random_state: Optional[random.RandomState] = None,
      task_bootstrap: bool = False,
      **kwargs: np.ndarray,
  ) -> None:
      """Initializes StratifiedBootstrap.
  
      Args:
        *args: Positional arguments to bootstrap. Typically used for the
          performance on a suite of tasks with multiple runs/episodes. The inputs
          are assumed to be of the shape `(num_runs, num_tasks, ..)`.
        random_state: If specified, ensures reproducibility in uncertainty
          estimates.
        task_bootstrap: Whether to perform bootstrapping (a) over runs or (b) over
          both runs and tasks. Defaults to False which corresponds to (a). (a)
          captures the statistical uncertainty in the aggregate performance if the
          experiment is repeated using a different set of runs (e.g., changing
          seeds) on the same set of tasks. (b) captures the sensitivity of the
          aggregate performance to a given task and provides the performance
          estimate if we had used a larger unknown population of tasks.
        **kwargs: Keyword arguments, passed directly to `IIDBootstrap`.
      """
  
      super().__init__(*args, random_state=random_state, **kwargs)
      self._args_shape = args[0].shape
      self._num_tasks = self._args_shape[1]
      self._parameters = [self._num_tasks, task_bootstrap]
      self._task_bootstrap = task_bootstrap
      self._strata_indices = self._get_strata_indices()
  
file_path: rliable/rliable/library.py
imports: from typing import Callable, Dict, List, Optional, Tuple, Union, Mapping
  from absl import logging
  import arch.bootstrap
  import numpy
  from numpy import random
label_desc: Use image node_id 1 to create a new StratifiedBootstrap object from inherited base classes: arch_bs with example: obj = StratifiedBootstrap()