-
大小: 4.53KB文件類型: .zip金幣: 1下載: 0 次發(fā)布日期: 2024-05-07
- 語言: Python
- 標簽: 神經(jīng)網(wǎng)絡(luò)??預(yù)測??控制??網(wǎng)絡(luò)??
資源簡介
Neural Network for Model Predictive Control
代碼片段和文件信息
import?numpy?as?np
class?data_construct:
data=[]
length=0
count=0
num_example=0;
def?__init__(self?length?data):
self.data=data
self.length=length
self.num_example=len(data)
self.count=0
def?clr_count(self):
self.count=0
def?next_batch(selfbatch_xbatch_ybatch_size):
temp_data=self.data[self.count*batch_size
:self.count*batch_size+batch_size+self.length-2+1]
#print?temp_data
for?i?in?range(batch_size):
for?j?in?range(self.length):
batch_x+=(temp_data[i+j][0:20].tolist())
batch_y.append(temp_data[i+self.length-1][20].tolist())
self.count+=1#count+=length
batch_x=np.reshape(batch_x(batch_size2*self.length))
batch_y=np.reshape(batch_y(batch_size1))
#print?batch_y
#in?case?list?go?out?of?range
if?self.count*batch_size+batch_size+self.length-2>=len(self.data):
self.count=0
return?batch_x?batch_y
def?plot_data(selfxysim_len):
for?i?in?range(sim_len):
x+=self.data[self.length+i-1][0:20].tolist()
y.append(self.data[i+self.length-1][20].tolist())
x=np.reshape(x(sim_len2))
y=np.reshape(y(sim_len1))
return?xy
#class?property
@property
def?data(self):
return?self.data
@property
def?count(self):
return?self.count
@property
def?num_example(self):
return?self.num_example
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2017-04-24?18:38??NN_MPC-master\
?????文件????????1045??2017-04-24?18:38??NN_MPC-master\.gitignore
?????文件??????????53??2017-04-24?18:38??NN_MPC-master\README.md
?????目錄???????????0??2017-04-24?18:38??NN_MPC-master\Simulation\
?????文件????????4238??2017-04-24?18:38??NN_MPC-master\Simulation\NN.py
?????文件????????1282??2017-04-24?18:38??NN_MPC-master\Simulation\data_construct.py
?????文件????????1669??2017-04-24?18:38??NN_MPC-master\Simulation\data_gen.py
- 上一篇:python簡單爬蟲
- 下一篇:神經(jīng)網(wǎng)絡(luò)擬合曲線
評論
共有 條評論