scaler = preprocessing.StandardScaler().fit(Xtrain) Xtrain = scaler.transform(Xtrain) Xtest = scaler.transform(Xtest) ################################################################# #################### Neural Net Using ######################### ################################################################# nH = 80 mySLFN = SLFN.CSLFN(nH=nH, fh="tanh", fo="tanh", errFunc="EXP") mySLFN.set_Train(Xtrain, Ytrain) mySLFN.set_Val(Xtest, Ytest) # WEIGHT INITIALIZATION initDistrib = paC.Init_Distrib("default", ["uniform", -1, 1]) # Define initialization #initDistrib = paC.Init_Distrib("default", ["normal",0,1])# Define initialization mySLFN.set_initDistrib(initDistrib) # Set the initialization mySLFN.init_Weights() # Initialize BP_F = 0 ELM_F = 1 BMBP_F = 0 FT_F = 0 # DEFINE TRAINING ALGORITHM if (BP_F == 1): # Step and number of epochs trainingAlg = paC.Training_Alg("BP", [1000, 0.0003])
nP = 10 ################################################################ #################### NEURAL NETWORM PARAMETERS ################## ################################################################# nH = 20 fh_name = "tanh" fo_name = "tanh" errFunc = "MSE" visual = 0 ######## WEIGHT INITIALIZATION ######## #initDistrib = paC.Init_Distrib("default", ["uniform",-1,1]) #initDistrib = paC.Init_Distrib("default", ["normal",0,1]) initDistrib = paC.Init_Distrib("deepLearning", ["DL1"]) ######## STOP CRITERION ######## stopCriterion = paC.Stop_Criterion("Nmax", []) ######## REGULARIZATION ######## regularization = paC.Regularization("NoL2", [0.000005]) ######## TRAINING ALGORITHM ######## # Parameters of the algorithms N_epochs = 200 Learning_Rate = 0.01 BatchSize = 2 ######## CLUSTER PARAMETERS !!!!! ######## """ If we execute in da cluuster (spanish u) we overwritte the parameters """
fh_name = "tanh" fo_name = "linear" fg_name = "linear" errFunc = "MSE" Nruns = 1 CV = 1 InitRandomSeed = -1 GSLFN_visual = [1] print "Number of neurons: " + str(nH) ######## WEIGHT INITIALIZATION ######## initDistrib = paC.Init_Distrib("default", ["uniform", -1, 1]) #initDistrib = paC.Init_Distrib("default", ["normal",0,1]) #initDistrib = paC.Init_Distrib("deepLearning", ["DL1"]) ######## STOP CRITERION ######## stopCriterion = paC.Stop_Criterion("Nmax", []) ######## REGULARIZATION ######## regularization = paC.Regularization("L2", [0.000005]) ######## TRAINING ALGORITHM ######## BP_F = 0 BMBP_F = 1 ELM_F = 0