I have a problem trying to figure out how to plot my predicted values against expected values. But i keep on getting this error:
AttributeError: 'numpy.ndarray' object has no attribute 'inverse_transform'
Below are my python Theano Backend for my Machine Learning purposes:
url = 'mydata.csv'
df = pd.read_csv(url)
y = df.loc[0:250, 'Y']
y = np.array(y)
X = df.loc[0:250, ['A','B','C', 'D', 'E']]
X = np.array(X)
X_train, X_test, y_train, y_test = cross_validation.train_test_split(X, y,
test_size=-.10, random_state=3)
model = Sequential()
model.add(Dense(128, input_dim=5, activation='tanh'))
model.add(Dropout(0.2))
model.add(Activation("tanh"))
model.add(Dense(64, activation='tanh'))
model.add(Activation("tanh"))
model.add(Dense(32, activation='tanh'))
# Output layer
model.add(Dense(1))
model.compile(loss='mse', optimizer='SGD',metrics=["accuracy"])
# Training model with train data. Fixed random seed
np.random.seed(7)
model.fit(X_train, y_train, nb_epoch=100, batch_size=10, verbose=1)
# Evaluation
scores = model.evaluate(X, y)
print("%s: %.2f%%" % (model.metrics_names[1], scores[1]*100))
pyplot.plot(y.inverse_transform(predicted), color="blue")
pyplot.plot(y.inverse_transform(y_test), color="green")
pyplot.show()#
No idea how to solve this. I'm a newbie anyway.
numpyarray and try to call a member function that does not exist. What is the functioninverse_transformsupposed to do? - Thomas Kühn