Price predictions for 3DHubs
Project description
Price Prediction
Start Predicting
-
Install the package:
pip install hubs-predictor
-
How to Use:
from hubs_predictor import predict_batch, predict_from_csv # IP = 'localhost' if the container is running locally IP = '164.52.192.139' # Hosted in my private server for quick testing # Predict using CSV file: csv_path = '/PATH/TO/YOUR/CSV/FILE.csv' result = predict_from_csv(csv_path, ip=IP) # Predict as list batches # input format should be list of list [[], []] # eg: data = [['2015-01-09 23:15:03.308', 'cart__4', '27.917', '86.632', '11.022', '247384.01', ....., 'supplier__054'], # ['2015-01-10 24:15:03.308', 'cart__5', '17.917', '76.632', '10.022', '147384.01', ....., 'supplier__055']] data = [[value1, value2, ...., value16], [value1, value2, ...., value16]] result = predict_batch(data, ip=IP) # NOTE: The input data both `csv_file` and `data` should be in the same feature sequence provided in the 'assignment-data.csv' # i.e: ['timestamp', 'cart', 'geometry/bounding_box/depth', 'geometry/bounding_box/width', ......., 'sourcing/supplier_country', 'sourcing/supplier'] # which is 16 columns excluding `target/price`, if `target/price` is provided, it will be ignored internally.
To build and setup local conatiner please check Replicate / Reproduce Whole Process see below.
Replicate / Reproduce Whole Process
Training Process
-
Pre-requirements:
- Install conda: link
- Install MLFlow:
pip install mlflow
-
Extract Data:
assignment-data.zip
totrain/data/
unzip assignment-data.zip -d train/data/
-
Run Mlflow UI server to track the training experiments:
cd train/ mlflow server --backend-store-uri ./mlruns/ & # open 'http://localhost:5000/' to see the experiments # To stop mlflow server use `pkill -f mlflow`
-
Train:
# working dir: "ml-engineer-assignment-bendangnuksung/train/" # (OPTIONAL) modify "train/MLproject" file, update parameters such as: # 'datapath' -> path to your data CSV file # 'kfolds' -> N kfolds you want # 'lr' -> Set your own learning rate # Run training mlflow run --experiment-name hubs_price_prediction .
Deployment Process
-
Pre-requirements:
- Install Docker. Link
- Install Docker Compose:
pip install docker-compose
-
Build and Start Docker:
# working dir: "ml-engineer-assignment-bendangnuksung/" # (OPTIONAL) Modify "docker-compose.yml" if: # 1. Wants to change PORT # 2. Change the volumes if model stored in different directory. (Default is: "./train/models" because models are stored there after training) docker-compose up
-
Building package (Optional):
# modify setup.py accordingly python setup.py sdist python setup.py bdist_wheel twine check dist/* twine upload dist/*
Now the docker container is Up and Running, you can run the models locally. Just assign IP = 'localhost'
from hubs_predictor import predict_batch, predict_from_csv
IP = 'localhost'
csv_path = '/PATH/TO/YOUR/CSV/FILE.csv'
result = predict_from_csv(csv_path, ip=IP)
result = predict_batch(data, ip=IP)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
hubs_predictor-0.1.1.tar.gz
(4.5 kB
view hashes)
Built Distribution
Close
Hashes for hubs_predictor-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0a9b2ba048407123e33dab1c70f9c1c2c8a8da5b50f89f7b19680f938a767cf0 |
|
MD5 | f79b7f17285e0b15a15386994654ef02 |
|
BLAKE2b-256 | ffb5324870384ab651b27c6a2c4fcb18c42c619c9531ea7a53ce388ce68b3ca4 |