def _post_update_n_dimensions_9(self) -> bool: # I != U1 != U2 != I, D1 != I != D2 self._U[0] = random_orthogonal_matrix(self._n_dimensions, self._rng) self._U[1] = random_orthogonal_matrix(self._n_dimensions, self._rng) self._d[0] = self._random_d() self._d[1] = self._random_d() raise NotImplementedError()
def _post_update_n_dimensions(self) -> None: if self._rotate: self._rotation_matrix_y = random_orthogonal_matrix( self._n_dimensions, self._rng) self._rotation_matrix_z = random_orthogonal_matrix( self._n_dimensions, self._rng) else: self._rotation_matrix_y = np.eye(self._n_dimensions) self._rotation_matrix_z = np.eye(self._n_dimensions) self._scaler_inv = self._a * self._a * self._n_dimensions
def _post_update_n_dimensions(self) -> None: self._rotation_matrix = (random_orthogonal_matrix( self._n_dimensions, self._rng) if self._rotate else np.eye( self._n_dimensions)) self._y_max = 1.0 / np.linalg.norm(self._rotation_matrix[0], np.inf) self._constraints_handler = BoxConstraintsHandler( self._n_dimensions, self._bounds)
def _post_update_n_dimensions_6(self) -> bool: # U1 = I, U2 != I, D2 != I for i in range(self._n_dimensions): self._U[0, i, i] = 1.0 self._U[1] = random_orthogonal_matrix(self._n_dimensions, self._rng) self._d[1] = self._random_d() raise NotImplementedError()
def _post_update_n_dimensions(self) -> None: if self._rotate: self._rotation_matrix_y = random_orthogonal_matrix( self._n_dimensions, self._rng ) self._rotation_matrix_z = random_orthogonal_matrix( self._n_dimensions, self._rng ) else: self._rotation_matrix_y = np.eye(self._n_dimensions) self._rotation_matrix_z = np.eye(self._n_dimensions) self._scaler_inv = self._a * self._a * self._n_dimensions self._coefficients = self._a ** ( 2.0 * np.arange(self._n_dimensions) / (self._n_dimensions - 1) )
def _post_update_n_dimensions(self) -> None: n = self._n_dimensions # Update box constraints lower_bounds = np.repeat(-5.0, n) lower_bounds[0] = 0.0 upper_bounds = np.repeat(5.0, n) upper_bounds[0] = 1.0 self._constraints_handler = BoxConstraintsHandler( self._n_dimensions, (lower_bounds, upper_bounds)) # Create the random orthogonal (and restricted) rotation matrix self._rotation_matrix = np.zeros((n, n)) self._rotation_matrix[0, 0] = 1.0 self._rotation_matrix[1:, 1:] = random_orthogonal_matrix(n - 1, self._rng)
def _post_update_n_dimensions(self) -> None: self._scaler_inv = self._a * self._a * self._n_dimensions # The O matrix in the paper orthogonal_matrix = random_orthogonal_matrix( self._n_dimensions, self._rng ) # The D matrix in the paper diagonal_matrix = np.zeros((self._n_dimensions, self._n_dimensions)) for i in range(self._n_dimensions): diagonal_matrix[i, i] = self._a ** (i / (self._n_dimensions - 1)) # The DO matrix in the paper self._rotation_matrix = diagonal_matrix @ orthogonal_matrix # The M matrix in the paper self._create_centers_matrix()
def setUp(self) -> None: """Set up for tests.""" rng = np.random.default_rng(seed=0) self.Q = random_orthogonal_matrix(100, rng)