Exemplo n.º 1
0
	# Plot #
	
	"""pca = PCA(n_components=2)
	pca.fit(X)
	X = pca.transform(X)
	S = [(np.array([1]+X[i].tolist()),Y[i]) for i in xrange(len(X))]
	print S"""
	
	########
	
	########
	# Aprender vector theta      #
	rho = 0.5
	nu  = 0.5
	l   = 1
	theta1 = MLPLearning.back_propagation_batch(S,rho,units_by_layer,factivation,850,50)
	theta2 = MLPLearning.back_propagation_online(S,rho,units_by_layer,factivation,850,50)
	theta3 = MLPLearning.back_propagation_batch_momentum(S,rho,nu,units_by_layer,factivation,850,50)
	theta4 = MLPLearning.back_propagation_batch_buffer(S,rho,l,units_by_layer,factivation,850,50)
	theta5 = MLPLearning.back_propagation_online_buffer(S,rho,l,units_by_layer,factivation,850,50)
	theta6 = MLPLearning.back_propagation_online_momentum(S,rho,nu,units_by_layer,factivation,850,50)
	theta7,fitness = MLPLearning.evolutional(S,units_by_layer,factivation,200,500,-2,2,1.1,0.9)
	##############################
	
	# Clasificacion #
	logging.info("Clase con theta1: (Backprop batch): "+str(Decision.classify(units_by_layer,[1.0,-6.3,1.0],theta1,factivation)))
	logging.info("Clase con theta2: (Backprop online): "+str(Decision.classify(units_by_layer,[1.0,-6.3,1.0],theta2,factivation)))
	logging.info("Clase con theta3: (Backprop batch con momentum): "+str(Decision.classify(units_by_layer,[1.0,-6.3,1.0],theta3,factivation)))
	logging.info("Clase con theta4: (Backprop batch con amortiguamiento): "+str(Decision.classify(units_by_layer,[1.0,-6.3,1.0],theta4,factivation)))
	logging.info("Clase con theta5: (Backprop online con amortiguamiento): "+str(Decision.classify(units_by_layer,[1.0,-6.3,1.0],theta5,factivation)))
	logging.info("Clase con theta6: (Backprop online con momentum): "+str(Decision.classify(units_by_layer,[1.0,-6.3,1.0],theta6,factivation)))
Exemplo n.º 2
0
def classify(units_by_layer, xk, theta, factivation):
    phi, s = MLPLearning.forward_propagation(units_by_layer, xk, theta,
                                             factivation)
    return s[-1].index(max(s[-1]))
Exemplo n.º 3
0
    # Plot #
    """pca = PCA(n_components=2)
	pca.fit(X)
	X = pca.transform(X)
	S = [(np.array([1]+X[i].tolist()),Y[i]) for i in xrange(len(X))]
	print S"""

    ########

    ########
    # Aprender vector theta      #
    rho = 0.5
    nu = 0.5
    l = 1
    theta1 = MLPLearning.back_propagation_batch(S, rho, units_by_layer,
                                                factivation, 850, 50)
    theta2 = MLPLearning.back_propagation_online(S, rho, units_by_layer,
                                                 factivation, 850, 50)
    theta3 = MLPLearning.back_propagation_batch_momentum(
        S, rho, nu, units_by_layer, factivation, 850, 50)
    theta4 = MLPLearning.back_propagation_batch_buffer(S, rho, l,
                                                       units_by_layer,
                                                       factivation, 850, 50)
    theta5 = MLPLearning.back_propagation_online_buffer(
        S, rho, l, units_by_layer, factivation, 850, 50)
    theta6 = MLPLearning.back_propagation_online_momentum(
        S, rho, nu, units_by_layer, factivation, 850, 50)
    theta7, fitness = MLPLearning.evolutional(S, units_by_layer, factivation,
                                              200, 500, -2, 2, 1.1, 0.9)
    ##############################
Exemplo n.º 4
0
def regression(units_by_layer, xk, theta, factivation):
    phi, s = MLPLearning.forward_propagation(units_by_layer, xk, theta,
                                             factivation)
    return s[-1]
Exemplo n.º 5
0
def get_output_vector(units_by_layer, xk, theta, factivation):
    phi, s = MLPLearning.forward_propagation(units_by_layer, xk, theta,
                                             factivation)
    return s[len(units_by_layer) - 1]
Exemplo n.º 6
0
def get_output_vector(units_by_layer,xk,theta,factivation):
	phi,s = MLPLearning.forward_propagation(units_by_layer,xk,theta,factivation)
	return s[len(units_by_layer)-1]
Exemplo n.º 7
0
def classify(units_by_layer,xk,theta,factivation):
	phi,s = MLPLearning.forward_propagation(units_by_layer,xk,theta,factivation)
	return s[-1].index(max(s[-1]))
Exemplo n.º 8
0
def regression(units_by_layer,xk,theta,factivation):
	phi,s = MLPLearning.forward_propagation(units_by_layer,xk,theta,factivation)
	return s[-1]