Skip to main content

pydacefit

The documentation can be found here: https://www.egr.msu.edu/coinlab/blankjul/pydacefit/

The purpose of this clone is to have a python version of the popular dacefit toolbox in MATLAB . The toolbox can be found here.

This framework is an exact clone of the original code and the correctness has been checked. Please contact me if you should be scenarios where the values are significantly different (10^6).

Installation

The test problems are uploaded to the PyPi Repository.

pip install pydacefit

Usage

import numpy as np

from pydacefit.corr import corr_gauss, corr_cubic, corr_exp, corr_expg, corr_spline, corr_spherical
from pydacefit.dace import DACE, regr_linear, regr_quadratic
from pydacefit.regr import regr_constant

import matplotlib.pyplot as plt

# -----------------------------------------------
# Different ways of initialization
# -----------------------------------------------

# regression can be: regr_constant, regr_linear or regr_quadratic
regression = regr_constant
# regression = regr_linear
# regression = regr_quadratic


# then define the correlation (all possible correlations are shown below)
# please have a look at the MATLAB document for more details
correlation = corr_gauss
# correlation = corr_cubic
# correlation = corr_exp
# correlation = corr_expg
# correlation = corr_spline
# correlation = corr_spherical
# correlation = corr_cubic


# This initializes a DACEFIT objective using the provided regression and correlation
# because an initial theta is provided and also thetaL and thetaU the hyper parameter
# optimization is done
dacefit = DACE(regr=regression, corr=correlation,
               theta=1.0, thetaL=0.00001, thetaU=100)

# if no lower and upper bounds are defined, then no hyperparameter optimization is executed
dacefit_no_hyperparameter_optimization = DACE(regr=regression, corr=correlation,
                                              theta=1.0, thetaL=None, thetaU=None)

# to turn on the automatic relevance detection use a vector for theta and define bounds
dacefit_with_ard = DACE(regr=regression, corr=correlation,
                        theta=[1.0, 1.0], thetaL=[0.001, 0.0001], thetaU=[20, 20])


# -----------------------------------------------
# Create some data for the purpose of testing
# -----------------------------------------------

def fun(X):
    return np.sum(np.sin(X * 2 * np.pi), axis=1)


X = np.random.random((20, 1))
F = fun(X)

# -----------------------------------------------
# Fit the model with the data and predict
# -----------------------------------------------

# create the model and fit it
dacefit.fit(X, F)

# predict values for plotting
_X = np.linspace(0, 1, 100)[:, None]
_F = dacefit.predict(_X)

# -----------------------------------------------
# Plot the results
# -----------------------------------------------

plt.scatter(X, F, label="prediction")
plt.plot(_X, _F, label="data")
plt.legend()
plt.show()

print("MSE: ", np.mean(np.abs(fun(_X)[:, None] - _F)))

Contact

Feel free to contact me if you have any question:

Julian Blank (blankjul [at] egr.msu.edu)
Michigan State University
Computational Optimization and Innovation Laboratory (COIN)
East Lansing, MI 48824, USA

Metadata

Release files for pydacefit 1.0.1

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

Source distribution (sdist)

Source distribution for pydacefit 1.0.1
File Size Uploaded
pydacefit-1.0.1.tar.gz 8.6 kB Details

Built distribution (wheel)

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

Total release size: 18.4 kB

Release files / pydacefit-1.0.1.tar.gz

Download URL pydacefit-1.0.1.tar.gz
Size 8.6 kB
Tags Source
SHA-256 checksum
How to use checksums
13f4bb9b2f9511b298511f71410294790be8c12e216b1704adcfabbc1d073083
BLAKE2b-256 checksum
How to use checksums
10f12e582500e666625798b2c3e3ddce0bc00fdf8b0e3a3f49e2008051b7739b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.5

Release files / pydacefit-1.0.1-py3-none-any.whl

Download URL pydacefit-1.0.1-py3-none-any.whl
Size 9.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
210e14ef6dad5372a9ab25128df38c0af9a495508b07f9f6570c09362ca494f4
BLAKE2b-256 checksum
How to use checksums
5e2873b349b7557251fd5730606c5b5477651518b313aad4b445d1e08c482808
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.5

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

1.0.0

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