我需要绘制时间序列数据.以下是示例代码:
ax2 = pyplot.subplot(212)
true_targets = pyplot.plot(test_y[:, 0, :])
guessed_targets = pyplot.plot(test_y_hat[:, 0, :], linestyle='--')
Run Code Online (Sandbox Code Playgroud)
并生成以下图表:
我想沿x轴向右移动图形(从1开始而不是0).
错误:
TypeError :('ofano函数的错误输入参数,名称为"c2.py:77",索引为1(从0开始)','维数错误:预期为2,形状为1(128L,).')
请告知如何解决?
代码和数据可以在以下链接下载: http ://u.163.com/axfWJ81e并输入以下代码:QU90WxTZ
这是我的代码:
# -*- coding: utf-8 -*-
import os
import pandas as pd
import theano
from theano import tensor as T
import numpy as np
def normalizeX(X):
return X / 255.0
data = pd.read_csv("digits3a.csv")
trX = normalizeX(data.values[:, 1:].astype(float))
trY = data.values[:, 0]
data = pd.read_csv("digits3b.csv")
teX = normalizeX(data.values.astype(float))
def floatX(X):
return np.asarray(X, dtype=theano.config.floatX)
def init_weights(shape):
return theano.shared(floatX(np.random.randn(*shape) * 0.01))
def model(X, w):
return T.nnet.softmax(T.dot(X, w))
X = T.fmatrix()
Y = T.fmatrix()
w = init_weights((784, …Run Code Online (Sandbox Code Playgroud)