ytm._core.initializer.SampleTAInit#
- class ytm._core.initializer.SampleTAInit(X: ndarray, Y: ndarray | None = None, margin: int = 0, p: float = 0.0, include_position: bool = False)#
Bases:
TAInitStart each clause as a copy of a training sample.
Each clause picks a sample (and, with convolution, a random patch of it) and includes exactly the literals that are true for it. All other literals start just below include.
- Parameters:
- Xarray-like of shape (N, …)
Samples to copy from, in the same format as
fittakes.- Yarray-like, default=None
Labels for
X, in the same format asfittakes. WithoutY, samples are picked at random. WithY, a clause with positive weight for a class copies a sample of that class, and a clause with negative weight copies a sample not of that class.- marginint, default=0
Spread of the initial states. Included literals start uniformly in
[include_state, include_state + margin], excluded ones in[include_state - 1 - margin, include_state - 1].- pfloat, default=0.0
Probability, in
[0, 1), of leaving out each copied literal.- include_positionbool, default=False
Also include the position literals of the copied patch.