def generate(n_centers, low, high, dimensions=None): r""" Factory method to build uniformly spaced gaussian radial basis functions with a 25\% overlap. Args: n_centers (list): list of the number of radial basis functions to be used for each dimension. low (np.ndarray): lowest value for each dimension; high (np.ndarray): highest value for each dimension; dimensions (list, None): list of the dimensions of the input to be considered by the feature. The number of dimensions must match the number of elements in ``n_centers`` and ``low``. Returns: The list of the generated radial basis functions. """ n_features = len(low) assert len(n_centers) == n_features assert len(low) == len(high) assert dimensions is None or n_features == len(dimensions) grid, b = uniform_grid(n_centers, low, high) basis = list() for i in range(len(grid)): v = grid[i, :] bf = GaussianRBF(v, b, dimensions) basis.append(bf) return basis
def generate(n_centers, ranges): """ Factory method that generates the list of dictionaries to build the tensors representing a set of uniformly spaced Gaussian radial basis functions with a 25\% overlap. Args: n_centers (list): list of the number of radial basis functions to be used for each dimension. ranges (list): list of two-elements lists specifying the range of each state variable. Returns: The list of dictionaries as described above. """ n_features = len(ranges) assert len(n_centers) == n_features assert len(ranges[0]) == 2 grid, scale = uniform_grid(n_centers, ranges) tensor_list = list() for i in range(len(grid)): mu = grid[i, :] tensor_list.append(PyTorchGaussianRBF(mu, scale)) return tensor_list
def generate(n_centers, low, high, dimensions=None): """ Factory method that generates the list of dictionaries to build the tensors representing a set of uniformly spaced Gaussian radial basis functions with a 25\% overlap. Args: n_centers (list): list of the number of radial basis functions to be used for each dimension; low (np.ndarray): lowest value for each dimension; high (np.ndarray): highest value for each dimension; dimensions (list, None): list of the dimensions of the input to be considered by the feature. The number of dimensions must match the number of elements in ``n_centers`` and ``low``. Returns: The list of dictionaries as described above. """ n_features = len(low) assert len(n_centers) == n_features assert len(low) == len(high) assert dimensions is None or n_features == len(dimensions) grid, scale = uniform_grid(n_centers, low, high) tensor_list = list() for i in range(len(grid)): mu = grid[i, :] tensor_list.append(PyTorchGaussianRBF(mu, scale, dimensions)) return tensor_list
def generate(n_centers, ranges, dimensions=None): """ Factory method to build uniformly spaced gaussian radial basis functions with a 25\% overlap. Args: n_centers (list): list of the number of radial basis functions to be used for each dimension. ranges (list): list of two-elements lists specifying the range of each state variable; dimensions (list, None): list of the dimensions of the input to be considered by the feature. The number of dimensions must match the number of elements in ``n_centers`` and ``ranges``. Returns: The list of the generated radial basis functions. """ n_features = len(ranges) assert len(n_centers) == n_features assert len(ranges[0]) == 2 assert dimensions is None or n_features == len(dimensions) grid, b = uniform_grid(n_centers, ranges) basis = list() for i in range(len(grid)): v = grid[i, :] bf = GaussianRBF(v, b, dimensions) basis.append(bf) return basis
def generate(n_centers, ranges): """ Factory method that generates the list of dictionaries to build the tensors representing a set of uniformly spaced Gaussian radial basis functions with a 25\% overlap. Args: n_centers (list): list of the number of radial basis functions to be used for each dimension. ranges (list): list of two-elements lists specifying the range of each state variable. Returns: The list of dictionaries as described above. """ n_features = len(ranges) assert len(n_centers) == n_features assert len(ranges[0]) == 2 grid, b = uniform_grid(n_centers, ranges) tensor_list = list() for i in xrange(len(grid)): v = grid[i, :] bf = {'type': tensors.gaussian_tensor, 'params': [v, b]} tensor_list.append(bf) return tensor_list