Skip to main content

py_predpurchase

codecov

py_predpurchase is a package for predicting online shopper purchasing intentions, whether an online shopper will purchase their current browsing session or not. This package contains functions to aid with the data analysis processes including conducting data preprocessing as well as calculating classification metrics, cross-validation scores and feature importances.

Full Documentation hosted on Read the Docs: https://py-predpurchase.readthedocs.io/en/latest/index.html

Installation

$ pip install py_predpurchase

Usage

py_predpurchase can be used to:

  • Apply preprocessing transformations to the data, including scaling, encoding, and passing through features as specified.
  • Calculate the cross-validation results for four common off-the-shelf models (Dummy, KNN, SVM and RandomForests)
  • Fit a given model, extract feature importances, sort in descending order, and return them as a DataFrame.
  • Calculate the classification metrics for model predictions including precision, recall, accuracy and F1 scores.

Please refer to the 'Example usage' page on the Read the Docs package documentation for a step-by-step, demonstration of each function in this package.

Below is an example usage for one of our functions, calculate_classification_metrics

import numpy as np
from py_predpurchase.function_classification_metrics import calculate_classification_metrics

# dummy data
y_true = [1,0,1,1,1,0,0,1,0,1]
y_pred = [1,1,1,0,1,0,0,1,0,0]

# using the function
calculate_classification_metrics(y_true, y_pred)

Contributing

Interested in contributing? Check out the contributing guidelines. Please note that this project is released with a Code of Conduct. By contributing to this project, you agree to abide by its terms.

License

py_predpurchase was created by Nour Abdelfattah, Sana Shams, Calvin Choi, Sai Pusuluri. It is licensed under the terms of the MIT license.

Other packages

pandas: Pandas is an extensive tool for data manipulation, py_predpurchase specializes in applying machine learning with basic data manipulation, offering functionalities to utilize off-the-shelf machine learning models. When comparing it to something like the E-Commerce Tools Package, our use of pandas along with sklearn allows us to manipulate and analyze data in a more primitive setting. The E-Commerce Tools Package is catered more towards transactional data with tools and functions for stock management and ledger items. pandas provides a simpler solution suited for the dataset used in py_predpurchase as the dataset pertains to consumer behaviour and E-Commerce marketing metrics which are less sophisticated.

scikit-learn: Scikit-learn excels in model building, but py_predpurchase extends its offerings by providing advanced tools for interpreting model outcomes. Unlike scikit-learn's broader approach, our package includes specific methods for detailing the impact of each predictor on the purchasing decision, allowing for a deeper understanding of model dynamics and more accurate validation scores. py_predpurchase benefits from these specialized insights and improves your model's predictive performance in the context of online shopping.

Credits

py_predpurchase was created with cookiecutter and the py-pkgs-cookiecutter template.

Release files for py-predpurchase 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for py-predpurchase 0.2.0
File Size Uploaded
py_predpurchase-0.2.0.tar.gz 6.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for py-predpurchase 0.2.0
File Interpreter ABI Platform
py_predpurchase-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size:14.5 kB

Release files / py_predpurchase-0.2.0.tar.gz

Download URL py_predpurchase-0.2.0.tar.gz
Size 6.4 kB
Tags Source
SHA-256 checksum
How to use checksums
584bd0f3dd5f4cb21c1154af10adac2e06b7e67f5bbcd2b9ccdba57b21287380
BLAKE2b-256 checksum
How to use checksums
40fcd160d55a1cfaa8a0d8733497e02d583fc3429005ac0aaa6483ad020fce3c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.3

Release files / py_predpurchase-0.2.0-py3-none-any.whl

Download URL py_predpurchase-0.2.0-py3-none-any.whl
Size 8.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
efe81e48cc7481a687b3530f8289a0dcca88234b2062a9928caa0dffe42dbcbe
BLAKE2b-256 checksum
How to use checksums
a1cf4d3ef0405998d3cacf1344bf328fcc8ccffca4de94d1b99b49f0491e198a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page