def rebalance(self): from plastk import rand data = rand.shuffle(self.all()) self._flat = FlatVectorDB(vector_len = self.vector_len) self._flat.db = data self._le = self._gt = None self._split()
def learn_batch(self, data): """ Learns on a batch of data, given as a sequence. The batch is shuffled, then presented sequentially to self.learn_step() """ import plastk.rand self.verbose("Training on", len(data), "examples.") for i in xrange(self.batch_epochs): data = rand.shuffle(data) for X, Y in data: self.learn_step(X, Y)
def learn_batch(self,data): """ Learns on a batch of data, given as a sequence. The batch is shuffled, then presented sequentially to self.learn_step() """ import plastk.rand self.verbose("Training on",len(data),"examples.") for i in xrange(self.batch_epochs): data = rand.shuffle(data) for X,Y in data: self.learn_step(X,Y)