semvec/pypi-packages huggingface dataset:
kerasplugins 0.1.5
Keras Plugins
License: MIT
Keywords: keras

# keras-plugins

## Callbacks

### Telegram Callback

Notify levels available:
1) on_train_begin,
2) on_train_end,
3) on_batch_begin,
4) on_batch_end,
5) on_epoch_begin,
6) on_epoch_end
  
##### How to use
##### Installation
```
pip install kerasplugins
```

```python
from kerasplugins import callbacks

#Notify can either be a list, dict or set
notify = { 
  'on_batch_end',  # sends BATCH END: Loss 0.50 Accuracy: 0.75
  'on_epoch_end'   # sends EPOCH END: Loss 0.43 Accuracy: 0.81
}

# msg is the initial message
msg = "Predicting Bitcoin Price"

telegram = callbacks.TelegramNotify(<token>, <chat_id>, msg=msg, notify=notify)

# channel is "#general" by default
slack = callbacks.SlackNotify(<slack_token>, <channel>, msg=msg, notify=notify)

model.fit(X_train, Y_train, validation_data=[X_test, Y_test], batch_size=256, epochs=10, callbacks=[telegram, slack])
```

## Coming Soon
1) Ability to stop training remotely
python-envtools 0.0.1rc1
Python environment toolchain
License: MIT

===============
python-envtools
===============

.. image:: https://travis-ci.org/pedroburon/python-envtools.svg?branch=master
   :target: https://travis-ci.org/pedroburon/python-envtools

.. image:: https://coveralls.io/repos/github/pedroburon/python-envtools/badge.svg?branch=master
   :target: https://coveralls.io/github/pedroburon/python-envtools?branch=master

Useful environment toolchain for python

********************
override_environment
********************

Context Processor that overrides environment vars.

::

    >>> @override_environment(DEBUG=False, FOO="Bar")
    >>> def foo():
    >>>     print(os.getenv("FOO"))
    >>>     return os.getenv("DEBUG")
    >>> foo()
    FOO
    "DEBUG"


::

    >>> with override_environment(DEBUG="False", FOO="Bar"):
    >>>     print(os.getenv("FOO"))
    >>>     os.getenv("DEBUG")
    FOO
    "DEBUG"


*****************
configure_logging
*****************

Wrap a `configDict` inside configure_logging, then logging level could be controlled by environment variables

::

    LOGGING = configure_logging({
        "loggers": {
            "module": {
                "handlers": ["console"],
                "level": "INFO",
            },
        }
    })

For this example, environment variable must be set as `LOGGING_LEVEL_module=DEBUG`.


*******
get_env
*******

Similar to `os.getenv()` but evaluates string content (default) into simple python types.

::

    >>> os.environ['FOO'] = "1"
    >>> os.getenv('FOO')
    "1"
    >>> get_env('FOO')
    1

    >>> os.environ['FOO'] = "bar"
    >>> get_env('FOO')
    "bar"

    >>> os.environ['FOO'] = "True"
    >>> os.getenv('FOO')
    "True"
    >>> get_env('FOO')
    True

    >>> os.environ['FOO'] = "[1,2,3]"
    >>> os.getenv('FOO')
    "[1,2,3]"
    >>> get_env('FOO')
    [1, 2, 3]


it works for list, tuples, dictionaries, numbers, booleans and strings. And is safe!