Skip to content

Commit c92624f

Browse files
committed
Fixed 2/3 issues with protobuf3 and some code changes
1 parent b46e3ac commit c92624f

File tree

108 files changed

+24688
-11400
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

108 files changed

+24688
-11400
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import numpy as np
2+
from sklearn_theano.feature_extraction import GoogLeNetClassifier
3+
from sklearn_theano.datasets import load_sample_image
4+
5+
X = load_sample_image("sloth_closeup.jpg")
6+
top_n_classes = 5
7+
goog_clf = GoogLeNetClassifier(top_n=top_n_classes)
8+
goog_preds = goog_clf.predict(X)[0]
9+
goog_probs = goog_clf.predict_proba(X)[0]
10+
# Want the sorted from greatest probability to least
11+
sort_indices = np.argsort(goog_probs)[::-1]
12+
13+
for n, (pred, prob) in enumerate(zip(goog_preds[sort_indices],
14+
goog_probs[sort_indices])):
15+
print("Class prediction (probability): %s (%.4f)" % (pred, prob))
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
google/ and subsequent directories generated by downloading the
2+
protobuf 3.0.0 alpha release from the following link:
3+
4+
https://github.com/google/protobuf/releases/download/v3.0.0-beta-1/protobuf-python-3.0.0-alpha-4.tar.gz)
5+
6+
This file was untarred with:
7+
8+
tar xzf protobuf-python-3.0.0-alpha-4.tar.gz
9+
10+
followed by:
11+
12+
cd protobuf-3.0.0-alpha-4
13+
14+
Next, protobuf3 was installed using
15+
16+
./configure && make && make install
17+
18+
Once protobuf was installed, the python bindings were built with:
19+
20+
cd protobuf-3.0.0-alpha-4/python/
21+
python setup.py build
22+
23+
The google/ folder was then copied out of the build/ directory into externals/
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__import__('pkg_resources').declare_namespace(__name__)

sklearn_theano/externals/google/__init__.py

100755100644
File mode changed.

sklearn_theano/externals/google/protobuf/__init__.py

100755100644
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Protocol Buffers - Google's data interchange format
2+
# Copyright 2008 Google Inc. All rights reserved.
3+
# https://developers.google.com/protocol-buffers/
4+
#
5+
# Redistribution and use in source and binary forms, with or without
6+
# modification, are permitted provided that the following conditions are
7+
# met:
8+
#
9+
# * Redistributions of source code must retain the above copyright
10+
# notice, this list of conditions and the following disclaimer.
11+
# * Redistributions in binary form must reproduce the above
12+
# copyright notice, this list of conditions and the following disclaimer
13+
# in the documentation and/or other materials provided with the
14+
# distribution.
15+
# * Neither the name of Google Inc. nor the names of its
16+
# contributors may be used to endorse or promote products derived from
17+
# this software without specific prior written permission.
18+
#
19+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20+
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21+
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22+
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23+
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24+
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25+
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26+
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27+
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28+
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29+
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30+
31+
# Copyright 2007 Google Inc. All Rights Reserved.
32+
33+
__version__ = '3.0.0a4'

sklearn_theano/externals/google/protobuf/compiler/__init__.py

Whitespace-only changes.

sklearn_theano/externals/google/protobuf/compiler/plugin_pb2.py

Lines changed: 0 additions & 184 deletions
This file was deleted.

0 commit comments

Comments
 (0)