File tree Expand file tree Collapse file tree 6 files changed +22
-14
lines changed Expand file tree Collapse file tree 6 files changed +22
-14
lines changed Original file line number Diff line number Diff line change 1
1
language : python
2
- sudo : false
2
+ sudo : required
3
+ services :
4
+ - xvfb
3
5
matrix :
4
6
include :
5
7
- python : " 3.6"
@@ -17,6 +19,7 @@ before_install:
17
19
- export PATH=/home/travis/miniconda3/bin:$PATH
18
20
- conda update --yes conda
19
21
- conda info -a
22
+ - conda config --add channels conda-forge
20
23
21
24
install :
22
25
- conda create -q -n krige-env -y $DEPS pip pytest-cov pytest python=${TRAVIS_PYTHON_VERSION}
@@ -27,8 +30,6 @@ install:
27
30
28
31
before_script :
29
32
- " export DISPLAY=:99.0"
30
- - " sh -e /etc/init.d/xvfb start"
31
- - sleep 3 # give xvfb some time to start
32
33
33
34
# command to run tests
34
35
script :
@@ -39,7 +40,7 @@ script:
39
40
# scikit-learn needed by the regression kriging example
40
41
conda install -y scikit-learn
41
42
set -x
42
- for f in examples/*.py; do
43
+ for f in examples/*.py; do
43
44
python $f 2>&1 | tee -a ~/log.txt
44
45
done
45
46
if grep -q "Traceback (most recent call last):" ~/log.txt; then false; else true; fi
Original file line number Diff line number Diff line change 1
1
build : false
2
2
3
3
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"
9
4
matrix :
10
5
- PYTHON_VERSION : " 2.7.x"
11
6
PYTHON_ARCH : " 64"
26
21
install :
27
22
- " set PATH=%MINICONDA%;%MINICONDA%\\ Scripts;%PYTHON%\\ Library\\ bin;%PATH%"
28
23
- conda config --set always_yes yes --set changeps1 no
24
+ - conda config --add channels conda-forge
25
+ - conda update -q conda
29
26
- 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
32
30
- pip install -e .
33
31
34
32
Original file line number Diff line number Diff line change
1
+ # -*- coding: utf-8 -*-
1
2
"""
2
3
Krige CV
3
4
--------
Original file line number Diff line number Diff line change
1
+ # -*- coding: utf-8 -*-
1
2
"""
2
3
Geometric example
3
4
------------------
56
57
# >>> Longitude: [122 166 92 138 86 122 136]
57
58
# >>> Latitude: [-46 -36 -25 -73 -25 50 -29]
58
59
# >>> z: [ 2.75 3.36 2.24 3.07 3.37 5.25 2.82]
59
- # >>>
60
+ # >>>
60
61
# >>> Krige at 60° latitude:
61
62
# >>> ======================
62
63
# >>> Longitude: [ 0. 60. 120. 180. 240. 300. 360.]
63
64
# >>> Value: [ 5.32 5.14 5.3 5.18 5.35 5.61 5.32]
64
65
# >>> Sigma²: [ 2.19 1.31 0.41 1.22 2.1 2.46 2.19]
65
- # >>>
66
+ # >>>
66
67
# >>> Ignoring curvature:
67
68
# >>> =====================
68
69
# >>> Value: [ 4.55 4.72 5.25 4.82 4.61 4.53 4.48]
Original file line number Diff line number Diff line change 14
14
from pykrige .rk import RegressionKriging
15
15
from pykrige .compat import train_test_split
16
16
17
- svr_model = SVR (C = 0.1 )
17
+ svr_model = SVR (C = 0.1 , gamma = "auto" )
18
18
rf_model = RandomForestRegressor (n_estimators = 100 )
19
19
lr_model = LinearRegression (normalize = True , copy_X = True , fit_intercept = False )
20
20
Original file line number Diff line number Diff line change 4
4
5
5
from __future__ import absolute_import
6
6
import sys
7
+ import inspect
8
+ from functools import partial
7
9
8
10
9
11
PY3 = (sys .version_info [0 ] == 3 )
19
21
from sklearn .cross_validation import train_test_split
20
22
21
23
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 )
22
29
23
30
except ImportError :
24
31
SKLEARN_INSTALLED = False
You can’t perform that action at this time.
0 commit comments