Exemple #1
0
 def __init__(self,numin,numclasses):
     self.numin  = numin
     self.numclasses = numclasses
     self.params = 0.01 * randn(self.numin*self.numclasses+self.numclasses)
     self.scorefunc = logreg_score(self.numin,self.numclasses,self.params)
     self.scorefuncs = [scorefunc]
     Contrastive.__init__(self,normalizeacrosscliques=False)
Exemple #2
0
 def __init__(self,numin,numout):
     self.numin  = numin
     self.numout = numout
     self.params = 0.01 * randn(numin*numout+numout)
     self.scorefunc = scorefunc.LinearRegressionScore(numin,numout,self.params)
     self.scorefuncs = [self.scorefunc]
     Contrastive.__init__(self,normalizeacrosscliques=False)
Exemple #3
0
 def __init__(self, numin, numclasses):
     self.numin = numin
     self.numclasses = numclasses
     self.params = 0.01 * randn(self.numin * self.numclasses +
                                self.numclasses)
     self.scorefunc = logreg_score(self.numin, self.numclasses, self.params)
     self.scorefuncs = [scorefunc]
     Contrastive.__init__(self, normalizeacrosscliques=False)
Exemple #4
0
 def __init__(self, numin, numout):
     self.numin = numin
     self.numout = numout
     self.params = 0.01 * randn(numin * numout + numout)
     self.scorefunc = scorefunc.LinearRegressionScore(
         numin, numout, self.params)
     self.scorefuncs = [self.scorefunc]
     Contrastive.__init__(self, normalizeacrosscliques=False)
Exemple #5
0
 def __init__(self,numin,numhid1,numhid2,numhid3,numout):
     self.numin  = numin
     self.numhid1 = numhid1
     self.numhid2 = numhid2
     self.numhid3 = numhid3
     self.numout = numout
     self.params = 0.1 * randn(scorefunc.Islsl.numparams(\
                                      numin,numhid1,numhid2,numhid3,numout))
     self.scorefuncs = [scorefunc.Islsl(\
                          numin,numhid1,numhid2,numhid3,numout,self.params)]
     Contrastive.__init__(self,normalizeacrosscliques=False)
Exemple #6
0
 def __init__(self,numin,numhid,numout,params=None):
     self.numin  = numin
     self.numhid = numhid
     self.numout = numout
     self.params = params
     if self.params == None:
         self.params = 0.01 * randn(self.numin*self.numhid+self.numhid+\
                                    self.numhid*self.numout+self.numout)
     self.scorefuncs = [scorefunc.SigmoidhiddenLinearoutputScore\
                                    (numin,numhid,numout,self.params)]
     Contrastive.__init__(self,normalizeacrosscliques=False)
Exemple #7
0
 def __init__(self, numin, numhid1, numhid2, numhid3, numout):
     self.numin = numin
     self.numhid1 = numhid1
     self.numhid2 = numhid2
     self.numhid3 = numhid3
     self.numout = numout
     self.params = 0.1 * randn(scorefunc.Islsl.numparams(\
                                      numin,numhid1,numhid2,numhid3,numout))
     self.scorefuncs = [scorefunc.Islsl(\
                          numin,numhid1,numhid2,numhid3,numout,self.params)]
     Contrastive.__init__(self, normalizeacrosscliques=False)
Exemple #8
0
 def __init__(self, numin, numhid, numout, params=None):
     self.numin = numin
     self.numhid = numhid
     self.numout = numout
     self.params = params
     if self.params == None:
         self.params = 0.01 * randn(self.numin*self.numhid+self.numhid+\
                                    self.numhid*self.numout+self.numout)
     self.scorefuncs = [scorefunc.SigmoidhiddenLinearoutputScore\
                                    (numin,numhid,numout,self.params)]
     Contrastive.__init__(self, normalizeacrosscliques=False)
Exemple #9
0
 def __init__(self, n_nodes):
     self.n_nodes = zip(n_nodes[:-1], n_nodes[1:])
     self.params = 0.01 * randn(sum(map(lambda (a,b): (a+1)*b + (b+1)*a, self.n_nodes)))
     self.layers = []
     start, stop = 0, self.params.shape[0]
     for (numin, numhid) in self.n_nodes:
         _in = (numin+1)*numhid
         _out = (numhid+1)*numin
         assert start+_in <= stop-_out, (start, _in, stop, _out)
         idx = range(start, start+_in) + range(stop-_out, stop)
         start += _in
         stop -= _out
         self.layers += [Isl(numin, numhid, numin, self.params[idx])]
     Contrastive.__init__(self, normalizeacrosscliques=False)
Exemple #10
0
 def __init__(self,numvis,numhid,sparsitygain=0.0,targethidprobs=0.2,\
                cditerations=1,normalizeacrosscliques=True,\
                meanfield_output=True,verbose=False):
     self.targethidprobs = targethidprobs
     self.numvis = numvis
     self.numhid = numhid
     self.cditerations = cditerations
     self.sparsitygain = sparsitygain
     self.meanfield_output = meanfield_output
     self.params = 0.01*randn(numvis*numhid+numvis+numhid)
     self.wyh = asmatrix(reshape(self.params[:numvis*numhid],(numvis,numhid)))
     self.wy = asmatrix(self.params[numvis*numhid:numvis*numhid+numvis]).T
     self.wh = asmatrix(self.params[numvis*numhid+numvis:]).T
     self.verbose = verbose
     Contrastive.__init__(self,normalizeacrosscliques)
Exemple #11
0
 def __init__(self, n_nodes):
     self.n_nodes = zip(n_nodes[:-1], n_nodes[1:])
     self.params = 0.01 * randn(
         sum(map(lambda (a, b): (a + 1) * b + (b + 1) * a, self.n_nodes)))
     self.layers = []
     start, stop = 0, self.params.shape[0]
     for (numin, numhid) in self.n_nodes:
         _in = (numin + 1) * numhid
         _out = (numhid + 1) * numin
         assert start + _in <= stop - _out, (start, _in, stop, _out)
         idx = range(start, start + _in) + range(stop - _out, stop)
         start += _in
         stop -= _out
         self.layers += [Isl(numin, numhid, numin, self.params[idx])]
     Contrastive.__init__(self, normalizeacrosscliques=False)
Exemple #12
0
 def __init__(self,numvis,numhid,sparsitygain=0.0,targethidprobs=0.2,\
                cditerations=1,normalizeacrosscliques=True,\
                meanfield_output=True,verbose=False):
     self.targethidprobs = targethidprobs
     self.numvis = numvis
     self.numhid = numhid
     self.cditerations = cditerations
     self.sparsitygain = sparsitygain
     self.meanfield_output = meanfield_output
     self.params = 0.01 * randn(numvis * numhid + numvis + numhid)
     self.wyh = asmatrix(
         reshape(self.params[:numvis * numhid], (numvis, numhid)))
     self.wy = asmatrix(self.params[numvis * numhid:numvis * numhid +
                                    numvis]).T
     self.wh = asmatrix(self.params[numvis * numhid + numvis:]).T
     self.verbose = verbose
     Contrastive.__init__(self, normalizeacrosscliques)
 def __init__(self, normalizeacrosscliques=False):
     Contrastive.__init__(self, normalizeacrosscliques)
Exemple #14
0
 def __init__(self,normalizeacrosscliques=False):
     Contrastive.__init__(self,normalizeacrosscliques)