Example #1
0
                    default='spiral',
                    help='Dataset: select between "spiral" and "flower".')
parser.add_argument('-d',
                    '--debug',
                    action='store_true',
                    help='Used for gradient checking.')

FLAGS, unparsed = parser.parse_known_args()

##======================================================================
## STEP 1: Loading data
#
#  In this section, we load the training examples and their labels.

if FLAGS.input_data == 'spiral':
    instances, labels, numClasses = utils.load_spiral_dataset()
elif FLAGS.input_data == 'flower':
    instances, labels, numClasses = utils.load_flower_dataset()
else:
    print('Wrong dataset specified. Select between "spiral" and "flower".')
    sys.exit(1)

inputSize = instances.shape[0]
numExamples = instances.shape[1]

# For debugging purposes, you may wish to reduce the size of the input data
# in order to speed up gradient checking.
# Here, we create synthetic dataset using random data for testing

if FLAGS.debug:
    inputSize = 8
Example #2
0
parser.add_argument('-d',
                    '--debug',
                    action='store_true',
                    help='Used for gradient checking.')

FLAGS, unparsed = parser.parse_known_args()

torch.manual_seed(3)

##======================================================================
## STEP 1: Load data
#
#  In this section, we load the training instances and their labels.

if FLAGS.input_data == 'spiral':
    X, y, n_y = utils.load_spiral_dataset()
    # Set hyper-parameters.
    n_h = 100
    decay = 0.001
    learning_rate = 1
    num_epochs = 10000
elif FLAGS.input_data == 'flower':
    X, y, n_y = utils.load_flower_dataset()
    # Set hyper-parameters.
    n_h = 20
    decay = 0
    learning_rate = 0.05
    num_epochs = 20000
else:
    print('Wrong dataset specified. Select between "spiral" and "flower".')
    sys.exit(1)