Giter Site home page Giter Site logo

animator / titus2 Goto Github PK

View Code? Open in Web Editor NEW
23.0 6.0 2.0 8.16 MB

Titus 2 : Portable Format for Analytics (PFA) implementation for Python 3.4+

Home Page: https://realworldpython.github.io/titus2/

License: Apache License 2.0

Python 95.81% PostScript 4.19%
pfa titus python scoring-engine pfa-standard scoring inference inference-engine analytics pmml

titus2's Introduction

titus2 logo

PyPI - Python Version PyPI version Maintenance GitHub

Project Documentation - Link

Data Scientist: Why is my cutting edge model still not in production?

Scenario 1:

IT Team: We are still implementing the scoring engine in Go/Java/C++.

Scenario 2:

IT Team: We are still figuring out how to read the model.pkl file you provided.

. .

and the push to production pang continues ..

New Features!

Changes in titus2 v1.2.1

View the complete changelog here.

Titus 2 - Portable Format for Analytics (PFA) implementation for Python 3.4-3.9

Titus 2 is a fork of the original Titus python library which resides in the (now defunct) Hadrian repository. Titus is not actively maintained by the Open Data Group and only supports Python 2, so this fork was created to actively support its development for Python 3.

Titus 2 is a complete, independent implementation of Portable Format for Analytics (PFA) in pure Python. PFA is a specification for scoring/inference engines: event-based processors that perform predictive or analytic calculations. It is a model interchange format which helps smoothen the transition from statistical model development to large-scale and/or online production. titus2 also focuses on model development, so it includes model producers and PFA manipulation tools in addition to runtime execution (scoring) engine.

Requirements

Titus 2 uses a number of open source projects to work properly:

  • avro-python3 >= 1.8.2
  • numpy == 1.14.0 (python 3.4 & 3.5) or numpy >=1.15.0, <1.20 (python 3.6+)
  • pytz >= 2019.1
  • pyyaml >= 5.1.2
  • ply >= 3.11

The above packages are available via pip and are automatically installed during setup.

Installation

Titus requires Python 3.4+ to run. It can be installed via pip/pip3 as follows:

$ pip install titus2

or you can directly install the latest build from github repository via

$ pip install git+https://github.com/animator/titus2.git

After installation please run the following elementary example in python

from titus.genpy import PFAEngine

pfa = {"input": "double",
 "output": "double",
 "action": [
   {"+": ["input", 100]}
 ]}
engine, = PFAEngine.fromJson(pfa)

l = [1.0, 2.0, 3.0, 4.0, 5.0]

for num in l:
    print(num, engine.action(num))

User Guide and Tutorials

See the Project Documentation for user guide and tutorials.

Current Testing Framework

To run the tests, you can execute

python3 setup.py test

To generate the coverage report, you can execute

pip3 install coverage
coverage run setup.py test
coverage report

Testing Status:

  • Unit testing status available here Build Status
  • Conformance testing status available here Build Status

Issues, Questions and Feature Requests

Please raise an issue/question/request here.

Development

Want to contribute? Great!

Please raise an issue to discuss your ideas and send a pull request.

Todos

  • Write MORE Tests for scripts/*.
  • Add scikit-learn model export to PFA tutorials.

titus2's People

Contributors

animator avatar collinbennett avatar jpivarski avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

titus2's Issues

ordering in map.zipmap

based on PFA spec 0.8.1, map.zipmap should be order-agnostic (unlike a.zipmap). However, it appears that both titus2 require the maps in the parameter to have the same order of keys. Ordering of keys are not easily preserved. A simple map.map could shuffle key order. No straight forward workaround is available, as there is no native sorting function in the map manipulation library.

pfa from scikit learn

Hi
is is possible to convert a trained scikit learn model to pfa? I see the following in your todo list: "Add scikit-learn model export to PFA tutorials". That means it's there?
thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.