Skip to content

Commit

Permalink
fix print function
Browse files Browse the repository at this point in the history
  • Loading branch information
HaohanWang committed Jun 18, 2019
1 parent 2fede73 commit c462c8b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions models/PrecisionLasso.py
Expand Up @@ -36,6 +36,7 @@ def fit(self, X, y, cg=True):
cf = 0
for it in range(self.maxIter):
self.mu = muList[it]
self.mu = self.lmbd
w = np.nan_to_num(w)
w[np.abs(w)<self.mu] = self.mu
W = P * np.tile(w, (P.shape[0], 1))
Expand Down
4 changes: 2 additions & 2 deletions runPL.py
Expand Up @@ -121,15 +121,15 @@ def KFold(X,y,k=5):
while min_lambda < max_lambda and iteration < patience:
iteration += 1
lmbd = np.exp((np.log(min_lambda) + np.log(max_lambda)) / 2.0)
print "Iter:{}\tlambda:{}".format(iteration, lmbd)
print ("Iter:{}\tlambda:{}".format(iteration, lmbd))
model.setLambda(lmbd)
if implementation == 1:
model.setLearningRate(options.lr) # learning rate must be set again every time we run it.
model.fit(X, Y)
beta = model.getBeta()

c = len(np.where(np.abs(beta) > 0)[0]) # we choose regularizers based on the number of non-zeros it reports
print "# Chosen:{}".format(c)
print ("# Chosen:{}".format(c))
if c < snum: # Regularizer too strong
max_lambda = lmbd
elif c > snum: # Regularizer too weak
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -5,7 +5,7 @@
name='precisionLasso',
version='0.99',
author = "Haohan Wang",
author_email='haohanw@andrew.cmu.edu',
author_email='haohanw@cs.cmu.edu',
url = "https://github.com/HaohanWang/thePrecisionLasso",
description = 'Precision Lasso, Accounting for Correlations and Linear Dependencies in High-Dimensional Genomic Data',
packages=['models', 'utility'],
Expand Down
6 changes: 3 additions & 3 deletions utility/dataLoader.py
Expand Up @@ -29,8 +29,8 @@ def famReader(self, fileName):
return np.array(d)

def imputation(self, X):
print 'Missing genotype imputation ... '
print 'This may take a while, use -m to skip this step'
print ('Missing genotype imputation ... ')
print ('This may take a while, use -m to skip this step')
[n, p] = X.shape
dis = np.zeros([n, n])
for i in range(n):
Expand Down Expand Up @@ -66,7 +66,7 @@ def simpleImputation(self, X):


def readFiles(self):
print 'Reading Data ...'
print ('Reading Data ...')
X = None
y = None
Xname = None
Expand Down

0 comments on commit c462c8b

Please sign in to comment.