class_docstr: Creates a kernel dataset. This dataset can perform MICE on itself,
  and impute new data from models obtained during MICE.
  
  Parameters
  ----------
  data : np.ndarray or pandas DataFrame.
  
      .. code-block:: text
  
          The data to be imputed.
  
  variable_schema : None or list or dict, default=None
  
      .. code-block:: text
  
          Specifies the feature - target relationships used to train models.
          This parameter also controls which models are built. Models can be built
          even if a variable contains no missing values, or is not being imputed
          (train_nonmissing must be set to True).
  
              - If None, all columns will be used as features in the training of each model.
              - If list, all columns in data are used to impute the variables in the list
              - If dict the values will be used to impute the keys. Can be either column
                  indices or names (if data is a pd.DataFrame).
  
          No models will be trained for variables not specified by variable_schema
          (either by None, a list, or in dict keys).
  
  imputation_order: str, list[str], list[int], default="ascending"
  
      .. code-block:: text
  
          The order the imputations should occur in. If a string from the
          items below, all variables specified by variable_schema with
          missing data are imputed:
              ascending: variables are imputed from least to most missing
              descending: most to least missing
              roman: from left to right in the dataset
              arabic: from right to left in the dataset.
          If a list is provided:
              - the variables will be imputed in that order.
              - only variables with missing values should be included in the list.
              - must be a subset of variables specified by variable_schema.
          If a variable with missing values is in variable_schema, but not in
          imputation_order, then models to impute that variable will be trained,
          but the actual values will not be imputed. See examples for details.
  
  train_nonmissing: boolean
  
      .. code-block:: text
  
          Should models be trained for variables with no missing values? Useful if you
          expect you will need to impute new data which will have missing values, but
          the training data is fully recognized.
  
          If True, parameters are interpreted like so:
              - models are run for all variables specified by variable_schema
              - if variable_schema is None, models are run for all variables
              - each iteration, models build for fully recognized variables are
                  always trained after the models trained during mice.
              - imputation_order does not have any affect on fully recognized
                  variable model training.
  
          WARNING: Setting this to True without specifying a variable schema will build
          models for all variables in the dataset, whether they have missing values or
          not. This may or may not be what you want.
  
  data_subset: None or int or float or dict.
  
      .. code-block:: text
  
          Subsets the data used in each iteration, which can save a significant amount of time.
          This can also help with memory consumption, as the candidate data must be copied to
          make a feature dataset for lightgbm.
  
          The number of rows used for each variable is (# rows in raw data) - (# missing variable values)
          for each variable. data_subset takes a random sample of this.
  
          If float, must be 0.0 < data_subset <= 1.0. Interpreted as a percentage of available candidates
          If int must be data_subset >= 0. Interpreted as the number of candidates.
          If 0, no subsetting is done.
          If dict, keys must be variable names, and values must follow two above rules.
  
          It is recommended to carefully select this value for each variable if dealing
          with very large data that barely fits into memory.
  
  mean_match_scheme: Dict, default = None
  
      .. code-block:: text
  
          An instance of the miceforest.MeanMatchScheme class.
  
          If None is passed, a sensible default scheme is used. There are multiple helpful
          schemes that can be accessed from miceforest.builtin_mean_match_schemes, or
          you can build your own.
  
          A description of the defaults:
          - mean_match_default (default, if mean_match_scheme is None))
              This scheme is has medium speed and accuracy for most data.
  
              Categorical:
                  If mmc = 0, the class with the highest probability is chosen.
                  If mmc > 0, get N nearest neighbors from class probabilities.
                      Select 1 at random.
              Numeric:
                  If mmc = 0, the predicted value is used
                  If mmc > 0, obtain the mmc closest candidate
                      predictions and collect the associated
                      real candidate values. Choose 1 randomly.
  
          - mean_match_shap
              This scheme is the most accurate, but takes the longest.
              It works the same as mean_match_default, except all nearest
              neighbor searches are performed on the shap values of the
              predictions, instead of the predictions themselves.
  
          - mean_match_scheme_fast_cat:
              This scheme is faster for categorical variables,
              but may be less accurate as well..
  
              Categorical:
                  If mmc = 0, the class with the highest probability is chosen.
                  If mmc > 0, return class based on random draw weighted by
                      class probability for each sample.
              Numeric or binary:
                  If mmc = 0, the predicted value is used
                  If mmc > 0, obtain the mmc closest candidate
                      predictions and collect the associated
                      real candidate values. Choose 1 randomly.
  
  categorical_feature: str or list, default="auto"
  
      .. code-block:: text
  
          The categorical features in the dataset. This handling depends on class of impute_data:
  
              pandas DataFrame:
                  - "auto": categorical information is inferred from any columns with
                      datatype category or object.
                  - list of column names (or indices): Useful if all categorical columns
                      have already been cast to numeric encodings of some type, otherwise you
                      should just use "auto". Will throw an error if a list is provided AND
                      categorical dtypes exist in data. If a list is provided, values in the
                      columns must be consecutive integers starting at 0, as required by lightgbm.
  
              numpy ndarray:
                  - "auto": no categorical information is stored.
                  - list of column indices: Specified columns are treated as categorical. Column
                      values must be consecutive integers starting at 0, as required by lightgbm.
  
  initialization: str
  
      .. code-block:: text
  
          "random" - missing values will be filled in randomly from existing values.
          "empty" - lightgbm will start MICE without initial imputation
  
  save_all_iterations: boolean, optional(default=True)
  
      .. code-block:: text
  
          Save all the imputation values from all iterations, or just
          the latest. Saving all iterations allows for additional
          plotting, but may take more memory
  
  save_models: int
  
      .. code-block:: text
  
          Which models should be saved:
              = 0: no models are saved. Cannot get feature importance or
                  impute new data.
              = 1: only the last model iteration is saved. Can only get
                  feature importance of last iteration. New data is
                  imputed using the last model for all specified iterations.
                  This is only an issue if data is heavily Missing At Random.
              = 2: all model iterations are saved. Can get feature importance
                  for any iteration. When imputing new data, each iteration is
                  imputed using the model obtained at that iteration in mice.
                  This allows for imputations that most closely resemble those
                  that would have been obtained in mice.
  
  copy_data: boolean (default = False)
  
      .. code-block:: text
  
          Should the dataset be referenced directly? If False, this will cause
          the dataset to be altered in place. If a copy is created, it is saved
          in self.working_data. There are different ways in which the dataset
          can be altered:
  
          1) complete_data() will fill in missing values
          2) To save space, mice() references and manipulates self.working_data directly.
              If self.working_data is a reference to the original dataset, the original
              dataset will undergo these manipulations during the mice process.
              At the end of the mice process, missing values will be set back to np.NaN
              where they were originally missing.
  
  save_loggers: boolean (default = False)
  
      .. code-block:: text
  
          A logger is created each time mice() or impute_new_data() is called.
          If True, the loggers are stored in a list ImputationKernel.loggers.
          If you wish to start saving logs, call ImputationKernel.start_logging().
          If you wish to stop saving logs, call ImputationKernel.stop_logging().
  
  random_state: None,int, or numpy.random.RandomState
  
      .. code-block:: text
  
          The random_state ensures script reproducibility. It only ensures reproducible
          results if the same script is called multiple times. It does not guarantee
          reproducible results at the record level, if a record is imputed multiple
          different times. If reproducible record-results are desired, a seed must be
          passed for each record in the random_seed_array parameter.
class_docstr_tok: ["Creates","a","kernel","dataset",".","This","dataset","can","perform","MICE","on","itself",",","and","impute","new","data","from","models","obtained","during","MICE",".","Parameters","--","--","--","--","--","data",":","np.ndarray","or","pandas","DataFrame",".","..","code-block",":",":","text","The","data","to","be","imputed",".","variable_schema",":","None","or","list","or","dict",",","default=None","..","code-block",":",":","text","Specifies","the","feature","-","target","relationships","used","to","train","models",".","This","parameter","also","controls","which","models","are","built",".","Models","can","be","built","even","if","a","variable","contains","no","missing","values",",","or","is","not","being","imputed","(","train_nonmissing","must","be","set","to","True",")",".","-","If","None",",","all","columns","will","be","used","as","features","in","the","training","of","each","model",".","-","If","list",",","all","columns","in","data","are","used","to","impute","the","variables","in","the","list","-","If","dict","the","values","will","be","used","to","impute","the","keys",".","Can","be","either","column","indices","or","names","(","if","data","is","a","pd.DataFrame",")",".","No","models","will","be","trained","for","variables","not","specified","by","variable_schema","(","either","by","None",",","a","list",",","or","in","dict","keys",")",".","imputation_order",":","str",",","list","[","str","]",",","list","[","int","]",",","default=","''","ascending","''","..","code-block",":",":","text","The","order","the","imputations","should","occur","in",".","If","a","string","from","the","items","below",",","all","variables","specified","by","variable_schema","with","missing","data","are","imputed",":","ascending",":","variables","are","imputed","from","least","to","most","missing","descending",":","most","to","least","missing","roman",":","from","left","to","right","in","the","dataset","arabic",":","from","right","to","left","in","the","dataset",".","If","a","list","is","provided",":","-","the","variables","will","be","imputed","in","that","order",".","-","only","variables","with","missing","values","should","be","included","in","the","list",".","-","must","be","a","subset","of","variables","specified","by","variable_schema",".","If","a","variable","with","missing","values","is","in","variable_schema",",","but","not","in","imputation_order",",","then","models","to","impute","that","variable","will","be","trained",",","but","the","actual","values","will","not","be","imputed",".","See","examples","for","details",".","train_nonmissing",":","boolean","..","code-block",":",":","text","Should","models","be","trained","for","variables","with","no","missing","values","?","Useful","if","you","expect","you","will","need","to","impute","new","data","which","will","have","missing","values",",","but","the","training","data","is","fully","recognized",".","If","True",",","parameters","are","interpreted","like","so",":","-","models","are","run","for","all","variables","specified","by","variable_schema","-","if","variable_schema","is","None",",","models","are","run","for","all","variables","-","each","iteration",",","models","build","for","fully","recognized","variables","are","always","trained","after","the","models","trained","during","mice",".","-","imputation_order","does","not","have","any","affect","on","fully","recognized","variable","model","training",".","WARNING",":","Setting","this","to","True","without","specifying","a","variable","schema","will","build","models","for","all","variables","in","the","dataset",",","whether","they","have","missing","values","or","not",".","This","may","or","may","not","be","what","you","want",".","data_subset",":","None","or","int","or","float","or","dict",".","..","code-block",":",":","text","Subsets","the","data","used","in","each","iteration",",","which","can","save","a","significant","amount","of","time",".","This","can","also","help","with","memory","consumption",",","as","the","candidate","data","must","be","copied","to","make","a","feature","dataset","for","lightgbm",".","The","number","of","rows","used","for","each","variable","is","(","#","rows","in","raw","data",")","-","(","#","missing","variable","values",")","for","each","variable",".","data_subset","takes","a","random","sample","of","this",".","If","float",",","must","be","0.0","<","data_subset","<","=","1.0",".","Interpreted","as","a","percentage","of","available","candidates","If","int","must","be","data_subset",">","=","0",".","Interpreted","as","the","number","of","candidates",".","If","0",",","no","subsetting","is","done",".","If","dict",",","keys","must","be","variable","names",",","and","values","must","follow","two","above","rules",".","It","is","recommended","to","carefully","select","this","value","for","each","variable","if","dealing","with","very","large","data","that","barely","fits","into","memory",".","mean_match_scheme",":","Dict",",","default","=","None","..","code-block",":",":","text","An","instance","of","the","miceforest.MeanMatchScheme","class",".","If","None","is","passed",",","a","sensible","default","scheme","is","used",".","There","are","multiple","helpful","schemes","that","can","be","accessed","from","miceforest.builtin_mean_match_schemes",",","or","you","can","build","your","own",".","A","description","of","the","defaults",":","-","mean_match_default","(","default",",","if","mean_match_scheme","is","None",")",")","This","scheme","is","has","medium","speed","and","accuracy","for","most","data",".","Categorical",":","If","mmc","=","0",",","the","class","with","the","highest","probability","is","chosen",".","If","mmc",">","0",",","get","N","nearest","neighbors","from","class","probabilities",".","Select","1","at","random",".","Numeric",":","If","mmc","=","0",",","the","predicted","value","is","used","If","mmc",">","0",",","obtain","the","mmc","closest","candidate","predictions","and","collect","the","associated","real","candidate","values",".","Choose","1","randomly",".","-","mean_match_shap","This","scheme","is","the","most","accurate",",","but","takes","the","longest",".","It","works","the","same","as","mean_match_default",",","except","all","nearest","neighbor","searches","are","performed","on","the","shap","values","of","the","predictions",",","instead","of","the","predictions","themselves",".","-","mean_match_scheme_fast_cat",":","This","scheme","is","faster","for","categorical","variables",",","but","may","be","less","accurate","as","well","..","Categorical",":","If","mmc","=","0",",","the","class","with","the","highest","probability","is","chosen",".","If","mmc",">","0",",","return","class","based","on","random","draw","weighted","by","class","probability","for","each","sample",".","Numeric","or","binary",":","If","mmc","=","0",",","the","predicted","value","is","used","If","mmc",">","0",",","obtain","the","mmc","closest","candidate","predictions","and","collect","the","associated","real","candidate","values",".","Choose","1","randomly",".","categorical_feature",":","str","or","list",",","default=","''","auto","''","..","code-block",":",":","text","The","categorical","features","in","the","dataset",".","This","handling","depends","on","class","of","impute_data",":","pandas","DataFrame",":","-","``","auto","''",":","categorical","information","is","inferred","from","any","columns","with","datatype","category","or","object",".","-","list","of","column","names","(","or","indices",")",":","Useful","if","all","categorical","columns","have","already","been","cast","to","numeric","encodings","of","some","type",",","otherwise","you","should","just","use","``","auto","''",".","Will","throw","an","error","if","a","list","is","provided","AND","categorical","dtypes","exist","in","data",".","If","a","list","is","provided",",","values","in","the","columns","must","be","consecutive","integers","starting","at","0",",","as","required","by","lightgbm",".","numpy","ndarray",":","-","``","auto","''",":","no","categorical","information","is","stored",".","-","list","of","column","indices",":","Specified","columns","are","treated","as","categorical",".","Column","values","must","be","consecutive","integers","starting","at","0",",","as","required","by","lightgbm",".","initialization",":","str","..","code-block",":",":","text","``","random","''","-","missing","values","will","be","filled","in","randomly","from","existing","values",".","``","empty","''","-","lightgbm","will","start","MICE","without","initial","imputation","save_all_iterations",":","boolean",",","optional","(","default=True",")","..","code-block",":",":","text","Save","all","the","imputation","values","from","all","iterations",",","or","just","the","latest",".","Saving","all","iterations","allows","for","additional","plotting",",","but","may","take","more","memory","save_models",":","int","..","code-block",":",":","text","Which","models","should","be","saved",":","=","0",":","no","models","are","saved",".","Can","not","get","feature","importance","or","impute","new","data",".","=","1",":","only","the","last","model","iteration","is","saved",".","Can","only","get","feature","importance","of","last","iteration",".","New","data","is","imputed","using","the","last","model","for","all","specified","iterations",".","This","is","only","an","issue","if","data","is","heavily","Missing","At","Random",".","=","2",":","all","model","iterations","are","saved",".","Can","get","feature","importance","for","any","iteration",".","When","imputing","new","data",",","each","iteration","is","imputed","using","the","model","obtained","at","that","iteration","in","mice",".","This","allows","for","imputations","that","most","closely","resemble","those","that","would","have","been","obtained","in","mice",".","copy_data",":","boolean","(","default","=","False",")","..","code-block",":",":","text","Should","the","dataset","be","referenced","directly","?","If","False",",","this","will","cause","the","dataset","to","be","altered","in","place",".","If","a","copy","is","created",",","it","is","saved","in","self.working_data",".","There","are","different","ways","in","which","the","dataset","can","be","altered",":","1",")","complete_data","(",")","will","fill","in","missing","values","2",")","To","save","space",",","mice","(",")","references","and","manipulates","self.working_data","directly",".","If","self.working_data","is","a","reference","to","the","original","dataset",",","the","original","dataset","will","undergo","these","manipulations","during","the","mice","process",".","At","the","end","of","the","mice","process",",","missing","values","will","be","set","back","to","np.NaN","where","they","were","originally","missing",".","save_loggers",":","boolean","(","default","=","False",")","..","code-block",":",":","text","A","logger","is","created","each","time","mice","(",")","or","impute_new_data","(",")","is","called",".","If","True",",","the","loggers","are","stored","in","a","list","ImputationKernel.loggers",".","If","you","wish","to","start","saving","logs",",","call","ImputationKernel.start_logging","(",")",".","If","you","wish","to","stop","saving","logs",",","call","ImputationKernel.stop_logging","(",")",".","random_state",":","None",",","int",",","or","numpy.random.RandomState","..","code-block",":",":","text","The","random_state","ensures","script","reproducibility",".","It","only","ensures","reproducible","results","if","the","same","script","is","called","multiple","times",".","It","does","not","guarantee","reproducible","results","at","the","record","level",",","if","a","record","is","imputed","multiple","different","times",".","If","reproducible","record-results","are","desired",",","a","seed","must","be","passed","for","each","record","in","the","random_seed_array","parameter","."]
docstr: Start saving loggers to self.loggers
docstr_tok: ["Start","saving","loggers","to","self.loggers"]
code: def start_logging(self):
      """
      Start saving loggers to self.loggers
      """
  
      self.save_loggers = True
  
imports: from .ImputedData import ImputedData
  from .MeanMatchScheme import MeanMatchScheme
  from .utils import _t_dat, _t_var_list, _t_var_dict, _t_var_sub, _t_random_state, _assert_dataset_equivalent, _draw_random_int32, _interpret_ds, _subset_data, ensure_rng, hash_int32, stratified_categorical_folds, stratified_continuous_folds, stratified_subset
  from .compat import pd_DataFrame, pd_Series
  from .default_lightgbm_parameters import default_parameters, make_default_tuning_space
  from .logger import Logger
  import numpy
  from numpy.random import RandomState
  from warnings import warn
  from lightgbm import train, Dataset, cv, log_evaluation, early_stopping, Booster
  from lightgbm.basic import _ConfigAliases
  from io import BytesIO
  import blosc
  import dill
  from copy import copy
  from typing import Union, List, Dict, Any, Optional
label_desc: Use image node_id 26 for calling the ImputationKernel obj's underlying member method code with example usage: obj.start_logging() without return types