From f475a7ddaf05910090c94a22254d7d868764cd43 Mon Sep 17 00:00:00 2001 From: "Alex J. Champandard" Date: Wed, 24 Jun 2015 19:11:33 +0200 Subject: [PATCH 1/3] Using the colorama module on Windows to prevent problems displaying colors. --- setup.py | 1 + sknn/__init__.py | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/setup.py b/setup.py index f23128c..4166f0f 100644 --- a/setup.py +++ b/setup.py @@ -22,6 +22,7 @@ 'scikit-learn', 'theano', 'pyyaml', + 'colorama' if sys.platform == 'win32' else '', # 'pylearn2', ] diff --git a/sknn/__init__.py b/sknn/__init__.py index 4cea71a..4d29a8d 100644 --- a/sknn/__init__.py +++ b/sknn/__init__.py @@ -53,3 +53,10 @@ def __getattr__(self, name): sys.modules['sknn.platform'] = TheanoConfigurator() + + +try: + import colorama + colorama.init() +except ImportError: + pass From 8adc3be077c8cf21a8e598eea477ef9017ecef5c Mon Sep 17 00:00:00 2001 From: "Alex J. Champandard" Date: Wed, 24 Jun 2015 19:11:45 +0200 Subject: [PATCH 2/3] Added documentation about backend configuration. --- docs/guide_intermediate.rst | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docs/guide_intermediate.rst b/docs/guide_intermediate.rst index 8c4009f..5314a7e 100644 --- a/docs/guide_intermediate.rst +++ b/docs/guide_intermediate.rst @@ -77,3 +77,15 @@ To setup the library to use your GPU or CPU explicitly in 32-bit or 64-bit mode, from sknn.platform import cpu64 WARNING: This will only work if your program has not yet imported the ``theano`` module, due to the way that library is designed. If ``THEANO_FLAGS`` are set on the command-line, they are not overwridden. + + +Backend Configuration +--------------------- + +As of version 0.3, ``scikit-neuralnetwork`` supports multiple neural network implementations called backends, each wrapped behind an identical standardized interface. To configure a backend, you can do so by importing the corresponding module: + +.. code:: python + + from sknn.backend import pylearn2 + +As long as you call this before creating a neural network, this will register the PyLearn2 implementation as the one that's used. Supported backends are currently ``pylearn2`` (default) and ``deepy`` (incomplete). From 8c5b68e21753a74ccefb37e15a04e0f21b4b985a Mon Sep 17 00:00:00 2001 From: "Alex J. Champandard" Date: Wed, 24 Jun 2015 19:43:09 +0200 Subject: [PATCH 3/3] Work-around for code coverage that runs without `colorama` installed. --- sknn/__init__.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sknn/__init__.py b/sknn/__init__.py index 4d29a8d..0ec3d83 100644 --- a/sknn/__init__.py +++ b/sknn/__init__.py @@ -56,7 +56,6 @@ def __getattr__(self, name): try: - import colorama - colorama.init() + import colorama; colorama.init(); del colorama except ImportError: pass