File Exchange

image thumbnail

Radial Basis Function Network

version 1.3 (8.14 KB) by

Simulates and trains Gaussian and polyharmonic spline radial basis function networks.

4.42857
8 Ratings

50 Downloads

Updated

View License

Radial basis functions are use for function approximation and interpolation. This package supports two popular classes of rbf: Gaussian and Polyharmonic Splines (of which the Thin Plate Spline is a subclass).
The package also calculates line integrals between two points as well as the surface's gradients.

For more information, see blog.nutaksas.com for academic papers.

Comments and Ratings (15)

Sonali Jena

Hai, I want to ask how to make block diagram simulink Space Vector Pulse Width Modulation based by Radial Basis Function. Please I need that block diagram, because that is my honours project on my campus.

Fadya jaw

num_tr = 3000;
num_te = 500;
num_hd = 20;
num_ou = 1;
num_in = 2;
num_hd = 30;
num_samp = num_tr+num_te;
width = 4;
dist = -4;
seed=3000;
rand('seed',seed);
[data1,Y1,Xt1]= double halfmoons(rad,width,dist,(num_samp./2),)
random_data=[data1,Y1]';random_seq = randperm(num_samp);random_data = random_data(:,random_seq);
X = random_data(1:2,1:num_tr)';
[indx,centers] = kmeans(X,num_hd);
pos_vector = indx';
c = centers';
%Calculating the variance for each center
for i = 1 : num_hd;
    
    cluster_number=(i);
    variance = 0;
    counter2=0;
    for j = 1 : num_tr;
        if cluster_number==pos_vector(j)
            sssss = sqrt(sum((random_data(1:2,j)'-c(:,i)').^2))
            variance = sssss + variance
            counter2=counter2+1;
        end
    end
    sigma(i) = variance/counter2;
end
 
%Parameters For RLS
w = ones(num_ou,num_hd);
lambda=0.9
P= (lambda)^(-1)*eye(num_hd);
spread = sigma;
IN = random_data(1:2,1:num_tr);
T = random_data(3,1:num_tr);
 
P= (lambda)^(-1)*eye(num_hd);
w = ones(num_ou,num_hd);
num_train_min=10;
for epoch =1:50;
    
    
    for m = 1:(num_tr-num_tr./10);

            for i = 1:num_hd;
             g(i,:) = exp(-(x-c(:,i))'*(x-c(:,i))/(2*spread(i)^2));
            end
     
        alpha = d - w*g;
        w_diffrence = ((P*g)*alpha' )';
        if (norm(w_diffrence) < 0.01) && (m >= num_train_min)
            
            break;
        end
        w = w + w_diffrence ;
           P=P-((P*g/(g'*P*g))*g'*P) ;
    end
 
end

Fadya jaw

%k-mean/rls

num_tr = 3600;
num_te = 400;
num_hd = 20;
num_ou = 1;
num_in = 2;
num_hd = 30;
num_samp = num_tr+num_te;
rad = 10;
width = 6;
dist = -6;
seed=30000000;
rand('seed',seed);
[data1,Y1,Xt1]=generate_two_moons(rad,width,dist,(num_samp./2),seed,0)
random_data=[data1,Y1]';random_seq = randperm(num_samp);random_data = random_data(:,random_seq);
X = random_data(1:2,1:num_tr)';
[indx,centers] = kmeans(X,num_hd);
pos_vector = indx';
c = centers';
%Calculating the variance for each center
for i = 1 : num_hd;
    
    cluster_number=(i);
    variance = 0;
    counter2=0;
    for j = 1 : num_tr;
        if cluster_number==pos_vector(j)
            sssss = sqrt(sum((random_data(1:2,j)'-c(:,i)').^2))
            variance = sssss + variance
            counter2=counter2+1;
        end
    end
    sigma(i) = variance/counter2;
end
 
%Parameters For RLS
w = ones(num_ou,num_hd);
lambda=0.9
P= (lambda)^(-1)*eye(num_hd);
spread = sigma;
IN = random_data(1:2,1:num_tr);
T = random_data(3,1:num_tr);
 
P= (lambda)^(-1)*eye(num_hd);
w = ones(num_ou,num_hd);
num_train_min=10;
for epoch =1:50;
    
    
    for m = 1:(num_tr-num_tr./10);

            for i = 1:num_hd;
             g(i,:) = exp(-(x-c(:,i))'*(x-c(:,i))/(2*spread(i)^2));
            end
     
        alpha = d - w*g;
        w_diffrence = ((P*g)*alpha' )';
        if (norm(w_diffrence) < 0.01) && (m >= num_train_min)
            
            break;
        end
        w = w + w_diffrence ;
           P=P-((P*g/(g'*P*g))*g'*P) ;
    end
 
end

dana gera

Bat

Bat (view profile)

It is ok.
Perfect!

Bat

Bat (view profile)

Thank you,
For the gradient, 'polyharmonicspline' case, isn't it "r.^(k_i(i)-1).*dX(:,jj).*(1+k_i(i)*log(r)" instead?

chu pingjung

hi sir..i need your help to solving my problem.. i am university student from indonesia..now i have research use metode RBF function for prediction rainfall.. in my research i have 4 input and 1 ouput which is output as rainfall..but i don't understand to use a scipt train_rbf;sim_rbf..if i input this code to windows command, it doesn't work.. could u gimme a prosedur step by step to use matlab 2014 a with metode

Shunmugesh

Dear Sir.,

I am new to ANN and i want to use RBF for my drilling optimization problem.
Which consist of 3 input and 3 output.
 I would appreciate if you get in matlab coding.
Pl send the code to shunmugesh@gmail.com

please provide code for dual directional sparse radial basis function

a shrestha

Hi,
i went through your last coding about rbf_1_02. I am just a beginner in RBF. I am working in a research for forecasting. I need a RBF network which has 5 input (environment factors) and one output(suitability index) for predicting the probability of fish catch. i would appreciate if i wil get any help in matlab coding.

Peter Ingram

hi,
I am a beginner in ANN and going through this code for some basic knowledge of RBF. I need to degin a RBF network(with gaussian function) for 22 inputs and 6 outputs. The problem is about the classification of breast cancer types. The 22 inputs are the features extracted from the given breast image(mammogram) and 6 outputs are the different cancer types. The second stage network is also needed with 2 or 3 outputs also(cancer stages). It would be great if you could manage some time to help me this with matlab code.
Thanks in advance!!

Updates

1.3

This update adds a gradient calculator.

1.2

Improved linear inversion.

1.1

Removed GPL per Mathworks' requirements.

MATLAB Release
MATLAB 7.4 (R2007a)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video