INNER CODE UNIT · Python

_initialize_dataset

AnotherSamWilson/miceforest · miceforest/imputation_kernel.py:369

    def _initialize_dataset(self, imputed_data, random_state):
        """
        Sets initial imputation values for iteration 0.
        If "random", draw values from the working data at random.
        If "empty", keep the values missing, since missing values
        can be handled natively by lightgbm.
        """

        assert not imputed_data.initialized, "dataset has already been initialized"

        if self.initialize_empty:
            # The default value when initialized is np.nan, nothing to do here
            pass
        else:
            for variable in imputed_data.imputed_variables:
                # Pulls from the kernel working data
                candidate_values = self._get_nonmissing_values(variable)
                candidate_num = candidate_values.shape[0]

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…