Example #1
0
if __name__ == '__main__':
	# set the random seed for reproducibility of results
	# setting the random seed forces the same results of randoming each
	# time you start the program - that way you can demonstrate your results
	np.random.seed(11071998)


	# Load the train / test data
	# X is the input matrix, y is the target vector
	# X can be a vector (and will be, in the first assignment) as well 

	"""
		To change the function being approximated, just change the paths 
		to the dataset in the arguments of the data loader.s
	"""
	X_train, y_train = dataLoader.loadFrom(SIN_TRAIN)
	X_test, y_test = dataLoader.loadFrom(SIN_TEST)

	# for check, print out the shapes of the input variables
	# the first dimension is the number of input samples, the second dimension
	# is the number of variables 

	print "Train data shapes: ", X_train.shape, y_train.shape 
	print "Test data shapes: ", X_test.shape, y_test.shape 

	# The dimensionality of the input layer of the network is the second
	# dimension of the shape 

	if len(X_train.shape) > 1:
		input_size = X_train.shape[1]
	else: 
Example #2
0
if __name__ == '__main__':
    # set the random seed for reproducibility of results
    # setting the random seed forces the same results of randoming each
    # time you start the program - that way you can demonstrate your results
    np.random.seed(11071998)

    # Load the train / test data
    # X is the input matrix, y is the target vector
    # X can be a vector (and will be, in the first assignment) as well
    """
        To change the function being approximated, just change the paths
        to the dataset in the arguments of the data loader.s
    """
    #X_train, y_train = dataLoader.loadFrom(SIN_TRAIN)
    #X_test, y_test = dataLoader.loadFrom(SIN_TEST)
    X_train, y_train = dataLoader.loadFrom(ROSENBROCK_TRAIN)
    X_test, y_test = dataLoader.loadFrom(ROSENBROCK_TEST)

    # for check, print out the shapes of the input variables
    # the first dimension is the number of input samples, the second dimension
    # is the number of variables

    print "Train data shapes: ", X_train.shape, y_train.shape
    print "Test data shapes: ", X_test.shape, y_test.shape

    # The dimensionality of the input layer of the network is the second
    # dimension of the shape

    if len(X_train.shape) > 1:
        input_size = X_train.shape[1]
    else:
Example #3
0

	# Load the train / test data
	# X is the input matrix, y is the target vector
	# X can be a vector (and will be, in the first assignment) as well 

	"""
		To change the function being approximated, just change the paths 
		to the dataset in the arguments of the data loader.s
	"""
	sinusoida = False
	rastrigin = True
	rosenbrock = False

	if sinusoida:
		X_train, y_train = dataLoader.loadFrom(SIN_TRAIN)
		X_test, y_test = dataLoader.loadFrom(SIN_TEST)

	if rastrigin:
		X_train, y_train = dataLoader.loadFrom(RASTRIGIN_TRAIN)
		X_test, y_test = dataLoader.loadFrom(RASTRIGIN_TEST)

	if rosenbrock:
		X_train, y_train = dataLoader.loadFrom(ROSENBROCK_TRAIN)
		X_test, y_test = dataLoader.loadFrom(ROSENBROCK_TEST)

	# for check, print out the shapes of the input variables
	# the first dimension is the number of input samples, the second dimension
	# is the number of variables 

	print "Train data shapes: ", X_train.shape, y_train.shape