Commit fafbd090 authored by pwrd's avatar pwrd

sev_analyse server file moved to home directory

parent 1750ac85
...@@ -311,18 +311,18 @@ class LinRegModel: ...@@ -311,18 +311,18 @@ class LinRegModel:
self.slr = Lasso(alpha=alpha, max_iter=maxiter) self.slr = Lasso(alpha=alpha, max_iter=maxiter)
reg = self.slr.fit(self.wdata.wd.iloc[:,1:], self.wdata.wd.iloc[:,0:1]) reg = self.slr.fit(self.wdata.wd.iloc[:,1:], self.wdata.wd.iloc[:,0:1])
print "params", self.slr.get_params() #print "params", self.slr.get_params()
print "coef ", self.slr.coef_ #print "coef ", self.slr.coef_
print "intercept ", self.slr.intercept_ #print "intercept ", self.slr.intercept_
coeff = [None]*len(self.wdata.wdname) coeff = [None]*len(self.wdata.wdname)
coeff[0] = self.slr.intercept_[0] coeff[0] = self.slr.intercept_[0]
if self.type == self.TYPE_LASSO_REGRESSION: if self.type == self.TYPE_LASSO_REGRESSION:
for i in range(1,len(self.wdata.wdname)): for i in range(1,len(self.wdata.wdname)):
print i, self.slr.coef_[i-1] #print i, self.slr.coef_[i-1]
coeff[i] = self.slr.coef_[i-1] coeff[i] = self.slr.coef_[i-1]
else: else:
for i in range(1,len(self.wdata.wdname)): for i in range(1,len(self.wdata.wdname)):
print i, self.slr.coef_[0][i-1] #print i, self.slr.coef_[0][i-1]
coeff[i] = self.slr.coef_[0][i-1] coeff[i] = self.slr.coef_[0][i-1]
self.regrcoef_draw(coeff) self.regrcoef_draw(coeff)
...@@ -737,7 +737,7 @@ class MLPModel: ...@@ -737,7 +737,7 @@ class MLPModel:
i = 0 i = 0
while i < self.mlp.n_layers_ - 1: while i < self.mlp.n_layers_ - 1:
j = 0 j = 0
print 'layer_sizes', i, len(layer_sizes), layer_sizes #print 'layer_sizes', i, len(layer_sizes), layer_sizes
while j < layer_sizes[i]: while j < layer_sizes[i]:
fp.write(str(self.mlp.intercepts_[i][j]) + ' ') fp.write(str(self.mlp.intercepts_[i][j]) + ' ')
j += 1 j += 1
...@@ -811,7 +811,7 @@ class MLPModel: ...@@ -811,7 +811,7 @@ class MLPModel:
i = 0 i = 0
while i < self.mlp.n_layers_ - 1: while i < self.mlp.n_layers_ - 1:
if i < self.mlp.n_layers_ - 2: if i < self.mlp.n_layers_ - 2:
print 'i+1', i+1, len(h) #print 'i+1', i+1, len(h)
h[i] = [None] * len(self.mlp.coefs_[i+1]) h[i] = [None] * len(self.mlp.coefs_[i+1])
else: else:
h[i] = [None] * 1 h[i] = [None] * 1
...@@ -862,7 +862,7 @@ class MLPModel: ...@@ -862,7 +862,7 @@ class MLPModel:
res = self.mlp.predict(X) res = self.mlp.predict(X)
score = r2_score(res, self.wdata.wd[self.wdata.wdcol[0]]) score = r2_score(res, self.wdata.wd[self.wdata.wdcol[0]])
print 'Score', score #print 'Score', score
layo = 1 * 100 + 10 layo = 1 * 100 + 10
...@@ -1010,7 +1010,7 @@ class WdWindow: ...@@ -1010,7 +1010,7 @@ class WdWindow:
i = 0 i = 0
for col in self.wdata.wdcol: for col in self.wdata.wdcol:
print col, mean[i], std[i] #print col, mean[i], std[i]
l = Label(dia, text=col, bg=bgcolor) l = Label(dia, text=col, bg=bgcolor)
l.grid(column=0, row=i+1, padx=20, pady=5, sticky=W) l.grid(column=0, row=i+1, padx=20, pady=5, sticky=W)
l = Label(dia, text=str(mean[i]), bg=bgcolor) l = Label(dia, text=str(mean[i]), bg=bgcolor)
...@@ -1829,7 +1829,7 @@ class FetchSev: ...@@ -1829,7 +1829,7 @@ class FetchSev:
# Server entry # Server entry
# Read last server from file # Read last server from file
try: try:
fp = open(pwrp_tmp + "/sevserver.dat", "r") fp = open(home + "/sevserver.dat", "r")
srv = fp.read() srv = fp.read()
fp.close() fp.close()
except IOError: except IOError:
...@@ -1872,7 +1872,7 @@ class FetchSev: ...@@ -1872,7 +1872,7 @@ class FetchSev:
# Store server to file # Store server to file
try: try:
fp = open(pwrp_tmp + "/sevserver.dat", "w") fp = open(home + "/sevserver.dat", "w")
fp.write(self.server) fp.write(self.server)
fp.close() fp.close()
except IOError: except IOError:
...@@ -2023,7 +2023,7 @@ class FetchSev: ...@@ -2023,7 +2023,7 @@ class FetchSev:
return return
origdata = pd.DataFrame(data=result) origdata = pd.DataFrame(data=result)
print 'Frame len', len(origdata), origdata.columns, origcol #print 'Frame len', len(origdata), origdata.columns, origcol
origdata.columns = origcol origdata.columns = origcol
self.wdata.new_data(origdata, wdcol, wdname) self.wdata.new_data(origdata, wdcol, wdname)
...@@ -2054,7 +2054,7 @@ for opt, arg in opts: ...@@ -2054,7 +2054,7 @@ for opt, arg in opts:
formula = arg formula = arg
pwr_exe = os.environ.get('pwr_exe') pwr_exe = os.environ.get('pwr_exe')
pwrp_tmp = os.environ.get('pwrp_tmp') home = os.environ.get('HOME')
bgcolor = 'white' bgcolor = 'white'
buttoncolor = '#F0F0F0' buttoncolor = '#F0F0F0'
......
...@@ -1784,7 +1784,7 @@ class FetchSev: ...@@ -1784,7 +1784,7 @@ class FetchSev:
# Server entry # Server entry
# Read last server from file # Read last server from file
try: try:
fp = open(pwrp_tmp + "/sevserver.dat", "r") fp = open(home + "/sevserver.dat", "r")
srv = fp.read() srv = fp.read()
fp.close() fp.close()
except IOError: except IOError:
...@@ -1821,7 +1821,7 @@ class FetchSev: ...@@ -1821,7 +1821,7 @@ class FetchSev:
# Store server to file # Store server to file
try: try:
fp = open(pwrp_tmp + "/sevserver.dat", "w") fp = open(home + "/sevserver.dat", "w")
fp.write(self.server) fp.write(self.server)
fp.close() fp.close()
except IOError: except IOError:
...@@ -2134,7 +2134,7 @@ for opt, arg in opts: ...@@ -2134,7 +2134,7 @@ for opt, arg in opts:
file = arg file = arg
pwr_exe = os.environ.get('pwr_exe') pwr_exe = os.environ.get('pwr_exe')
pwrp_tmp = os.environ.get('pwrp_tmp') home = os.environ.get('HOME')
bgcolor = 'white' bgcolor = 'white'
buttoncolor = '#F0F0F0' buttoncolor = '#F0F0F0'
......
...@@ -186,7 +186,7 @@ class WData: ...@@ -186,7 +186,7 @@ class WData:
self.origdata.to_csv(file, index=False) self.origdata.to_csv(file, index=False)
def save_wd(self, file): def save_wd(self, file):
save = self.wd save = self.wd.copy()
save.columns = self.wdname save.columns = self.wdname
save.insert(0, 'Time', self.wdtime) save.insert(0, 'Time', self.wdtime)
save.to_csv(file, index=False) save.to_csv(file, index=False)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment