Example #1
0
    def init_dir_prior(self, prior, name):
        if prior is None:
            prior = 'symmetric'

        is_auto = False

        if isinstance(prior, six.string_types):
            if prior == 'symmetric':
                logger.info("using symmetric %s at %s", name,
                            1.0 / self.num_topics)
                init_prior = numpy.asanyarray(
                    [1.0 / self.num_topics for i in xrange(self.num_topics)])
            elif prior == 'asymmetric':
                init_prior = numpy.assrray([
                    1.0 / (i + numpy.sqrt(self.num_topics))
                    for i in xrange(self.num_topics)
                ])
                init_prior /= init_prior.sum()
                logger.info("using asymmetric %s %s", name, list(init_prior))
            elif prior == 'auto':
                is_auto = True
                init_prior = numpy.assarray(
                    [1.0 / self.num_topics for i in xrange(self.num_topics)])
                logger.info("using autotuned %s, starting with %s", name,
                            list(init_prior))
Example #2
0
	def UniformDigest(self, mol_, at_, mxstep, num):
		""" Returns list of inputs sampled on a uniform cubic grid around at """
		ncase = num*num*num
		samps=MakeUniform(mol_.coords[at_],mxstep,num)
		if (self.name=="SymFunc"):
			inputs = self.Emb(self, mol_, at_, samps, None, False) #(self.EmbF())(mol_.coords, samps, mol_.atoms, self.eles ,  self.SensRadius, self.ngrid, at_, 0.0)
			inputs = np.asarray(inputs)
		else:
			inputs = self.Emb(self, mol_, at_, samps, None, False)
			inputs = np.assrray(inputs[0])
		return samps, inputs