-
Notifications
You must be signed in to change notification settings - Fork 754
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from erikbern/erikbern/tox
setting up travis
- Loading branch information
Showing
12 changed files
with
154 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
language: python | ||
python: | ||
- "2.7_with_system_site_packages" | ||
- "3.4" | ||
|
||
install: | ||
- sudo bash install.sh | ||
|
||
script: nosetests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,15 @@ | ||
sudo apt-get install -y python-numpy python-scipy python-sklearn | ||
apt-get update | ||
apt-get install -y python-numpy python-scipy python-pip python-nose | ||
pip install scikit-learn | ||
|
||
# Install GCC 4.8 | ||
add-apt-repository ppa:ubuntu-toolchain-r/test -y | ||
apt-get update -qq | ||
apt-get install -y libboost1.48-all-dev g++-4.8 | ||
export CXX="g++-4.8" CC="gcc-4.8" | ||
|
||
cd install | ||
for fn in annoy.sh panns.sh nearpy.sh sklearn.sh flann.sh kgraph.sh nmslib.sh glove.sh sift.sh | ||
for fn in annoy.sh panns.sh nearpy.sh sklearn.sh flann.sh kgraph.sh nmslib.sh | ||
do | ||
source $fn | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
sudo apt-get install -y python-dev python-setuptools | ||
apt-get install -y python-dev python-setuptools | ||
git clone https://github.com/spotify/annoy | ||
cd annoy | ||
sudo python setup.py install | ||
python setup.py install | ||
cd .. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
sudo apt-get install -y python-pip | ||
sudo pip install nearpy bitarray redis | ||
apt-get install -y python-pip libhdf5-dev | ||
pip install cython | ||
pip install nearpy bitarray redis h5py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from setuptools import setup | ||
|
||
setup(packages=['ann_benchmarks']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import random | ||
import inspect | ||
import ann_benchmarks | ||
from sklearn.datasets.samples_generator import make_blobs | ||
|
||
# Generate dataset | ||
X, labels_true = make_blobs(n_samples=10000, n_features=10, | ||
centers=10, cluster_std=5, | ||
random_state=0) | ||
|
||
def check_algo(algo_name, algo): | ||
algo.fit(X) | ||
result = algo.query(X[42], 10) | ||
if len(result) != 10: | ||
raise AssertionError('Expected results to have length 10: Result: %s' % result) | ||
if len(set(result)) != 10: | ||
raise AssertionError('Expected results to be unique: Result: %s' % result) | ||
#if result[0] != 42: | ||
# raise AssertionError('Expected first item to be 42: Result: %s' % result) | ||
|
||
|
||
def test_all_algos(): | ||
for metric in ['angular', 'euclidean']: | ||
algos = ann_benchmarks.get_algos(metric) | ||
for algo_key in algos.keys(): | ||
algo = random.choice(algos[algo_key]) # Just pick one of each | ||
yield check_algo, algo.name, algo # pass name just so unittest can capture it |