In [1]:
import numpy as np
import polars as pl
from survey_kit.imputation.srmi import SRMI
from survey_kit.utilities.dataframe import summary
from survey_kit import logger, config
In [2]:
# Draw some random data with a few variables missing
n_rows = 5_000
rng = np.random.default_rng(20260913)
x1 = rng.normal(size=n_rows)
x2 = rng.normal(size=n_rows)
income_latent = 40_000 + 8_000 * x1 - 3_000 * x2 + rng.normal(scale=5_000, size=n_rows)
has_disability = (rng.normal(size=n_rows) + 0.5 * x1 > 1.0).astype(int)
df = pl.DataFrame(
dict(
person_id=range(n_rows),
age=rng.integers(18, 90, size=n_rows),
education_years=rng.integers(8, 20, size=n_rows),
income=income_latent,
has_disability=has_disability,
)
)
# Punch some holes in the two variables we want imputed
missing_income = rng.random(n_rows) < 0.2
missing_disability = rng.random(n_rows) < 0.15
df = df.with_columns(
[
pl.when(pl.Series(missing_income)).then(None).otherwise(pl.col("income")).alias(
"income"
),
pl.when(pl.Series(missing_disability))
.then(None)
.otherwise(pl.col("has_disability"))
.alias("has_disability"),
]
)
logger.info(f"Missing income: {missing_income.sum()} of {n_rows} rows")
logger.info(f"Missing disability: {missing_disability.sum()} of {n_rows} rows")
Missing income: 952 of 5000 rows
Missing disability: 698 of 5000 rows
In [3]:
logger.info("That's it - point SRMI.simple_model() at the dataframe and an id column")
logger.info(
"It finds every column with missing values, figures out whether each one is "
"binary or continuous, and picks a sensible model for each - no Variable objects "
"to build by hand."
)
srmi = SRMI.simple_model(
df=df,
index="person_id",
replication=SRMI.Replication(n_implicates=3, n_iterations=3),
parallel=SRMI.Parallel(enabled=False),
bootstrap=SRMI.Bootstrap(enabled=True),
storage=SRMI.Storage(
path_model=f"{config.path_temp_files}/tutorial_simple_model_getting_started",
force_start=True,
),
)
That's it - point SRMI.simple_model() at the dataframe and an id column
It finds every column with missing values, figures out whether each one is binary or continuous, and picks a sensible model for each - no Variable objects to build by hand.
auto_detect: 'income' -> class=continuous, modeltype=LightGBM, predictors=['age', 'education_years', 'has_disability']
auto_detect: 'has_disability' -> class=binary, modeltype=LightGBM, predictors=['age', 'education_years', 'income']
Removing existing directory C:\Users\jonro\OneDrive\Documents\Coding\survey_kit\.scratch\temp_files/tutorial_simple_model_getting_started.srmi
In [4]:
logger.info("Inspect what it decided before running anything")
for v in srmi.variables:
logger.info(f" {v.impute_var}: modeltype={v.modeltype.name}, predictors={v.model}")
Inspect what it decided before running anything
income: modeltype=LightGBM, predictors=['age', 'education_years', 'has_disability']
has_disability: modeltype=LightGBM, predictors=['age', 'education_years', 'income']
In [5]:
logger.info("Now actually run the imputation")
srmi.run()
Now actually run the imputation
Variable selection before SRMI run, if necessary
income: Method.No
has_disability: Method.No
Hyperparameter tuning before SRMI run, if necessary
Removing existing directory C:\Users\jonro\OneDrive\Documents\Coding\survey_kit\.scratch\temp_files/tutorial_simple_model_getting_started.srmi/1.srmi.implicate
Removing existing directory C:\Users\jonro\OneDrive\Documents\Coding\survey_kit\.scratch\temp_files/tutorial_simple_model_getting_started.srmi/2.srmi.implicate
Removing existing directory C:\Users\jonro\OneDrive\Documents\Coding\survey_kit\.scratch\temp_files/tutorial_simple_model_getting_started.srmi/3.srmi.implicate
Imputation using LightGBM
Running lightgbm model with parameters: {'objective': 'regression', 'metric': 'rmse', 'boosting': 'gbdt', 'min_data_per_group': 25, 'num_threads': 1, 'verbose': -1, 'seed': 3231957680}
Iterations: 100
Model: income=f(age, education_years, bbweight__1)
Categorical features: []
┌─────────────────┬────────┬───────────┬─────────────────┬───────┬─────────────────┬────────┐ │ Feature ┆ Gain ┆ Frequency ┆ Model ┆ Model ┆ Impute ┆ Impute │ │ ┆ ┆ ┆ share (missing) ┆ mean ┆ share (missing) ┆ mean │ ╞═════════════════╪════════╪═══════════╪═════════════════╪═══════╪═════════════════╪════════╡ │ age ┆ 0.6255 ┆ 0.6327 ┆ 0 ┆ 53.56 ┆ 0 ┆ 53.98 │ │ education_years ┆ 0.3745 ┆ 0.3673 ┆ 0 ┆ 13.53 ┆ 0 ┆ 13.5 │ └─────────────────┴────────┴───────────┴─────────────────┴───────┴─────────────────┴────────┘
Predictions
shape: (9, 4) ┌────────────┬──────────────┬──────────────┬────────────────┐ │ statistic ┆ income ┆ Model (yhat) ┆ Imputed (yhat) │ │ --- ┆ --- ┆ --- ┆ --- │ │ str ┆ f64 ┆ f64 ┆ f64 │ ╞════════════╪══════════════╪══════════════╪════════════════╡ │ count ┆ 4048.0 ┆ 4048.0 ┆ 952.0 │ │ null_count ┆ 0.0 ┆ 0.0 ┆ 0.0 │ │ mean ┆ 40148.871404 ┆ 40087.183401 ┆ 40451.350447 │ │ std ┆ 9717.268746 ┆ 3234.77877 ┆ 3412.342701 │ │ min ┆ 6435.355391 ┆ 27616.153297 ┆ 27616.153297 │ │ 25% ┆ 33492.580529 ┆ 38008.232065 ┆ 38243.671739 │ │ 50% ┆ 40048.030097 ┆ 40127.779199 ┆ 40467.668994 │ │ 75% ┆ 46684.497161 ┆ 42101.454306 ┆ 42591.903072 │ │ max ┆ 73924.778328 ┆ 53344.510534 ┆ 56071.816105 │ └────────────┴──────────────┴──────────────┴────────────────┘
shape: (9, 4) ┌────────────┬──────────────┬──────────────┬────────────────┐ │ statistic ┆ income ┆ Model (yhat) ┆ Imputed (yhat) │ │ --- ┆ --- ┆ --- ┆ --- │ │ str ┆ f64 ┆ f64 ┆ f64 │ ╞════════════╪══════════════╪══════════════╪════════════════╡ │ count ┆ 4048.0 ┆ 4048.0 ┆ 952.0 │ │ null_count ┆ 0.0 ┆ 0.0 ┆ 0.0 │ │ mean ┆ 40148.871404 ┆ 40087.183401 ┆ 40451.350447 │ │ std ┆ 9717.268746 ┆ 3234.77877 ┆ 3412.342701 │ │ min ┆ 6435.355391 ┆ 27616.153297 ┆ 27616.153297 │ │ 25% ┆ 33492.580529 ┆ 38008.232065 ┆ 38243.671739 │ │ 50% ┆ 40048.030097 ┆ 40127.779199 ┆ 40467.668994 │ │ 75% ┆ 46684.497161 ┆ 42101.454306 ┆ 42591.903072 │ │ max ┆ 73924.778328 ┆ 53344.510534 ┆ 56071.816105 │ └────────────┴──────────────┴──────────────┴────────────────┘
error=pmm: donating observed value(s) ['income'] from 10-nearest matched donors
Finding 10 nearest neighbors on ['___prediction']
Randomly picking one and donating ['income']
Most common matches:
shape: (5, 2) ┌───────────┬─────────┐ │ person_id ┆ nDonors │ │ --- ┆ --- │ │ i16 ┆ i8 │ ╞═══════════╪═════════╡ │ 1991 ┆ 4 │ │ 649 ┆ 3 │ │ 747 ┆ 3 │ │ 1936 ┆ 3 │ │ 2217 ┆ 3 │ └───────────┴─────────┘
Post-imputation statistics for ['income']
Where: None
Where (impute): col(___imp_missing_income_1)
┌──────────┬─────────┬──────┬──────────────┬─────────┬────────┬──────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┐ │ Variable ┆ Imputed ┆ n ┆ n (not null) ┆ mean ┆ std ┆ mean (not 0) ┆ std (not 0) ┆ q10 (not 0) ┆ q25 (not 0) ┆ q50 (not 0) ┆ q75 (not 0) ┆ q90 (not 0) ┆ min (not 0) ┆ max (not 0) │ ╞══════════╪═════════╪══════╪══════════════╪═════════╪════════╪══════════════╪═════════════╪═════════════╪═════════════╪═════════════╪═════════════╪═════════════╪═════════════╪═════════════╡ │ income ┆ ┆ 5000 ┆ 5000 ┆ 40140.0 ┆ 9720.0 ┆ 40140.0 ┆ 9720.0 ┆ 27450.0 ┆ 33620.0 ┆ 40030.0 ┆ 46690.0 ┆ 52760.0 ┆ 6435.0 ┆ 73920.0 │ │ income ┆ 0 ┆ 4048 ┆ 4048 ┆ 40150.0 ┆ 9717.0 ┆ 40150.0 ┆ 9717.0 ┆ 27570.0 ┆ 33480.0 ┆ 40040.0 ┆ 46680.0 ┆ 52820.0 ┆ 6435.0 ┆ 73920.0 │ │ income ┆ 1 ┆ 952 ┆ 952 ┆ 40130.0 ┆ 9734.0 ┆ 40130.0 ┆ 9734.0 ┆ 27160.0 ┆ 33770.0 ┆ 40010.0 ┆ 46900.0 ┆ 52500.0 ┆ 10570.0 ┆ 68600.0 │ └──────────┴─────────┴──────┴──────────────┴─────────┴────────┴──────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┘
Imputation using LightGBM
Running lightgbm model with parameters: {'objective': 'regression', 'metric': 'rmse', 'boosting': 'gbdt', 'min_data_per_group': 25, 'num_threads': 1, 'verbose': -1, 'seed': 3576473637}
Iterations: 100
Model: has_disability=f(age, education_years, income, bbweight__1)
Categorical features: []
┌─────────────────┬────────┬───────────┬─────────────────┬──────────┬─────────────────┬──────────┐ │ Feature ┆ Gain ┆ Frequency ┆ Model ┆ Model ┆ Impute ┆ Impute │ │ ┆ ┆ ┆ share (missing) ┆ mean ┆ share (missing) ┆ mean │ ╞═════════════════╪════════╪═══════════╪═════════════════╪══════════╪═════════════════╪══════════╡ │ income ┆ 0.5309 ┆ 0.4837 ┆ 0 ┆ 40,060.0 ┆ 0 ┆ 40,690.0 │ │ age ┆ 0.3041 ┆ 0.331 ┆ 0 ┆ 53.55 ┆ 0 ┆ 54.16 │ │ education_years ┆ 0.165 ┆ 0.1853 ┆ 0 ┆ 13.56 ┆ 0 ┆ 13.33 │ └─────────────────┴────────┴───────────┴─────────────────┴──────────┴─────────────────┴──────────┘
Predictions
shape: (9, 4) ┌────────────┬────────────────┬──────────────┬────────────────┐ │ statistic ┆ has_disability ┆ Model (yhat) ┆ Imputed (yhat) │ │ --- ┆ --- ┆ --- ┆ --- │ │ str ┆ f64 ┆ f64 ┆ f64 │ ╞════════════╪════════════════╪══════════════╪════════════════╡ │ count ┆ 4302.0 ┆ 4302.0 ┆ 698.0 │ │ null_count ┆ 0.0 ┆ 0.0 ┆ 0.0 │ │ mean ┆ 0.190841 ┆ 0.186469 ┆ 0.188834 │ │ std ┆ 0.39301 ┆ 0.161597 ┆ 0.155775 │ │ min ┆ 0.0 ┆ -0.191995 ┆ -0.071936 │ │ 25% ┆ 0.0 ┆ 0.077477 ┆ 0.075327 │ │ 50% ┆ 0.0 ┆ 0.143861 ┆ 0.151796 │ │ 75% ┆ 0.0 ┆ 0.254712 ┆ 0.262954 │ │ max ┆ 1.0 ┆ 0.996314 ┆ 0.799331 │ └────────────┴────────────────┴──────────────┴────────────────┘
shape: (9, 4) ┌────────────┬────────────────┬──────────────┬────────────────┐ │ statistic ┆ has_disability ┆ Model (yhat) ┆ Imputed (yhat) │ │ --- ┆ --- ┆ --- ┆ --- │ │ str ┆ f64 ┆ f64 ┆ f64 │ ╞════════════╪════════════════╪══════════════╪════════════════╡ │ count ┆ 4302.0 ┆ 4302.0 ┆ 698.0 │ │ null_count ┆ 0.0 ┆ 0.0 ┆ 0.0 │ │ mean ┆ 0.190841 ┆ 0.186469 ┆ 0.188834 │ │ std ┆ 0.39301 ┆ 0.161597 ┆ 0.155775 │ │ min ┆ 0.0 ┆ -0.191995 ┆ -0.071936 │ │ 25% ┆ 0.0 ┆ 0.077477 ┆ 0.075327 │ │ 50% ┆ 0.0 ┆ 0.143861 ┆ 0.151796 │ │ 75% ┆ 0.0 ┆ 0.254712 ┆ 0.262954 │ │ max ┆ 1.0 ┆ 0.996314 ┆ 0.799331 │ └────────────┴────────────────┴──────────────┴────────────────┘
error=pmm: donating observed value(s) ['has_disability'] from 10-nearest matched donors
Finding 10 nearest neighbors on ['___prediction']
Randomly picking one and donating ['has_disability']
Most common matches:
shape: (5, 2) ┌───────────┬─────────┐ │ person_id ┆ nDonors │ │ --- ┆ --- │ │ i16 ┆ i8 │ ╞═══════════╪═════════╡ │ 310 ┆ 3 │ │ 760 ┆ 3 │ │ 1538 ┆ 3 │ │ 2856 ┆ 3 │ │ 3345 ┆ 3 │ └───────────┴─────────┘
Post-imputation statistics for ['has_disability']
Where: None
Where (impute): col(___imp_missing_has_disability_2)
┌────────────────┬─────────┬──────┬──────────────┬────────┬────────┬──────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┐ │ Variable ┆ Imputed ┆ n ┆ n (not null) ┆ mean ┆ std ┆ mean (not 0) ┆ std (not 0) ┆ q10 (not 0) ┆ q25 (not 0) ┆ q50 (not 0) ┆ q75 (not 0) ┆ q90 (not 0) ┆ min (not 0) ┆ max (not 0) │ ╞════════════════╪═════════╪══════╪══════════════╪════════╪════════╪══════════════╪═════════════╪═════════════╪═════════════╪═════════════╪═════════════╪═════════════╪═════════════╪═════════════╡ │ has_disability ┆ ┆ 5000 ┆ 5000 ┆ 0.1914 ┆ 0.3934 ┆ 1 ┆ 0 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 │ │ has_disability ┆ 0 ┆ 4302 ┆ 4302 ┆ 0.1908 ┆ 0.393 ┆ 1 ┆ 0 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 │ │ has_disability ┆ 1 ┆ 698 ┆ 698 ┆ 0.1948 ┆ 0.3964 ┆ 1 ┆ 0 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 │ └────────────────┴─────────┴──────┴──────────────┴────────┴────────┴──────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┘
Removing existing directory C:\Users\jonro\OneDrive\Documents\Coding\survey_kit\.scratch\temp_files/tutorial_simple_model_getting_started.srmi/1.srmi.implicate
Imputation using LightGBM
Running lightgbm model with parameters: {'objective': 'regression', 'metric': 'rmse', 'boosting': 'gbdt', 'min_data_per_group': 25, 'num_threads': 1, 'verbose': -1, 'seed': 3060749353}
Iterations: 100
Model: income=f(age, education_years, has_disability, bbweight__1)
Categorical features: []
┌─────────────────┬────────┬───────────┬─────────────────┬────────┬─────────────────┬────────┐ │ Feature ┆ Gain ┆ Frequency ┆ Model ┆ Model ┆ Impute ┆ Impute │ │ ┆ ┆ ┆ share (missing) ┆ mean ┆ share (missing) ┆ mean │ ╞═════════════════╪════════╪═══════════╪═════════════════╪════════╪═════════════════╪════════╡ │ age ┆ 0.5086 ┆ 0.6263 ┆ 0 ┆ 53.64 ┆ 0 ┆ 53.98 │ │ education_years ┆ 0.2922 ┆ 0.3427 ┆ 0 ┆ 13.52 ┆ 0 ┆ 13.5 │ │ has_disability ┆ 0.1992 ┆ 0.031 ┆ 0 ┆ 0.1914 ┆ 0 ┆ 0.1943 │ └─────────────────┴────────┴───────────┴─────────────────┴────────┴─────────────────┴────────┘
Predictions
shape: (9, 4) ┌────────────┬──────────────┬──────────────┬────────────────┐ │ statistic ┆ income ┆ Model (yhat) ┆ Imputed (yhat) │ │ --- ┆ --- ┆ --- ┆ --- │ │ str ┆ f64 ┆ f64 ┆ f64 │ ╞════════════╪══════════════╪══════════════╪════════════════╡ │ count ┆ 5000.0 ┆ 5000.0 ┆ 952.0 │ │ null_count ┆ 0.0 ┆ 0.0 ┆ 0.0 │ │ mean ┆ 40144.349184 ┆ 39993.124956 ┆ 40163.778108 │ │ std ┆ 9719.560349 ┆ 3789.223514 ┆ 3819.883008 │ │ min ┆ 6435.355391 ┆ 25948.851377 ┆ 25948.851377 │ │ 25% ┆ 33624.814518 ┆ 37355.215854 ┆ 37595.625133 │ │ 50% ┆ 40032.977538 ┆ 39629.625365 ┆ 39970.653294 │ │ 75% ┆ 46693.455607 ┆ 42019.012244 ┆ 42117.439283 │ │ max ┆ 73924.778328 ┆ 54668.368485 ┆ 53123.472056 │ └────────────┴──────────────┴──────────────┴────────────────┘
shape: (9, 4) ┌────────────┬──────────────┬──────────────┬────────────────┐ │ statistic ┆ income ┆ Model (yhat) ┆ Imputed (yhat) │ │ --- ┆ --- ┆ --- ┆ --- │ │ str ┆ f64 ┆ f64 ┆ f64 │ ╞════════════╪══════════════╪══════════════╪════════════════╡ │ count ┆ 5000.0 ┆ 5000.0 ┆ 952.0 │ │ null_count ┆ 0.0 ┆ 0.0 ┆ 0.0 │ │ mean ┆ 40144.349184 ┆ 39993.124956 ┆ 40163.778108 │ │ std ┆ 9719.560349 ┆ 3789.223514 ┆ 3819.883008 │ │ min ┆ 6435.355391 ┆ 25948.851377 ┆ 25948.851377 │ │ 25% ┆ 33624.814518 ┆ 37355.215854 ┆ 37595.625133 │ │ 50% ┆ 40032.977538 ┆ 39629.625365 ┆ 39970.653294 │ │ 75% ┆ 46693.455607 ┆ 42019.012244 ┆ 42117.439283 │ │ max ┆ 73924.778328 ┆ 54668.368485 ┆ 53123.472056 │ └────────────┴──────────────┴──────────────┴────────────────┘
error=pmm: donating observed value(s) ['income'] from 10-nearest matched donors
Finding 10 nearest neighbors on ['___prediction']
Randomly picking one and donating ['income']
Most common matches:
shape: (5, 2) ┌───────────┬─────────┐ │ person_id ┆ nDonors │ │ --- ┆ --- │ │ i16 ┆ i8 │ ╞═══════════╪═════════╡ │ 1276 ┆ 3 │ │ 1705 ┆ 3 │ │ 1895 ┆ 3 │ │ 2377 ┆ 3 │ │ 2743 ┆ 3 │ └───────────┴─────────┘
Post-imputation statistics for ['income']
Where: None
Where (impute): col(___imp_missing_income_1)
┌──────────┬─────────┬──────┬──────────────┬─────────┬────────┬──────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┐ │ Variable ┆ Imputed ┆ n ┆ n (not null) ┆ mean ┆ std ┆ mean (not 0) ┆ std (not 0) ┆ q10 (not 0) ┆ q25 (not 0) ┆ q50 (not 0) ┆ q75 (not 0) ┆ q90 (not 0) ┆ min (not 0) ┆ max (not 0) │ ╞══════════╪═════════╪══════╪══════════════╪═════════╪════════╪══════════════╪═════════════╪═════════════╪═════════════╪═════════════╪═════════════╪═════════════╪═════════════╪═════════════╡ │ income ┆ ┆ 5952 ┆ 5952 ┆ 40170.0 ┆ 9649.0 ┆ 40170.0 ┆ 9649.0 ┆ 27590.0 ┆ 33710.0 ┆ 40080.0 ┆ 46730.0 ┆ 52690.0 ┆ 6435.0 ┆ 73920.0 │ │ income ┆ 0 ┆ 5000 ┆ 5000 ┆ 40140.0 ┆ 9720.0 ┆ 40140.0 ┆ 9720.0 ┆ 27450.0 ┆ 33620.0 ┆ 40030.0 ┆ 46690.0 ┆ 52760.0 ┆ 6435.0 ┆ 73920.0 │ │ income ┆ 1 ┆ 952 ┆ 952 ┆ 40300.0 ┆ 9271.0 ┆ 40300.0 ┆ 9271.0 ┆ 28490.0 ┆ 34120.0 ┆ 40420.0 ┆ 46970.0 ┆ 52190.0 ┆ 11750.0 ┆ 69170.0 │ └──────────┴─────────┴──────┴──────────────┴─────────┴────────┴──────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┘
Imputation using LightGBM
Running lightgbm model with parameters: {'objective': 'regression', 'metric': 'rmse', 'boosting': 'gbdt', 'min_data_per_group': 25, 'num_threads': 1, 'verbose': -1, 'seed': 1252105961}
Iterations: 100
Model: has_disability=f(age, education_years, income, bbweight__1)
Categorical features: []
┌─────────────────┬────────┬───────────┬─────────────────┬──────────┬─────────────────┬──────────┐ │ Feature ┆ Gain ┆ Frequency ┆ Model ┆ Model ┆ Impute ┆ Impute │ │ ┆ ┆ ┆ share (missing) ┆ mean ┆ share (missing) ┆ mean │ ╞═════════════════╪════════╪═══════════╪═════════════════╪══════════╪═════════════════╪══════════╡ │ income ┆ 0.5191 ┆ 0.464 ┆ 0 ┆ 40,180.0 ┆ 0 ┆ 40,740.0 │ │ age ┆ 0.3159 ┆ 0.3463 ┆ 0 ┆ 53.64 ┆ 0 ┆ 54.16 │ │ education_years ┆ 0.165 ┆ 0.1897 ┆ 0 ┆ 13.52 ┆ 0 ┆ 13.33 │ └─────────────────┴────────┴───────────┴─────────────────┴──────────┴─────────────────┴──────────┘
Predictions
shape: (9, 4) ┌────────────┬────────────────┬──────────────┬────────────────┐ │ statistic ┆ has_disability ┆ Model (yhat) ┆ Imputed (yhat) │ │ --- ┆ --- ┆ --- ┆ --- │ │ str ┆ f64 ┆ f64 ┆ f64 │ ╞════════════╪════════════════╪══════════════╪════════════════╡ │ count ┆ 5000.0 ┆ 5000.0 ┆ 698.0 │ │ null_count ┆ 0.0 ┆ 0.0 ┆ 0.0 │ │ mean ┆ 0.1914 ┆ 0.19225 ┆ 0.196272 │ │ std ┆ null ┆ 0.16738 ┆ 0.169814 │ │ min ┆ 0.0 ┆ -0.116715 ┆ -0.103693 │ │ 25% ┆ null ┆ 0.07588 ┆ 0.073109 │ │ 50% ┆ null ┆ 0.146471 ┆ 0.147714 │ │ 75% ┆ null ┆ 0.262034 ┆ 0.276487 │ │ max ┆ 1.0 ┆ 1.025953 ┆ 0.93794 │ └────────────┴────────────────┴──────────────┴────────────────┘
shape: (9, 4) ┌────────────┬────────────────┬──────────────┬────────────────┐ │ statistic ┆ has_disability ┆ Model (yhat) ┆ Imputed (yhat) │ │ --- ┆ --- ┆ --- ┆ --- │ │ str ┆ f64 ┆ f64 ┆ f64 │ ╞════════════╪════════════════╪══════════════╪════════════════╡ │ count ┆ 5000.0 ┆ 5000.0 ┆ 698.0 │ │ null_count ┆ 0.0 ┆ 0.0 ┆ 0.0 │ │ mean ┆ 0.1914 ┆ 0.19225 ┆ 0.196272 │ │ std ┆ null ┆ 0.16738 ┆ 0.169814 │ │ min ┆ 0.0 ┆ -0.116715 ┆ -0.103693 │ │ 25% ┆ null ┆ 0.07588 ┆ 0.073109 │ │ 50% ┆ null ┆ 0.146471 ┆ 0.147714 │ │ 75% ┆ null ┆ 0.262034 ┆ 0.276487 │ │ max ┆ 1.0 ┆ 1.025953 ┆ 0.93794 │ └────────────┴────────────────┴──────────────┴────────────────┘
error=pmm: donating observed value(s) ['has_disability'] from 10-nearest matched donors
Finding 10 nearest neighbors on ['___prediction']
Randomly picking one and donating ['has_disability']
Most common matches:
shape: (5, 2) ┌───────────┬─────────┐ │ person_id ┆ nDonors │ │ --- ┆ --- │ │ i16 ┆ i8 │ ╞═══════════╪═════════╡ │ 631 ┆ 3 │ │ 1177 ┆ 3 │ │ 2781 ┆ 3 │ │ 385 ┆ 2 │ │ 424 ┆ 2 │ └───────────┴─────────┘
Post-imputation statistics for ['has_disability']
Where: None
Where (impute): col(___imp_missing_has_disability_2)
┌────────────────┬─────────┬──────┬──────────────┬────────┬────────┬──────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┐ │ Variable ┆ Imputed ┆ n ┆ n (not null) ┆ mean ┆ std ┆ mean (not 0) ┆ std (not 0) ┆ q10 (not 0) ┆ q25 (not 0) ┆ q50 (not 0) ┆ q75 (not 0) ┆ q90 (not 0) ┆ min (not 0) ┆ max (not 0) │ ╞════════════════╪═════════╪══════╪══════════════╪════════╪════════╪══════════════╪═════════════╪═════════════╪═════════════╪═════════════╪═════════════╪═════════════╪═════════════╪═════════════╡ │ has_disability ┆ ┆ 5698 ┆ 5698 ┆ 0.192 ┆ 0.3939 ┆ 1 ┆ 0 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 │ │ has_disability ┆ 0 ┆ 5000 ┆ 5000 ┆ 0.1914 ┆ 0.3934 ┆ 1 ┆ 0 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 │ │ has_disability ┆ 1 ┆ 698 ┆ 698 ┆ 0.1963 ┆ 0.3975 ┆ 1 ┆ 0 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 │ └────────────────┴─────────┴──────┴──────────────┴────────┴────────┴──────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┘
Removing existing directory C:\Users\jonro\OneDrive\Documents\Coding\survey_kit\.scratch\temp_files/tutorial_simple_model_getting_started.srmi/1.srmi.implicate
Imputation using LightGBM
Running lightgbm model with parameters: {'objective': 'regression', 'metric': 'rmse', 'boosting': 'gbdt', 'min_data_per_group': 25, 'num_threads': 1, 'verbose': -1, 'seed': 1973793047}
Iterations: 100
Model: income=f(age, education_years, has_disability, bbweight__1)
Categorical features: []
┌─────────────────┬────────┬───────────┬─────────────────┬────────┬─────────────────┬────────┐ │ Feature ┆ Gain ┆ Frequency ┆ Model ┆ Model ┆ Impute ┆ Impute │ │ ┆ ┆ ┆ share (missing) ┆ mean ┆ share (missing) ┆ mean │ ╞═════════════════╪════════╪═══════════╪═════════════════╪════════╪═════════════════╪════════╡ │ age ┆ 0.4783 ┆ 0.5863 ┆ 0 ┆ 53.64 ┆ 0 ┆ 53.98 │ │ education_years ┆ 0.3227 ┆ 0.3847 ┆ 0 ┆ 13.52 ┆ 0 ┆ 13.5 │ │ has_disability ┆ 0.1991 ┆ 0.029 ┆ 0 ┆ 0.1916 ┆ 0 ┆ 0.1922 │ └─────────────────┴────────┴───────────┴─────────────────┴────────┴─────────────────┴────────┘
Predictions
shape: (9, 4) ┌────────────┬──────────────┬──────────────┬────────────────┐ │ statistic ┆ income ┆ Model (yhat) ┆ Imputed (yhat) │ │ --- ┆ --- ┆ --- ┆ --- │ │ str ┆ f64 ┆ f64 ┆ f64 │ ╞════════════╪══════════════╪══════════════╪════════════════╡ │ count ┆ 5000.0 ┆ 5000.0 ┆ 952.0 │ │ null_count ┆ 0.0 ┆ 0.0 ┆ 0.0 │ │ mean ┆ 40178.553299 ┆ 40374.369324 ┆ 40597.782215 │ │ std ┆ 9633.235117 ┆ 3998.653684 ┆ 4080.288303 │ │ min ┆ 6435.355391 ┆ 28245.147111 ┆ 28245.147111 │ │ 25% ┆ 33692.556635 ┆ 37712.58466 ┆ 37785.890672 │ │ 50% ┆ 40120.158754 ┆ 40023.388511 ┆ 40278.083509 │ │ 75% ┆ 46719.841751 ┆ 42715.966656 ┆ 43166.638188 │ │ max ┆ 73924.778328 ┆ 55133.366387 ┆ 54874.364909 │ └────────────┴──────────────┴──────────────┴────────────────┘
shape: (9, 4) ┌────────────┬──────────────┬──────────────┬────────────────┐ │ statistic ┆ income ┆ Model (yhat) ┆ Imputed (yhat) │ │ --- ┆ --- ┆ --- ┆ --- │ │ str ┆ f64 ┆ f64 ┆ f64 │ ╞════════════╪══════════════╪══════════════╪════════════════╡ │ count ┆ 5000.0 ┆ 5000.0 ┆ 952.0 │ │ null_count ┆ 0.0 ┆ 0.0 ┆ 0.0 │ │ mean ┆ 40178.553299 ┆ 40374.369324 ┆ 40597.782215 │ │ std ┆ 9633.235117 ┆ 3998.653684 ┆ 4080.288303 │ │ min ┆ 6435.355391 ┆ 28245.147111 ┆ 28245.147111 │ │ 25% ┆ 33692.556635 ┆ 37712.58466 ┆ 37785.890672 │ │ 50% ┆ 40120.158754 ┆ 40023.388511 ┆ 40278.083509 │ │ 75% ┆ 46719.841751 ┆ 42715.966656 ┆ 43166.638188 │ │ max ┆ 73924.778328 ┆ 55133.366387 ┆ 54874.364909 │ └────────────┴──────────────┴──────────────┴────────────────┘
error=pmm: donating observed value(s) ['income'] from 10-nearest matched donors
Finding 10 nearest neighbors on ['___prediction']
Randomly picking one and donating ['income']
Most common matches:
shape: (5, 2) ┌───────────┬─────────┐ │ person_id ┆ nDonors │ │ --- ┆ --- │ │ i16 ┆ i8 │ ╞═══════════╪═════════╡ │ 491 ┆ 3 │ │ 955 ┆ 3 │ │ 2343 ┆ 3 │ │ 3710 ┆ 3 │ │ 4143 ┆ 3 │ └───────────┴─────────┘
Post-imputation statistics for ['income']
Where: None
Where (impute): col(___imp_missing_income_1)
┌──────────┬─────────┬──────┬──────────────┬─────────┬────────┬──────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┐ │ Variable ┆ Imputed ┆ n ┆ n (not null) ┆ mean ┆ std ┆ mean (not 0) ┆ std (not 0) ┆ q10 (not 0) ┆ q25 (not 0) ┆ q50 (not 0) ┆ q75 (not 0) ┆ q90 (not 0) ┆ min (not 0) ┆ max (not 0) │ ╞══════════╪═════════╪══════╪══════════════╪═════════╪════════╪══════════════╪═════════════╪═════════════╪═════════════╪═════════════╪═════════════╪═════════════╪═════════════╪═════════════╡ │ income ┆ ┆ 5952 ┆ 5952 ┆ 40170.0 ┆ 9668.0 ┆ 40170.0 ┆ 9668.0 ┆ 27610.0 ┆ 33650.0 ┆ 40110.0 ┆ 46850.0 ┆ 52760.0 ┆ 6435.0 ┆ 73920.0 │ │ income ┆ 0 ┆ 5000 ┆ 5000 ┆ 40180.0 ┆ 9633.0 ┆ 40180.0 ┆ 9633.0 ┆ 27680.0 ┆ 33690.0 ┆ 40110.0 ┆ 46720.0 ┆ 52700.0 ┆ 6435.0 ┆ 73920.0 │ │ income ┆ 1 ┆ 952 ┆ 952 ┆ 40120.0 ┆ 9851.0 ┆ 40120.0 ┆ 9851.0 ┆ 27440.0 ┆ 33180.0 ┆ 40080.0 ┆ 47050.0 ┆ 53160.0 ┆ 10980.0 ┆ 68600.0 │ └──────────┴─────────┴──────┴──────────────┴─────────┴────────┴──────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┘
Imputation using LightGBM
Running lightgbm model with parameters: {'objective': 'regression', 'metric': 'rmse', 'boosting': 'gbdt', 'min_data_per_group': 25, 'num_threads': 1, 'verbose': -1, 'seed': 3833210258}
Iterations: 100
Model: has_disability=f(age, education_years, income, bbweight__1)
Categorical features: []
┌─────────────────┬────────┬───────────┬─────────────────┬──────────┬─────────────────┬──────────┐ │ Feature ┆ Gain ┆ Frequency ┆ Model ┆ Model ┆ Impute ┆ Impute │ │ ┆ ┆ ┆ share (missing) ┆ mean ┆ share (missing) ┆ mean │ ╞═════════════════╪════════╪═══════════╪═════════════════╪══════════╪═════════════════╪══════════╡ │ income ┆ 0.5235 ┆ 0.4617 ┆ 0 ┆ 40,140.0 ┆ 0 ┆ 40,790.0 │ │ age ┆ 0.3108 ┆ 0.3523 ┆ 0 ┆ 53.64 ┆ 0 ┆ 54.16 │ │ education_years ┆ 0.1657 ┆ 0.186 ┆ 0 ┆ 13.52 ┆ 0 ┆ 13.33 │ └─────────────────┴────────┴───────────┴─────────────────┴──────────┴─────────────────┴──────────┘
Predictions
shape: (9, 4) ┌────────────┬────────────────┬──────────────┬────────────────┐ │ statistic ┆ has_disability ┆ Model (yhat) ┆ Imputed (yhat) │ │ --- ┆ --- ┆ --- ┆ --- │ │ str ┆ f64 ┆ f64 ┆ f64 │ ╞════════════╪════════════════╪══════════════╪════════════════╡ │ count ┆ 5000.0 ┆ 5000.0 ┆ 698.0 │ │ null_count ┆ 0.0 ┆ 0.0 ┆ 0.0 │ │ mean ┆ 0.1916 ┆ 0.193056 ┆ 0.197955 │ │ std ┆ null ┆ 0.173789 ┆ 0.182434 │ │ min ┆ 0.0 ┆ -0.111879 ┆ -0.083318 │ │ 25% ┆ null ┆ 0.070892 ┆ 0.071322 │ │ 50% ┆ null ┆ 0.143215 ┆ 0.138656 │ │ 75% ┆ null ┆ 0.267108 ┆ 0.28241 │ │ max ┆ 1.0 ┆ 1.018064 ┆ 1.000056 │ └────────────┴────────────────┴──────────────┴────────────────┘
shape: (9, 4) ┌────────────┬────────────────┬──────────────┬────────────────┐ │ statistic ┆ has_disability ┆ Model (yhat) ┆ Imputed (yhat) │ │ --- ┆ --- ┆ --- ┆ --- │ │ str ┆ f64 ┆ f64 ┆ f64 │ ╞════════════╪════════════════╪══════════════╪════════════════╡ │ count ┆ 5000.0 ┆ 5000.0 ┆ 698.0 │ │ null_count ┆ 0.0 ┆ 0.0 ┆ 0.0 │ │ mean ┆ 0.1916 ┆ 0.193056 ┆ 0.197955 │ │ std ┆ null ┆ 0.173789 ┆ 0.182434 │ │ min ┆ 0.0 ┆ -0.111879 ┆ -0.083318 │ │ 25% ┆ null ┆ 0.070892 ┆ 0.071322 │ │ 50% ┆ null ┆ 0.143215 ┆ 0.138656 │ │ 75% ┆ null ┆ 0.267108 ┆ 0.28241 │ │ max ┆ 1.0 ┆ 1.018064 ┆ 1.000056 │ └────────────┴────────────────┴──────────────┴────────────────┘
error=pmm: donating observed value(s) ['has_disability'] from 10-nearest matched donors
Finding 10 nearest neighbors on ['___prediction']
Randomly picking one and donating ['has_disability']
Most common matches:
shape: (5, 2) ┌───────────┬─────────┐ │ person_id ┆ nDonors │ │ --- ┆ --- │ │ i16 ┆ i8 │ ╞═══════════╪═════════╡ │ 124 ┆ 3 │ │ 1319 ┆ 3 │ │ 45 ┆ 2 │ │ 141 ┆ 2 │ │ 195 ┆ 2 │ └───────────┴─────────┘
Post-imputation statistics for ['has_disability']
Where: None
Where (impute): col(___imp_missing_has_disability_2)
┌────────────────┬─────────┬──────┬──────────────┬────────┬────────┬──────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┐ │ Variable ┆ Imputed ┆ n ┆ n (not null) ┆ mean ┆ std ┆ mean (not 0) ┆ std (not 0) ┆ q10 (not 0) ┆ q25 (not 0) ┆ q50 (not 0) ┆ q75 (not 0) ┆ q90 (not 0) ┆ min (not 0) ┆ max (not 0) │ ╞════════════════╪═════════╪══════╪══════════════╪════════╪════════╪══════════════╪═════════════╪═════════════╪═════════════╪═════════════╪═════════════╪═════════════╪═════════════╪═════════════╡ │ has_disability ┆ ┆ 5698 ┆ 5698 ┆ 0.1909 ┆ 0.3931 ┆ 1 ┆ 0 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 │ │ has_disability ┆ 0 ┆ 5000 ┆ 5000 ┆ 0.1916 ┆ 0.3936 ┆ 1 ┆ 0 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 │ │ has_disability ┆ 1 ┆ 698 ┆ 698 ┆ 0.1862 ┆ 0.3896 ┆ 1 ┆ 0 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 │ └────────────────┴─────────┴──────┴──────────────┴────────┴────────┴──────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┘
income
has_disability
Final Estimates by Iteration
Removing existing directory C:\Users\jonro\OneDrive\Documents\Coding\survey_kit\.scratch\temp_files/tutorial_simple_model_getting_started.srmi/1.srmi.implicate
Imputation using LightGBM
Running lightgbm model with parameters: {'objective': 'regression', 'metric': 'rmse', 'boosting': 'gbdt', 'min_data_per_group': 25, 'num_threads': 1, 'verbose': -1, 'seed': 3740608219}
Iterations: 100
Model: income=f(age, education_years, bbweight__1)
Categorical features: []
┌─────────────────┬────────┬───────────┬─────────────────┬───────┬─────────────────┬────────┐ │ Feature ┆ Gain ┆ Frequency ┆ Model ┆ Model ┆ Impute ┆ Impute │ │ ┆ ┆ ┆ share (missing) ┆ mean ┆ share (missing) ┆ mean │ ╞═════════════════╪════════╪═══════════╪═════════════════╪═══════╪═════════════════╪════════╡ │ age ┆ 0.6832 ┆ 0.6533 ┆ 0 ┆ 53.56 ┆ 0 ┆ 53.98 │ │ education_years ┆ 0.3168 ┆ 0.3467 ┆ 0 ┆ 13.53 ┆ 0 ┆ 13.5 │ └─────────────────┴────────┴───────────┴─────────────────┴───────┴─────────────────┴────────┘
Predictions
shape: (9, 4) ┌────────────┬──────────────┬──────────────┬────────────────┐ │ statistic ┆ income ┆ Model (yhat) ┆ Imputed (yhat) │ │ --- ┆ --- ┆ --- ┆ --- │ │ str ┆ f64 ┆ f64 ┆ f64 │ ╞════════════╪══════════════╪══════════════╪════════════════╡ │ count ┆ 4048.0 ┆ 4048.0 ┆ 952.0 │ │ null_count ┆ 0.0 ┆ 0.0 ┆ 0.0 │ │ mean ┆ 40148.871404 ┆ 40165.493198 ┆ 40473.480547 │ │ std ┆ 9717.268746 ┆ 3393.140834 ┆ 3537.777674 │ │ min ┆ 6435.355391 ┆ 28547.30916 ┆ 28547.30916 │ │ 25% ┆ 33492.580529 ┆ 38005.246422 ┆ 38193.217474 │ │ 50% ┆ 40048.030097 ┆ 40493.885816 ┆ 40672.008743 │ │ 75% ┆ 46684.497161 ┆ 42408.347037 ┆ 42866.343897 │ │ max ┆ 73924.778328 ┆ 51856.922976 ┆ 52382.157218 │ └────────────┴──────────────┴──────────────┴────────────────┘
shape: (9, 4) ┌────────────┬──────────────┬──────────────┬────────────────┐ │ statistic ┆ income ┆ Model (yhat) ┆ Imputed (yhat) │ │ --- ┆ --- ┆ --- ┆ --- │ │ str ┆ f64 ┆ f64 ┆ f64 │ ╞════════════╪══════════════╪══════════════╪════════════════╡ │ count ┆ 4048.0 ┆ 4048.0 ┆ 952.0 │ │ null_count ┆ 0.0 ┆ 0.0 ┆ 0.0 │ │ mean ┆ 40148.871404 ┆ 40165.493198 ┆ 40473.480547 │ │ std ┆ 9717.268746 ┆ 3393.140834 ┆ 3537.777674 │ │ min ┆ 6435.355391 ┆ 28547.30916 ┆ 28547.30916 │ │ 25% ┆ 33492.580529 ┆ 38005.246422 ┆ 38193.217474 │ │ 50% ┆ 40048.030097 ┆ 40493.885816 ┆ 40672.008743 │ │ 75% ┆ 46684.497161 ┆ 42408.347037 ┆ 42866.343897 │ │ max ┆ 73924.778328 ┆ 51856.922976 ┆ 52382.157218 │ └────────────┴──────────────┴──────────────┴────────────────┘
error=pmm: donating observed value(s) ['income'] from 10-nearest matched donors
Finding 10 nearest neighbors on ['___prediction']
Randomly picking one and donating ['income']
Most common matches:
shape: (5, 2) ┌───────────┬─────────┐ │ person_id ┆ nDonors │ │ --- ┆ --- │ │ i16 ┆ i8 │ ╞═══════════╪═════════╡ │ 447 ┆ 3 │ │ 707 ┆ 3 │ │ 1550 ┆ 3 │ │ 1555 ┆ 3 │ │ 1933 ┆ 3 │ └───────────┴─────────┘
Post-imputation statistics for ['income']
Where: None
Where (impute): col(___imp_missing_income_1)
┌──────────┬─────────┬──────┬──────────────┬─────────┬────────┬──────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┐ │ Variable ┆ Imputed ┆ n ┆ n (not null) ┆ mean ┆ std ┆ mean (not 0) ┆ std (not 0) ┆ q10 (not 0) ┆ q25 (not 0) ┆ q50 (not 0) ┆ q75 (not 0) ┆ q90 (not 0) ┆ min (not 0) ┆ max (not 0) │ ╞══════════╪═════════╪══════╪══════════════╪═════════╪════════╪══════════════╪═════════════╪═════════════╪═════════════╪═════════════╪═════════════╪═════════════╪═════════════╪═════════════╡ │ income ┆ ┆ 5000 ┆ 5000 ┆ 40270.0 ┆ 9735.0 ┆ 40270.0 ┆ 9735.0 ┆ 27630.0 ┆ 33720.0 ┆ 40190.0 ┆ 46860.0 ┆ 52910.0 ┆ 6435.0 ┆ 73920.0 │ │ income ┆ 0 ┆ 4048 ┆ 4048 ┆ 40150.0 ┆ 9717.0 ┆ 40150.0 ┆ 9717.0 ┆ 27570.0 ┆ 33480.0 ┆ 40040.0 ┆ 46680.0 ┆ 52820.0 ┆ 6435.0 ┆ 73920.0 │ │ income ┆ 1 ┆ 952 ┆ 952 ┆ 40760.0 ┆ 9800.0 ┆ 40760.0 ┆ 9800.0 ┆ 27900.0 ┆ 34170.0 ┆ 40930.0 ┆ 47260.0 ┆ 53790.0 ┆ 11130.0 ┆ 67630.0 │ └──────────┴─────────┴──────┴──────────────┴─────────┴────────┴──────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┘
Imputation using LightGBM
Running lightgbm model with parameters: {'objective': 'regression', 'metric': 'rmse', 'boosting': 'gbdt', 'min_data_per_group': 25, 'num_threads': 1, 'verbose': -1, 'seed': 2244005575}
Iterations: 100
Model: has_disability=f(age, education_years, income, bbweight__1)
Categorical features: []
┌─────────────────┬────────┬───────────┬─────────────────┬──────────┬─────────────────┬──────────┐ │ Feature ┆ Gain ┆ Frequency ┆ Model ┆ Model ┆ Impute ┆ Impute │ │ ┆ ┆ ┆ share (missing) ┆ mean ┆ share (missing) ┆ mean │ ╞═════════════════╪════════╪═══════════╪═════════════════╪══════════╪═════════════════╪══════════╡ │ income ┆ 0.5397 ┆ 0.489 ┆ 0 ┆ 40,170.0 ┆ 0 ┆ 40,870.0 │ │ age ┆ 0.3191 ┆ 0.3437 ┆ 0 ┆ 53.55 ┆ 0 ┆ 54.16 │ │ education_years ┆ 0.1412 ┆ 0.1673 ┆ 0 ┆ 13.56 ┆ 0 ┆ 13.33 │ └─────────────────┴────────┴───────────┴─────────────────┴──────────┴─────────────────┴──────────┘
Predictions
shape: (9, 4) ┌────────────┬────────────────┬──────────────┬────────────────┐ │ statistic ┆ has_disability ┆ Model (yhat) ┆ Imputed (yhat) │ │ --- ┆ --- ┆ --- ┆ --- │ │ str ┆ f64 ┆ f64 ┆ f64 │ ╞════════════╪════════════════╪══════════════╪════════════════╡ │ count ┆ 4302.0 ┆ 4302.0 ┆ 698.0 │ │ null_count ┆ 0.0 ┆ 0.0 ┆ 0.0 │ │ mean ┆ 0.190841 ┆ 0.183357 ┆ 0.186739 │ │ std ┆ 0.39301 ┆ 0.162556 ┆ 0.156693 │ │ min ┆ 0.0 ┆ -0.108784 ┆ -0.065637 │ │ 25% ┆ 0.0 ┆ 0.071019 ┆ 0.076268 │ │ 50% ┆ 0.0 ┆ 0.137202 ┆ 0.149526 │ │ 75% ┆ 0.0 ┆ 0.251927 ┆ 0.264036 │ │ max ┆ 1.0 ┆ 1.042379 ┆ 0.902752 │ └────────────┴────────────────┴──────────────┴────────────────┘
shape: (9, 4) ┌────────────┬────────────────┬──────────────┬────────────────┐ │ statistic ┆ has_disability ┆ Model (yhat) ┆ Imputed (yhat) │ │ --- ┆ --- ┆ --- ┆ --- │ │ str ┆ f64 ┆ f64 ┆ f64 │ ╞════════════╪════════════════╪══════════════╪════════════════╡ │ count ┆ 4302.0 ┆ 4302.0 ┆ 698.0 │ │ null_count ┆ 0.0 ┆ 0.0 ┆ 0.0 │ │ mean ┆ 0.190841 ┆ 0.183357 ┆ 0.186739 │ │ std ┆ 0.39301 ┆ 0.162556 ┆ 0.156693 │ │ min ┆ 0.0 ┆ -0.108784 ┆ -0.065637 │ │ 25% ┆ 0.0 ┆ 0.071019 ┆ 0.076268 │ │ 50% ┆ 0.0 ┆ 0.137202 ┆ 0.149526 │ │ 75% ┆ 0.0 ┆ 0.251927 ┆ 0.264036 │ │ max ┆ 1.0 ┆ 1.042379 ┆ 0.902752 │ └────────────┴────────────────┴──────────────┴────────────────┘
error=pmm: donating observed value(s) ['has_disability'] from 10-nearest matched donors
Finding 10 nearest neighbors on ['___prediction']
Randomly picking one and donating ['has_disability']
Most common matches:
shape: (5, 2) ┌───────────┬─────────┐ │ person_id ┆ nDonors │ │ --- ┆ --- │ │ i16 ┆ i8 │ ╞═══════════╪═════════╡ │ 133 ┆ 2 │ │ 189 ┆ 2 │ │ 252 ┆ 2 │ │ 601 ┆ 2 │ │ 612 ┆ 2 │ └───────────┴─────────┘
Post-imputation statistics for ['has_disability']
Where: None
Where (impute): col(___imp_missing_has_disability_2)
┌────────────────┬─────────┬──────┬──────────────┬────────┬────────┬──────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┐ │ Variable ┆ Imputed ┆ n ┆ n (not null) ┆ mean ┆ std ┆ mean (not 0) ┆ std (not 0) ┆ q10 (not 0) ┆ q25 (not 0) ┆ q50 (not 0) ┆ q75 (not 0) ┆ q90 (not 0) ┆ min (not 0) ┆ max (not 0) │ ╞════════════════╪═════════╪══════╪══════════════╪════════╪════════╪══════════════╪═════════════╪═════════════╪═════════════╪═════════════╪═════════════╪═════════════╪═════════════╪═════════════╡ │ has_disability ┆ ┆ 5000 ┆ 5000 ┆ 0.19 ┆ 0.3923 ┆ 1 ┆ 0 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 │ │ has_disability ┆ 0 ┆ 4302 ┆ 4302 ┆ 0.1908 ┆ 0.393 ┆ 1 ┆ 0 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 │ │ has_disability ┆ 1 ┆ 698 ┆ 698 ┆ 0.1848 ┆ 0.3884 ┆ 1 ┆ 0 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 │ └────────────────┴─────────┴──────┴──────────────┴────────┴────────┴──────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┘
Removing existing directory C:\Users\jonro\OneDrive\Documents\Coding\survey_kit\.scratch\temp_files/tutorial_simple_model_getting_started.srmi/2.srmi.implicate
Imputation using LightGBM
Running lightgbm model with parameters: {'objective': 'regression', 'metric': 'rmse', 'boosting': 'gbdt', 'min_data_per_group': 25, 'num_threads': 1, 'verbose': -1, 'seed': 39306175}
Iterations: 100
Model: income=f(age, education_years, has_disability, bbweight__1)
Categorical features: []
┌─────────────────┬────────┬───────────┬─────────────────┬───────┬─────────────────┬────────┐ │ Feature ┆ Gain ┆ Frequency ┆ Model ┆ Model ┆ Impute ┆ Impute │ │ ┆ ┆ ┆ share (missing) ┆ mean ┆ share (missing) ┆ mean │ ╞═════════════════╪════════╪═══════════╪═════════════════╪═══════╪═════════════════╪════════╡ │ age ┆ 0.5129 ┆ 0.6373 ┆ 0 ┆ 53.64 ┆ 0 ┆ 53.98 │ │ education_years ┆ 0.2779 ┆ 0.3307 ┆ 0 ┆ 13.52 ┆ 0 ┆ 13.5 │ │ has_disability ┆ 0.2092 ┆ 0.032 ┆ 0 ┆ 0.19 ┆ 0 ┆ 0.1964 │ └─────────────────┴────────┴───────────┴─────────────────┴───────┴─────────────────┴────────┘
Predictions
shape: (9, 4) ┌────────────┬──────────────┬──────────────┬────────────────┐ │ statistic ┆ income ┆ Model (yhat) ┆ Imputed (yhat) │ │ --- ┆ --- ┆ --- ┆ --- │ │ str ┆ f64 ┆ f64 ┆ f64 │ ╞════════════╪══════════════╪══════════════╪════════════════╡ │ count ┆ 5000.0 ┆ 5000.0 ┆ 952.0 │ │ null_count ┆ 0.0 ┆ 0.0 ┆ 0.0 │ │ mean ┆ 40265.643298 ┆ 40061.35193 ┆ 40258.450042 │ │ std ┆ 9735.121925 ┆ 4044.430495 ┆ 4081.902752 │ │ min ┆ 6435.355391 ┆ 25010.833118 ┆ 25010.833118 │ │ 25% ┆ 33726.509287 ┆ 37444.991867 ┆ 37444.991867 │ │ 50% ┆ 40191.037808 ┆ 39562.466269 ┆ 39839.18606 │ │ 75% ┆ 46857.705393 ┆ 42087.902928 ┆ 42327.090637 │ │ max ┆ 73924.778328 ┆ 56290.350186 ┆ 54959.696347 │ └────────────┴──────────────┴──────────────┴────────────────┘
shape: (9, 4) ┌────────────┬──────────────┬──────────────┬────────────────┐ │ statistic ┆ income ┆ Model (yhat) ┆ Imputed (yhat) │ │ --- ┆ --- ┆ --- ┆ --- │ │ str ┆ f64 ┆ f64 ┆ f64 │ ╞════════════╪══════════════╪══════════════╪════════════════╡ │ count ┆ 5000.0 ┆ 5000.0 ┆ 952.0 │ │ null_count ┆ 0.0 ┆ 0.0 ┆ 0.0 │ │ mean ┆ 40265.643298 ┆ 40061.35193 ┆ 40258.450042 │ │ std ┆ 9735.121925 ┆ 4044.430495 ┆ 4081.902752 │ │ min ┆ 6435.355391 ┆ 25010.833118 ┆ 25010.833118 │ │ 25% ┆ 33726.509287 ┆ 37444.991867 ┆ 37444.991867 │ │ 50% ┆ 40191.037808 ┆ 39562.466269 ┆ 39839.18606 │ │ 75% ┆ 46857.705393 ┆ 42087.902928 ┆ 42327.090637 │ │ max ┆ 73924.778328 ┆ 56290.350186 ┆ 54959.696347 │ └────────────┴──────────────┴──────────────┴────────────────┘
error=pmm: donating observed value(s) ['income'] from 10-nearest matched donors
Finding 10 nearest neighbors on ['___prediction']
Randomly picking one and donating ['income']
Most common matches:
shape: (5, 2) ┌───────────┬─────────┐ │ person_id ┆ nDonors │ │ --- ┆ --- │ │ i16 ┆ i8 │ ╞═══════════╪═════════╡ │ 668 ┆ 3 │ │ 765 ┆ 3 │ │ 2352 ┆ 3 │ │ 2464 ┆ 3 │ │ 2548 ┆ 3 │ └───────────┴─────────┘
Post-imputation statistics for ['income']
Where: None
Where (impute): col(___imp_missing_income_1)
┌──────────┬─────────┬──────┬──────────────┬─────────┬────────┬──────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┐ │ Variable ┆ Imputed ┆ n ┆ n (not null) ┆ mean ┆ std ┆ mean (not 0) ┆ std (not 0) ┆ q10 (not 0) ┆ q25 (not 0) ┆ q50 (not 0) ┆ q75 (not 0) ┆ q90 (not 0) ┆ min (not 0) ┆ max (not 0) │ ╞══════════╪═════════╪══════╪══════════════╪═════════╪════════╪══════════════╪═════════════╪═════════════╪═════════════╪═════════════╪═════════════╪═════════════╪═════════════╪═════════════╡ │ income ┆ ┆ 5952 ┆ 5952 ┆ 40280.0 ┆ 9770.0 ┆ 40280.0 ┆ 9770.0 ┆ 27550.0 ┆ 33700.0 ┆ 40260.0 ┆ 46990.0 ┆ 52910.0 ┆ 6435.0 ┆ 73920.0 │ │ income ┆ 0 ┆ 5000 ┆ 5000 ┆ 40270.0 ┆ 9735.0 ┆ 40270.0 ┆ 9735.0 ┆ 27630.0 ┆ 33720.0 ┆ 40190.0 ┆ 46860.0 ┆ 52910.0 ┆ 6435.0 ┆ 73920.0 │ │ income ┆ 1 ┆ 952 ┆ 952 ┆ 40360.0 ┆ 9955.0 ┆ 40360.0 ┆ 9955.0 ┆ 27130.0 ┆ 33340.0 ┆ 40570.0 ┆ 47350.0 ┆ 52900.0 ┆ 11430.0 ┆ 69170.0 │ └──────────┴─────────┴──────┴──────────────┴─────────┴────────┴──────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┘
Imputation using LightGBM
Running lightgbm model with parameters: {'objective': 'regression', 'metric': 'rmse', 'boosting': 'gbdt', 'min_data_per_group': 25, 'num_threads': 1, 'verbose': -1, 'seed': 1679397514}
Iterations: 100
Model: has_disability=f(age, education_years, income, bbweight__1)
Categorical features: []
┌─────────────────┬────────┬───────────┬─────────────────┬──────────┬─────────────────┬──────────┐ │ Feature ┆ Gain ┆ Frequency ┆ Model ┆ Model ┆ Impute ┆ Impute │ │ ┆ ┆ ┆ share (missing) ┆ mean ┆ share (missing) ┆ mean │ ╞═════════════════╪════════╪═══════════╪═════════════════╪══════════╪═════════════════╪══════════╡ │ income ┆ 0.5437 ┆ 0.484 ┆ 0 ┆ 40,190.0 ┆ 0 ┆ 40,830.0 │ │ age ┆ 0.3208 ┆ 0.3403 ┆ 0 ┆ 53.64 ┆ 0 ┆ 54.16 │ │ education_years ┆ 0.1355 ┆ 0.1757 ┆ 0 ┆ 13.52 ┆ 0 ┆ 13.33 │ └─────────────────┴────────┴───────────┴─────────────────┴──────────┴─────────────────┴──────────┘
Predictions
shape: (9, 4) ┌────────────┬────────────────┬──────────────┬────────────────┐ │ statistic ┆ has_disability ┆ Model (yhat) ┆ Imputed (yhat) │ │ --- ┆ --- ┆ --- ┆ --- │ │ str ┆ f64 ┆ f64 ┆ f64 │ ╞════════════╪════════════════╪══════════════╪════════════════╡ │ count ┆ 5000.0 ┆ 5000.0 ┆ 698.0 │ │ null_count ┆ 0.0 ┆ 0.0 ┆ 0.0 │ │ mean ┆ 0.19 ┆ 0.192365 ┆ 0.193291 │ │ std ┆ null ┆ 0.177562 ┆ 0.184167 │ │ min ┆ 0.0 ┆ -0.175052 ┆ -0.089813 │ │ 25% ┆ null ┆ 0.063448 ┆ 0.059661 │ │ 50% ┆ null ┆ 0.142758 ┆ 0.140595 │ │ 75% ┆ null ┆ 0.274387 ┆ 0.274387 │ │ max ┆ 1.0 ┆ 1.035577 ┆ 0.930254 │ └────────────┴────────────────┴──────────────┴────────────────┘
shape: (9, 4) ┌────────────┬────────────────┬──────────────┬────────────────┐ │ statistic ┆ has_disability ┆ Model (yhat) ┆ Imputed (yhat) │ │ --- ┆ --- ┆ --- ┆ --- │ │ str ┆ f64 ┆ f64 ┆ f64 │ ╞════════════╪════════════════╪══════════════╪════════════════╡ │ count ┆ 5000.0 ┆ 5000.0 ┆ 698.0 │ │ null_count ┆ 0.0 ┆ 0.0 ┆ 0.0 │ │ mean ┆ 0.19 ┆ 0.192365 ┆ 0.193291 │ │ std ┆ null ┆ 0.177562 ┆ 0.184167 │ │ min ┆ 0.0 ┆ -0.175052 ┆ -0.089813 │ │ 25% ┆ null ┆ 0.063448 ┆ 0.059661 │ │ 50% ┆ null ┆ 0.142758 ┆ 0.140595 │ │ 75% ┆ null ┆ 0.274387 ┆ 0.274387 │ │ max ┆ 1.0 ┆ 1.035577 ┆ 0.930254 │ └────────────┴────────────────┴──────────────┴────────────────┘
error=pmm: donating observed value(s) ['has_disability'] from 10-nearest matched donors
Finding 10 nearest neighbors on ['___prediction']
Randomly picking one and donating ['has_disability']
Most common matches:
shape: (5, 2) ┌───────────┬─────────┐ │ person_id ┆ nDonors │ │ --- ┆ --- │ │ i16 ┆ i8 │ ╞═══════════╪═════════╡ │ 1789 ┆ 3 │ │ 4848 ┆ 3 │ │ 60 ┆ 2 │ │ 140 ┆ 2 │ │ 649 ┆ 2 │ └───────────┴─────────┘
Post-imputation statistics for ['has_disability']
Where: None
Where (impute): col(___imp_missing_has_disability_2)
┌────────────────┬─────────┬──────┬──────────────┬────────┬────────┬──────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┐ │ Variable ┆ Imputed ┆ n ┆ n (not null) ┆ mean ┆ std ┆ mean (not 0) ┆ std (not 0) ┆ q10 (not 0) ┆ q25 (not 0) ┆ q50 (not 0) ┆ q75 (not 0) ┆ q90 (not 0) ┆ min (not 0) ┆ max (not 0) │ ╞════════════════╪═════════╪══════╪══════════════╪════════╪════════╪══════════════╪═════════════╪═════════════╪═════════════╪═════════════╪═════════════╪═════════════╪═════════════╪═════════════╡ │ has_disability ┆ ┆ 5698 ┆ 5698 ┆ 0.1874 ┆ 0.3903 ┆ 1 ┆ 0 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 │ │ has_disability ┆ 0 ┆ 5000 ┆ 5000 ┆ 0.19 ┆ 0.3923 ┆ 1 ┆ 0 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 │ │ has_disability ┆ 1 ┆ 698 ┆ 698 ┆ 0.1691 ┆ 0.3751 ┆ 1 ┆ 0 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 │ └────────────────┴─────────┴──────┴──────────────┴────────┴────────┴──────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┘
Removing existing directory C:\Users\jonro\OneDrive\Documents\Coding\survey_kit\.scratch\temp_files/tutorial_simple_model_getting_started.srmi/2.srmi.implicate
Imputation using LightGBM
Running lightgbm model with parameters: {'objective': 'regression', 'metric': 'rmse', 'boosting': 'gbdt', 'min_data_per_group': 25, 'num_threads': 1, 'verbose': -1, 'seed': 3979080582}
Iterations: 100
Model: income=f(age, education_years, has_disability, bbweight__1)
Categorical features: []
┌─────────────────┬────────┬───────────┬─────────────────┬────────┬─────────────────┬────────┐ │ Feature ┆ Gain ┆ Frequency ┆ Model ┆ Model ┆ Impute ┆ Impute │ │ ┆ ┆ ┆ share (missing) ┆ mean ┆ share (missing) ┆ mean │ ╞═════════════════╪════════╪═══════════╪═════════════════╪════════╪═════════════════╪════════╡ │ age ┆ 0.4365 ┆ 0.5967 ┆ 0 ┆ 53.64 ┆ 0 ┆ 53.98 │ │ education_years ┆ 0.297 ┆ 0.3793 ┆ 0 ┆ 13.52 ┆ 0 ┆ 13.5 │ │ has_disability ┆ 0.2666 ┆ 0.024 ┆ 0 ┆ 0.1878 ┆ 0 ┆ 0.1901 │ └─────────────────┴────────┴───────────┴─────────────────┴────────┴─────────────────┴────────┘
Predictions
shape: (9, 4) ┌────────────┬──────────────┬──────────────┬────────────────┐ │ statistic ┆ income ┆ Model (yhat) ┆ Imputed (yhat) │ │ --- ┆ --- ┆ --- ┆ --- │ │ str ┆ f64 ┆ f64 ┆ f64 │ ╞════════════╪══════════════╪══════════════╪════════════════╡ │ count ┆ 5000.0 ┆ 5000.0 ┆ 952.0 │ │ null_count ┆ 0.0 ┆ 0.0 ┆ 0.0 │ │ mean ┆ 40189.87808 ┆ 40243.360677 ┆ 40523.922632 │ │ std ┆ 9762.397095 ┆ 4056.6026 ┆ 4198.214413 │ │ min ┆ 6435.355391 ┆ 28986.003233 ┆ 28986.003233 │ │ 25% ┆ 33469.311117 ┆ 37582.666108 ┆ 37742.732831 │ │ 50% ┆ 40163.69243 ┆ 39620.356454 ┆ 39928.071313 │ │ 75% ┆ 46910.398498 ┆ 42234.18439 ┆ 42651.533889 │ │ max ┆ 73924.778328 ┆ 56877.528922 ┆ 56877.528922 │ └────────────┴──────────────┴──────────────┴────────────────┘
shape: (9, 4) ┌────────────┬──────────────┬──────────────┬────────────────┐ │ statistic ┆ income ┆ Model (yhat) ┆ Imputed (yhat) │ │ --- ┆ --- ┆ --- ┆ --- │ │ str ┆ f64 ┆ f64 ┆ f64 │ ╞════════════╪══════════════╪══════════════╪════════════════╡ │ count ┆ 5000.0 ┆ 5000.0 ┆ 952.0 │ │ null_count ┆ 0.0 ┆ 0.0 ┆ 0.0 │ │ mean ┆ 40189.87808 ┆ 40243.360677 ┆ 40523.922632 │ │ std ┆ 9762.397095 ┆ 4056.6026 ┆ 4198.214413 │ │ min ┆ 6435.355391 ┆ 28986.003233 ┆ 28986.003233 │ │ 25% ┆ 33469.311117 ┆ 37582.666108 ┆ 37742.732831 │ │ 50% ┆ 40163.69243 ┆ 39620.356454 ┆ 39928.071313 │ │ 75% ┆ 46910.398498 ┆ 42234.18439 ┆ 42651.533889 │ │ max ┆ 73924.778328 ┆ 56877.528922 ┆ 56877.528922 │ └────────────┴──────────────┴──────────────┴────────────────┘
error=pmm: donating observed value(s) ['income'] from 10-nearest matched donors
Finding 10 nearest neighbors on ['___prediction']
Randomly picking one and donating ['income']
Most common matches:
shape: (5, 2) ┌───────────┬─────────┐ │ person_id ┆ nDonors │ │ --- ┆ --- │ │ i16 ┆ i8 │ ╞═══════════╪═════════╡ │ 418 ┆ 3 │ │ 977 ┆ 3 │ │ 1529 ┆ 3 │ │ 2217 ┆ 3 │ │ 3062 ┆ 3 │ └───────────┴─────────┘
Post-imputation statistics for ['income']
Where: None
Where (impute): col(___imp_missing_income_1)
┌──────────┬─────────┬──────┬──────────────┬─────────┬────────┬──────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┐ │ Variable ┆ Imputed ┆ n ┆ n (not null) ┆ mean ┆ std ┆ mean (not 0) ┆ std (not 0) ┆ q10 (not 0) ┆ q25 (not 0) ┆ q50 (not 0) ┆ q75 (not 0) ┆ q90 (not 0) ┆ min (not 0) ┆ max (not 0) │ ╞══════════╪═════════╪══════╪══════════════╪═════════╪════════╪══════════════╪═════════════╪═════════════╪═════════════╪═════════════╪═════════════╪═════════════╪═════════════╪═════════════╡ │ income ┆ ┆ 5952 ┆ 5952 ┆ 40180.0 ┆ 9761.0 ┆ 40180.0 ┆ 9761.0 ┆ 27380.0 ┆ 33460.0 ┆ 40210.0 ┆ 46900.0 ┆ 52800.0 ┆ 6435.0 ┆ 73920.0 │ │ income ┆ 0 ┆ 5000 ┆ 5000 ┆ 40190.0 ┆ 9762.0 ┆ 40190.0 ┆ 9762.0 ┆ 27500.0 ┆ 33460.0 ┆ 40160.0 ┆ 46910.0 ┆ 52830.0 ┆ 6435.0 ┆ 73920.0 │ │ income ┆ 1 ┆ 952 ┆ 952 ┆ 40100.0 ┆ 9756.0 ┆ 40100.0 ┆ 9756.0 ┆ 27010.0 ┆ 33460.0 ┆ 40330.0 ┆ 46700.0 ┆ 52710.0 ┆ 10980.0 ┆ 67630.0 │ └──────────┴─────────┴──────┴──────────────┴─────────┴────────┴──────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┘
Imputation using LightGBM
Running lightgbm model with parameters: {'objective': 'regression', 'metric': 'rmse', 'boosting': 'gbdt', 'min_data_per_group': 25, 'num_threads': 1, 'verbose': -1, 'seed': 2416741702}
Iterations: 100
Model: has_disability=f(age, education_years, income, bbweight__1)
Categorical features: []
┌─────────────────┬────────┬───────────┬─────────────────┬──────────┬─────────────────┬──────────┐ │ Feature ┆ Gain ┆ Frequency ┆ Model ┆ Model ┆ Impute ┆ Impute │ │ ┆ ┆ ┆ share (missing) ┆ mean ┆ share (missing) ┆ mean │ ╞═════════════════╪════════╪═══════════╪═════════════════╪══════════╪═════════════════╪══════════╡ │ income ┆ 0.5409 ┆ 0.473 ┆ 0 ┆ 40,140.0 ┆ 0 ┆ 40,500.0 │ │ age ┆ 0.2967 ┆ 0.345 ┆ 0 ┆ 53.64 ┆ 0 ┆ 54.16 │ │ education_years ┆ 0.1624 ┆ 0.182 ┆ 0 ┆ 13.52 ┆ 0 ┆ 13.33 │ └─────────────────┴────────┴───────────┴─────────────────┴──────────┴─────────────────┴──────────┘
Predictions
shape: (9, 4) ┌────────────┬────────────────┬──────────────┬────────────────┐ │ statistic ┆ has_disability ┆ Model (yhat) ┆ Imputed (yhat) │ │ --- ┆ --- ┆ --- ┆ --- │ │ str ┆ f64 ┆ f64 ┆ f64 │ ╞════════════╪════════════════╪══════════════╪════════════════╡ │ count ┆ 5000.0 ┆ 5000.0 ┆ 698.0 │ │ null_count ┆ 0.0 ┆ 0.0 ┆ 0.0 │ │ mean ┆ 0.1878 ┆ 0.181981 ┆ 0.183637 │ │ std ┆ null ┆ 0.176948 ┆ 0.190844 │ │ min ┆ 0.0 ┆ -0.129391 ┆ -0.129391 │ │ 25% ┆ null ┆ 0.057435 ┆ 0.055846 │ │ 50% ┆ null ┆ 0.130465 ┆ 0.126774 │ │ 75% ┆ null ┆ 0.249639 ┆ 0.251876 │ │ max ┆ 1.0 ┆ 1.040101 ┆ 1.030956 │ └────────────┴────────────────┴──────────────┴────────────────┘
shape: (9, 4) ┌────────────┬────────────────┬──────────────┬────────────────┐ │ statistic ┆ has_disability ┆ Model (yhat) ┆ Imputed (yhat) │ │ --- ┆ --- ┆ --- ┆ --- │ │ str ┆ f64 ┆ f64 ┆ f64 │ ╞════════════╪════════════════╪══════════════╪════════════════╡ │ count ┆ 5000.0 ┆ 5000.0 ┆ 698.0 │ │ null_count ┆ 0.0 ┆ 0.0 ┆ 0.0 │ │ mean ┆ 0.1878 ┆ 0.181981 ┆ 0.183637 │ │ std ┆ null ┆ 0.176948 ┆ 0.190844 │ │ min ┆ 0.0 ┆ -0.129391 ┆ -0.129391 │ │ 25% ┆ null ┆ 0.057435 ┆ 0.055846 │ │ 50% ┆ null ┆ 0.130465 ┆ 0.126774 │ │ 75% ┆ null ┆ 0.249639 ┆ 0.251876 │ │ max ┆ 1.0 ┆ 1.040101 ┆ 1.030956 │ └────────────┴────────────────┴──────────────┴────────────────┘
error=pmm: donating observed value(s) ['has_disability'] from 10-nearest matched donors
Finding 10 nearest neighbors on ['___prediction']
Randomly picking one and donating ['has_disability']
Most common matches:
shape: (5, 2) ┌───────────┬─────────┐ │ person_id ┆ nDonors │ │ --- ┆ --- │ │ i16 ┆ i8 │ ╞═══════════╪═════════╡ │ 4360 ┆ 3 │ │ 38 ┆ 2 │ │ 121 ┆ 2 │ │ 130 ┆ 2 │ │ 136 ┆ 2 │ └───────────┴─────────┘
Post-imputation statistics for ['has_disability']
Where: None
Where (impute): col(___imp_missing_has_disability_2)
┌────────────────┬─────────┬──────┬──────────────┬────────┬────────┬──────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┐ │ Variable ┆ Imputed ┆ n ┆ n (not null) ┆ mean ┆ std ┆ mean (not 0) ┆ std (not 0) ┆ q10 (not 0) ┆ q25 (not 0) ┆ q50 (not 0) ┆ q75 (not 0) ┆ q90 (not 0) ┆ min (not 0) ┆ max (not 0) │ ╞════════════════╪═════════╪══════╪══════════════╪════════╪════════╪══════════════╪═════════════╪═════════════╪═════════════╪═════════════╪═════════════╪═════════════╪═════════════╪═════════════╡ │ has_disability ┆ ┆ 5698 ┆ 5698 ┆ 0.1894 ┆ 0.3918 ┆ 1 ┆ 0 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 │ │ has_disability ┆ 0 ┆ 5000 ┆ 5000 ┆ 0.1878 ┆ 0.3906 ┆ 1 ┆ 0 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 │ │ has_disability ┆ 1 ┆ 698 ┆ 698 ┆ 0.2006 ┆ 0.4007 ┆ 1 ┆ 0 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 │ └────────────────┴─────────┴──────┴──────────────┴────────┴────────┴──────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┘
income
has_disability
Final Estimates by Iteration
Removing existing directory C:\Users\jonro\OneDrive\Documents\Coding\survey_kit\.scratch\temp_files/tutorial_simple_model_getting_started.srmi/2.srmi.implicate
Imputation using LightGBM
Running lightgbm model with parameters: {'objective': 'regression', 'metric': 'rmse', 'boosting': 'gbdt', 'min_data_per_group': 25, 'num_threads': 1, 'verbose': -1, 'seed': 2971838600}
Iterations: 100
Model: income=f(age, education_years, bbweight__1)
Categorical features: []
┌─────────────────┬────────┬───────────┬─────────────────┬───────┬─────────────────┬────────┐ │ Feature ┆ Gain ┆ Frequency ┆ Model ┆ Model ┆ Impute ┆ Impute │ │ ┆ ┆ ┆ share (missing) ┆ mean ┆ share (missing) ┆ mean │ ╞═════════════════╪════════╪═══════════╪═════════════════╪═══════╪═════════════════╪════════╡ │ age ┆ 0.7091 ┆ 0.6507 ┆ 0 ┆ 53.56 ┆ 0 ┆ 53.98 │ │ education_years ┆ 0.2909 ┆ 0.3493 ┆ 0 ┆ 13.53 ┆ 0 ┆ 13.5 │ └─────────────────┴────────┴───────────┴─────────────────┴───────┴─────────────────┴────────┘
Predictions
shape: (9, 4) ┌────────────┬──────────────┬──────────────┬────────────────┐ │ statistic ┆ income ┆ Model (yhat) ┆ Imputed (yhat) │ │ --- ┆ --- ┆ --- ┆ --- │ │ str ┆ f64 ┆ f64 ┆ f64 │ ╞════════════╪══════════════╪══════════════╪════════════════╡ │ count ┆ 4048.0 ┆ 4048.0 ┆ 952.0 │ │ null_count ┆ 0.0 ┆ 0.0 ┆ 0.0 │ │ mean ┆ 40148.871404 ┆ 40212.199137 ┆ 40464.116591 │ │ std ┆ 9717.268746 ┆ 3072.365268 ┆ 3100.136279 │ │ min ┆ 6435.355391 ┆ 28166.200892 ┆ 30074.195336 │ │ 25% ┆ 33492.580529 ┆ 38240.990497 ┆ 38688.304411 │ │ 50% ┆ 40048.030097 ┆ 40294.994369 ┆ 40436.708232 │ │ 75% ┆ 46684.497161 ┆ 42212.387376 ┆ 42362.902645 │ │ max ┆ 73924.778328 ┆ 52031.823356 ┆ 52031.823356 │ └────────────┴──────────────┴──────────────┴────────────────┘
shape: (9, 4) ┌────────────┬──────────────┬──────────────┬────────────────┐ │ statistic ┆ income ┆ Model (yhat) ┆ Imputed (yhat) │ │ --- ┆ --- ┆ --- ┆ --- │ │ str ┆ f64 ┆ f64 ┆ f64 │ ╞════════════╪══════════════╪══════════════╪════════════════╡ │ count ┆ 4048.0 ┆ 4048.0 ┆ 952.0 │ │ null_count ┆ 0.0 ┆ 0.0 ┆ 0.0 │ │ mean ┆ 40148.871404 ┆ 40212.199137 ┆ 40464.116591 │ │ std ┆ 9717.268746 ┆ 3072.365268 ┆ 3100.136279 │ │ min ┆ 6435.355391 ┆ 28166.200892 ┆ 30074.195336 │ │ 25% ┆ 33492.580529 ┆ 38240.990497 ┆ 38688.304411 │ │ 50% ┆ 40048.030097 ┆ 40294.994369 ┆ 40436.708232 │ │ 75% ┆ 46684.497161 ┆ 42212.387376 ┆ 42362.902645 │ │ max ┆ 73924.778328 ┆ 52031.823356 ┆ 52031.823356 │ └────────────┴──────────────┴──────────────┴────────────────┘
error=pmm: donating observed value(s) ['income'] from 10-nearest matched donors
Finding 10 nearest neighbors on ['___prediction']
Randomly picking one and donating ['income']
Most common matches:
shape: (5, 2) ┌───────────┬─────────┐ │ person_id ┆ nDonors │ │ --- ┆ --- │ │ i16 ┆ i8 │ ╞═══════════╪═════════╡ │ 4549 ┆ 5 │ │ 198 ┆ 4 │ │ 4554 ┆ 4 │ │ 53 ┆ 3 │ │ 388 ┆ 3 │ └───────────┴─────────┘
Post-imputation statistics for ['income']
Where: None
Where (impute): col(___imp_missing_income_1)
┌──────────┬─────────┬──────┬──────────────┬─────────┬─────────┬──────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┐ │ Variable ┆ Imputed ┆ n ┆ n (not null) ┆ mean ┆ std ┆ mean (not 0) ┆ std (not 0) ┆ q10 (not 0) ┆ q25 (not 0) ┆ q50 (not 0) ┆ q75 (not 0) ┆ q90 (not 0) ┆ min (not 0) ┆ max (not 0) │ ╞══════════╪═════════╪══════╪══════════════╪═════════╪═════════╪══════════════╪═════════════╪═════════════╪═════════════╪═════════════╪═════════════╪═════════════╪═════════════╪═════════════╡ │ income ┆ ┆ 5000 ┆ 5000 ┆ 40210.0 ┆ 9802.0 ┆ 40210.0 ┆ 9802.0 ┆ 27450.0 ┆ 33650.0 ┆ 40040.0 ┆ 46820.0 ┆ 52900.0 ┆ 6435.0 ┆ 73920.0 │ │ income ┆ 0 ┆ 4048 ┆ 4048 ┆ 40150.0 ┆ 9717.0 ┆ 40150.0 ┆ 9717.0 ┆ 27570.0 ┆ 33480.0 ┆ 40040.0 ┆ 46680.0 ┆ 52820.0 ┆ 6435.0 ┆ 73920.0 │ │ income ┆ 1 ┆ 952 ┆ 952 ┆ 40490.0 ┆ 10150.0 ┆ 40490.0 ┆ 10150.0 ┆ 27090.0 ┆ 33800.0 ┆ 40040.0 ┆ 47120.0 ┆ 53350.0 ┆ 11130.0 ┆ 73550.0 │ └──────────┴─────────┴──────┴──────────────┴─────────┴─────────┴──────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┘
Imputation using LightGBM
Running lightgbm model with parameters: {'objective': 'regression', 'metric': 'rmse', 'boosting': 'gbdt', 'min_data_per_group': 25, 'num_threads': 1, 'verbose': -1, 'seed': 1404984554}
Iterations: 100
Model: has_disability=f(age, education_years, income, bbweight__1)
Categorical features: []
┌─────────────────┬────────┬───────────┬─────────────────┬──────────┬─────────────────┬──────────┐ │ Feature ┆ Gain ┆ Frequency ┆ Model ┆ Model ┆ Impute ┆ Impute │ │ ┆ ┆ ┆ share (missing) ┆ mean ┆ share (missing) ┆ mean │ ╞═════════════════╪════════╪═══════════╪═════════════════╪══════════╪═════════════════╪══════════╡ │ income ┆ 0.5595 ┆ 0.497 ┆ 0 ┆ 40,110.0 ┆ 0 ┆ 40,840.0 │ │ age ┆ 0.2826 ┆ 0.327 ┆ 0 ┆ 53.55 ┆ 0 ┆ 54.16 │ │ education_years ┆ 0.1579 ┆ 0.176 ┆ 0 ┆ 13.56 ┆ 0 ┆ 13.33 │ └─────────────────┴────────┴───────────┴─────────────────┴──────────┴─────────────────┴──────────┘
Predictions
shape: (9, 4) ┌────────────┬────────────────┬──────────────┬────────────────┐ │ statistic ┆ has_disability ┆ Model (yhat) ┆ Imputed (yhat) │ │ --- ┆ --- ┆ --- ┆ --- │ │ str ┆ f64 ┆ f64 ┆ f64 │ ╞════════════╪════════════════╪══════════════╪════════════════╡ │ count ┆ 4302.0 ┆ 4302.0 ┆ 698.0 │ │ null_count ┆ 0.0 ┆ 0.0 ┆ 0.0 │ │ mean ┆ 0.190841 ┆ 0.188341 ┆ 0.193084 │ │ std ┆ 0.39301 ┆ 0.167145 ┆ 0.162589 │ │ min ┆ 0.0 ┆ -0.160084 ┆ -0.097605 │ │ 25% ┆ 0.0 ┆ 0.068124 ┆ 0.078932 │ │ 50% ┆ 0.0 ┆ 0.143228 ┆ 0.155735 │ │ 75% ┆ 0.0 ┆ 0.26797 ┆ 0.275287 │ │ max ┆ 1.0 ┆ 0.958894 ┆ 1.048121 │ └────────────┴────────────────┴──────────────┴────────────────┘
shape: (9, 4) ┌────────────┬────────────────┬──────────────┬────────────────┐ │ statistic ┆ has_disability ┆ Model (yhat) ┆ Imputed (yhat) │ │ --- ┆ --- ┆ --- ┆ --- │ │ str ┆ f64 ┆ f64 ┆ f64 │ ╞════════════╪════════════════╪══════════════╪════════════════╡ │ count ┆ 4302.0 ┆ 4302.0 ┆ 698.0 │ │ null_count ┆ 0.0 ┆ 0.0 ┆ 0.0 │ │ mean ┆ 0.190841 ┆ 0.188341 ┆ 0.193084 │ │ std ┆ 0.39301 ┆ 0.167145 ┆ 0.162589 │ │ min ┆ 0.0 ┆ -0.160084 ┆ -0.097605 │ │ 25% ┆ 0.0 ┆ 0.068124 ┆ 0.078932 │ │ 50% ┆ 0.0 ┆ 0.143228 ┆ 0.155735 │ │ 75% ┆ 0.0 ┆ 0.26797 ┆ 0.275287 │ │ max ┆ 1.0 ┆ 0.958894 ┆ 1.048121 │ └────────────┴────────────────┴──────────────┴────────────────┘
error=pmm: donating observed value(s) ['has_disability'] from 10-nearest matched donors
Finding 10 nearest neighbors on ['___prediction']
Randomly picking one and donating ['has_disability']
Most common matches:
shape: (5, 2) ┌───────────┬─────────┐ │ person_id ┆ nDonors │ │ --- ┆ --- │ │ i16 ┆ i8 │ ╞═══════════╪═════════╡ │ 303 ┆ 3 │ │ 31 ┆ 2 │ │ 89 ┆ 2 │ │ 99 ┆ 2 │ │ 217 ┆ 2 │ └───────────┴─────────┘
Post-imputation statistics for ['has_disability']
Where: None
Where (impute): col(___imp_missing_has_disability_2)
┌────────────────┬─────────┬──────┬──────────────┬────────┬────────┬──────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┐ │ Variable ┆ Imputed ┆ n ┆ n (not null) ┆ mean ┆ std ┆ mean (not 0) ┆ std (not 0) ┆ q10 (not 0) ┆ q25 (not 0) ┆ q50 (not 0) ┆ q75 (not 0) ┆ q90 (not 0) ┆ min (not 0) ┆ max (not 0) │ ╞════════════════╪═════════╪══════╪══════════════╪════════╪════════╪══════════════╪═════════════╪═════════════╪═════════════╪═════════════╪═════════════╪═════════════╪═════════════╪═════════════╡ │ has_disability ┆ ┆ 5000 ┆ 5000 ┆ 0.1896 ┆ 0.392 ┆ 1 ┆ 0 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 │ │ has_disability ┆ 0 ┆ 4302 ┆ 4302 ┆ 0.1908 ┆ 0.393 ┆ 1 ┆ 0 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 │ │ has_disability ┆ 1 ┆ 698 ┆ 698 ┆ 0.1819 ┆ 0.3861 ┆ 1 ┆ 0 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 │ └────────────────┴─────────┴──────┴──────────────┴────────┴────────┴──────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┘
Removing existing directory C:\Users\jonro\OneDrive\Documents\Coding\survey_kit\.scratch\temp_files/tutorial_simple_model_getting_started.srmi/3.srmi.implicate
Imputation using LightGBM
Running lightgbm model with parameters: {'objective': 'regression', 'metric': 'rmse', 'boosting': 'gbdt', 'min_data_per_group': 25, 'num_threads': 1, 'verbose': -1, 'seed': 699104912}
Iterations: 100
Model: income=f(age, education_years, has_disability, bbweight__1)
Categorical features: []
┌─────────────────┬────────┬───────────┬─────────────────┬────────┬─────────────────┬────────┐ │ Feature ┆ Gain ┆ Frequency ┆ Model ┆ Model ┆ Impute ┆ Impute │ │ ┆ ┆ ┆ share (missing) ┆ mean ┆ share (missing) ┆ mean │ ╞═════════════════╪════════╪═══════════╪═════════════════╪════════╪═════════════════╪════════╡ │ age ┆ 0.4865 ┆ 0.5897 ┆ 0 ┆ 53.64 ┆ 0 ┆ 53.98 │ │ education_years ┆ 0.332 ┆ 0.3883 ┆ 0 ┆ 13.52 ┆ 0 ┆ 13.5 │ │ has_disability ┆ 0.1816 ┆ 0.022 ┆ 0 ┆ 0.1896 ┆ 0 ┆ 0.2038 │ └─────────────────┴────────┴───────────┴─────────────────┴────────┴─────────────────┴────────┘
Predictions
shape: (9, 4) ┌────────────┬──────────────┬──────────────┬────────────────┐ │ statistic ┆ income ┆ Model (yhat) ┆ Imputed (yhat) │ │ --- ┆ --- ┆ --- ┆ --- │ │ str ┆ f64 ┆ f64 ┆ f64 │ ╞════════════╪══════════════╪══════════════╪════════════════╡ │ count ┆ 5000.0 ┆ 5000.0 ┆ 952.0 │ │ null_count ┆ 0.0 ┆ 0.0 ┆ 0.0 │ │ mean ┆ 40213.895183 ┆ 40278.352706 ┆ 40531.84309 │ │ std ┆ 9801.82595 ┆ 3741.312958 ┆ 3925.322037 │ │ min ┆ 6435.355391 ┆ 28604.417864 ┆ 28718.912065 │ │ 25% ┆ 33670.321242 ┆ 37937.391977 ┆ 38016.825228 │ │ 50% ┆ 40048.030097 ┆ 40099.543628 ┆ 40245.2126 │ │ 75% ┆ 46821.064118 ┆ 42187.810719 ┆ 42510.044035 │ │ max ┆ 73924.778328 ┆ 56074.283142 ┆ 56074.283142 │ └────────────┴──────────────┴──────────────┴────────────────┘
shape: (9, 4) ┌────────────┬──────────────┬──────────────┬────────────────┐ │ statistic ┆ income ┆ Model (yhat) ┆ Imputed (yhat) │ │ --- ┆ --- ┆ --- ┆ --- │ │ str ┆ f64 ┆ f64 ┆ f64 │ ╞════════════╪══════════════╪══════════════╪════════════════╡ │ count ┆ 5000.0 ┆ 5000.0 ┆ 952.0 │ │ null_count ┆ 0.0 ┆ 0.0 ┆ 0.0 │ │ mean ┆ 40213.895183 ┆ 40278.352706 ┆ 40531.84309 │ │ std ┆ 9801.82595 ┆ 3741.312958 ┆ 3925.322037 │ │ min ┆ 6435.355391 ┆ 28604.417864 ┆ 28718.912065 │ │ 25% ┆ 33670.321242 ┆ 37937.391977 ┆ 38016.825228 │ │ 50% ┆ 40048.030097 ┆ 40099.543628 ┆ 40245.2126 │ │ 75% ┆ 46821.064118 ┆ 42187.810719 ┆ 42510.044035 │ │ max ┆ 73924.778328 ┆ 56074.283142 ┆ 56074.283142 │ └────────────┴──────────────┴──────────────┴────────────────┘
error=pmm: donating observed value(s) ['income'] from 10-nearest matched donors
Finding 10 nearest neighbors on ['___prediction']
Randomly picking one and donating ['income']
Most common matches:
shape: (5, 2) ┌───────────┬─────────┐ │ person_id ┆ nDonors │ │ --- ┆ --- │ │ i16 ┆ i8 │ ╞═══════════╪═════════╡ │ 1169 ┆ 3 │ │ 4694 ┆ 3 │ │ 238 ┆ 2 │ │ 331 ┆ 2 │ │ 467 ┆ 2 │ └───────────┴─────────┘
Post-imputation statistics for ['income']
Where: None
Where (impute): col(___imp_missing_income_1)
┌──────────┬─────────┬──────┬──────────────┬─────────┬─────────┬──────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┐ │ Variable ┆ Imputed ┆ n ┆ n (not null) ┆ mean ┆ std ┆ mean (not 0) ┆ std (not 0) ┆ q10 (not 0) ┆ q25 (not 0) ┆ q50 (not 0) ┆ q75 (not 0) ┆ q90 (not 0) ┆ min (not 0) ┆ max (not 0) │ ╞══════════╪═════════╪══════╪══════════════╪═════════╪═════════╪══════════════╪═════════════╪═════════════╪═════════════╪═════════════╪═════════════╪═════════════╪═════════════╪═════════════╡ │ income ┆ ┆ 5952 ┆ 5952 ┆ 40350.0 ┆ 9864.0 ┆ 40350.0 ┆ 9864.0 ┆ 27500.0 ┆ 33700.0 ┆ 40160.0 ┆ 47040.0 ┆ 53170.0 ┆ 6435.0 ┆ 73920.0 │ │ income ┆ 0 ┆ 5000 ┆ 5000 ┆ 40210.0 ┆ 9802.0 ┆ 40210.0 ┆ 9802.0 ┆ 27450.0 ┆ 33650.0 ┆ 40040.0 ┆ 46820.0 ┆ 52900.0 ┆ 6435.0 ┆ 73920.0 │ │ income ┆ 1 ┆ 952 ┆ 952 ┆ 41060.0 ┆ 10160.0 ┆ 41060.0 ┆ 10160.0 ┆ 27620.0 ┆ 33990.0 ┆ 40800.0 ┆ 48730.0 ┆ 54080.0 ┆ 13200.0 ┆ 73550.0 │ └──────────┴─────────┴──────┴──────────────┴─────────┴─────────┴──────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┘
Imputation using LightGBM
Running lightgbm model with parameters: {'objective': 'regression', 'metric': 'rmse', 'boosting': 'gbdt', 'min_data_per_group': 25, 'num_threads': 1, 'verbose': -1, 'seed': 1079958577}
Iterations: 100
Model: has_disability=f(age, education_years, income, bbweight__1)
Categorical features: []
┌─────────────────┬────────┬───────────┬─────────────────┬──────────┬─────────────────┬──────────┐ │ Feature ┆ Gain ┆ Frequency ┆ Model ┆ Model ┆ Impute ┆ Impute │ │ ┆ ┆ ┆ share (missing) ┆ mean ┆ share (missing) ┆ mean │ ╞═════════════════╪════════╪═══════════╪═════════════════╪══════════╪═════════════════╪══════════╡ │ income ┆ 0.5405 ┆ 0.49 ┆ 0 ┆ 40,320.0 ┆ 0 ┆ 40,930.0 │ │ age ┆ 0.287 ┆ 0.3153 ┆ 0 ┆ 53.64 ┆ 0 ┆ 54.16 │ │ education_years ┆ 0.1726 ┆ 0.1947 ┆ 0 ┆ 13.52 ┆ 0 ┆ 13.33 │ └─────────────────┴────────┴───────────┴─────────────────┴──────────┴─────────────────┴──────────┘
Predictions
shape: (9, 4) ┌────────────┬────────────────┬──────────────┬────────────────┐ │ statistic ┆ has_disability ┆ Model (yhat) ┆ Imputed (yhat) │ │ --- ┆ --- ┆ --- ┆ --- │ │ str ┆ f64 ┆ f64 ┆ f64 │ ╞════════════╪════════════════╪══════════════╪════════════════╡ │ count ┆ 5000.0 ┆ 5000.0 ┆ 698.0 │ │ null_count ┆ 0.0 ┆ 0.0 ┆ 0.0 │ │ mean ┆ 0.1896 ┆ 0.186735 ┆ 0.184362 │ │ std ┆ null ┆ 0.168506 ┆ 0.166109 │ │ min ┆ 0.0 ┆ -0.078683 ┆ -0.057889 │ │ 25% ┆ null ┆ 0.069181 ┆ 0.069186 │ │ 50% ┆ null ┆ 0.136891 ┆ 0.137629 │ │ 75% ┆ null ┆ 0.258769 ┆ 0.24924 │ │ max ┆ 1.0 ┆ 1.020924 ┆ 0.871374 │ └────────────┴────────────────┴──────────────┴────────────────┘
shape: (9, 4) ┌────────────┬────────────────┬──────────────┬────────────────┐ │ statistic ┆ has_disability ┆ Model (yhat) ┆ Imputed (yhat) │ │ --- ┆ --- ┆ --- ┆ --- │ │ str ┆ f64 ┆ f64 ┆ f64 │ ╞════════════╪════════════════╪══════════════╪════════════════╡ │ count ┆ 5000.0 ┆ 5000.0 ┆ 698.0 │ │ null_count ┆ 0.0 ┆ 0.0 ┆ 0.0 │ │ mean ┆ 0.1896 ┆ 0.186735 ┆ 0.184362 │ │ std ┆ null ┆ 0.168506 ┆ 0.166109 │ │ min ┆ 0.0 ┆ -0.078683 ┆ -0.057889 │ │ 25% ┆ null ┆ 0.069181 ┆ 0.069186 │ │ 50% ┆ null ┆ 0.136891 ┆ 0.137629 │ │ 75% ┆ null ┆ 0.258769 ┆ 0.24924 │ │ max ┆ 1.0 ┆ 1.020924 ┆ 0.871374 │ └────────────┴────────────────┴──────────────┴────────────────┘
error=pmm: donating observed value(s) ['has_disability'] from 10-nearest matched donors
Finding 10 nearest neighbors on ['___prediction']
Randomly picking one and donating ['has_disability']
Most common matches:
shape: (5, 2) ┌───────────┬─────────┐ │ person_id ┆ nDonors │ │ --- ┆ --- │ │ i16 ┆ i8 │ ╞═══════════╪═════════╡ │ 3043 ┆ 3 │ │ 45 ┆ 2 │ │ 190 ┆ 2 │ │ 246 ┆ 2 │ │ 247 ┆ 2 │ └───────────┴─────────┘
Post-imputation statistics for ['has_disability']
Where: None
Where (impute): col(___imp_missing_has_disability_2)
┌────────────────┬─────────┬──────┬──────────────┬────────┬────────┬──────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┐ │ Variable ┆ Imputed ┆ n ┆ n (not null) ┆ mean ┆ std ┆ mean (not 0) ┆ std (not 0) ┆ q10 (not 0) ┆ q25 (not 0) ┆ q50 (not 0) ┆ q75 (not 0) ┆ q90 (not 0) ┆ min (not 0) ┆ max (not 0) │ ╞════════════════╪═════════╪══════╪══════════════╪════════╪════════╪══════════════╪═════════════╪═════════════╪═════════════╪═════════════╪═════════════╪═════════════╪═════════════╪═════════════╡ │ has_disability ┆ ┆ 5698 ┆ 5698 ┆ 0.1857 ┆ 0.3889 ┆ 1 ┆ 0 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 │ │ has_disability ┆ 0 ┆ 5000 ┆ 5000 ┆ 0.1896 ┆ 0.392 ┆ 1 ┆ 0 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 │ │ has_disability ┆ 1 ┆ 698 ┆ 698 ┆ 0.1576 ┆ 0.3646 ┆ 1 ┆ 0 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 │ └────────────────┴─────────┴──────┴──────────────┴────────┴────────┴──────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┘
Removing existing directory C:\Users\jonro\OneDrive\Documents\Coding\survey_kit\.scratch\temp_files/tutorial_simple_model_getting_started.srmi/3.srmi.implicate
Imputation using LightGBM
Running lightgbm model with parameters: {'objective': 'regression', 'metric': 'rmse', 'boosting': 'gbdt', 'min_data_per_group': 25, 'num_threads': 1, 'verbose': -1, 'seed': 2541026245}
Iterations: 100
Model: income=f(age, education_years, has_disability, bbweight__1)
Categorical features: []
┌─────────────────┬────────┬───────────┬─────────────────┬────────┬─────────────────┬────────┐ │ Feature ┆ Gain ┆ Frequency ┆ Model ┆ Model ┆ Impute ┆ Impute │ │ ┆ ┆ ┆ share (missing) ┆ mean ┆ share (missing) ┆ mean │ ╞═════════════════╪════════╪═══════════╪═════════════════╪════════╪═════════════════╪════════╡ │ age ┆ 0.4707 ┆ 0.5907 ┆ 0 ┆ 53.64 ┆ 0 ┆ 53.98 │ │ education_years ┆ 0.3034 ┆ 0.3833 ┆ 0 ┆ 13.52 ┆ 0 ┆ 13.5 │ │ has_disability ┆ 0.2258 ┆ 0.026 ┆ 0 ┆ 0.1862 ┆ 0 ┆ 0.1943 │ └─────────────────┴────────┴───────────┴─────────────────┴────────┴─────────────────┴────────┘
Predictions
shape: (9, 4) ┌────────────┬──────────────┬──────────────┬────────────────┐ │ statistic ┆ income ┆ Model (yhat) ┆ Imputed (yhat) │ │ --- ┆ --- ┆ --- ┆ --- │ │ str ┆ f64 ┆ f64 ┆ f64 │ ╞════════════╪══════════════╪══════════════╪════════════════╡ │ count ┆ 5000.0 ┆ 5000.0 ┆ 952.0 │ │ null_count ┆ 0.0 ┆ 0.0 ┆ 0.0 │ │ mean ┆ 40321.401231 ┆ 40364.847391 ┆ 40619.200328 │ │ std ┆ 9808.260338 ┆ 3900.107025 ┆ 4157.497662 │ │ min ┆ 6435.355391 ┆ 29394.76287 ┆ 29394.76287 │ │ 25% ┆ 33643.890464 ┆ 37927.323784 ┆ 37868.598469 │ │ 50% ┆ 40191.037808 ┆ 39824.756727 ┆ 40131.779813 │ │ 75% ┆ 47036.850402 ┆ 42345.394168 ┆ 42706.881553 │ │ max ┆ 73924.778328 ┆ 54597.55146 ┆ 54400.599544 │ └────────────┴──────────────┴──────────────┴────────────────┘
shape: (9, 4) ┌────────────┬──────────────┬──────────────┬────────────────┐ │ statistic ┆ income ┆ Model (yhat) ┆ Imputed (yhat) │ │ --- ┆ --- ┆ --- ┆ --- │ │ str ┆ f64 ┆ f64 ┆ f64 │ ╞════════════╪══════════════╪══════════════╪════════════════╡ │ count ┆ 5000.0 ┆ 5000.0 ┆ 952.0 │ │ null_count ┆ 0.0 ┆ 0.0 ┆ 0.0 │ │ mean ┆ 40321.401231 ┆ 40364.847391 ┆ 40619.200328 │ │ std ┆ 9808.260338 ┆ 3900.107025 ┆ 4157.497662 │ │ min ┆ 6435.355391 ┆ 29394.76287 ┆ 29394.76287 │ │ 25% ┆ 33643.890464 ┆ 37927.323784 ┆ 37868.598469 │ │ 50% ┆ 40191.037808 ┆ 39824.756727 ┆ 40131.779813 │ │ 75% ┆ 47036.850402 ┆ 42345.394168 ┆ 42706.881553 │ │ max ┆ 73924.778328 ┆ 54597.55146 ┆ 54400.599544 │ └────────────┴──────────────┴──────────────┴────────────────┘
error=pmm: donating observed value(s) ['income'] from 10-nearest matched donors
Finding 10 nearest neighbors on ['___prediction']
Randomly picking one and donating ['income']
Most common matches:
shape: (5, 2) ┌───────────┬─────────┐ │ person_id ┆ nDonors │ │ --- ┆ --- │ │ i16 ┆ i8 │ ╞═══════════╪═════════╡ │ 25 ┆ 3 │ │ 1051 ┆ 3 │ │ 1431 ┆ 3 │ │ 1796 ┆ 3 │ │ 2757 ┆ 3 │ └───────────┴─────────┘
Post-imputation statistics for ['income']
Where: None
Where (impute): col(___imp_missing_income_1)
┌──────────┬─────────┬──────┬──────────────┬─────────┬────────┬──────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┐ │ Variable ┆ Imputed ┆ n ┆ n (not null) ┆ mean ┆ std ┆ mean (not 0) ┆ std (not 0) ┆ q10 (not 0) ┆ q25 (not 0) ┆ q50 (not 0) ┆ q75 (not 0) ┆ q90 (not 0) ┆ min (not 0) ┆ max (not 0) │ ╞══════════╪═════════╪══════╪══════════════╪═════════╪════════╪══════════════╪═════════════╪═════════════╪═════════════╪═════════════╪═════════════╪═════════════╪═════════════╪═════════════╡ │ income ┆ ┆ 5952 ┆ 5952 ┆ 40470.0 ┆ 9814.0 ┆ 40470.0 ┆ 9814.0 ┆ 27690.0 ┆ 33790.0 ┆ 40370.0 ┆ 47160.0 ┆ 53210.0 ┆ 6435.0 ┆ 73920.0 │ │ income ┆ 0 ┆ 5000 ┆ 5000 ┆ 40320.0 ┆ 9808.0 ┆ 40320.0 ┆ 9808.0 ┆ 27570.0 ┆ 33620.0 ┆ 40190.0 ┆ 47040.0 ┆ 53080.0 ┆ 6435.0 ┆ 73920.0 │ │ income ┆ 1 ┆ 952 ┆ 952 ┆ 41260.0 ┆ 9810.0 ┆ 41260.0 ┆ 9810.0 ┆ 28790.0 ┆ 34630.0 ┆ 41100.0 ┆ 47970.0 ┆ 53490.0 ┆ 6435.0 ┆ 73550.0 │ └──────────┴─────────┴──────┴──────────────┴─────────┴────────┴──────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┘
Imputation using LightGBM
Running lightgbm model with parameters: {'objective': 'regression', 'metric': 'rmse', 'boosting': 'gbdt', 'min_data_per_group': 25, 'num_threads': 1, 'verbose': -1, 'seed': 1476922760}
Iterations: 100
Model: has_disability=f(age, education_years, income, bbweight__1)
Categorical features: []
┌─────────────────┬────────┬───────────┬─────────────────┬──────────┬─────────────────┬──────────┐ │ Feature ┆ Gain ┆ Frequency ┆ Model ┆ Model ┆ Impute ┆ Impute │ │ ┆ ┆ ┆ share (missing) ┆ mean ┆ share (missing) ┆ mean │ ╞═════════════════╪════════╪═══════════╪═════════════════╪══════════╪═════════════════╪══════════╡ │ income ┆ 0.5364 ┆ 0.4957 ┆ 0 ┆ 40,360.0 ┆ 0 ┆ 41,000.0 │ │ age ┆ 0.2797 ┆ 0.3237 ┆ 0 ┆ 53.64 ┆ 0 ┆ 54.16 │ │ education_years ┆ 0.1839 ┆ 0.1807 ┆ 0 ┆ 13.52 ┆ 0 ┆ 13.33 │ └─────────────────┴────────┴───────────┴─────────────────┴──────────┴─────────────────┴──────────┘
Predictions
shape: (9, 4) ┌────────────┬────────────────┬──────────────┬────────────────┐ │ statistic ┆ has_disability ┆ Model (yhat) ┆ Imputed (yhat) │ │ --- ┆ --- ┆ --- ┆ --- │ │ str ┆ f64 ┆ f64 ┆ f64 │ ╞════════════╪════════════════╪══════════════╪════════════════╡ │ count ┆ 5000.0 ┆ 5000.0 ┆ 698.0 │ │ null_count ┆ 0.0 ┆ 0.0 ┆ 0.0 │ │ mean ┆ 0.1862 ┆ 0.17764 ┆ 0.183156 │ │ std ┆ null ┆ 0.171547 ┆ 0.175332 │ │ min ┆ 0.0 ┆ -0.104417 ┆ -0.080481 │ │ 25% ┆ null ┆ 0.058701 ┆ 0.060286 │ │ 50% ┆ null ┆ 0.12441 ┆ 0.125982 │ │ 75% ┆ null ┆ 0.243941 ┆ 0.256987 │ │ max ┆ 1.0 ┆ 1.002446 ┆ 0.902305 │ └────────────┴────────────────┴──────────────┴────────────────┘
shape: (9, 4) ┌────────────┬────────────────┬──────────────┬────────────────┐ │ statistic ┆ has_disability ┆ Model (yhat) ┆ Imputed (yhat) │ │ --- ┆ --- ┆ --- ┆ --- │ │ str ┆ f64 ┆ f64 ┆ f64 │ ╞════════════╪════════════════╪══════════════╪════════════════╡ │ count ┆ 5000.0 ┆ 5000.0 ┆ 698.0 │ │ null_count ┆ 0.0 ┆ 0.0 ┆ 0.0 │ │ mean ┆ 0.1862 ┆ 0.17764 ┆ 0.183156 │ │ std ┆ null ┆ 0.171547 ┆ 0.175332 │ │ min ┆ 0.0 ┆ -0.104417 ┆ -0.080481 │ │ 25% ┆ null ┆ 0.058701 ┆ 0.060286 │ │ 50% ┆ null ┆ 0.12441 ┆ 0.125982 │ │ 75% ┆ null ┆ 0.243941 ┆ 0.256987 │ │ max ┆ 1.0 ┆ 1.002446 ┆ 0.902305 │ └────────────┴────────────────┴──────────────┴────────────────┘
error=pmm: donating observed value(s) ['has_disability'] from 10-nearest matched donors
Finding 10 nearest neighbors on ['___prediction']
Randomly picking one and donating ['has_disability']
Most common matches:
shape: (5, 2) ┌───────────┬─────────┐ │ person_id ┆ nDonors │ │ --- ┆ --- │ │ i16 ┆ i8 │ ╞═══════════╪═════════╡ │ 899 ┆ 3 │ │ 163 ┆ 2 │ │ 326 ┆ 2 │ │ 339 ┆ 2 │ │ 377 ┆ 2 │ └───────────┴─────────┘
Post-imputation statistics for ['has_disability']
Where: None
Where (impute): col(___imp_missing_has_disability_2)
┌────────────────┬─────────┬──────┬──────────────┬────────┬────────┬──────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┬─────────────┐ │ Variable ┆ Imputed ┆ n ┆ n (not null) ┆ mean ┆ std ┆ mean (not 0) ┆ std (not 0) ┆ q10 (not 0) ┆ q25 (not 0) ┆ q50 (not 0) ┆ q75 (not 0) ┆ q90 (not 0) ┆ min (not 0) ┆ max (not 0) │ ╞════════════════╪═════════╪══════╪══════════════╪════════╪════════╪══════════════╪═════════════╪═════════════╪═════════════╪═════════════╪═════════════╪═════════════╪═════════════╪═════════════╡ │ has_disability ┆ ┆ 5698 ┆ 5698 ┆ 0.1853 ┆ 0.3886 ┆ 1 ┆ 0 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 │ │ has_disability ┆ 0 ┆ 5000 ┆ 5000 ┆ 0.1862 ┆ 0.3893 ┆ 1 ┆ 0 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 │ │ has_disability ┆ 1 ┆ 698 ┆ 698 ┆ 0.1791 ┆ 0.3837 ┆ 1 ┆ 0 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 ┆ 1 │ └────────────────┴─────────┴──────┴──────────────┴────────┴────────┴──────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┴─────────────┘
income
has_disability
Final Estimates by Iteration
Removing existing directory C:\Users\jonro\OneDrive\Documents\Coding\survey_kit\.scratch\temp_files/tutorial_simple_model_getting_started.srmi/3.srmi.implicate
In [6]:
logger.info("Look at one completed implicate")
_ = srmi.df_implicates.pipe(summary)
Look at one completed implicate
┌─────────────────┬───────┬─────────────┬───────────────┬──────────────┬──────────────┬───────────────┐ │ Variable ┆ n ┆ n (missing) ┆ mean ┆ std ┆ min ┆ max │ ╞═════════════════╪═══════╪═════════════╪═══════════════╪══════════════╪══════════════╪═══════════════╡ │ person_id ┆ 5,000 ┆ 0 ┆ 2,499.5 ┆ 1,443.520003 ┆ 0.0 ┆ 4,999.0 │ │ age ┆ 5,000 ┆ 0 ┆ 53.6372 ┆ 20.60971 ┆ 18.0 ┆ 89.0 │ │ education_years ┆ 5,000 ┆ 0 ┆ 13.5238 ┆ 3.46194 ┆ 8.0 ┆ 19.0 │ │ income ┆ 5,000 ┆ 0 ┆ 40,143.741992 ┆ 9,741.858426 ┆ 6,435.355391 ┆ 73,924.778328 │ │ has_disability ┆ 5,000 ┆ 0 ┆ 0.1902 ┆ 0.392498 ┆ 0.0 ┆ 1.0 │ └─────────────────┴───────┴─────────────┴───────────────┴──────────────┴──────────────┴───────────────┘
┌─────────────────┬───────┬─────────────┬───────────────┬──────────────┬──────────────┬───────────────┐ │ Variable ┆ n ┆ n (missing) ┆ mean ┆ std ┆ min ┆ max │ ╞═════════════════╪═══════╪═════════════╪═══════════════╪══════════════╪══════════════╪═══════════════╡ │ person_id ┆ 5,000 ┆ 0 ┆ 2,499.5 ┆ 1,443.520003 ┆ 0.0 ┆ 4,999.0 │ │ age ┆ 5,000 ┆ 0 ┆ 53.6372 ┆ 20.60971 ┆ 18.0 ┆ 89.0 │ │ education_years ┆ 5,000 ┆ 0 ┆ 13.5238 ┆ 3.46194 ┆ 8.0 ┆ 19.0 │ │ income ┆ 5,000 ┆ 0 ┆ 40,140.109014 ┆ 9,723.732023 ┆ 6,435.355391 ┆ 73,924.778328 │ │ has_disability ┆ 5,000 ┆ 0 ┆ 0.1922 ┆ 0.394069 ┆ 0.0 ┆ 1.0 │ └─────────────────┴───────┴─────────────┴───────────────┴──────────────┴──────────────┴───────────────┘
┌─────────────────┬───────┬─────────────┬───────────────┬──────────────┬──────────────┬───────────────┐ │ Variable ┆ n ┆ n (missing) ┆ mean ┆ std ┆ min ┆ max │ ╞═════════════════╪═══════╪═════════════╪═══════════════╪══════════════╪══════════════╪═══════════════╡ │ person_id ┆ 5,000 ┆ 0 ┆ 2,499.5 ┆ 1,443.520003 ┆ 0.0 ┆ 4,999.0 │ │ age ┆ 5,000 ┆ 0 ┆ 53.6372 ┆ 20.60971 ┆ 18.0 ┆ 89.0 │ │ education_years ┆ 5,000 ┆ 0 ┆ 13.5238 ┆ 3.46194 ┆ 8.0 ┆ 19.0 │ │ income ┆ 5,000 ┆ 0 ┆ 40,360.822393 ┆ 9,743.867376 ┆ 6,435.355391 ┆ 73,924.778328 │ │ has_disability ┆ 5,000 ┆ 0 ┆ 0.1892 ┆ 0.391707 ┆ 0.0 ┆ 1.0 │ └─────────────────┴───────┴─────────────┴───────────────┴──────────────┴──────────────┴───────────────┘