Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel
Integration:  dvc git github
cd38f6c9a1
predict with file
2 years ago
9504630970
change model to processors
2 years ago
69faac688d
change drop columns to keep columns
2 years ago
src
9504630970
change model to processors
2 years ago
f6390cde33
finish segmentation
2 years ago
f9683ecc9c
Initialize DVC
2 years ago
de52079bda
add processed functions
2 years ago
52bf9b6eea
deploy bentoml model
2 years ago
cb55891ad4
add scaler
2 years ago
8a2c4c99cc
fix readme and dependencies
2 years ago
9504630970
change model to processors
2 years ago
40742fa840
rename config files
2 years ago
52bf9b6eea
deploy bentoml model
2 years ago
6ee4126d21
change dvc files
2 years ago
9504630970
change model to processors
2 years ago
6ee4126d21
change dvc files
2 years ago
9504630970
change model to processors
2 years ago
de52079bda
add processed functions
2 years ago
Storage Buckets
Data Pipeline
Legend
DVC Managed File
Git Managed File
Metric
Stage File
External File

README.md

You have to be logged in to leave a comment. Sign In

End-to-end Customer Segmentation Project

Dataset

The data is downloaded from Kaggle.

Tools Used in This Project

  • Prefect: Orchestrate workflows
  • hydra: Manage configuration files
  • pre-commit plugins: Automate code reviewing formatting
  • poetry: Python dependency management
  • DVC: Data version control
  • BentoML: Deploy and serve machine learning models

Project Structure

  • src: consists of Python scripts
  • config: consists of configuration files
  • notebook: consists of Jupyter Notebooks
  • tests: consists of test files

Set Up the Project

  1. Install Poetry
  2. Set up the environment:
make setup
  1. To persist the output of Prefect's flow, run
export PREFECT__FLOWS__CHECKPOINTING=true

Run the Project

To run all flows, type:

python src/main.py

To run the process flow, type:

python src/main.py flow=process

To run the segment flow, type:

python src/main.py flow=segment

Serve Machine Learning Models with BentoML

To serve the trained model, run:

bentoml serve src/bentoml_app.py:service --reload

To send requests to the newly started service in Python, run:

python src/predict.py

Details of predict.py:

import requests

prediction = requests.post(
    "http://127.0.0.1:5000/predict",
    headers={"content-type": "application/json"},
    data='{"Income": 58138, "Recency": 58,"MntWines": 635,"MntFruits": 88,"MntMeatProducts": 546,"MntFishProducts": 172,"MntSweetProducts": 88,"MntGoldProds": 88,"Complain": 0,"Response": 1,"age": 64,"enrollment_years": 10,"family_size": 1}',
).text

print(prediction)

Output:

2
Tip!

Press p or to see the previous file or, n or to see the next file

About

End-to-end Customer Segmentation Project using
Prefect, hydra, Weights & Biases, pre-commit, poetry, DVC, and BentoML

Collaborators 1

Comments

Loading...