Optimization Matrix

build_constr_mat

Build the matrix and target vector for the least square optimization.

treehfd.optimization_matrix.build_constr_mat(y_tree: ndarray, interaction_list: list, X_bin: ndarray, main_variables: ndarray, partition_index: ndarray) tuple

Build the matrix and target vector for the least square optimization.

Parameters:
  • y_tree (np.ndarray) – 1d array with the tree output for the input training data.

  • interaction_list (list) – List of variable index pairs for interactions.

  • X_bin (np.ndarray) – Array with the cell indices of all Cartesian partitions for each training point.

  • main_variables (np.ndarray) – list of variable indices for main effects.

  • partition_index (np.ndarray) – cell indices of all partitions.

Returns:

constr_matscipy.sparse.csr_matrix

scipy sparse matrix for the least square problem.

targetnp.ndarray

array (1d) for the target vector of the least square problem.

Return type:

tuple