Exemplo n.º 1
0
  def add(self, sample, cat):
    if cat not in self.cats: self.cats[cat] = DPGMM(self.dims)

    self.cats[cat].add(sample)
    if self.inc and self.cats[cat].setPrior():
      self.cats[cat] = self.cats[cat].multiGrowSolve(self.runs)

    self.counts = None
Exemplo n.º 2
0
  def __init__(self, dims, runs = 1):
    """dims is the number of dimensions the input vectors have, whilst runs is how many starting points to converge from for each variational run. Increasing runs helps to avoid local minima at the expense of computation, but as it often converges well enough with the first attempt, so this is only for the paranoid."""
    self.dims = dims
    self.runs = runs

    self.inc = True

    self.prior = DPGMM(self.dims)
    self.cats = dict() # Dictionary indexed by category going to the associated DPGMM object.
    self.counts = None