在jupyter notebook中 以下out是什么意思 帮我用汉语注释def gen_train_datadf sequence_length columns data = dfcolumnsvalues num_elements = datashape0 # -1 and +1 because of Python indexing for start stop in
yield返回生成器对象,用于迭代
gen_train_data函数用于生成训练数据
df是一个数据框,sequence_length是序列长度,columns是数据框的列
data是df的列的值
num_elements是data的行数
for循环用于生成训练数据,从0开始到num_elements-(sequence_length-1),每次取sequence_length行数据,stop为start+sequence_length
yield返回data[start:stop, :],即从start到stop行的所有列的值
原文地址: https://www.cveoy.top/t/topic/ck6z 著作权归作者所有。请勿转载和采集!