Git Product home page Git Product logo

Comments (5)

dme65 avatar dme65 commented on June 13, 2024

Your data points should have size 20 x 3 since you have 20 points in 3 dimensions.

A simple example where you build a cubic RBF from 100 data points in 3 dimensions may look like this:

import numpy as np
from pySOT.surrogate import RBFInterpolant, CubicKernel, LinearTail

np.random.seed(0)
X = np.random.rand(100, 3)
y = np.sin(np.sum(X, 1))
rbf = RBFInterpolant(dim=3, kernel=CubicKernel(), tail=LinearTail(dim=3), eta=1e-6)
rbf.add_points(X, y)
print(rbf.predict(np.zeros((1, 3))))  # Should be close to 0

Output:

[[0.01681138]]

The functional form of the surrogate model depends on what model you're using. RBFs aren't easily interpretable from the model weights, but other models like polynomial regression are.

from pysot.

Zosezhuo avatar Zosezhuo commented on June 13, 2024

Hello,

My query is related to the above example.

Using your example above, I would like to build a cubic RBF over 20 points in 3*3 dimensions.

Does pySOT support this feature?

Thank you!

from pysot.

dme65 avatar dme65 commented on June 13, 2024

Hi Zosezhuo,
Can you clarify what you mean by 3*3 dimensions?

from pysot.

Zosezhuo avatar Zosezhuo commented on June 13, 2024

Hi

Specifically, I would like to do the following in 3 by 3 dimensions.

np.random.seed(0)
X = np.random.uniform(low=0.0, high=1.0, size=[3,3])
y= fun(X)
y2= fun2(X)

print(X)
print(y)
print(y2)
[[0.5488135  0.71518937 0.60276338]
 [0.54488318 0.4236548  0.64589411]
 [0.43758721 0.891773   0.96366276]]
134408.75071136828
3.144276104044118

When I tried to add points, I received the following output

rbf_cubic = RBFInterpolant(dim=[3,3], kernel=CubicKernel(), tail=LinearTail(dim=[3,3]), eta=1e-6)
rbf_cubic.add_points(X, y)
rbf_cubic.add_points(X, y2)

TypeError: unsupported operand type(s) for +: 'int' and 'list

Appreciate your time and help very much

from pysot.

dme65 avatar dme65 commented on June 13, 2024

An RBF interpolant is a function from R^d -> R. You need to pass in a matrix X with shape (n, d) and y with shape (n,).

from pysot.

Related Issues (20)

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.