Package: input-checker
input_checkerTheinput_checkerpackage enables users to compare a given data frame against a benchmark data frame.
The package executes that by keeping track of the key information in the benchmark data frame and
cross-checking the comparison data frame against those tracked characteristics.The package currently contains five main checks;Null checker:ensures that columns with missing values in the benchmark data frame
are the only columns with missing values in the comparison data frameDtype checker:ensures that columns in the comparison data frame are of the same data type as
in the benchmark data frameCategorical value checker:ensures that categorical columns in the comparison data frame only contain
values that exist in the benchmark data frameNumerical checker:ensures that the values of the numerical columns in
the comparison data frame lie within the minimum and maximum range of the numerical columns
in the benchmark data frameDatetime checker:ensures that the values of datetime columns in the
comparison data frame lie beyond the minimum date (optionally maximum) of datetime columns
in the benchmark data frameThe package has multiple usage areas including but not limited to ensuring that data points
sent to the model in live environment matches key characteristics of the data the model was
initially trained on.Here is a simple example of using input_checker to compare training data to test data;importpandasaspdfromsklearn.datasetsimportload_winefromsklearn.model_selectionimporttrain_test_splitimportinput_checkerfrominput_checker.checkerimportInputChecker# load and prepare sklearn wine datasetwine=load_wine()df_wine=pd.DataFrame(wine['data'],columns=wine['feature_names'])df_wine['target']=wine['target']# split into train/test setsdf_train,df_test=train_test_split(df_wine,test_size=0.2)# define numerical columns# please note; the original wine dataset only has numerical fields# please refer to the example notebook under the examples folder for# using input_checker with different dtypes and missing valuesnumerical_columns=['alcohol','malic_acid','ash','alcalinity_of_ash','magnesium','total_phenols','flavanoids','nonflavanoid_phenols','proanthocyanins','color_intensity','hue','od280/od315_of_diluted_wines','proline']# define input_checkerchecker=InputChecker(columns=numerical_columns,numerical_columns=numerical_columns)# fitting input_checkerchecker.fit(df_train)# compare test data frame to the training data framedf_test_checked=checker.transform(df_test)Installationinput_checker can be installed from PyPI simply with;pip install input_checkerDocumentationDocumentation for input_checker can be found onreadthedocs.ExamplesTo help get started there is an example notebook in theexamplesfolder that shows how to use input_checker.Build and testThe test framework we are using for this project ispytest, to run the tests follow the steps below.First clone the repo and move to the root directory;gitclonehttps://github.com/lvgig/input_checker.gitcdinput_checkerThen install input_checker in editable mode;pipinstall-e.-rrequirements-dev.txtThen run the tests simply with pytestpytestContributeinput_checkeris under active development, we're super excited if you're interested in contributing! See theCONTRIBUTING.mdfor the full details of our working practices.For bugs and feature requests please open anissue.