-
Notifications
You must be signed in to change notification settings - Fork 0
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 #24 from sdevenes/feature/deploy_doc
Feature/deploy doc
- Loading branch information
Showing
11 changed files
with
121 additions
and
58 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 |
---|---|---|
|
@@ -7,3 +7,4 @@ public/* | |
|
||
### Python execution ### | ||
scripts/__pycache__/ | ||
tests/output/ |
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,32 @@ | ||
# From here: https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/use-conda-with-travis-ci.html | ||
language: python | ||
python: | ||
# We don't actually use the Travis Python, but this keeps it organized. | ||
- "3.7" | ||
- "3.8" | ||
install: | ||
# Install phase of our CI pipeline | ||
- wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh | ||
- bash miniconda.sh -b -p $HOME/miniconda | ||
- source "$HOME/miniconda/etc/profile.d/conda.sh" | ||
- hash -r | ||
- conda config --set always_yes yes --set changeps1 no | ||
- conda update -q conda | ||
- conda info -a | ||
- conda create -q -n project python=$TRAVIS_PYTHON_VERSION -c plotly --file requirements.txt | ||
- conda activate project | ||
|
||
script: | ||
# Run phase of our CI pipeline | ||
- make unitTests | ||
- make doc | ||
|
||
deploy: | ||
- provider: pages:git | ||
verbose: true | ||
edge: true | ||
token: $GITHUB_TOKEN | ||
local_dir: ./public/ | ||
on: | ||
branch: master | ||
condition: $TRAVIS_PYTHON_VERSION = 3.8 |
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 |
---|---|---|
|
@@ -8,4 +8,4 @@ scripts | |
analysis | ||
database | ||
download_data | ||
test | ||
paper |
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,7 +1,7 @@ | ||
test module | ||
=========== | ||
paper module | ||
============ | ||
|
||
.. automodule:: test | ||
.. automodule:: paper | ||
:members: | ||
:undoc-members: | ||
:show-inheritance: |
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,22 @@ | ||
TESTDIR = tests | ||
SCRIPTDIR = scripts | ||
|
||
default: | ||
echo "Welcome to M05 mini project" | ||
|
||
.PHONY: loadData | ||
loadData: | ||
# todo | ||
|
||
.PHONY: unitTests | ||
unitTests: cleanTests | ||
nosetests --nocapture -v "$(TESTDIR)/test.py" | ||
|
||
.PHONY: cleanTests | ||
cleanTests: | ||
rm -rf "$(TESTDIR)/output" | ||
|
||
.PHONY: doc | ||
doc: | ||
$(MAKE) -C docs clean | ||
$(MAKE) -C docs html |
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,6 @@ | ||
requests | ||
sklearn | ||
plotly.express | ||
scikit-learn | ||
plotly_express==0.4.1 | ||
sphinx | ||
sphinx_rtd_theme | ||
sphinx_rtd_theme | ||
nose |
This file was deleted.
Oops, something went wrong.
Empty file.
Binary file not shown.
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,57 @@ | ||
import os | ||
import sys | ||
sys.path.insert(0, os.path.dirname(os.path.realpath(__file__)) + "/../scripts/") | ||
|
||
import download_data | ||
import zipfile | ||
import requests | ||
|
||
import algorithm | ||
import analysis | ||
import numpy as np | ||
|
||
import nose.tools | ||
|
||
# Get the path of this file to easily build relative path | ||
base_path = os.path.dirname(os.path.realpath(__file__)) | ||
|
||
def test_unzip_file_not_a_zip(): | ||
path_to_zip_file = base_path + "/inputs/not_a_zip.txt" # not a zip | ||
directory_to_extract_to = base_path # extract here | ||
nose.tools.assert_raises(zipfile.BadZipFile, download_data.unzip_file, path_to_zip_file, directory_to_extract_to) | ||
|
||
def test_unzip_file_invalid_zip_path(): | ||
path_to_zip_file = base_path + "/simpleZip.zip" # Invalid path | ||
directory_to_extract_to = base_path # extract here | ||
nose.tools.assert_raises(FileNotFoundError, download_data.unzip_file, path_to_zip_file, directory_to_extract_to) | ||
|
||
def test_unzip_file(): | ||
path_to_zip_file = base_path + "/inputs/simpleZip.zip" | ||
directory_to_extract_to = base_path + "/output/" # extract here | ||
download_data.unzip_file(path_to_zip_file, directory_to_extract_to) | ||
nose.tools.ok_(os.path.isfile(base_path + "/output/f1.txt"), msg="SimpleZip not correctly unzipped") | ||
|
||
def test_download_url_invalid_url(): | ||
url = "https://invalid_url.zip" | ||
save_path = base_path + "/output/invalid_dl.zip" | ||
nose.tools.assert_raises(requests.exceptions.ConnectionError, download_data.download_url, url, save_path) | ||
|
||
def test_download_url(): | ||
url = "https://archive.ics.uci.edu/ml/machine-learning-databases/00405/Postures.zip" # Smaller zip to test | ||
save_path = base_path + "/output/test_dl.zip" | ||
download_data.download_url(url, save_path) | ||
nose.tools.ok_(os.path.isfile(save_path), msg="Dataset not correctly downloaded") | ||
|
||
def test_make_labels(): | ||
X = [np.array([0, 1, 0]), np.array([2, 3]), np.array([7, 4, 6, 9])] | ||
labels = algorithm.make_labels(X) | ||
ref = np.array([0,0,0,1,1,2,2,2,2]) | ||
nose.tools.ok_((labels==ref).all(), msg="{} != {}".format(labels,ref)) | ||
|
||
def test_get_confusion_matrix(): | ||
prediction = [1,2,3,1,2,2,3] | ||
true_val = [1,2,3,1,2,3,2] | ||
cm = analysis.get_confusion_matrix(prediction, true_val) | ||
ref = np.array([[2, 0, 0],[0, 2, 1],[0, 1, 1]]) | ||
nose.tools.ok_((cm==ref).all(), msg="{} != {}".format(cm,ref)) | ||
|