col_gen_estimator.BDRMasterProblem

class col_gen_estimator.BDRMasterProblem(C=10, p=1, solver_str='glop')[source]

The master problem for boolean decision rule generation described in ‘Boolean decision rules via column generation’ by Sanjeeb Dash et. al. 2018. This extends the BaseMasterProblem for column generation classifier.

Parameters:
Cint, default=10,

A parameter used for controlling the overall complexity of decision rule.

pfloat, default=1,

A parameter used for balancing the penalty between false negatives and false positives. Higher value of p would result in more penalty for the false negatives.

solver_strstring, default=’glop’,

Describes the solver used for solving the master problem.

Attributes:
X_ndarray, shape (n_samples, n_features)

The input passed during generate_mp(). The inputs should only contain values in {0,1}.

y_ndarray, shape (n_samples,)

The labels passed during generate_mp(). The labels should only contain values in {0,1}.

solver_MPSolver from OR-Tools,

The solver used for solving the master problem.

clause_vars_list(int),

Stores the indices of clause variables w_k generated so far.

xi_vars_list(int),

Stores the indices of positive penalty variables xi.

clause_satisfaction_list(int)

Stores the indices of constraints (1a).

clause_complexity_: int

Index of constraint (1b).

clause_dict_dictionary, (int->list)

Dictionary of clauses generated so far. The keys are the indices of the corresponding variables and the values are the lists containing the indices of features that make the clause.

generated_boolean,

True when the master problem model has been generated. False otherwise.

__init__(C=10, p=1, solver_str='glop')[source]
add_column(clause)[source]

Adds the given column to the master problem model. Retuns True if the column is added to the master problem.

Boolean decision rule generation is a special case where we take the clause as input instead of the column coefficients.

Parameters:
clauselist(int),

The clause for which the column is to be generated.

static generate_lexicographic_clause(index)[source]

Generates the ‘index’th clause as per lexicogrphical index. Parameters ———- index : int.

generate_mp(X, y)[source]

Generates the master problem model (RMP) and initializes the primal and dual solutions. Parameters ———- X : ndarray, shape (n_samples, n_features)

The input. The inputs should only contain values in {0,1}.

yndarray, shape (n_samples,)

The labels. The labels should only contain values in {0,1}.

get_clause_coeffs(clause)[source]

Given the clause, returns the coefficients for corresponding variable in RMP. Parameters ———- clause : list(int),

The list containing the indices of features present in the clause.

get_objective_coeff_mp(clause)[source]

Returns the number of zero examples satisfying the clause. Parameters ———- clause : list(int),

The list containing the indices of features present in the clause.

static satisfies_clause(entry, clause)[source]

Given the entry and clause, returns 1 if the entry satisfies the clause and 0 oterwise. Parameters ———- entry : ndarray, shape(n_features)

The input example. The array should have values in {0,1}.

clauselist(int),

The list containing the indices of features present in the clause.

solve_ip(solver_params='')[source]

Solves the integer RMP with given solver params. Returns True if the explanation is generated. Parameters ———- solver_params : string, default=’’,

The solver parameters for solving the integer RMP.

solve_rmp(solver_params='')[source]

Solves the RMP with given solver params. Returns the dual costs of constraints (1b) and (1a) in a tuple. Parameters ———- solver_params : string, default=’’,

The solver parameters for solving the RMP.