class_docstr: The sample greedy algorithm for optimization.
  
  The sample greedy algorithm is a simple approach that subsamples the full 
  data set with a user-defined sampling probability and then runs an 
  optimization on that subset. This subsampling can lead to obvious speed 
  improvements because fewer elements as selected, but will generally find 
  a lower quality subset because fewer elements are present. This approach 
  is typically used a baseline for other approaches but can save a lot of 
  time on massive data sets that are known to be highly redundant.
  
  .. code::python
  
          from apricot import FeatureBasedSelection
  
          X = numpy.random.randint(10, size=(10000, 100))
  
          selector = FeatureBasedSelection(100, 'sqrt', optimizer='sample')
          selector.fit(X)
  
  Parameters
  ----------
  self.function : base.BaseSelection
          A submodular function that implements the `_calculate_gains` and
          `_select_next` methods. This is the function that will be
          optimized.
  
  epsilon : float, optional
          The sampling probability to use when constructing the subset. A
          subset of size n * epsilon will be selected from.
  
  random_state : int or RandomState or None, optional
          The random seed to use for the random selection process.
  
  self.verbose : bool
          Whether to display a progress bar during the optimization process.
  
  
  Attributes
  ----------
  self.function : base.BaseSelection
          A submodular function that implements the `_calculate_gains` and
          `_select_next` methods. This is the function that will be
          optimized.
  
  self.verbose : bool
          Whether to display a progress bar during the optimization process.
  
  self.gains_ : numpy.ndarray or None
          The gain that each example would give the last time that it was
          evaluated.
class_docstr_tok: ["The","sample","greedy","algorithm","for","optimization",".","The","sample","greedy","algorithm","is","a","simple","approach","that","subsamples","the","full","data","set","with","a","user-defined","sampling","probability","and","then","runs","an","optimization","on","that","subset",".","This","subsampling","can","lead","to","obvious","speed","improvements","because","fewer","elements","as","selected",",","but","will","generally","find","a","lower","quality","subset","because","fewer","elements","are","present",".","This","approach","is","typically","used","a","baseline","for","other","approaches","but","can","save","a","lot","of","time","on","massive","data","sets","that","are","known","to","be","highly","redundant",".","..","code",":",":python","from","apricot","import","FeatureBasedSelection","X","=","numpy.random.randint","(","10",",","size=","(","10000",",","100",")",")","selector","=","FeatureBasedSelection","(","100",",","'sqrt","'",",","optimizer='sample","'",")","selector.fit","(","X",")","Parameters","--","--","--","--","--","self.function",":","base.BaseSelection","A","submodular","function","that","implements","the","`","_calculate_gains","`","and","`","_select_next","`","methods",".","This","is","the","function","that","will","be","optimized",".","epsilon",":","float",",","optional","The","sampling","probability","to","use","when","constructing","the","subset",".","A","subset","of","size","n","*","epsilon","will","be","selected","from",".","random_state",":","int","or","RandomState","or","None",",","optional","The","random","seed","to","use","for","the","random","selection","process",".","self.verbose",":","bool","Whether","to","display","a","progress","bar","during","the","optimization","process",".","Attributes","--","--","--","--","--","self.function",":","base.BaseSelection","A","submodular","function","that","implements","the","`","_calculate_gains","`","and","`","_select_next","`","methods",".","This","is","the","function","that","will","be","optimized",".","self.verbose",":","bool","Whether","to","display","a","progress","bar","during","the","optimization","process",".","self.gains_",":","numpy.ndarray","or","None","The","gain","that","each","example","would","give","the","last","time","that","it","was","evaluated","."]
code: def __init__(
      self,
      function=None,
      epsilon=0.9,
      optimizer="lazy",
      random_state=None,
      n_jobs=None,
      verbose=False,
  ):
      self.epsilon = epsilon
      self.optimizer = optimizer
      super(SampleGreedy, self).__init__(
          function=function,
          random_state=random_state,
          n_jobs=n_jobs,
          verbose=verbose,
      )
  
imports: import os
  import copy
  import numpy
  import scipy
  from tqdm import tqdm
  from .utils import PriorityQueue
  from .utils import check_random_state
  from .utils import _calculate_pairwise_distances
label_desc: Use image node_id 1 to create a new SampleGreedy object from inherited base classes: BaseOptimizer with example: obj = SampleGreedy(function, epsilon, optimizer, random_state, n_jobs, verbose)