DiscreteTypeProcessor.clear

DiscreteTypeProcessor.clear(clearDiscretizationParameters=False)

Sets the number of continuous variables and the total number of bins created by this discretizer to 0. If clearDiscretizationParameters is True, also clears the the parameters for discretization the user has set for each variable.

Parameters:

clearDiscretizationParameters (bool) – if True, this method also clears the parameters the user has set for each variable and resets them to the default.

Return type:

None

Example

import numpy as np
import pandas as pd

from pyagrum.lib.discreteTypeProcessor import DiscreteTypeProcessor

rng = np.random.default_rng(42)
X = pd.DataFrame({"x1": rng.normal(size=200), "x2": rng.integers(0, 3, size=200)})
dtp = DiscreteTypeProcessor(defaultDiscretizationMethod="uniform", defaultNumberOfBins=3)
bn = dtp.discretizedTemplate(X)
dtp.numberOfContinuous, dtp.totalNumberOfBins
# (1, 3)
dtp.clear()
dtp.numberOfContinuous, dtp.totalNumberOfBins
# (0, 0)

Class

DiscreteTypeProcessor