def __init__( self, conf): # idim = 1, odim = 1, numepisodes = 1, visualize = False): """smpModel.__init__ init """ defaults = { 'idim': 1, 'odim': 1, } set_attr_from_dict(self, conf) self.model = None # FIXME: variables for all models # X, Y # e, perf, loss # dw, |W| # self.idim = idim # self.odim = odim # self.numepisodes = numepisodes # self.visualize = visualize if self.visualize: plt.ion() self.figs = [] # store data for plotting, another internal model self.Xhist = [] self.Yhist = [] self.visualize_model_init()
def __init__(self, conf): # if len(conf['mdls']) > 1: # set_attr_from_dict(self, conf['mdls']) k1 = conf['mdls'].keys()[0] set_attr_from_dict(self, conf['mdls'][k1])
def __init__(self, conf): set_attr_from_dict(self, conf) self.isrunning = True # self.name = "lpzros" self.mode = HK.modes[self.mode] self.cnt = 0 ############################################################ # model + meta params self.numsen_raw = self.idim self.numsen = self.idim self.nummot = self.odim # buffer size accomodates causal minimum 1 + lag time steps self.bufsize = self.maxlag + 1 # 1 + self.robot.lag # 2 # self.creativity = 0.5 # self.epsA = 0.2 # self.epsA = 0.02 # self.epsA = 0.001 # self.epsC = 0.001 # self.epsC = 0.001 # self.epsC = 0.01 # self.epsC = 0.1 # self.epsC = 0.3 # self.epsC = 0.5 # self.epsC = 0.9 # self.epsC = 1.0 # self.epsC = 2.0 ############################################################ # forward model # self.A = np.eye(self.numsen) * 1. self.A = np.zeros((self.numsen, self.nummot)) # self.A[range(self.nummot),range(self.nummot)] = 1. # diagonal self.b = np.zeros((self.numsen, 1)) # controller # self.C = np.eye(self.nummot) * 0.4 self.C = np.zeros((self.nummot, self.numsen)) self.C[list(range(self.nummot)), list(range(self.nummot))] = 1 # * 0.4 # self.C = np.random.uniform(-1e-2, 1e-2, (self.nummot, self.numsen)) # print "models_selforg.py: HK.__init__: self.C", self.C self.h = np.zeros((self.nummot, 1)) self.g = np.tanh # sigmoidal activation function self.g_ = dtanh # derivative of sigmoidal activation function # state self.x = np.ones((self.numsen, self.bufsize)) self.y = np.zeros((self.nummot, self.bufsize)) self.z = np.zeros((self.numsen, 1)) # auxiliary variables # self.L = np.zeros((self.numsen, self.nummot)) self.v = np.zeros((self.numsen, 1)) self.v_avg = np.zeros((self.numsen, 1)) self.xsi = np.zeros((self.numsen, 1)) self.imu_vec = np.zeros((3 + 3 + 3, 1)) self.imu_smooth = 0.8 # coef