Skip to main content

End-to-end machine learning on your desktop or server.

Project description

pre-alpha


Mission

  • Automated
    AIdb is an autoML tool that keeps track of the moving parts of machine learning (model tuning, feature selection, dataset splitting, and cross validation) so that data scientists can perform best practice ML without the coding overhead.

  • Local-first
    We empower non-cloud users (academic/ institute HPCs, private cloud companies, desktop hackers, or even remote server SSH'ers) with the same quality ML services as present in public clouds (e.g. SageMaker).

  • Integrated
    We don’t force your entire workflow into the confines of a GUI app or specific IDE because we integrate with your existing code.

Functionality:

  • Calculates and saves model metrics in a local SQLite file.
  • Visually compare model metrics to find the best model.
  • Queue for hypertuning jobs and batches.
  • Treats cross-validated splits (k-fold) and validation sets (3rd split) as first-level citizens.
  • Feature engineering to select the most informative columns.
  • If you need to scale (data size, training time) just switch to cloud_queue=True.

Installation:

Requires Python 3+. You will only need to perform these steps the first time you use the package.

Enter the following commands one-by-one and follow any instructions returned by the command prompt to resolve errors should they arise.

Starting from the command line:

$ pip install --upgrade pydatasci
$ python

Once inside the Python shell:

>>> import pydatasci as pds
>>> pds.create_folder()
>>> pds.create_config()
>>> from pydatasci import aidb
>>> aidb.create_db()

PyDataSci makes use of the Python package, appdirs, for an operating system (OS) agnostic location to store configuration and database files. This not only keeps your $HOME directory clean, but also helps prevent careless users from deleting your database.

The installation process checks not only that the corresponding appdirs folder exists on your system but also that you have the permissions neceessary to read from and write to that location. If these conditions are not met, then you will be provided instructions during the installation about how to create the folder and/ or grant yourself the appropriate permissions.

We have attempted to support both Windows (icacls permissions and backslashes C:\\) as well as POSIX including Mac and Linux (chmod letters permissions and slashes /). Note: due to variations in the ordering of appdirs author and app directories in different OS', we do not make use of the appdirs appauthor directory, only the appname directory.

If you run into trouble with the installation process on your OS, please submit a GitHub issue so that we can attempt to resolve, document, and release a fix as quickly as possible.

Installation Location Based on OS
appdir.user_data_dir('pydatasci'):

  • Mac:
    /Users/Username/Library/Application Support/pydatasci

  • Linux - Alpine and Ubuntu:
    /root/.local/share/pydatasci

  • Windows:
    C:\Users\Username\AppData\Local\pydatasci

create_db() is equivalent to a migration in Django in that it creates the tables found in the Object Relational Model (ORM). We use the peewee ORM as it is simpler than SQLAlchemy, has good documentation, and found the project to be actively maintained (saw same-day GitHub response to issues on a Saturday). With the addition of Dash-Plotly, this will make for a full-stack experience that also works directly in an IDE like Jupyter or VS Code.

Deleting & Recreating the Database:

When deleting the database, you need to either reload the aidb module or restart the Python shell before you can attempt to recreate the database.

>>> from pydatasci import aidb
>>> aidb.delete_db(True)
>>> from importlib import reload
>>> reload(aidb)
>>> create_db()

Usage

Let's get started.

import pydatasci as pds
from pydatasci import aidb

1. Add a Dataset.

Supported tabular file formats include: CSV, TSV, Apache Parquet. At this point in the project, our Parquet support is extremely minimal.

The bytes of the file will be stored as a BlobField in the SQLite database file. Storing the data in the database not only (a) provides an entity that we can use to keep track of experiments and link relational data to but also (b) makes the data less mutable than keeping it in the open filesystem.

aidb.Dataset.create_from_file(
	path 			= 'iris.tsv'
	,file_format 	= 'tsv'
	,name			= 'tab-separated plants'
	,perform_gzip 	= True
)

You can choose whether or not you want to gzip compress the file when importing it with the perform_gzip=bool parameter. This compression not only enables you to store up to 90% more data on your local machine, but also helps overcome the maximum BlobField size of 2.147 GB. We handle the zipping and unzipping on the fly for you, so you don't even notice it.

Fetch a Dataset.

Supported in-memory formats include: NumPy Structured Array and Pandas DataFrame.

df = aidb.Dataset.read_to_pandas(id=1)
df.head()

arr = aidb.Dataset.read_to_numpy(id=1)
arr[:4]

We chose structured array because it keeps track of column names. For the sake of simplicity, we are reading into NumPy via Pandas. If we want to revert to a simpler ndarray in the future, then we won't have to rewrite the function to read NumPy.

2. Derive a Label from a Dataset column.

From a Dataset, pick a column that you want to train against/ predict. If you are planning on training an unsupervised model, then you don't need to do this.

aidb.Label.create_from_dataset(dataset_id=1, column_name='target')

3. Derive a Featureset of columns from a Dataset.

This won't duplicate your data, but rather it simply denotes the column_names to be used in training.

d = aidb.Dataset.get_by_id(1)

a) Supervisedset for a set of features tied to an existing Label that you want to predict.

l = aidb.Label.get_by_id(1)

# Easy mode:
aidb.Supervisedset.create_all_columns_except_label(
	dataset_id=d.id
	,label_id=l.id
)

# Or if you have already selected specific features:
aidb.Supervisedset.create_from_dataset(
	dataset_id=d.id
	,label_id=l.id
	,column_names=['petal width (cm)', 'petal length (cm)']
)

b) Unsupervisedset for a set of features whose variance you want to understand irrespective of a Label.

Feature selection is about finding out which columns in your data are most important. In performing feature engineering, a data scientist reduces the dimensionality of the data by determining the effect each feature has on the variance of the data. This makes for simpler models in the form of faster training and reduces overfitting by making the model more generalizable to future data.

# Easy mode:
aidb.Unsupervisedset.create_from_dataset_columns(
	dataset_id=d.id,
	column_names=['petal width (cm)']
)

# # Or if you want to specify columns:
aidb.Unsupervisedset.create_all_columns(dataset_id=d.id)

4. Split the Dataset rows into Splitsets based on how you want to train, test, and validate your models.

5. Create an Algorithm aka model to fit to your splits.

6. Create combinations of hyperparameters for your algorithms.

7. Jobs will automatically be created for each of your splits and paramsets.


PyPI Package

Steps to Build & Upload:

$ pip3 install --upgrade wheel twine
$ python3 setup.py sdist bdist_wheel
$ python3 -m twine upload --repository pypi dist/*
$ rm -r build dist pydatasci.egg-info
# proactively update the version number in setup.py next time
$ pip install --upgrade pydatasci; pip install --upgrade pydatasci

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pydatasci-0.0.45.tar.gz (12.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pydatasci-0.0.45-py3-none-any.whl (22.9 kB view details)

Uploaded Python 3

File details

Details for the file pydatasci-0.0.45.tar.gz.

File metadata

  • Download URL: pydatasci-0.0.45.tar.gz
  • Upload date:
  • Size: 12.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.7.6

File hashes

Hashes for pydatasci-0.0.45.tar.gz
Algorithm Hash digest
SHA256 43f020b1dac04329c699c2a831553d704f79473083df8fbd285861cce2e95cc9
MD5 99fcdd8d94db47b468e23eab9d2cadde
BLAKE2b-256 2b463bab645d3202c85def381f2afe9522d1495e4b3c2f0173166c2c6498ff9e

See more details on using hashes here.

File details

Details for the file pydatasci-0.0.45-py3-none-any.whl.

File metadata

  • Download URL: pydatasci-0.0.45-py3-none-any.whl
  • Upload date:
  • Size: 22.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.7.6

File hashes

Hashes for pydatasci-0.0.45-py3-none-any.whl
Algorithm Hash digest
SHA256 32e6a837153c1d7dd49a581e899d375752d6d4848bf72d61adca836496a6a0ad
MD5 922c7cc67c1b69d4086a67ad25eab735
BLAKE2b-256 a662caf47a34ba8c9bfe2cc30f6b8622c9099ea36af26f7a7755df826e0fdb73

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page