Skip to content

Commit a31dbbb

Browse files
MuellerSebrth
authored andcommitted
MAINT Fix CI setup (#131)
1 parent a4db300 commit a31dbbb

File tree

6 files changed

+22
-14
lines changed

6 files changed

+22
-14
lines changed

.travis.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
language: python
2-
sudo: false
2+
sudo: required
3+
services:
4+
- xvfb
35
matrix:
46
include:
57
- python: "3.6"
@@ -17,6 +19,7 @@ before_install:
1719
- export PATH=/home/travis/miniconda3/bin:$PATH
1820
- conda update --yes conda
1921
- conda info -a
22+
- conda config --add channels conda-forge
2023

2124
install:
2225
- conda create -q -n krige-env -y $DEPS pip pytest-cov pytest python=${TRAVIS_PYTHON_VERSION}
@@ -27,8 +30,6 @@ install:
2730

2831
before_script:
2932
- "export DISPLAY=:99.0"
30-
- "sh -e /etc/init.d/xvfb start"
31-
- sleep 3 # give xvfb some time to start
3233

3334
# command to run tests
3435
script:
@@ -39,7 +40,7 @@ script:
3940
# scikit-learn needed by the regression kriging example
4041
conda install -y scikit-learn
4142
set -x
42-
for f in examples/*.py; do
43+
for f in examples/*.py; do
4344
python $f 2>&1 | tee -a ~/log.txt
4445
done
4546
if grep -q "Traceback (most recent call last):" ~/log.txt; then false; else true; fi

appveyor.yml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
build: false
22

33
environment:
4-
global:
5-
# SDK v7.0 MSVC Express 2008's SetEnv.cmd script will fail if the
6-
# /E:ON and /V:ON options are not enabled in the batch script intepreter
7-
# See: http://stackoverflow.com/a/13751649/163740
8-
WITH_COMPILER: "cmd /E:ON /V:ON /C .\\appveyor\\run_with_compiler.cmd"
94
matrix:
105
- PYTHON_VERSION: "2.7.x"
116
PYTHON_ARCH: "64"
@@ -26,9 +21,12 @@ init:
2621
install:
2722
- "set PATH=%MINICONDA%;%MINICONDA%\\Scripts;%PYTHON%\\Library\\bin;%PATH%"
2823
- conda config --set always_yes yes --set changeps1 no
24+
- conda config --add channels conda-forge
25+
- conda update -q conda
2926
- conda info -a
30-
- conda install numpy scipy nose matplotlib cython scikit-learn pytest pytest-cov
31-
- pip install coverage
27+
- conda create --name pykrige numpy scipy matplotlib cython scikit-learn
28+
- activate pykrige
29+
- pip install coverage pytest-cov
3230
- pip install -e .
3331

3432

examples/krige_cv.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# -*- coding: utf-8 -*-
12
"""
23
Krige CV
34
--------

examples/krige_geometric.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# -*- coding: utf-8 -*-
12
"""
23
Geometric example
34
------------------
@@ -56,13 +57,13 @@
5657
# >>> Longitude: [122 166 92 138 86 122 136]
5758
# >>> Latitude: [-46 -36 -25 -73 -25 50 -29]
5859
# >>> z: [ 2.75 3.36 2.24 3.07 3.37 5.25 2.82]
59-
# >>>
60+
# >>>
6061
# >>> Krige at 60° latitude:
6162
# >>> ======================
6263
# >>> Longitude: [ 0. 60. 120. 180. 240. 300. 360.]
6364
# >>> Value: [ 5.32 5.14 5.3 5.18 5.35 5.61 5.32]
6465
# >>> Sigma²: [ 2.19 1.31 0.41 1.22 2.1 2.46 2.19]
65-
# >>>
66+
# >>>
6667
# >>> Ignoring curvature:
6768
# >>> =====================
6869
# >>> Value: [ 4.55 4.72 5.25 4.82 4.61 4.53 4.48]

examples/regression_kriging2d.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from pykrige.rk import RegressionKriging
1515
from pykrige.compat import train_test_split
1616

17-
svr_model = SVR(C=0.1)
17+
svr_model = SVR(C=0.1, gamma="auto")
1818
rf_model = RandomForestRegressor(n_estimators=100)
1919
lr_model = LinearRegression(normalize=True, copy_X=True, fit_intercept=False)
2020

pykrige/compat.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
from __future__ import absolute_import
66
import sys
7+
import inspect
8+
from functools import partial
79

810

911
PY3 = (sys.version_info[0] == 3)
@@ -19,6 +21,11 @@
1921
from sklearn.cross_validation import train_test_split
2022

2123
SKLEARN_INSTALLED = True
24+
if PY3:
25+
arg_spec = inspect.getfullargspec(GridSearchCV)[0]
26+
# https://stackoverflow.com/a/56618067/6696397
27+
if "return_train_score" in arg_spec:
28+
GridSearchCV = partial(GridSearchCV, return_train_score=True)
2229

2330
except ImportError:
2431
SKLEARN_INSTALLED = False

0 commit comments

Comments
 (0)