okridge.node
Module Contents
Classes
Functions
|
Create two new z vectors by branching on the index-th variable |
|
Branch on the current node |
- okridge.node.get_RAM_used_in_GB()
- class okridge.node.Node(parent, zlb, zub, **kwargs)
- delete_storedData_on_allowed_support()
Delete the stored data on the allowed support to save memory
- store_data_on_allowed_support()
Store the data on the allowed support to save future computation
- upper_solve(k, upper_solver, parent_size=50, child_size=50)
Solve the k-sparse ridge regression for the current node using heuristic method
- Parameters:
k (int) – cardinality constraint
upper_solver (CustomClass) – solver that can search for the k-sparse solution
parent_size (int, optional) – parent size of the beam search procedure. Defaults to 50.
child_size (int, optional) – child size of the beam search procedure. Defaults to 50.
- Returns:
loss of the k-sparse solution
- Return type:
float
- upper_solve_with_cache(k, upper_solver)
Solve the k-sparse ridge regression for the current node using heuristic method
- Parameters:
k (int) – cardinality constraint
upper_solver (CustomClass) – solver that can search for the k-sparse solution
- Returns:
loss of the k-sparse solution
- Return type:
float
- lower_solve_brute_force(k, upper_solver)
Find the lower bound of the current node using brute force method
- Parameters:
k (int) – cardinality constraint
upper_solver (CustomClass) – solver that can find the best k-sparse solution via brute force
- Returns:
loss of the best k-sparse solution
- Return type:
float
- lower_solve_fast(k, upper_bound)
Solve the perspective relaxation of the current node through the Fast Solve method
- Parameters:
k (int) – cardinality constraint
upper_bound (float) – loss of the best k-sparse solution found so far
- Returns:
a valid lower bound of the current node
- Return type:
float
- calculate_lower_bound(lower_beta_on_allowed_support, k)
Calculate the lower bound of the current node for the saddle point formulation
- Parameters:
lower_beta_on_allowed_support (np.array) – 1D array of coefficients for the saddle point formulation
k (int) – cardinality constraint
- Returns:
a valid lower bound of the current node
- Return type:
float
- finetune_ADMM_rho(k, upper_bound, factor=10)
Finetune the step size of ADMM via two-way grid search
- Parameters:
k (int) – cardinality constraint
upper_bound (float) – loss of the best k-sparse solution found so far
factor (int, optional) – multiplicative factor when we perform grid search on the best step size. Defaults to 10.
- lower_solve_admm(k, upper_bound)
Solve the perspective relaxation of the current node through the ADMM method
- Parameters:
k (int) – cardinality constraint
upper_bound (float) – loss of the best k-sparse solution found so far
- Returns:
a valid lower bound of the current node
- Return type:
float
- okridge.node.new_z(node, index)
Create two new z vectors by branching on the index-th variable
- Parameters:
node (CustomClass) – parent node
index (int) – index of the variable to branch on
- Returns:
1D array of left z vector np.array: 1D array of right z vector
- Return type:
np.array
- okridge.node.branch(current_node, k)
Branch on the current node
- Parameters:
current_node (CustomClass) – parent node
k (int) – cardinality constraint
- Returns:
left child node CustomClass: right child node
- Return type:
CustomClass