Coder Social home page Coder Social logo

loudml-python's Introduction

Loud ML - Python

The Python client interface to the Loud ML model server.

Latest version released on PyPI Build status Test coverage License

Installation

loudml-python requires a running Loud ML model server . See Loud ML's quickstart for installation instructions.

loudml-python can be installed using pip similar to other Python packages. Do not use sudo with pip. It is usually good to work in a virtualenv or venv to avoid conflicts with other package managers and Python projects. For a quick introduction see Python Virtual Environments in Five Minutes.

To install loudml-python, simply:

$ pip install loudml-python

or from source:

$ python setup.py install

Getting Started

If you’ve installed loudml-python locally, the loudml command should be available via the command line. Executing loudml will start the CLI and automatically connect to the local Loud ML model server instance (assuming you have already started the server with systemctl start loudmld or by running loudmld directly). The output should look like this:

$ loudml
Connected to localhost:8077 version 1.6.0-577c87de
Loud ML shell 1.6.0-42136d38
>

You can get a description of the available commands:

> help

Client Classes: Loud and Job

The main helper in the Python client library is the Loud class. You can create an instance that connects to a remote Loud ML model server and run queries.

>>> from loudml_py.client import Loud
>>> loud = Loud(hosts=['localhost:8077'])
>>> models = loud.models.get(
        model_names=['first_model'],
        fields=['settings', 'state'],
        include_fields=True,
    )
>>> len(models)
1
>>> print(models[0]['state'])
{'trained': False}

Long running commands eg training return a job name. Use loudml.jobs.id(job_name) to create a class instance and then track the progress of the job or cancel it. loudml uses tqdm to display progress information.

def cancel_job_handler(*args):
    job.cancel()
    print('Signal received. Canceled job: ', job.id)
    sys.exit()

signal.signal(signal.SIGINT, cancel_job_handler)

while not job.done():
    time.sleep(1)
    job.fetch()

Data generator: loudml-wave

The loudml-wave tool is included in this package. You can use the application to output time series data with a given pattern and write the data to a bucket.

The output should look like this:

$ loudml-wave -v -f now-1h -t now --shape sin --tags tag_one:foo,tag_two:bar output_bucket
INFO:root:generating data from 2019-09-21 07:23:51.350293 to 2019-09-21 08:23:51.350316
Connected to localhost:8077 version 1.5.0.88.g5ad0216
INFO:root:writing 131 points
timestamp                value                    tags
1569043431.35            38369.884                tag_one=foo,tag_two=bar
1569043431.85            70881.022                tag_one=foo,tag_two=bar
1569043491.35            33949.816                tag_one=foo,tag_two=bar
1569043551.35            30892.148                tag_one=foo,tag_two=bar
1569043551.6833332       10851.922                tag_one=foo,tag_two=bar

You can get a description of the available commands:

$ loudml-wave -h

Change Log

Please see CHANGELOG.md.

Issue Reporting

If you have found a bug or if you have a feature request, please report them at this repository issues section. Please do not report security vulnerabilities on the public GitHub issue tracker.

Author

Loud ML

loudml-python is developed and maintained by Sebastien Leger (@regel). It can be found here: https://github.com/loudml/loudml-python

Special thanks to:

  • Christophe Osuna (@osunac) for all the review and packaging support.

License

This project is licensed under the MIT license. See the LICENSE file for more info.

loudml-python's People

Contributors

regel avatar

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.