Giter Club home page Giter Club logo

pydoe's People

Contributors

joergdietrich avatar tisimst avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pydoe's Issues

Error in generator specification for fracfact()

There is an issue with the fracfact() function when specifying the generator.
The following code should give me a 2^(3-1) design in 4 runs
gen = 'a b ab'; fracfact(gen)
But instead it treats the the generator string as "a b a b" and gives me a 2^4 design in 16 runs.
This comes from the following code in the fracfact() function:
A = [item for item in re.split('\-?\s?\+?', gen) if item]
The regex string should be '-?\s+?', this way the space isn't optional and it treats a string 'ab' as an interaction and not as two factor 'a' 'b' put together.

Is there any essential difference between "ff2n" and "fracfact"?

Excuse me.

As I know, full-factorial design can manipulate all the main and interaction effects already. The meaning of fraction factorial design is to reduce the runs based on that some interaction have little effect, such as some high-order interactions.

Why do I need "fracfact" if the runs of "fracfact" is equal or even bigger than the runs of "ff2n"?
Just because "fracfact" can list the columns of interaction?

Error box Behnken

Hi, I am using pyDOE for generating box Behnken and I got an error:
File "/root/anaconda3/lib/python3.6/site-packages/pyDOE/doe_repeat_center.py", line 43, in repeat_center
return np.zeros((repeat, n))
TypeError: 'float' object cannot be interpreted as an integer

I think the problem is in line 73 from the file pyDOE/doe_box_behnken:
nb_lines = (n*(n-1)/2)*H_fact.shape[0]

when I modify the above line to
nb_lines = int((n*(n-1)/2)*H_fact.shape[0])
it works well

ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/scipy/special/_ufuncs.cpython-310-darwin.so, 0x0002): symbol not found in flat namespace (_npy_asinh)

I am using full fact. This was working fine until this morning. I got:

ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/scipy/special/_ufuncs.cpython-310-darwin.so, 0x0002): symbol not found in flat namespace (_npy_asinh)

I believe that this is an issue with Apple Silicon. I did not find a solution (that I understood how to implement).

Suggestions would be greatly appreciated.

Model Name: MacBook Pro
Model Identifier: MacBookPro18,3
Chip: Apple M1 Pro
Total Number of Cores: 10 (8 performance and 2 efficiency)
Memory: 32 GB
System Firmware Version: 7459.141.1
OS Loader Version: 7459.141.1

Line 190 of doe_lhs.py

I think maybe you should transpose the matrix (2D array) of Hcandidate (Hcandidate.T) in order to get the correct correlation matrix? The numpy documents states each row is associated with the samples of one variable (which is different from MATLAB). Thanks!

Request that you use np.random.RandomState for random draws

The code would be much more flexible if you passed a numpy random state in and used that for the random draws. Object oriented random number generator would allow the user to create and manage multiple lhs (and other) designs simultaneously.

def lhs(rstate, n, samples=None, criterion=None, iterations=None):
    """
    Generate a latin-hypercube design

    Parameters

    rstate : np.random.RandomState
         Random state which controls the seed and random draws

An example use is:

# set the random state once for each independent design
rstate = np.random.RandomState(master_seed)  

# in the source code the draw is now controlled by the explicit random state object
u = rstate.rand(samples, n)   # instead of np.random.rand(samples, n)


This design philosophy is much more flexible.

can't install

setup.py imports pyDOE, so this can't be installed unless it's already installed. A catch-22.

bbdesign result not consistent with docs

I get this result:

Python 2.7.5+ (default, Sep 19 2013, 13:48:49) 
Type "copyright", "credits" or "license" for more information.

IPython 1.1.0 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: from pyDOE import *

In [2]: bbdesign(3)
Out[2]: 
array([[-3., -3.,  0.],
       [ 1., -3.,  0.],
       [-3.,  1.,  0.],
       [ 1.,  1.,  0.],
       [-3.,  0., -3.],
       [ 1.,  0., -3.],
       [-3.,  0.,  1.],
       [ 1.,  0.,  1.],
       [ 0., -3., -3.],
       [ 0.,  1., -3.],
       [ 0., -3.,  1.],
       [ 0.,  1.,  1.],
       [ 0.,  0.,  0.],
       [ 0.,  0.,  0.],
       [ 0.,  0.,  0.]])

Instead of this:

Help on function bbdesign in module pyDOE.doe_box_behnken:

...

    Example
    -------
    ::

        >>> bbdesign(3)
        array([[-1., -1.,  0.],
               [ 1., -1.,  0.],
               [-1.,  1.,  0.],
               [ 1.,  1.,  0.],
               [-1.,  0., -1.],
               [ 1.,  0., -1.],
               [-1.,  0.,  1.],
               [ 1.,  0.,  1.],
               [ 0., -1., -1.],
               [ 0.,  1., -1.],
               [ 0., -1.,  1.],
               [ 0.,  1.,  1.],
               [ 0.,  0.,  0.],
               [ 0.,  0.,  0.],
               [ 0.,  0.,  0.]])

The issue seems to be that we're getting -3s instead of -1s. Something similar seems to be happening in ccdesign.

TypeError Python 3.5.2

Hi,

I get the following TypeError with newer versions of Python. Any suggestions how to fix this?

Kind regards,
e-neu

pyDOE.fullfact([1, 2])

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-65-d26355a11123> in <module>()
----> 1 pyDOE.fullfact([1, 2])

C:\Users\XXX\AppData\Roaming\Python\Python35\site-packages\pydoe-0.3.8-py3.5.egg\pyDOE\doe_factorial.py in fullfact(levels)
     76         for j in range(levels[i]):
     77             lvl += [j]*level_repeat
---> 78         rng = lvl*range_repeat
     79         level_repeat *= levels[i]
     80         H[:, i] = rng

TypeError: 'numpy.float64' object cannot be interpreted as an integer
import sys
sys.version

'3.5.2 |Anaconda custom (64-bit)| (default, Jul 5 2016, 11:41:13) [MSC v.1900 64 bit (AMD64)]'

import pyDOE
pyDOE.__version__

'0.3.8'

bbdesign not working in python 3.8.5

bbdesing is not working on Python 3.8.5

This is the error if I try to run the example in the docstring

----> 1 doe.bbdesign(3)

~/virtual_enviroments/hamopt/lib/python3.8/site-packages/pyDOE/doe_box_behnken.py in bbdesign(n, center)
     64 
     65     # First, compute a factorial DOE with 2 parameters
---> 66     H_fact = ff2n(2)
     67     # Now we populate the real DOE with this DOE
     68 

~/virtual_enviroments/hamopt/lib/python3.8/site-packages/pyDOE/doe_factorial.py in ff2n(n)
    113 
    114     """
--> 115     return 2*fullfact([2]*n) - 1
    116 
    117 ################################################################################

~/virtual_enviroments/hamopt/lib/python3.8/site-packages/pyDOE/doe_factorial.py in fullfact(levels)
     76         for j in range(levels[i]):
     77             lvl += [j]*level_repeat
---> 78         rng = lvl*range_repeat
     79         level_repeat *= levels[i]
     80         H[:, i] = rng

TypeError: can't multiply sequence by non-int of type 'numpy.float64'

Seed for latin hypercube

Hi,
I am playing with the latin hypercube samper and was wondering if there is
a way to set the random seed somewhere.
Thanks,
Holger

Add Unit Tests?

I work on a team that would like to use the Latin Hypercube from PyDOE. But I note there is no unit testing on this project.

If I were to build a set of unit tests (say with pytest) and have them run via GitHub Actions, would you accept the PR?

(I notice there is not a lot of movement on the project in the last few years, so this may not be an option.)

pyDOE pbdesign not accepting large number of features

when I try n=60 I do get a return array
but for 61 or 64 I get an error
as if that isnt a 4-fold...
while it works for n=17 :-)

How to get a PB design for large numbers of uncertainties (>48 .. 500)?

Erik

AssertionError Traceback (most recent call last)
in
11 # # Plackett-Burman, by concept, ignoring Factors, then merge all PB designs over all concepts into one JS table
12 # PB_Design_Array = pbdesign(NrFeatures_Concept)
---> 13 PB_Design_Array = pbdesign(64)
14 print(f' PB_Design_Array:=<{PB_Design_Array}>\n PB_Design_Array.shape={PB_Design_Array.shape}')

~\AppData\Local\Programs\Python\Python37\lib\site-packages\pyDOE\doe_plackett_burman.py in pbdesign(n)
67 k = [idx for idx, val in enumerate(np.logical_and(f==0.5, e>0)) if val]
68
---> 69 assert isinstance(n, int) and k!=[], 'Invalid inputs. n must be a multiple of 4.'
70
71 k = k[0]

AssertionError: Invalid inputs. n must be a multiple of 4.

python3 error

(doe) LC25423:Envs corti938$ ipython
Python 3.6.4 |Anaconda, Inc.| (default, Jan 16 2018, 12:04:33)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.1.1 -- An enhanced Interactive Python. Type '?' for help.

In [1]: from pyDOE import *

In [2]: import pyDOE

In [3]: pyDOE.version
Out[3]: '0.3.8'

In [4]: fullfact([2, 3])

TypeError Traceback (most recent call last)
in
----> 1 fullfact([2, 3])

~/my_codes/Envs/doe/lib/python3.6/site-packages/pyDOE/doe_factorial.py in fullfact(levels)
76 for j in range(levels[i]):
77 lvl += [j]level_repeat
---> 78 rng = lvl
range_repeat
79 level_repeat *= levels[i]
80 H[:, i] = rng

TypeError: can't multiply sequence by non-int of type 'numpy.float64'

"correlate"/"correlation" confusion in doe_lhs.py

Just a heads-up:

There's a mixup with the name for the correlation criterion for the Latin Hypercube. In doe_lhs.py, the documentation says "correlation" but the example says 'correlate'. The check in the code uses 'correlation', but later the if that actually selects the used function uses 'correlate'.

36:        "centermaximin" or "cm", and "correlation" or "corr". If no value 
88:        >>> lhs(4, samples=5, criterion='correlate', iterations=10)
98:            'centermaximin', 'cm', 'correlation', 
116:        elif criterion.lower() in ('correlate', 'corr'):

Thanks!

_lhscorrelate calculates correlation coefficient incorrectly

The correlation coefficient in _lhscorrelate is calculated as:
R = np.corrcoef(Hcandidate)
According to NumPy documentation, this function expects each row to be a variable; however, lhs treats the columns as variables. The correct way to calculate the correlation coefficient should be:
R = np.corrcoef(Hcandidate, rowvar=False)

pyDOE ccdesign float error

Hi

I am new to Python. I am using miniconda. I installed pyDOE using conda install -c conda-forge pydoe

When I run the ccdesign command,
ccdesign(2)
I get the following error -

File "", line 1, in
pyDOE.ccdesign(2)
File "/home/home_shihab/miniconda3/lib/python3.6/site-packages/pyDOE/doe_composite.py", line 151, in ccdesign
H1 = ff2n(n)
File "/home/home_shihab/miniconda3/lib/python3.6/site-packages/pyDOE/doe_factorial.py", line 115, in ff2n
return 2*fullfact([2]n) - 1
File "/home/home_shihab/miniconda3/lib/python3.6/site-packages/pyDOE/doe_factorial.py", line 78, in fullfact
rng = lvl
range_repeat
TypeError: 'numpy.float64' object cannot be interpreted as an integer

What should I do?

Python 3 numpy warnings

In Python 3.6.0, numpy 1.11.3, the following warnings appear:

C:\Users\######\AppData\Local\Continuum\Anaconda3\lib\site-packages\pydoe-0.3.8-py3.6.egg\pyDOE\doe_repeat_center.py:43: VisibleDep
recationWarning: using a non-integer number instead of an integer will result in an error in the future
.C:\Users\######\AppData\Local\Continuum\Anaconda3\lib\site-packages\pydoe-0.3.8-py3.6.egg\pyDOE\doe_factorial.py:78: VisibleDeprec
ationWarning: using a non-integer number instead of an integer will result in an error in the future

At least one of them appears to be due to this line in bbdesign:
nb_lines = (n*(n-1)/2)*H_fact.shape[0]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.