def __init__(self, ticker_len, start_amount, histdepth): self.in_shapes = [] self.out_shapes = [] self.trade_hist = {} self.polo = Poloniex() self.hist_depth = histdepth self.ticker_len = ticker_len self.end_ts = datetime.now()+timedelta(seconds=(ticker_len*24)) self.start_amount = start_amount self.hs = HistWorker() self.refresh_data() self.inputs = self.hs.hist_shaped.shape[0]*(self.hs.hist_shaped[0].shape[1]) self.outputs = self.hs.hist_shaped.shape[0] #self.make_shapes() self.folio = CryptoFolio(start_amount, list(self.hs.currentHists.keys())) self.leaf_names = [] for ix in range(1,self.inputs+1): sign = sign *-1 self.in_shapes.append((0.0-(sign*.005*ix), -1.0, 0.0+(sign*.005*ix))) self.out_shapes.append((0.0, 1.0, 0.0)) self.subStrate = Substrate(self.in_shapes, self.out_shapes) for l in range(len(self.in_shapes[0])): self.leaf_names.append('leaf_one_'+str(l)) self.leaf_names.append('leaf_two_'+str(l)) self.load_net() print(self.hs.coin_dict) self.poloTrader()
def __init__(self, args, substrate=None): _GymNeatConfig.__init__(self, args, layout=(5, 1)) subs = self.params['Substrate'] actfun = subs['function'] inp = eval(subs['input']) hid = eval(subs['hidden']) if substrate is None else substrate out = eval(subs['output']) self.substrate = Substrate(inp, out, hid) self.actfun = actfun # For recurrent nets self.activations = len(self.substrate.hidden_coordinates) + 2 # Output of CPPN is recurrent, so negate indices self.node_names = {j: self.node_names[k] for j, k in enumerate(self.node_names)} # CPPN itself always has the same input and output nodes self.cppn_node_names = {-1: 'x1', -2: 'y1', -3: 'x2', -4: 'y2', -5: 'bias', 0: 'weight'}
def __init__(self, ticker_len, start_amount, histdepth, base_sym): self.trade_hist = {} self.polo = Poloniex() self.hd = histdepth self.ticker_len = ticker_len self.end_ts = datetime.now() + timedelta(seconds=(ticker_len * 24)) self.start_amount = start_amount self.hs = HistWorker() self.hs.combine_live_usd_frames() print(self.hs.currentHists.keys()) self.end_idx = len(self.hs.hist_shaped[0]) - 1 self.but_target = .1 self.inputs = self.hs.hist_shaped.shape[0] * ( self.hs.hist_shaped[0].shape[1]) self.outputs = self.hs.hist_shaped.shape[0] self.folio = CryptoFolio(start_amount, list(self.hs.currentHists.keys()), base_sym) self.base_sym = base_sym sign = 1 for ix in range(1, self.outputs + 1): sign = sign * -1 self.out_shapes.append((0.0 - (sign * .005 * ix), 0.0, -1.0)) for ix2 in range(1, (self.inputs // self.outputs) + 1): self.in_shapes.append( (0.0 + (sign * .01 * ix2), 0.0 - (sign * .01 * ix2), 0.0)) self.subStrate = Substrate(self.in_shapes, self.out_shapes) self.load_net() print(self.hs.coin_dict) self.poloTrader()
def __init__(self, hist_depth): self.hs = HistWorker() self.hs.combine_binance_frames() self.hd = hist_depth print(self.hs.currentHists.keys()) self.end_idx = len(self.hs.hist_shaped[0]) self.but_target = .1 self.inputs = self.hs.hist_shaped.shape[0] * ( self.hs.hist_shaped[0].shape[1]) self.outputs = self.hs.hist_shaped.shape[0] sign = 1 for ix in range(1, self.outputs + 1): sign = sign * -1 self.out_shapes.append((0.0 - (sign * .005 * ix), -1.0, -1.0)) for ix2 in range(1, (self.inputs // self.outputs) + 1): self.in_shapes.append( (0.0 + (sign * .01 * ix2), 0.0 - (sign * .01 * ix2), 1.0)) self.subStrate = Substrate(self.in_shapes, self.out_shapes) self.epoch_len = 144 #self.node_names = ['x1', 'y1', 'z1', 'x2', 'y2', 'z2', 'weight'] self.leaf_names = [] #num_leafs = 2**(len(self.node_names)-1)//2 for l in range(len(self.in_shapes[0])): self.leaf_names.append('leaf_one_' + str(l)) self.leaf_names.append('leaf_two_' + str(l))
def reset_substrate(self, input_row): current_inputs = self.substrate.input_coordinates new_input = [] for ix, t in enumerate(current_inputs): t = list(t) offset = input_row[ix] * .5 t[2] = t[2] + .5 new_input.append(tuple(t)) #self.in_shapes = new_input self.substrate = Substrate(new_input, self.out_shapes)
def set_substrate(self): sign = 1 x_increment = 1.0 / self.outputs y_increment = 1.0 / len(self.hs.hist_shaped[0][0]) for ix in range(self.outputs): self.out_shapes.append((1.0 - (ix * x_increment), 0.0, -1.0)) for ix2 in range(len(self.hs.hist_shaped[0][0])): self.in_shapes.append((-1.0 + (ix * x_increment), 1.0 - (ix2 * y_increment), 1.0)) self.subStrate = Substrate(self.in_shapes, self.out_shapes)
def make_shapes(self): sign = 1 self.out_shapes = [] self.in_shapes = [] for ix in range(1, self.outputs + 1): sign = sign * -1 self.out_shapes.append((0.0 - (sign * .005 * ix), 0.0, -1.0)) for ix2 in range(1, (self.inputs // self.outputs) + 1): self.in_shapes.append( (0.0 + (sign * .01 * ix2), 0.0 - (sign * .01 * ix2), 0.0)) self.subStrate = Substrate(self.in_shapes, self.out_shapes)
def set_substrate(self): sign = 1 x_increment = 1.0 / self.outputs y_increment = 1.0 / len(self.hs.hist_shaped[0][0]) for ix in range(self.outputs): self.out_shapes.append((1.0-(ix*x_increment), 0.0, -1.0)) for ix2 in range(self.inputs//self.outputs): if(ix2 >= len(self.tree.cs)-1): treex = ix2 - len(self.tree.cs)-1 else: treex = ix2 center = self.tree.cs[treex] self.in_shapes.append((center.coord[0]+(ix*x_increment), center.coord[1] - (ix2*y_increment), center.coord[2]+.5)) self.subStrate = Substrate(self.in_shapes, self.out_shapes)
def __init__(self, hist_depth): self.hs = HistWorker() self.hd = hist_depth self.end_idx = len(self.hs.currentHists["XCP"]) self.but_target = .1 self.inputs = self.hs.hist_shaped.shape[0]*(self.hs.hist_shaped[0].shape[1]-1) self.outputs = self.hs.hist_shaped.shape[0] sign = 1 for ix in range(1,self.outputs+1): sign = sign *-1 self.out_shapes.append((sign/ix, .0, 1.0*sign)) for ix2 in range(1,len(self.hs.hist_shaped[0][0])): self.in_shapes.append((-sign/ix, (sign/ix2), 1.0*sign)) self.subStrate = Substrate(self.in_shapes, self.out_shapes) self.epoch_len = 360
def make_config(args): cfg = _GymNeatConfig.load(args, '-hyper') subs = cfg['Substrate'] actfun = subs['function'] inp = eval(subs['input']) hid = eval(subs['hidden']) out = eval(subs['output']) substrate = Substrate(inp, out, hid) # Load rest of config from file config = _GymHyperConfig(args, substrate, actfun) evalfun = _GymHyperConfig.eval_genome return config, evalfun
def __init__(self, hist_depth): self.hs = HistWorker() self.hd = hist_depth self.end_idx = len(self.hs.currentHists["DASH"]) self.but_target = .1 self.inputs = self.hs.hist_shaped.shape[0]*(self.hs.hist_shaped[0].shape[1]-1) * self.hd self.outputs = self.hs.hist_shaped.shape[0] sign = 1 for ix in range(self.outputs): sign = sign *-1 self.out_shapes.append((sign*ix, 1)) for ix2 in range(len(self.hs.hist_shaped[0][0])-1): for ix3 in range(self.hd): self.in_shapes.append((sign*ix, ((1+ix2)*.1))) self.subStrate = Substrate(self.in_shapes, self.out_shapes) self.epoch_len = 55
def __init__(self, genome, config): self.genome = genome self.config = config # Network input, hidden and output coordinates. input_coordinates = [] for i in range(0, 5883): input_coordinates.append((-1. + (2. * i / 3.), -1.)) hidden_coordinates = [[(-0.5, 0.5), (0.5, 0.5)], [(-0.5, -0.5), (0.5, -0.5)]] output_coordinates = [(-1., 1.), (1., 1.), (-1., 1.)] activations = len(hidden_coordinates) + 2 sub = Substrate(input_coordinates, output_coordinates, hidden_coordinates) self.sub = sub activations = len(hidden_coordinates) + 2 self.activations = activations
def poloTrader(self): end_prices = {} active = self.get_one_bar_input_2d() sub = Substrate(self.in_shapes, self.out_shapes) network = ESNetwork(sub, self.cppn, self.params) net = network.create_phenotype_network() net.reset() for n in range(network.activations): out = net.activate(active) #print(len(out)) rng = len(out) #rng = iter(shuffle(rng)) for x in np.random.permutation(rng): sym = self.coin_dict[x] #print(out[x]) try: if (out[x] < -.5): print("selling: ", sym) self.folio.sell_coin( sym, self.currentHists[sym]['close'][self.end_idx]) elif (out[x] > .5): print("buying: ", sym) self.folio.buy_coin( sym, self.currentHists[sym]['close'][self.end_idx]) except: print('error', sym) #skip the hold case because we just dont buy or sell hehe end_prices[sym] = self.hist_shaped[x][len(self.hist_shaped[x]) - 1][2] if datetime.now() >= self.end_ts: port_info = self.folio.get_total_btc_value(end_prices) print("total val: ", port_info[0], "btc balance: ", port_info[1]) return else: print(self.get_current_balance()) for t in range(3): time.sleep(self.ticker_len / 4) p_vals = self.get_current_balance() print("current value: ", p_vals[0], "current btc holdings: ", p_vals[1]) #print(self.folio.ledger) time.sleep(self.ticker_len / 4) self.pull_polo() self.poloTrader()
def make_config(args): # Load config from file cfg = _GymNeatConfig.load(args, '-eshyper') subs = cfg['Substrate'] actfun = subs['function'] inp = eval(subs['input']) out = eval(subs['output']) # Get substrate from -hyper.cfg file named by Gym environment substrate = Substrate(inp, out) # Load rest of config from file config = _GymEsHyperConfig(args, substrate, actfun, cfg['ES']) evalfun = _GymEsHyperConfig.eval_genome return config, evalfun
def refresh(self): self.in_shapes = [] self.out_shapes = [] self.hs = HistWorker() self.hs.get_kraken_train() print(self.hs.currentHists.keys()) self.end_idx = len(self.hs.hist_shaped[0]) self.but_target = .1 self.inputs = self.hs.hist_shaped.shape[0] * ( self.hs.hist_shaped[0].shape[1]) self.outputs = self.hs.hist_shaped.shape[0] sign = 1 for ix in range(1, self.outputs + 1): sign = sign * -1 self.out_shapes.append((0.0 - (sign * .005 * ix), 0.0, -1.0)) for ix2 in range(1, (self.inputs // self.outputs) + 1): self.in_shapes.append( (0.0 + (sign * .01 * ix2), 0.0 - (sign * .01 * ix2), 0.0)) self.subStrate = Substrate(self.in_shapes, self.out_shapes)
def refresh(self): self.in_shapes = [] self.out_shapes = [(0.0, -1.0, -1.0)] self.hs = HistWorker() self.hs.get_binance_train() print(self.hs.currentHists.keys()) self.end_idx = len(self.hs.hist_shaped[0]) self.but_target = .1 print(self.hs.hist_shaped.shape) self.num_syms = self.hs.hist_shaped.shape[0] self.inputs = self.hs.hist_shaped[0].shape[1] + 1 self.outputs = 1 sign = 1 for ix2 in range(1, self.inputs + 1): sign *= -1 self.in_shapes.append( (0.0 + (sign * .01 * ix2), 0.0 - (sign * .01 * ix2), 0.0)) self.substrate = Substrate(self.in_shapes, self.out_shapes) self.set_leaf_names()
def refresh(self): self.in_shapes = [] self.out_shapes = [(0.0, -1.0, -1.0)] self.hs = HistWorker() self.hs.get_kraken_train() print(self.hs.currentHists.keys()) self.end_idx = len(self.hs.hist_shaped[0]) self.but_target = .1 print(self.hs.hist_shaped.shape) self.num_syms = self.hs.hist_shaped.shape[0] # add one to number of symbols to account for current position size # input we pass for context self.inputs = self.hs.hist_shaped[0].shape[1] + 1 self.outputs = 1 sign = 1 for ix2 in range(1,self.inputs+1): sign *= -1 self.in_shapes.append((0.0+(sign*.01*ix2), 0.0-(sign*.01*ix2), 0.0)) self.substrate = Substrate(self.in_shapes, self.out_shapes) self.set_leaf_names()
def refresh(self, reload_data=False): print("refreshing") self.in_shapes = [] self.out_shapes = [] self.hs = HistWorker() if(reload_data != False): self.hs.pull_robinhood_train_data() self.hs.get_robinhood_train() print(self.hs.currentHists.keys()) self.end_idx = len(self.hs.hist_shaped[0]) self.but_target = 1.0 self.inputs = self.hs.hist_shaped.shape[0]*(self.hs.hist_shaped[0].shape[1]) self.outputs = self.hs.hist_shaped.shape[0] sign = 1 for ix in range(1,self.outputs+1): sign = sign *-1 self.out_shapes.append((0.0-(sign*.005*ix), 0.0, -1.0)) for ix2 in range(1,(self.inputs//self.outputs)+1): self.in_shapes.append((0.0+(sign*.01*ix2), 0.0-(sign*.01*ix2), 0.0)) self.subStrate = Substrate(self.in_shapes, self.out_shapes)
def poloTrader(self): end_prices = {} active = self.get_one_bar_input_2d() self.load_net() sub = Substrate(self.in_shapes, self.out_shapes) network = ESNetwork(sub, self.cppn, self.params) net = network.create_phenotype_network_nd('paper_net.png') net.reset() for n in range(1, self.hist_depth+1): out = net.activate(active[self.hist_depth-n]) #print(len(out)) rng = len(out) #rng = iter(shuffle(rng)) self.reset_tickers() for x in np.random.permutation(rng): sym = self.hs.coin_dict[x] #print(out[x]) try: if(out[x] < -.5): print("selling: ", sym) p = self.get_price('BTC_'+sym) price = p -(p*.01) self.sell_coin('BTC_'+sym, price) elif(out[x] > .5): print("buying: ", sym) self.target_percent = .1 + out[x] - .45 p = self.get_price('BTC_'+sym) price = p*1.01 self.buy_coin('BTC_'+sym, price) except: print('error', sym) #skip the hold case because we just dont buy or sell hehe if datetime.now() >= self.end_ts: return else: time.sleep(self.ticker_len) self.refresh_data() #self.closeOrders() self.poloTrader()
def __init__(self, args, substrate=None): _GymNeatConfig.__init__(self, args, layout=(5, 1)) # Attempt to get substrate info from environment if hasattr(self.env, 'get_substrate'): actfun, inp, hid, out = self.env.get_substrate() # Default to substrate info from config file else: subs = self.params['Substrate'] inp = eval(subs['input']) hid = eval(subs['hidden']) if substrate is None else substrate out = eval(subs['output']) actfun = subs['function'] self.substrate = Substrate(inp, out, hid) self.actfun = actfun # For recurrent nets self.activations = len(self.substrate.hidden_coordinates) + 2 # Output of CPPN is recurrent, so negate indices self.node_names = { j: self.node_names[k] for j, k in enumerate(self.node_names) } # CPPN itself always has the same input and output nodes self.cppn_node_names = { -1: 'x1', -2: 'y1', -3: 'x2', -4: 'y2', -5: 'bias', 0: 'weight' }
def poloTrader(self): end_prices = {} active = self.get_one_bar_input_2d() sub = Substrate(self.in_shapes, self.out_shapes) network = ESNetwork(sub, self.cppn, self.params) net = network.create_phenotype_network() net.reset() for n in range(network.activations): out = net.activate(active) #print(len(out)) rng = len(out) #rng = iter(shuffle(rng)) for x in np.random.permutation(rng): sym = self.coin_dict[x] #print(out[x]) try: if (out[x] < -.5): print("selling: ", sym) self.sell_coin( sym, self.get_price(sym), ) elif (out[x] > .5): print("buying: ", sym) self.buy_coin(sym, self.get_price(sym)) except: print('error', sym) #skip the hold case because we just dont buy or sell hehe end_prices[sym] = self.get_price(sym) if datetime.now() >= self.end_ts: return else: time.sleep(self.ticker_len) self.reset_tickers self.pull_polo() self.poloTrader()
import neat import logging import cPickle as pickle import gym from pureples.shared.visualize import draw_net from pureples.shared.substrate import Substrate from pureples.shared.gym_runner import run_es from pureples.es_hyperneat.es_hyperneat import ESNetwork # Network input and output coordinates. input_coordinates = [(-0.33, -1.), (0.33, -1.)] output_coordinates = [(-0.5, 1.), (0., 1.), (0.5, 1.)] sub = Substrate(input_coordinates, output_coordinates) # ES-HyperNEAT specific parameters. params = { "initial_depth": 0, "max_depth": 1, "variance_threshold": 0.03, "band_threshold": 0.3, "iteration_level": 1, "division_threshold": 0.5, "max_weight": 8.0, "activation": "sigmoid" } # Config for CPPN. config = neat.config.Config(neat.genome.DefaultGenome, neat.reproduction.DefaultReproduction, neat.species.DefaultSpeciesSet,
import logging import pickle import gym import neat from pureples.shared.visualize import draw_net from pureples.shared.substrate import Substrate from pureples.shared.gym_runner import run_hyper from pureples.hyperneat.hyperneat import create_phenotype_network # Network input and output coordinates. input_coordinates = [(-0.33, -1.), (0.33, -1.)] OUTPUT_COORDINATES = [(-0.5, 1.), (0., 1.), (0.5, 1.)] HIDDEN_COORDINATES = [[(-0.5, 0.5), (0.5, 0.5)], [(0.0, 0.0)], [(-0.5, -0.5), (0.5, -0.5)]] SUBSTRATE = Substrate(input_coordinates, OUTPUT_COORDINATES, HIDDEN_COORDINATES) ACTIVATIONS = len(HIDDEN_COORDINATES) + 2 # Config for CPPN. CONFIG = neat.config.Config(neat.genome.DefaultGenome, neat.reproduction.DefaultReproduction, neat.species.DefaultSpeciesSet, neat.stagnation.DefaultStagnation, 'config_cppn_mountain_car') def run(gens, env): """ Run the pole balancing task using the Gym environment Returns the winning genome and the statistics of the run. """
def poloTrader(self): try: trade_df = pd.read_json("./live_hist/json_hist.json") except Exception as e: trade_df = pd.DataFrame() end_prices = {} active = self.get_one_bar_input_2d() self.load_net() sub = Substrate(self.in_shapes, self.out_shapes) net = ESNetwork(sub, self.cppn, self.params, self.hd) network = net.create_phenotype_network_nd('paper_net.png') sell_syms = [] buy_syms = [] buy_signals = [] sell_signals = [] for n in range(1, self.hd): network.activate(active[self.hd - n]) out = network.activate(active[0]) self.reset_tickers() for x in range(len(out)): sym = self.hs.coin_dict[x] end_prices[sym] = self.get_price(self.base_sym + "_" + sym) if (out[x] > .5): buy_signals.append(out[x]) buy_syms.append(sym) if (out[x] < -.5): sell_signals.append(out[x]) sell_syms.append(sym) #rng = iter(shuffle(rng)) sorted_buys = np.argsort(buy_signals)[::-1] sorted_sells = np.argsort(sell_signals) for x in sorted_sells: try: sym = sell_syms[x] p = end_prices[sym] print("selling: ", sym) self.folio.sell_coin(sym, p) except Exception as e: print("error placing order") for x in sorted_buys: try: sym = buy_syms[x] p = end_prices[sym] print("buying: ", sym) self.folio.buy_coin(sym, p) except Exception as e: print("error placing order") ''' self.trade_hist["date"] = datetime.now() self.trade_hist["portfoliovalue"] = self.folio.get_total_btc_value_no_sell(end_prices)[0] self.trade_hist["portfolio"] = self.folio.ledger self.trade_hist["percentchange"] = ((self.trade_hist["portfoliovalue"] - self.folio.start)/self.folio.start)*100 trade_df.append(self.trade_hist) trade_df.to_json("./live_hist/json_hist.json") if(self.trade_hist["portfoliovalue"] > self.folio.start *1.1): self.folio.start = self.folio.get_total_btc_value(end_prices)[0] ''' if datetime.now() >= self.end_ts: port_info = self.folio.get_total_btc_value(end_prices) print("total val: ", port_info[0], "btc balance: ", port_info[1]) return else: print(self.get_current_balance()) for t in range(2): p_vals = self.get_current_balance() print("current value: ", p_vals[0], "current holdings: ", p_vals[1]) time.sleep(self.ticker_len / 2) self.refresh_data() self.poloTrader()
def poloTrader(self): try: trade_df = pd.read_json("./live_hist/json_hist.json") except: trade_df = pd.DataFrame() end_prices = {} active = self.get_one_bar_input_2d() self.load_net() sub = Substrate(self.in_shapes, self.out_shapes) network = ESNetwork(sub, self.cppn, self.params) net = network.create_phenotype_network_nd() net.reset() signals = [] net.reset() for n in range(1, self.hist_depth+1): out = net.activate(active[self.hist_depth-n]) for x in range(len(out)): signals.append(out[x]) #rng = iter(shuffle(rng)) sorted_shit = np.argsort(signals)[::-1] self.reset_tickers() sym = "" for x in sorted_shit: sym = self.hs.coin_dict[x] #print(out[x]) try: if(out[x] < -.5): p = self.get_price('BTC_'+sym) print("selling: ", sym) self.folio.sell_coin(sym, p) elif(out[x] > .5): p = self.get_price('BTC_'+sym) print("buying: ", sym) self.folio.buy_coin(sym, p) except: print("error buying or selling") #skip the hold case because we just dont buy or sell hehe end_prices[sym] = self.hs.currentHists[sym]["close"].iloc[-1] #self.trade_hist["date"] = self.hs.currentHists[sym]["date"].iloc[-1] self.trade_hist["date"] = time.time() self.trade_hist["portfoliovalue"] = self.folio.get_total_btc_value_no_sell(end_prices)[0] self.trade_hist["portfolio"] = self.folio.ledger self.trade_hist["percentchange"] = ((self.trade_hist["portfoliovalue"] - self.folio.start)/self.folio.start)*100 print(self.trade_hist) print(self.folio.ledger) self.db.insert(self.trade_hist) self.trade_hist = {} ''' if(self.trade_hist["portfoliovalue"] > self.folio.start *1.1): self.folio.start = self.folio.get_total_btc_value(end_prices)[0] ''' if datetime.now() >= self.end_ts: port_info = self.folio.get_total_btc_value(end_prices) print("total val: ", port_info[0], "btc balance: ", port_info[1]) return else: print(self.get_current_balance()) for t in range(2): time.sleep(self.ticker_len/2) #print(self.folio.ledger) self.refresh_data self.poloTrader()
from pureples.shared.substrate import Substrate from pureples.shared.visualize import draw_net from pureples.es_hyperneat.es_hyperneat import ESNetwork # S, M or L; Small, Medium or Large (logic implemented as "Not 'S' or 'M' then Large"). VERSION = "S" VERSION_TEXT = "small" if VERSION == "S" else "medium" if VERSION == "M" else "large" # Network inputs and expected outputs. XOR_INPUTS = [(0.0, 0.0), (0.0, 1.0), (1.0, 0.0), (1.0, 1.0)] XOR_OUTPUTS = [(0.0, ), (1.0, ), (1.0, ), (0.0, )] # Network coordinates and the resulting substrate. INPUT_COORDINATES = [(-1.0, -1.0), (0.0, -1.0), (1.0, -1.0)] OUTPUT_COORDINATES = [(0.0, 1.0)] SUBSTRATE = Substrate(INPUT_COORDINATES, OUTPUT_COORDINATES) def params(version): """ ES-HyperNEAT specific parameters. """ return { "initial_depth": 0 if version == "S" else 1 if version == "M" else 2, "max_depth": 1 if version == "S" else 2 if version == "M" else 3, "variance_threshold": 0.03, "band_threshold": 0.3, "iteration_level": 1, "division_threshold": 0.5, "max_weight": 5.0, "activation": "sigmoid"
# Network input and output coordinates. # input_coordinates = [(-0.33, -1.), (0.33, -1.), (0.33, -1.), (0.33, -1.), (0.33, -1.), (0.33, -1.), (0.33, -1.), (0.33, -1.), (0.33, -1.), (0.33, -1.), (0.33, -1.), (0.33, -1.), (0.33, -1.), (0.33, -1.), (0.33, -1.), (0.33, -1.), (0.33, -1.), (0.33, -1.), (0.33, -1.), (0.33, -1.), (0.33, -1.), (0.33, -1.)] # output_coordinates = [(-0.5, 1.),(-0.5, 1.),(-0.5, 1.)] # # sub = Substrate(input_coordinates, output_coordinates) # Network input and output coordinates. # input_coordinates = [ (-0.8, -1.), (-0.7, -1.), (-0.6, -1.), (-0.5, -1.), (-0.4, -1.), (-0.3, -1.), (-0.2, -1.), (-0.1, -1.), (-0.05, -1.), (0.01, -1.), (0.01, -1.), (0.05, -1.), (0.1, -1.), (0.2, -1.), (0.3, -1.), (0.4, -1.), (0.5, -1.), (0.6, -1.), (0.7, -1.), (0.8, -1.), (0.9, -1.)] input_coordinates = [(-0.5, -1.)] output_coordinates = [(0.5, 1.)] # hidden_coordinates = [[(0.0, 0.0)]] sub = Substrate(input_coordinates, output_coordinates) #,hidden_coordinates) # activations = len(hidden_coordinates) + 2 # ES-HyperNEAT specific parameters. params = { "initial_depth": 0, "max_depth": 100, "variance_threshold": 0.9, "band_threshold": 0.3, "iteration_level": 10, "division_threshold": 0.5, "max_weight": 8.0, "activation": "sigmoid" } # Config for CPPN.