HotDeck

class geoanalytics.imputation.HotDeck.HotDeck(dataframe)[source]

Bases: object

About this algorithm

Description:

Hot Deck Imputation is a simple, non-parametric method for handling missing values by replacing each missing entry with a randomly selected observed value from the same column. This method is suitable for datasets where missing values are not patterned or large in volume.

Parameters:
  • Dataset (pandas DataFrame) must be provided during object initialization.

Attributes:
  • df (pd.DataFrame) – The input data with ‘x’, ‘y’ coordinates and features.

  • imputedDF (pd.DataFrame) – DataFrame after filling in missing values.

  • startTime, endTime (float) – Variables to track execution time.

  • memoryUSS, memoryRSS (float) – Memory usage of the imputation process in kilobytes.

Execution methods

Calling from a Python program

import pandas as pd

from geoanalytics.imputation import HotDeck

df = pd.read_csv("input.csv")

imputer = HotDeck(df)

imputed_df = imputer.run()

imputer.getRuntime()
imputer.getMemoryUSS()
imputer.getMemoryRSS()

imputer.save('HotDeck.csv')

Credits

This implementation was created by Raashika and revised by M.Charan Teja under the guidance of Professor Rage Uday Kiran.

getMemoryRSS()[source]

Prints the memory usage (RSS) of the process in kilobytes.

getMemoryUSS()[source]

Prints the memory usage (USS) of the process in kilobytes.

getRuntime()[source]

Prints the total runtime of the clustering algorithm.

run()[source]

Executes the Hot Deck Imputation algorithm by replacing missing values with randomly selected non-missing values from the same column.

Returns:

imputedDF (pd.DataFrame) – DataFrame with missing values filled

save(outputFile='HotDeck.csv')[source]

Saves the imputed DataFrame to a CSV file.

Parameters:

outputFile – str, filename to save the imputed data (default: ‘HotDeck.csv’)