code: def ffnet():
      inputs = 2
      outputs = 2
      layers = 2
      hidden_dimension = 50
  
      # input variables denoting the features and label data
      features = C.input_variable((inputs), np.float32)
      label = C.input_variable((outputs), np.float32)
  
      # Instantiate the feedforward classification model
      my_model = Sequential(
          [
              Dense(hidden_dimension, activation=C.sigmoid),
              Dense(outputs),
          ]
      )
      z = my_model(features)
  
      ce = C.cross_entropy_with_softmax(z, label)
      pe = C.classification_error(z, label)
  
      # Instantiate the trainer object to drive the model training
      lr_per_minibatch = C.learning_parameter_schedule(0.125)
      progress_printer = ProgressPrinter(0)
      trainer = C.Trainer(
          z,
          (ce, pe),
          [sgd(z.parameters, lr=lr_per_minibatch)],
          [progress_printer],
      )
  
      # Get minibatches of training data and perform model training
      minibatch_size = 25
      num_minibatches_to_train = 1024
  
      aggregate_loss = 0.0
      for i in range(num_minibatches_to_train):
          train_features, labels = generate_random_data(
              minibatch_size, inputs, outputs
          )
          # Specify the mapping of input variables in the model to actual minibatch data to be trained with
          trainer.train_minibatch(
              {features: train_features, label: labels}
          )
          sample_count = trainer.previous_minibatch_sample_count
          aggregate_loss += (
              trainer.previous_minibatch_loss_average * sample_count
          )
  
      last_avg_error = (
          aggregate_loss / trainer.total_number_of_samples_seen
      )
  
      test_features, test_labels = generate_random_data(
          minibatch_size, inputs, outputs
      )
      avg_error = trainer.test_minibatch(
          {features: test_features, label: test_labels}
      )
      print(" error rate on an unseen minibatch: {}".format(avg_error))
      return last_avg_error, avg_error
  
file_path: CNTK/bindings/python/doc/simplenet.py
imports: from __future__ import print_function
  import numpy
  import cntk
  from cntk.learners import sgd
  from cntk.logging import ProgressPrinter
  from cntk.layers import Dense, Sequential
label_desc: Use image node_id 2 for calling a global function with example usage: ffnet() and returns: last_avg_error,  avg_error