A Python gRPC framework for serving a machine learning module written in Python.


Keywords
Rekcurd, Kubernetes, drucker, grpc, ml
License
Apache-2.0
Install
pip install rekcurd==1.0.1.post1

Documentation

Rekcurd

Build Status PyPI version codecov pypi supported versions

Rekcurd is the Project for serving ML module. This is a gRPC micro-framework and it can be used like Django and Flask.

Parent Project

https://github.com/rekcurd/community

Components

Installation

From source:

$ git clone --recursive https://github.com/rekcurd/rekcurd-python.git
$ cd rekcurd-python
$ pip install -e .

From PyPi directly:

$ pip install rekcurd

How to use

Example is available here. You can generate Rekcurd template and implement necessary methods.

$ rekcurd startapp {Your application name}
$ cd {Your application name}
$ vi app.py
$ python app.py

Unittest

$ python -m unittest

Kubernetes support

Rekcurd can be run on Kubernetes. See community repository.

Type definition

PredictLabel type

V is the length of feature vector.

Field Type Description
input
(required)
One of below
- string
- bytes
- string[V]
- int[V]
- double[V]
Input data for inference.
- "Nice weather." for a sentiment analysis.
- PNG file for an image transformation.
- ["a", "b"] for a text summarization.
- [1, 2] for a sales forcast.
- [0.9, 0.1] for mnist data.
option string Option field. Must be json format.

The "option" field needs to be a json format. Any style is Ok but we have some reserved fields below.

Field Type Description
suppress_log_input bool True: NOT print the input and output to the log message.
False (default): Print the input and outpu to the log message.
YOUR KEY any YOUR VALUE

PredictResult type

M is the number of classes. If your algorithm is a binary classifier, you set M to 1. If your algorithm is a multi-class classifier, you set M to the number of classes.

Field Type Description
label
(required)
One of below
-string
-bytes
-string[M]
-int[M]
-double[M]
Result of inference.
-"positive" for a sentiment analysis.
-PNG file for an image transformation.
-["a", "b"] for a multi-class classification.
-[1, 2] for a multi-class classification.
-[0.9, 0.1] for a multi-class classification.
score
(required)
One of below
-double
-double[M]
Score of result.
-0.98 for a binary classification.
-[0.9, 0.1] for a multi-class classification.
option string Option field. Must be json format.

EvaluateResult type

EvaluateResult is the evaluation score. N is the number of evaluation data. M is the number of classes. If your algorithm is a binary classifier, you set M to 1. If your algorithm is a multi-class classifier, you set M to the number of classes.

Field Type Description
num
(required)
int Number of evaluation data.
accuracy
(required)
double Accuracy.
precision
(required)
double[M] Precision.
recall
(required)
double[M] Recall.
fvalue
(required)
double[M] F1 value.

EvaluateDetail type

EvaluateDetail is the details of evaluation result.

Field Type Description
result
(required)
PredictResult Prediction result.
is_correct
(required)
bool Correct or not.