dagma.linear.DagmaLinear
¶
-
class dagma.linear.DagmaLinear(loss_type: str, verbose: bool =
False
, dtype: type =np.float64
)¶ A Python object that contains the implementation of DAGMA for linear models using numpy and scipy.
- Parameters:¶
- loss_type : str¶
One of [“l2”, “logistic”].
l2
refers to the least squares loss, whilelogistic
refers to the logistic loss. For continuous data: usel2
. For discrete 0/1 data: uselogistic
.- verbose : bool, optional¶
If true, the loss/score and h values will print to stdout every
checkpoint
iterations, as defined infit()
. Defaults toFalse
.- dtype : type, optional¶
Defines the float precision, for large number of nodes it is recommened to use
np.float64
. Defaults tonp.float64
.
Methods¶
_score
(→ Tuple[float, numpy.ndarray])Evaluate value and gradient of the score function.
_h
(→ Tuple[float, numpy.ndarray])Evaluate value and gradient of the logdet acyclicity constraint.
_func
(→ Tuple[float, numpy.ndarray])Evaluate value of the penalized objective function.
_adam_update
(→ numpy.ndarray)Performs one update of Adam.
minimize
(→ Tuple[numpy.ndarray, bool])Solves the optimization problem:
fit
(→ numpy.ndarray)Runs the DAGMA algorithm and returns a weighted adjacency matrix.