Skip to content

Commit

Permalink
fix save and load function
Browse files Browse the repository at this point in the history
  • Loading branch information
yabata committed Jan 21, 2016
1 parent ece8223 commit 3be5d8c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions python/pyrenn.py
Original file line number Diff line number Diff line change
Expand Up @@ -876,8 +876,8 @@ def saveNN(net,filename):
import pandas as pd

#create csv write
file = open(filename,"wb")
writer = csv.writer(file)
file = open(filename,"w")
writer = csv.writer(file, lineterminator='\n')


#write network structure nn
Expand Down Expand Up @@ -912,6 +912,9 @@ def saveNN(net,filename):

#write weight vector w
writer.writerow(['w'])
file.close()

file = open(filename,"ab")
np.savetxt(file,net['w'],delimiter=',',fmt='%.55f')

#close file
Expand All @@ -931,7 +934,7 @@ def loadNN(filename):
import pandas as pd

#read csv
data= list(csv.reader(open(filename,"rb")))
data= list(csv.reader(open(filename,"r")))

#read network structure nn
nn = list(np.array(data[1],dtype=np.int))
Expand Down

0 comments on commit 3be5d8c

Please sign in to comment.