Skip to main content

Description

This project is an adaptation from the work of Hans Bruun Nielsen, Søren Nymand and Lophaven Jacob Søndergaard.

Notes

This is a implementation that relies heavily on linear algebra solvers (least-squares solvers, Cholesky and QR decompositions, etc.). Therefore, it is strongly advised that your numpy library be integrated to a BLAS library (e.g.: Intel-MKL, OpenBLAS, ATLAS, etc.) in order to attain satisfactory performances of calculation.

For the sake of convenience, Anaconda handles the gritty details of how to combine numpy and those libraries natively.

Installation

To install through PyPi Repository:

pip install pydace

To install via conda

conda install -c felipes21 pydace

Usage

Example with dace model

    import numpy as np
    import scipy.io as sio
    from pydace import Dace
    import matplotlib.pyplot as plt
    
    # Load the training and validation data. (Here we are using a file from the
    # github repo located in the folder pydace\tests with the name 
    # 'doe_final_infill_mat'
    
    mat_contents = sio.loadmat('doe_final_infill.mat')
    
    design_data = mat_contents['MV']  # design sites
    observed_data = mat_contents['CV']  # experiment results
    
    # define the hyperparameters bounds and initial estimate
    theta0 = 1 * np.ones((design_data.shape[1],))
    lob = 1e-5 * np.ones(theta0.shape)
    upb = 1e5 * np.ones(theta0.shape)
    
    # select the training and validation data
    design_val = design_data[:99, :]
    observed_val = observed_data[:99, :]
    
    design_train = design_data[100:, :]
    observed_train = observed_data[100:, :]
    
    # build the univariate kriging models with a first order polynomial 
    # regression and a gaussian regression model
    observed_prediction = np.empty(observed_val.shape)
    for j in np.arange(design_data.shape[1]):
        # initialize the dace object
        dace_obj = Dace('poly1', 'corrgauss', optimizer='boxmin')

        # fit the training data using the default hyperparameter optimizer
        dace_obj.fit(design_train, observed_train[:, j], theta0, lob, upb)

        # predict the validation data
        observed_prediction[:, [j]], *_ = dace_obj.predict(design_val)
    
    # labels for the observed data
    var_labels = ['L/F', 'V/F', 'xD', 'xB', 'J', 'QR'] 
    
    # plot the validation data
    for var in np.arange(design_data.shape[1]):
        plt.figure(var + 1)
        plt.plot(observed_val[:, var], observed_prediction[:,var], 'b+')
        plt.xlabel(var_labels[var] + ' - Observed')
        plt.ylabel(var_labels[var] + ' - Kriging Prediction')
    
    plt.show()

Example of design of experiment data generation

It is also possible to generate design of experiment data with a variation reduction technique called Latin Hypercube Sampling (LHS) that is already implemented in this toolbox.

Lets say we have a 4-th dimensional problem (i.e. 4 design/input variables). They are defined by the following bounds.

Variables to sample

If we want to build a latin hypercube within these bounds we would do the following:

    import numpy as np
    from pydace.aux_functions import lhsdesign
    
    lb = np.array([8.5, 0., 102., 0.])
    ub = np.array([20., 100., 400., 400.])

    lhs = lhsdesign(53, lb, ub, include_vertices=False)

Contact/Talk to me

My e-email is felipe.lima@eq.ufcg.edu.br. Feel free to contact me anytime, or just nag me if I'm being lazy.

Metadata

Release files for pydace 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pydace 0.1.4
File Size Uploaded
pydace-0.1.4.tar.gz 18.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pydace 0.1.4
File Interpreter ABI Platform
pydace-0.1.4-py3-none-any.whl Python 3 none any Details

Total release size: 36.2 kB

Release files / pydace-0.1.4.tar.gz

Download URL pydace-0.1.4.tar.gz
Size 18.0 kB
Tags Source
SHA-256 checksum
How to use checksums
dbb7ba6166fc2f35ca7889de8101f53515c13192b97c7eb83192dc4a8e934e6b
BLAKE2b-256 checksum
How to use checksums
8a45a460cb37d7ffb6746d3789bae2fa9b6d879c225c107a66f991f41d447dd2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5

Release files / pydace-0.1.4-py3-none-any.whl

Download URL pydace-0.1.4-py3-none-any.whl
Size 18.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
852ce3f73ca81a31ca8fb9ab35deb7a1872e5f5d300fc8832a21e5a1ade64023
BLAKE2b-256 checksum
How to use checksums
4b04fa43c61b9ef741a82c1215befbefbdb060fce14ecfd41dd6c8a363662e79
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5

Release history Release notifications | RSS feed

This release

0.1.4 This release

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page