Skip to content

Commit

Permalink
Merge pull request #110 from OneraHub/master
Browse files Browse the repository at this point in the history
PyDOE2 and Python 3 compatibility
  • Loading branch information
bouhlelma authored Sep 3, 2018
2 parents 6d09740 + e163a06 commit 6ace718
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 21 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
*.pyd
*.pyc
*~
*build*
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
branches:
only:
- master
- ft-mixture-of-experts

sudo: required

Expand All @@ -15,6 +14,7 @@ language: generic

env:
- PY=2.7
- PY=3.6

addons:
apt:
Expand Down
12 changes: 1 addition & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,7 @@ SMT is distributed under the New BSD license.
Version 0.2

# Required packages
Numpy >= Version 1.9.2

Scikit-learn >= Version 0.13.1

pyDOE >= Version 0.3.8

six

Cython

Scipy
SMT depends on the following modules: numpy, scipy, sk-learn, pyDOE2 and Cython.

# Installation
Clone the repository from github then run:
Expand Down
5 changes: 3 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ platform:

environment:
matrix:
- PYTHON: 3.6
- PYTHON: 2.7

init:
- set CONDA=Miniconda
- if "%PYTHON%" == "3.4" (set CONDA=%CONDA%3)
- if "%PYTHON%" == "3.6" (set CONDA=%CONDA%3)
- if "%PLATFORM%" == "x64" (set CONDA=%CONDA%-x64)
- echo %CONDA%
- set PATH=C:\%CONDA%;C:\%CONDA%\Scripts;%PATH%
Expand All @@ -24,7 +25,7 @@ init:
- IF "%ARCH%"=="64" (call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86_amd64)

install:
- pip install -i https://pypi.anaconda.org/carlkl/simple mingwpy
#pip install -i https://pypi.anaconda.org/carlkl/simple mingwpy
#Grab testflo for running test, to ensure examples are run
- pip install git+https://github.com/OpenMDAO/testflo.git
- pip install git+https://github.com/hwangjt/sphinx_auto_embed.git
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
],
install_requires=[
'scikit-learn',
'pyDOE',
'pyDOE2',
'matplotlib',
'numpydoc',
'six>=1.10',
Expand Down
2 changes: 1 addition & 1 deletion smt/extensions/tests/test_moe.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ def run_moe_example():
x0 = np.linspace(xlim[0, 0], xlim[0, 1], 20)
x1 = np.linspace(xlim[1, 0], xlim[1, 1], 20)
xv, yv = np.meshgrid(x0, x1)
x = np.array(zip(xv.reshape((-1,)), yv.reshape((-1,))))
x = np.array(list(zip(xv.reshape((-1,)), yv.reshape((-1,)))))
prob = moe._proba_cluster(x)

plt.subplot(221, projection='3d')
Expand Down
6 changes: 3 additions & 3 deletions smt/sampling_methods/lhs.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
This package is distributed under New BSD license.
LHS sampling; uses the pyDOE package.
LHS sampling; uses the pyDOE2 package.
"""
from __future__ import division
import pyDOE
from pyDOE2 import lhs
from six.moves import range
from scipy.spatial.distance import pdist, cdist
import numpy as np
Expand Down Expand Up @@ -38,7 +38,7 @@ def _compute(self, n):
xlimits = self.options['xlimits']
nx = xlimits.shape[0]
if self.options['criterion'] != 'ese':
return pyDOE.lhs(nx, samples=n, criterion=self.options['criterion'])
return lhs(nx, samples=n, criterion=self.options['criterion'])
elif self.options['criterion'] == 'ese':
return self._ese(nx,n)

Expand Down
2 changes: 1 addition & 1 deletion smt/surrogate_models/krg_based.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ def _reduced_likelihood_function(self, theta):
try:
C = linalg.cholesky(R, lower=True)
except (linalg.LinAlgError, ValueError) as e:
print "exception : ", e
print("exception : ", e)
return reduced_likelihood_function_value, par

# Get generalized least squares solution
Expand Down
2 changes: 1 addition & 1 deletion smt/utils/kriging_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import numpy as np
from sklearn.cross_decomposition.pls_ import PLSRegression as pls
from pyDOE import *
from pyDOE2 import bbdesign

def standardization(X,y,copy=False):

Expand Down

0 comments on commit 6ace718

Please sign in to comment.