def __init__(self, X, y, n_importance, prior_log_pdf, ridge=0., num_shogun_threads=1): self.n_importance = n_importance self.prior_log_pdf = prior_log_pdf self.ridge = ridge self.X = X self.y = y self.num_shogun_threads = num_shogun_threads # tell shogun to use 1 thread only logger.debug("Using Shogun with %d threads" % self.num_shogun_threads) sg.ZeroMean().parallel.set_num_threads(self.num_shogun_threads) # shogun representation of data self.sg_labels = sg.BinaryLabels(self.y) self.sg_feats_train = sg.RealFeatures(self.X.T) # ARD: set set theta, which is in log-scale, as kernel weights self.sg_kernel = sg.GaussianARDKernel(10, 1) self.sg_mean = sg.ZeroMean() self.sg_likelihood = sg.LogitLikelihood()
def sha1sum(fname, blocksize=65536): """ Computes sha1sum of the given file. Same as the unix command line hash. Returns: string with the hex-formatted sha1sum hash """ hasher = hashlib.sha1() with open(fname, 'rb') as afile: logger.debug("Hasing %s" % fname) buf = afile.read(blocksize) while len(buf) > 0: hasher.update(buf) buf = afile.read(blocksize) return hasher.hexdigest()
def sha1sum(fname, blocksize=65536): """ Computes sha1sum of the given file. Same as the unix command line hash. Returns: string with the hex-formatted sha1sum hash """ hasher = hashlib.sha1() with open(fname, 'rb') as afile: logger.debug("Hasing %s" % fname) buf = afile.read(blocksize) while len(buf) > 0: hasher.update(buf) buf = afile.read(blocksize) return hasher.hexdigest()
def __init__(self, X, y, n_importance, prior_log_pdf, ridge=0., num_shogun_threads=1): self.n_importance = n_importance self.prior_log_pdf = prior_log_pdf self.ridge = ridge self.X = X self.y = y self.num_shogun_threads = num_shogun_threads # tell shogun to use 1 thread only logger.debug("Using Shogun with %d threads" % self.num_shogun_threads) sg.ZeroMean().parallel.set_num_threads(self.num_shogun_threads) # shogun representation of data self.sg_labels = sg.BinaryLabels(self.y) self.sg_feats_train = sg.RealFeatures(self.X.T) # ARD: set set theta, which is in log-scale, as kernel weights self.sg_kernel = sg.GaussianARDKernel(10, 1) self.sg_mean = sg.ZeroMean() self.sg_likelihood = sg.LogitLikelihood()