{ "info": { "author": "ASI Data Science", "author_email": "engineering@asidatascience.com", "bugtrack_url": null, "classifiers": [], "description": "sherlockml-boltzmannclean\n=========================\n\nFill missing values in a pandas DataFrame using a Restricted Boltzmann Machine.\n\nProvides a class implementing the scikit-learn transformer interface for creating and training a Restricted Boltzmann Machine. This can then be sampled from to fill in missing values in training data or new data of the same format. Utility functions for applying the transformations to a pandas DataFrame are provided, with the option to treat columns as either continuous numerical or categorical features.\n\nInstallation\n------------\n\n.. code-block:: bash\n\n pip install sherlockml-boltzmannclean\n\n\nUsage\n-----\n\nTo fill in missing values from a DataFrame with the minimum of fuss, a cleaning function is provided.\n\n.. code-block:: python\n\n import boltzmannclean\n\n my_clean_dataframe = boltzmannclean.clean(\n dataframe=my_dataframe,\n numerical_columns=['Height', 'Weight'],\n categorical_columns=['Colour', 'Shape'],\n tune_rbm=True # tune RBM hyperparameters for my data\n )\n\nTo create and use the underlying scikit-learn transformer.\n\n.. code-block:: python\n\n my_rbm = boltzmannclean.RestrictedBoltzmannMachine(\n n_hidden=100, learn_rate=0.01,\n batchsize=10, dropout_fraction=0.5, max_epochs=1,\n adagrad=True\n )\n\n my_rbm.fit_transform(a_numpy_array)\n\nHere the default RBM hyperparameters are those listed above, and the numpy array operated on is expected to be composed entirely of numbers in the range [0,1] or np.nan/None. The hyperparameters are:\n\n- *n_hidden*: the size of the hidden layer\n- *learn_rate*: learning rate for stochastic gradient descent\n- *batchsize*: batchsize for stochastic gradient descent\n- *dropout_fraction*: fraction of hidden nodes to be dropped out on each backward pass during training\n- *max_epochs*: maximum number of passes over the training data\n- *adagrad*: whether to use the Adagrad update rules for stochastic gradient descent\n\nExample\n-------\n\n.. code-block:: python\n\n import boltzmannclean\n import numpy as np\n import pandas as pd\n from sklearn import datasets\n\n iris = datasets.load_iris()\n\n df_iris = pd.DataFrame(iris.data,columns=iris.feature_names)\n df_iris['target'] = pd.Series(iris.target, dtype=str)\n\n df_iris.head()\n\n= ================= ================ ================= ================ ======\n_ sepal length (cm) sepal width (cm) petal length (cm) petal width (cm) target\n= ================= ================ ================= ================ ======\n0 5.1 3.5 1.4 0.2 0\n1 4.9 3.0 1.4 0.2 0\n2 4.7 3.2 1.3 0.2 0\n3 4.6 3.1 1.5 0.2 0\n4 5.0 3.6 1.4 0.2 0\n= ================= ================ ================= ================ ======\n\n\nAdd some noise:\n\n.. code-block:: python\n\n noise = [(0,1),(2,0),(0,4)]\n\n for noisy in noise:\n df_iris.iloc[noisy] = None\n\n df_iris.head()\n\n= ================= ================ ================= ================ ======\n_ sepal length (cm) sepal width (cm) petal length (cm) petal width (cm) target\n= ================= ================ ================= ================ ======\n0 5.1 NaN 1.4 0.2 None\n1 4.9 3.0 1.4 0.2 0\n2 NaN 3.2 1.3 0.2 0\n3 4.6 3.1 1.5 0.2 0\n4 5.0 3.6 1.4 0.2 0\n= ================= ================ ================= ================ ======\n\nClean the DataFrame:\n\n.. code-block:: python\n\n df_iris_cleaned = boltzmannclean.clean(\n dataframe=df_iris,\n numerical_columns=[\n 'sepal length (cm)', 'sepal width (cm)',\n 'petal length (cm)', 'petal width (cm)'\n ],\n categorical_columns=['target'],\n tune_rbm=True\n )\n\n df_iris_cleaned.round(1).head()\n\n\n= ================= ================ ================= ================ ======\n_ sepal length (cm) sepal width (cm) petal length (cm) petal width (cm) target\n= ================= ================ ================= ================ ======\n0 5.1 3.3 1.4 0.2 0\n1 4.9 3.0 1.4 0.2 0\n2 6.3 3.2 1.3 0.2 0\n3 4.6 3.1 1.5 0.2 0\n4 5.0 3.6 1.4 0.2 0\n= ================= ================ ================= ================ ======\n\nThe larger and more correlated the dataset is, the better the imputed values will be.", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://sherlockml.com", "keywords": "", "license": "Apache 2.0", "maintainer": "", "maintainer_email": "", "name": "sherlockml-boltzmannclean", "package_url": "https://pypi.org/project/sherlockml-boltzmannclean/", "platform": "", "project_url": "https://pypi.org/project/sherlockml-boltzmannclean/", "project_urls": { "Homepage": "https://sherlockml.com" }, "release_url": "https://pypi.org/project/sherlockml-boltzmannclean/0.1.2/", "requires_dist": null, "requires_python": "", "summary": "Fills missing values in a pandas DataFrame using a Restricted Boltzmann Machine.", "version": "0.1.2" }, "last_serial": 3710376, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "f1df4a39dabf3af9f098d3c6cc1c4bde", "sha256": "75f6af442ece51bf9bdb28e59a9f250d8c80f4fd6150678e533d31e4278ddee3" }, "downloads": -1, "filename": "sherlockml-boltzmannclean-0.1.0.tar.gz", "has_sig": false, "md5_digest": "f1df4a39dabf3af9f098d3c6cc1c4bde", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6669, "upload_time": "2018-03-23T13:23:09", "url": "https://files.pythonhosted.org/packages/c2/71/f51e75774a3429c2fecf86ef19b7eb43cb458268a08293183399e80d54f8/sherlockml-boltzmannclean-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "b87ce9c908f6f622518bd0b06252ccf2", "sha256": "afd223e4d06b345c0f71674048efe42b82096a22f2d86e1fcae3f57dc3c35691" }, "downloads": -1, "filename": "sherlockml-boltzmannclean-0.1.1.tar.gz", "has_sig": false, "md5_digest": "b87ce9c908f6f622518bd0b06252ccf2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6587, "upload_time": "2018-03-23T13:40:50", "url": "https://files.pythonhosted.org/packages/9c/69/9b9cf231d40d67b82484f455276868a01d961f5f9411394d8b120e1ad38e/sherlockml-boltzmannclean-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "64374ebdc30e8dc6d26c455e12d7749f", "sha256": "0c028e9f8a67fac787587c20e24ef69792899d1c76e1313515518a9aff0f57ed" }, "downloads": -1, "filename": "sherlockml-boltzmannclean-0.1.2.tar.gz", "has_sig": false, "md5_digest": "64374ebdc30e8dc6d26c455e12d7749f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6773, "upload_time": "2018-03-27T14:12:01", "url": "https://files.pythonhosted.org/packages/f1/39/61996745b73da8786eeab4bccb31f7cfbefe9ee1d22b2ebe5e92a4f51611/sherlockml-boltzmannclean-0.1.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "64374ebdc30e8dc6d26c455e12d7749f", "sha256": "0c028e9f8a67fac787587c20e24ef69792899d1c76e1313515518a9aff0f57ed" }, "downloads": -1, "filename": "sherlockml-boltzmannclean-0.1.2.tar.gz", "has_sig": false, "md5_digest": "64374ebdc30e8dc6d26c455e12d7749f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6773, "upload_time": "2018-03-27T14:12:01", "url": "https://files.pythonhosted.org/packages/f1/39/61996745b73da8786eeab4bccb31f7cfbefe9ee1d22b2ebe5e92a4f51611/sherlockml-boltzmannclean-0.1.2.tar.gz" } ] }