def __init__(self, indim, outdim, nhidden=20): FA.__init__(self, indim, outdim) # learning rate self.alpha = 0.1 # number of neurons in each layer self.indim = indim self.nhidden = nhidden self.outdim = outdim # change output activation if task is classification self.classification = False # online training or batch, if batch, then train for that many epochs self.online = False self.epochs = 100 # initialize weights randomly (+1 for bias) self.hWeights = 0.01 * np.random.random((self.nhidden, self.indim+1)) self.oWeights = 0.01 * np.random.random((self.outdim, self.nhidden+1)) # activations of neurons (sum of inputs) self.hActivation = np.zeros((self.nhidden, 1), dtype=float) self.oActivation = np.zeros((self.outdim, 1), dtype=float) # outputs of neurons (after sigmoid function) self.iOutput = np.zeros((self.indim+1, 1), dtype=float) # +1 for bias self.hOutput = np.zeros((self.nhidden+1, 1), dtype=float) # +1 for bias self.oOutput = np.zeros((self.outdim, 1), dtype=float) # deltas for hidden and output layer self.hDelta = np.zeros((self.nhidden), dtype=float) self.oDelta = np.zeros((self.outdim), dtype=float)
def __init__(self, indim, outdim, bayes=True, rbf=False): """ initialize function approximator with input and output dimension. """ self.rbf = rbf self.bayes = bayes if self.rbf: self.numCenters = 20 else: self.numCenters = indim FA.__init__(self, indim, outdim)
def __init__(self, indim, outdim): FA.__init__(self, indim, outdim) self.filename = None