Skip to content

Commit

Permalink
Merge pull request #22 from tgsmith61591/release-0.6.5
Browse files Browse the repository at this point in the history
Release 0.6.5
  • Loading branch information
tgsmith61591 committed Mar 27, 2018
2 parents b12ff9b + 87759a8 commit 5a52d60
Show file tree
Hide file tree
Showing 32 changed files with 378 additions and 102 deletions.
4 changes: 1 addition & 3 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
[run]
branch = True
source = pyramid
include = */pyramid/*
omit =
*/setup.py
*/__check_build/*
*/_build_utils/*
*/_build_utils/*
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
# Pypi pws
.pypipws

# Coverage
coverage

# OAuth access for automating releases
ACCESS_TOKEN

Expand Down
10 changes: 8 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ cache:
- $HOME/.cache/pip
- $HOME/.ccache

before_install: source build_tools/travis/before_install.sh
before_install:
- source build_tools/travis/before_install.sh
env:
global:
- PYMODULE=pyramid
Expand Down Expand Up @@ -93,8 +94,13 @@ matrix:
install: source build_tools/travis/install.sh
before_script: bash build_tools/travis/before_script.sh
script: bash build_tools/travis/test_script.sh

# we set +e to re-instate the error-tolerant state. The problem is Travis is broken on Mac OS
# builds right now due to Issue 6307 (https://github.com/travis-ci/travis-ci/issues/6307)
# and fails at the end of a successful build. This will allow the build to recover even if
# a non-zero status code is encountered. (had `- set +e`)
after_success:
- source build_tools/travis/after_success.sh
- source build_tools/travis/after_success.sh # || echo "shell_session_update failed"
# Build the wheels every time so we can debug
- bash build_tools/travis/build_wheels.sh
- ls dist/
Expand Down
1 change: 1 addition & 0 deletions AUTHORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ The following people have been core contributors to `pyramid`'s development:
* [Taylor Smith](https://github.com/tgsmith61591)
* [Gary Foreman](https://github.com/garyForeman)
* [Charles Drotar](https://github.com/charlesdrotar)
* [Steven Hoelscher](https://github.com/shoelsch)

__Please do not email the authors directly with questions or issues.__ Rather, use
the [issues](https://github.com/tgsmith61591/pyramid/issues) page. Furthermore, issues
Expand Down
2 changes: 1 addition & 1 deletion ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!-- Instructions For Filing a Bug: https://github.com/scikit-learn/scikit-learn/blob/master/CONTRIBUTING.md#filing-bugs -->

#### Description
<!-- Example: Joblib Error thrown when calling fit on LatentDirichletAllocation with evaluate_every > 0-->
<!-- Example: ValueError raised when fitting very high-frequency data -->

#### Steps/Code to Reproduce
<!--
Expand Down
16 changes: 14 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,37 @@ environment:
- PY_MAJOR_VER: 2
PYTHON_ARCH: "x86"
PYTHON_VERSION: "2.7"
MINICONDA_MICRO_VERSION: "30"

- PY_MAJOR_VER: 2
PYTHON_ARCH: "x86_64"
PYTHON_VERSION: "2.7"
MINICONDA_MICRO_VERSION: "30"

- PY_MAJOR_VER: 3
PYTHON_ARCH: "x86"
PYTHON_VERSION: "3.5"
MINICONDA_MICRO_VERSION: "31"

- PY_MAJOR_VER: 3
PYTHON_ARCH: "x86_64"
PYTHON_VERSION: "3.5"
MINICONDA_MICRO_VERSION: "31"

# 3/27/18 - Conda is not working well on Windows because they haven't gotten
# their act together RE: powershell...
build_script:
- ps: Start-FileDownload "https://repo.continuum.io/miniconda/Miniconda$env:PY_MAJOR_VER-latest-Windows-$env:PYTHON_ARCH.exe" C:\Miniconda.exe; echo "Finished downloading miniconda"
- ps: Start-FileDownload "https://repo.continuum.io/miniconda/Miniconda$env:PY_MAJOR_VER-4.3.$env:MINICONDA_MICRO_VERSION-Windows-$env:PYTHON_ARCH.exe" C:\Miniconda.exe; echo "Finished downloading miniconda"
# - ps: Start-FileDownload "https://repo.continuum.io/miniconda/Miniconda$env:PY_MAJOR_VER-latest-Windows-$env:PYTHON_ARCH.exe" C:\Miniconda.exe; echo "Finished downloading miniconda"
- cmd: C:\Miniconda.exe /S /D=C:\Py
- SET PATH=C:\Py;C:\Py\Scripts;C:\Py\Library\bin;%PATH%
- conda config --set always_yes yes
- conda update conda --quiet
# - conda update conda

# Debugging because Appveyor gives us no stack traces when this stuff breaks.
- ps: echo "Conda version:"
- conda --version
- ps: echo "Python version=$env:PYTHON_VERSION"

# Things we'll need for build/test
- ps: conda create -n testenv --yes python=$env:PYTHON_VERSION numpy scipy cython scikit-learn statsmodels pip nose patsy
Expand Down
57 changes: 57 additions & 0 deletions benchmarks/benchmark_funcs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# -*- coding: utf-8 -*-
#
# Benchmark various approaches to functions to speed things up.
# ... hopefully.

from __future__ import absolute_import

import numpy as np

import time


def _do_time(func, n_iter=10, *args, **kwargs):
times = []
for _ in range(n_iter):
start = time.time()
func(*args, **kwargs)
times.append(time.time() - start)

times = np.asarray(times)
print("Completed %i iterations (avg=%.6f, min=%.6f, max=%.6f)"
% (n_iter, times.mean(), times.min(), times.max()))


def benchmark_is_constant():
"""This benchmarks the "is_constant" function from ``pyramid.arima.utils``.
This was added in 0.6.2.
"""
# WINNER!
def is_const1(x):
"""This is the version in Pyramid 0.6.2.
Parameters
----------
x : np.ndarray
This is the array.
"""
return (x == x[0]).all()

def is_const2(x):
"""This should ostensibly only take O(N) rather than O(2N) like
its predecessor. But we'll see...
Parameters
----------
x : np.ndarray
This is the array.
"""
return np.unique(x).shape[0] == 1

x = np.random.choice(np.arange(10), 1000000, replace=True)
_do_time(is_const1, 25, x)
_do_time(is_const2, 25, x)


if __name__ == '__main__':
benchmark_is_constant()
9 changes: 7 additions & 2 deletions build_tools/travis/after_success.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@

# License: 3-clause BSD

set -e
# 02/10/2018 remove due to Travis build issue 6307
# set -e
set +e # because TRAVIS SUCKS

# push coverage if necessary
if [[ "$COVERAGE" == "true" ]]; then

# Need to run coveralls from a git checkout, so we copy .coverage
# from TEST_DIR where nosetests has been run
cp $TEST_DIR/.coverage $TRAVIS_BUILD_DIR
Expand All @@ -17,7 +20,9 @@ if [[ "$COVERAGE" == "true" ]]; then
# very reliable but we don't want travis to report a failure
# in the github UI just because the coverage report failed to
# be published.
coveralls || echo "Coveralls upload failed"
coveralls --rcfile .coveragerc || echo "Coveralls upload failed"
else
echo "Skipping coverage upload since COVERAGE=false"
fi

# make sure we have twine in case we deploy
Expand Down
11 changes: 11 additions & 0 deletions build_tools/travis/before_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,15 @@ set -e
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
echo "Updating apt-get for Linux build"
sudo apt-get -qq update

# Workaround for https://github.com/travis-ci/travis-ci/issues/6307, which
# caused the following error on MacOS X workers:
#
# Warning, RVM 1.26.0 introduces signed releases and automated check of
# signatures when GPG software found.
# /Users/travis/build.sh: line 109: shell_session_update: command not found
elif [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
echo "Updating Ruby for Mac OS build"
# command curl -sSL https://rvm.io/mpapis.asc | gpg --import -;
# rvm get stable
fi
5 changes: 5 additions & 0 deletions doc/_static/css/gitcontrib.css
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@
margin-top: 10px;
}

img.avatar {
width: 60px;
height: 60px;
}

.contrib-author-wrapper {
position: absolute;
display: block;
Expand Down
5 changes: 3 additions & 2 deletions doc/_static/js/contrib.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ function commaFmt(x) {
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}

$(document).ready(function() {
function fetchContributors() {
$.getJSON("https://api.github.com/repos/tgsmith61591/pyramid/stats/contributors", function(arr) {
// sort the array based on total count
arr.sort(function(a, b) {
Expand Down Expand Up @@ -54,7 +54,8 @@ $(document).ready(function() {
'</div>' +
'</li>')

// can only do this once the doc is ready
$('#contrib').append(li);
});
});
});
}
6 changes: 6 additions & 0 deletions doc/contributors.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ Thanks to the following users for their contributions to Pyramid!

<!-- This does all the heavy lifting -->
<script src="_static/js/contrib.js"></script>
<script type="text/javascript">
// actually call the contrib code
$(document).ready(function() {
fetchContributors();
});
</script>

<!-- This is taken from the Github contrib page -->
<ol id="contrib" class="contrib-data capped-cards clearfix"></ol>
12 changes: 12 additions & 0 deletions doc/doc_requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Cython>=0.23
numpy>=1.9
scipy>=0.9
scikit-learn>=0.17
statsmodels>=0.8
sphinx
sphinx_rtd_theme
matplotlib==2.2.0rc1
sphinx_gallery==0.1.13
numpydoc==0.7.0
Django==1.11
image==1.5.19
36 changes: 18 additions & 18 deletions doc/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,26 @@ Here is a simple example of Pyramid use:
... error_action='ignore', # don't want to know if an order does not work
... suppress_warnings=True, # don't want convergence warnings
... stepwise=True) # set to stepwise
Fit ARIMA: order=(1, 1, 1) seasonal_order=(0, 1, 1, 12); AIC=3066.811, BIC=3082.663, Fit time=1.731 seconds
Fit ARIMA: order=(1, 1, 1) seasonal_order=(0, 1, 1, 12); AIC=3066.811, BIC=3082.663, Fit time=0.517 seconds
Fit ARIMA: order=(0, 1, 0) seasonal_order=(0, 1, 0, 12); AIC=nan, BIC=nan, Fit time=nan seconds
Fit ARIMA: order=(1, 1, 0) seasonal_order=(1, 1, 0, 12); AIC=3099.735, BIC=3112.417, Fit time=0.434 seconds
Fit ARIMA: order=(0, 1, 1) seasonal_order=(0, 1, 1, 12); AIC=3066.983, BIC=3079.665, Fit time=0.473 seconds
Fit ARIMA: order=(1, 1, 1) seasonal_order=(1, 1, 1, 12); AIC=3067.666, BIC=3086.688, Fit time=2.184 seconds
Fit ARIMA: order=(1, 1, 1) seasonal_order=(0, 1, 0, 12); AIC=3088.109, BIC=3100.791, Fit time=0.344 seconds
Fit ARIMA: order=(1, 1, 1) seasonal_order=(0, 1, 2, 12); AIC=3067.669, BIC=3086.692, Fit time=4.371 seconds
Fit ARIMA: order=(1, 1, 1) seasonal_order=(1, 1, 2, 12); AIC=3068.757, BIC=3090.951, Fit time=4.160 seconds
Fit ARIMA: order=(2, 1, 1) seasonal_order=(0, 1, 1, 12); AIC=3067.485, BIC=3086.508, Fit time=1.204 seconds
Fit ARIMA: order=(1, 1, 0) seasonal_order=(0, 1, 1, 12); AIC=3094.578, BIC=3107.260, Fit time=0.468 seconds
Fit ARIMA: order=(1, 1, 2) seasonal_order=(0, 1, 1, 12); AIC=3066.771, BIC=3085.794, Fit time=1.222 seconds
Fit ARIMA: order=(2, 1, 3) seasonal_order=(0, 1, 1, 12); AIC=3070.642, BIC=3096.006, Fit time=3.495 seconds
Fit ARIMA: order=(1, 1, 2) seasonal_order=(1, 1, 1, 12); AIC=3068.086, BIC=3090.280, Fit time=1.180 seconds
Fit ARIMA: order=(1, 1, 2) seasonal_order=(0, 1, 0, 12); AIC=3090.977, BIC=3106.830, Fit time=0.544 seconds
Fit ARIMA: order=(1, 1, 2) seasonal_order=(0, 1, 2, 12); AIC=3067.766, BIC=3089.959, Fit time=3.303 seconds
Fit ARIMA: order=(1, 1, 2) seasonal_order=(1, 1, 2, 12); AIC=3069.717, BIC=3095.081, Fit time=5.675 seconds
Fit ARIMA: order=(1, 1, 0) seasonal_order=(1, 1, 0, 12); AIC=3099.735, BIC=3112.417, Fit time=0.162 seconds
Fit ARIMA: order=(0, 1, 1) seasonal_order=(0, 1, 1, 12); AIC=3066.983, BIC=3079.665, Fit time=0.164 seconds
Fit ARIMA: order=(1, 1, 1) seasonal_order=(1, 1, 1, 12); AIC=3067.666, BIC=3086.688, Fit time=0.645 seconds
Fit ARIMA: order=(1, 1, 1) seasonal_order=(0, 1, 0, 12); AIC=3088.109, BIC=3100.791, Fit time=0.136 seconds
Fit ARIMA: order=(1, 1, 1) seasonal_order=(0, 1, 2, 12); AIC=3067.669, BIC=3086.692, Fit time=1.512 seconds
Fit ARIMA: order=(1, 1, 1) seasonal_order=(1, 1, 2, 12); AIC=3068.757, BIC=3090.951, Fit time=1.651 seconds
Fit ARIMA: order=(2, 1, 1) seasonal_order=(0, 1, 1, 12); AIC=3067.485, BIC=3086.508, Fit time=0.445 seconds
Fit ARIMA: order=(1, 1, 0) seasonal_order=(0, 1, 1, 12); AIC=3094.578, BIC=3107.260, Fit time=0.174 seconds
Fit ARIMA: order=(1, 1, 2) seasonal_order=(0, 1, 1, 12); AIC=3066.771, BIC=3085.794, Fit time=0.425 seconds
Fit ARIMA: order=(2, 1, 3) seasonal_order=(0, 1, 1, 12); AIC=3070.642, BIC=3096.006, Fit time=0.966 seconds
Fit ARIMA: order=(1, 1, 2) seasonal_order=(1, 1, 1, 12); AIC=3068.086, BIC=3090.280, Fit time=0.411 seconds
Fit ARIMA: order=(1, 1, 2) seasonal_order=(0, 1, 0, 12); AIC=3090.977, BIC=3106.830, Fit time=0.249 seconds
Fit ARIMA: order=(1, 1, 2) seasonal_order=(0, 1, 2, 12); AIC=3067.766, BIC=3089.959, Fit time=1.170 seconds
Fit ARIMA: order=(1, 1, 2) seasonal_order=(1, 1, 2, 12); AIC=3069.717, BIC=3095.081, Fit time=2.000 seconds
Fit ARIMA: order=(0, 1, 2) seasonal_order=(0, 1, 1, 12); AIC=nan, BIC=nan, Fit time=nan seconds
Fit ARIMA: order=(2, 1, 2) seasonal_order=(0, 1, 1, 12); AIC=3068.701, BIC=3090.895, Fit time=1.509 seconds
Fit ARIMA: order=(1, 1, 3) seasonal_order=(0, 1, 1, 12); AIC=3068.842, BIC=3091.036, Fit time=2.329 seconds
Total fit time: 34.636 seconds
Fit ARIMA: order=(2, 1, 2) seasonal_order=(0, 1, 1, 12); AIC=3068.701, BIC=3090.895, Fit time=0.523 seconds
Fit ARIMA: order=(1, 1, 3) seasonal_order=(0, 1, 1, 12); AIC=3068.842, BIC=3091.036, Fit time=0.590 seconds
Total fit time: 11.745 seconds
It's easy to examine your model fit results. Simply use the ``summary`` method:

Expand Down
3 changes: 3 additions & 0 deletions doc/setup.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,6 @@ python:
.. code-block:: python
from pyramid.arima import auto_arima
If you encounter an ``ImportError``, try updating numpy and re-installing. Outdated
numpy versions have been observed to break the Pyramid build.
3 changes: 3 additions & 0 deletions pyramid/__check_build/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-

from __future__ import absolute_import
14 changes: 14 additions & 0 deletions pyramid/__check_build/tests/test_check_build.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# -*- coding: utf-8 -*-

from __future__ import absolute_import

from pyramid.__check_build import raise_build_error

from nose.tools import assert_raises


def test_raise_build_error():
try:
raise ValueError("this is a dummy err msg")
except ValueError as v:
assert_raises(ImportError, raise_build_error, v)
2 changes: 1 addition & 1 deletion pyramid/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
# The pyramid module

__version__ = "0.6.2"
__version__ = "0.6.5"

try:
# this var is injected in the setup build to enable
Expand Down
2 changes: 2 additions & 0 deletions pyramid/_build_utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
# license: BSD

from __future__ import division, print_function, absolute_import

from numpy.distutils.system_info import get_info
from distutils.version import LooseVersion

import os

DEFAULT_ROOT = 'pyramid'
Expand Down
3 changes: 3 additions & 0 deletions pyramid/_build_utils/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-

from __future__ import absolute_import
1 change: 1 addition & 0 deletions pyramid/arima/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
from .arima import *
from .auto import *
from .utils import *
from .warnings import *

__all__ = [s for s in dir() if not s.startswith("_")]
12 changes: 11 additions & 1 deletion pyramid/arima/approx.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@
'mean': np.average
}

# identity function defined once to avoid multiple lambda calls
# littered throughout
_identity = (lambda t: t)


def _regularize(x, y, ties):
"""Regularize the values, make them ordered and remove duplicates.
Expand Down Expand Up @@ -82,8 +86,14 @@ def tie_apply(f, u_val):
return f(vals)

# replace the duplicates in the y array with the "tie" func
func = VALID_TIES.get(ties, lambda t: t)
func = VALID_TIES.get(ties, _identity)

# maybe expensive to vectorize on the fly? Not sure; would need
# to do some benchmarking. However, we need to in order to keep y
# and x in scope...
y = np.vectorize(tie_apply)(func, ux)

# does ux need ordering? hmm..
x = ux

return x, y
Expand Down
Loading

0 comments on commit 5a52d60

Please sign in to comment.