Skip to content
This repository has been archived by the owner on Jul 10, 2021. It is now read-only.

Commit

Permalink
Fix for the documentation error and support for Python3 in the cifar1…
Browse files Browse the repository at this point in the history
…0 example.
  • Loading branch information
alexjc committed May 7, 2015
1 parent b0ff467 commit e82cba8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
12 changes: 7 additions & 5 deletions docs/guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,17 @@ Verbose Mode

To see the output of the neural network's training, you need to configure two things: first setting up the Python logger (mandatory), and secondly to specify a verbose mode if you want more information during training (optional).

The first step is to configure either the ``sknn`` logger specifically, or do so globally (easier) as follows:

.. code:: python
import sys
import logging
log = logging.getLogger('sknn')
log.basicConfig(
format="%(message)s",
level=logging.DEBUG,
stream=sys.stdout)
logging.basicConfig(
format="%(message)s",
level=logging.DEBUG,
stream=sys.stdout)
Then you can optionally create your neural networks using an additional ``verbose`` parameter to show the output during training:

Expand Down
18 changes: 12 additions & 6 deletions examples/bench_cifar10.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
import cPickle
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, unicode_literals, print_function)

import pickle
import numpy as np

def load(name):
print("\t"+name)
try:
with open(name, 'rb') as f:
return cPickle.load(f)
return pickle.load(f, encoding='latin1')
except IOError:
import gzip
with gzip.open(name+'.gz', 'rb') as f:
return cPickle.load(f)
return pickle.load(f, encoding='latin1')

print("Loading...")
dataset1 = load('data_batch_1')
dataset2 = load('data_batch_2')
dataset3 = load('data_batch_3')
print("")

data_train = np.vstack([dataset1['data'], dataset2['data']])
labels_train = np.hstack([dataset1['labels'], dataset2['labels']])
Expand Down Expand Up @@ -48,6 +54,6 @@ def load(name):
expected = labels_test
predicted = net.predict(data_test)

print "Classification report for classifier %s:\n%s\n" % (
net, classification_report(expected, predicted))
print "Confusion matrix:\n%s" % confusion_matrix(expected, predicted)
print("Classification report for classifier %s:\n%s\n" % (
net, classification_report(expected, predicted)))
print("Confusion matrix:\n%s" % confusion_matrix(expected, predicted))

0 comments on commit e82cba8

Please sign in to comment.