args = parser.parse_args() ############################################################################ # Read config file ############################################################################ paramhelper = parameterhelper.ParameterHelper(args.optconfig) optconfig = paramhelper._optimization ############################################################################ # Load data ############################################################################ print("Loading data (%s)" % args.data) # If the data is stored in a directory, load the data from there. Otherwise, # load from the single file and split it. if os.path.isdir(args.data): Xtr, Ytr, Xval, Yval, _, _ = esnet.load_from_dir(args.data) else: X, Y = esnet.load_from_text(args.data) # Construct training/test sets Xtr, Ytr, Xval, Yval, _, _ = esnet.generate_datasets(X, Y) ############################################################################ # Initialization of the genetic algorithm ############################################################################ # Fitness and individual. Different formats, depending on dimensionality reduction. if paramhelper._fixed_values['embedding'] == 'identity': creator.create("FitnessMin", base.Fitness, weights=(-1.0, )) # -1.0 => minimize function else:
# Read config file ############################################################################ config = json.load(open(args.esnconfig + '.json', 'r')) reconstructconfig = json.load(open(args.reconstructconfig + '.json', 'r')) ############################################################################ # Load data ############################################################################ # If the data is stored in a directory, load the data from there. Otherwise, # load from the single file and split it. allPredictions = [] dataType = args.data.split('/')[-1] if os.path.isdir(args.data): Xtr, Ytr, _, _, Xte, Yte, Yscaler = esnet.load_from_dir(args.data) elif dataType=='SantaFe' or dataType=='Sunspots' or dataType=='Hongik' \ or dataType=='GEFC' or dataType=='Mackey' or dataType=='SP500' \ or dataType=='Rainfall' or dataType=='Temperature' \ or dataType == 'MinTempMel' or dataType == 'SunSpotsZu'\ or dataType == 'TempAlbuquerque' or dataType == 'TempDenver' or dataType == 'TempLasVegas' \ or dataType == 'TempLosAngeles' or dataType == 'TempPhoenix' or dataType == 'TempPortland' \ or dataType == 'TempSanDiego' or dataType == 'TempSanFrancisco' or dataType == 'TempSeattle' \ or dataType == 'TempVancouver' \ or dataType == 'eleGB2015_7_12' or dataType == 'eleDE2015_7_12' or dataType == 'eleFR2015_7_12'\ or dataType == 'Electric': #Xtr, Ytr, _, _, Xte, Yte, Yscaler = esnet.generate_datasets_santafe(args.data) X, Y = esnet.load_from_text(args.data) # Construct training/test sets
############################################################################ # Read reconstructconfig file ############################################################################ reconstructconfig = json.load(open(args.reconstructconfig + '.json', 'r')) ############################################################################ # Load data ############################################################################ logger.info("Loading data (%s)"%args.data) # If the data is stored in a directory, load the data from there. Otherwise, # load from the single file and split it. dataType = args.data.split('/')[-1] if os.path.isdir(args.data): Xtr, Ytr, Xval, Yval, _, _, Yscaler = esnet.load_from_dir(args.data, reconstructconfig) elif dataType=='SantaFe' or dataType=='Sunspots' or dataType=='Hongik' \ or dataType=='GEFC' or dataType=='Mackey' or dataType=='SP500' \ or dataType == 'Rainfall' or dataType=='Temperature'\ or dataType=='MinTempMel' or dataType=='SunSpotsZu' \ or dataType == 'TempAlbuquerque' or dataType == 'TempDenver' or dataType=='TempLasVegas' \ or dataType == 'TempLosAngeles' or dataType == 'TempPhoenix' or dataType == 'TempPortland' \ or dataType == 'TempSanDiego' or dataType == 'TempSanFrancisco' or dataType == 'TempSeattle'\ or dataType == 'TempVancouver' \ or dataType == 'eleGB2015_7_12' or dataType == 'eleDE2015_7_12' or dataType == 'eleFR2015_7_12' \ or dataType == 'Electric': #Xtr, Ytr, Xval, Yval, _, _, Yscaler = esnet.generate_datasets_santafe(args.data) X, Y = esnet.load_from_text(args.data) # Construct training/test sets