I generated some random values inside a 1D numpy array and I'm trying to feed this data into a CNTK model I've created (codes below) to train it. But I'm getting different errors according my approach.
Neural network I've created:
mean = 10
stdev = 2
x = np.random.normal(mean, stdev, 1000)
y = 2 * x + 25
inputs = c.input_variable(1) #Number of variables
labels = c.input_variable(1) #Number of results
layer1 = Dense(1000, activation = c.relu) #input layer with 1000 neurons
layer2 = Dense(1000, activation = c.relu) #hidden layer with 1000 neurons
layer3 = Dense(1, activation = None) #output layer with 1 neuron
model1 = Sequential([layer1, layer2, layer3])
result = model1(inputs)
loss = c.squared_error(result, labels)
learner = c.sgd(model1.parameters, c.learning_parameter_schedule(0.01))
progress_writer = c.logging.ProgressPrinter(0)
For approach below (https://cntk.ai/pythondocs/Manual_How_to_feed_data.html) I'm getting this error:
RuntimeError: The Variable 'Input('Input4', [#], [1])' DataType Float does not match the corresponding Value's DataType Double
progress_writer = c.logging.ProgressPrinter(0)
trainer = loss.train((x,y), parameter_learners = [learner], callbacks=[progress_writer])
For this other approach, I'm getting:
ValueError: non-dict argument (ndarray) is not supported for nodes with more than one input
trainer = c.Trainer(result, loss, [learner])
trainer.train_minibatch((x,y))
Could some one give me some help?
trainer.train_minibatch()
only takes a dictionary. So it should be something like this:
data = {inputs: x, labels: y}
trainer.train_minibatch(data)