Пример #1
0
import loadGroupData
import optGroupData
import disGroupData
from lmfit import report_fit

traindays = 20
begin = 0
end = 135621
mode = 0  #[0, 1, 2, 3, 4, 5] for [multi, single, SIRd, SIR, SI, SpikeM]
name = ['multi', 'single', 'SIRd', 'SIR', 'SI']

fw = open('../../' + name[mode] + '_res/params.csv', 'w')
for i in range(begin, end):
    rawdata = loadGroupData.load_data(i)
    result = optGroupData.optimize(rawdata, mode)
    report_fit(result.params)
    fw.write(str(i) + ',')
    fw.write(str(result.params))
    fw.write('\n')
    path = '../../' + name[mode] + '/'
    #disGroupData.display_bi(rawdata,result,result_test,path+str(i)+'.png')
    p = disGroupData.display(rawdata, result, path + str(i) + '.png', mode)
    if peaks.has_key(p):
        peaks[p] += 1
    else:
        peaks[p] = 1
    print 'No.' + str(i) + ' items finished.(' + name[i] + ')'
fw.close()
print peaks
Пример #2
0
import loadGroupData
import optGroupData
import disGroupData
from lmfit import report_fit

traindays = 20
begin = 0
end = 135621
mode = 0 #[0, 1, 2, 3, 4, 5] for [multi, single, SIRd, SIR, SI, SpikeM]
name = ['multi', 'single', 'SIRd', 'SIR', 'SI']

fw=open('../../' + name[mode] + '_res/params.csv','w')
for i in range(begin, end):
    rawdata=loadGroupData.load_data(i)
    result=optGroupData.optimize(rawdata, mode)
    report_fit(result.params)
    fw.write(str(i)+',')
    fw.write(str(result.params))
    fw.write('\n')
    path='../../'+name[mode]+'/'
    #disGroupData.display_bi(rawdata,result,result_test,path+str(i)+'.png')
    p = disGroupData.display(rawdata,result,path+str(i)+'.png',mode)
    if peaks.has_key(p):
        peaks[p] += 1
    else:
        peaks[p] = 1
    print 'No.' + str(i) + ' items finished.('+name[i]+')'
fw.close()
print peaks
Пример #3
0
	data.append(line)
csvfile.close()
csvfile = file('../../badID.csv', 'rb')
reader = csv.reader(csvfile)
baddata = list()
for line in reader:
	baddata.append(line)
csvfile.close()
fw = open('../multi_predict/params.csv','w')
for line in data:
	flag = False
	for per in baddata:
		if line[0] == per[0]:
			flag = True
			break
	if flag:
		continue
	index = int(line[0])
	rawdata = loadGroupData.load_data(index)
	front = list()
	for i in range(4):
		front.append(rawdata[i][:-10])
	result=optGroupData.optimize(front)
	report_fit(result.params)
	fw.write(str(result.params))
	fw.write('\n')
	path='../multi_predict/'
	p = disGroupData.display(rawdata,result,path+line[0]+'.png')
fw.close()
print 'Finished.'
Пример #4
0
    data.append(line)
csvfile.close()
csvfile = file('../../badID.csv', 'rb')
reader = csv.reader(csvfile)
baddata = list()
for line in reader:
    baddata.append(line)
csvfile.close()
fw = open('../multi_predict/params.csv', 'w')
for line in data:
    flag = False
    for per in baddata:
        if line[0] == per[0]:
            flag = True
            break
    if flag:
        continue
    index = int(line[0])
    rawdata = loadGroupData.load_data(index)
    front = list()
    for i in range(4):
        front.append(rawdata[i][:-10])
    result = optGroupData.optimize(front)
    report_fit(result.params)
    fw.write(str(result.params))
    fw.write('\n')
    path = '../multi_predict/'
    p = disGroupData.display(rawdata, result, path + line[0] + '.png')
fw.close()
print 'Finished.'