1 / 26

Data driven function approximation

Data driven function approximation. Plot1d. Plot an arbitrary one-dimensional function. clear all fstr=input('input a function: x.^2+cos(x) :','s'); fx=inline(fstr); range=2*pi; x=linspace(-range,range); y=fx(x); max_y=max(abs(y)); plot(x,y/max_y); hold on;. Sampling.

danyl
Download Presentation

Data driven function approximation

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Data driven function approximation

  2. Plot1d Plot an arbitrary one-dimensional function clear all fstr=input('input a function: x.^2+cos(x) :','s'); fx=inline(fstr); range=2*pi; x=linspace(-range,range); y=fx(x); max_y=max(abs(y)); plot(x,y/max_y); hold on;

  3. Sampling N=input('keyin sample size:'); x=rand(1,N)*2*range-range; n=rand(1,N)*0.1-0.05; y=fx(x)/max_y+n; figure plot(x,y,'.');

  4. Paired data Y X

  5. Function Approximation DDFA

  6. Plot2d • Plot an arbitrary two-dimensional function fstr=input('input a 2D function: x1.^2+x2.^2+cos(x1) :','s'); fx=inline(fstr); range=pi; x1=-range:0.02:range; x2=x1; for i=1:length(x1) C(i,:)=fx(x1(i),x2); end mesh(x1,x2,C); hold on;

  7. tanh(x1+x2)+tanh(x1-x2)

  8. sin(x1+x2)

  9. Sampling N=input('keyin sample size:'); x(1,:)=rand(1,N)*2*range-range; x(2,:)=rand(1,N)*2*range-range; n=rand(1,N)*0.1-0.05; y=fx(x(1,:),x(2,:))+n; plot3(x(2,:),x(1,:),y,'.');

  10. Sampling

  11. Function guessing DDFA

  12. Neural Networks b1 tanh r1 b2 1 a1 tanh r2 a2 x ……. bM rM aM tanh rM+1 1

  13. Neural Networks b1 tanh r1 b2 1 a1 tanh r2 a2 x bM ……. rM aM tanh rM+1 1

  14. MLP_Tool.fig MLP_Tool.m

  15. Mapping • Head: function y=eval_MLP2(x,r,a,b) • Body: M=size(a,1) y=r(M+1) for m=1:M Add r(m)*tanh(a(m,:)*x+b(m)) to y

  16. Function Riddle DDFA

  17. MLP learning [a,b,r]=learn_MLP2(x',y',M); MLP learning

  18. High-dimensional function approximation The NNSYSID Toolbox

  19. One-dimensional function approximation

  20. Example Black box plot1d.m x y observation Create paired data sampling.m DDFA learning.m

  21. Example Black box plot2d.m observations Create paired data sampling2.m y=cos(x1)+sin(x2) DDFA M=input('M:'); [a,b,r]=learn_MLP(x',y',M); E=mean_square_error2(x,y,a,b,r)

  22. Mean Square Error

  23. Mean square error • Head: E=mean_square_error2(x,y,a,b,r) • Body: E = 0 n = size(x,2) for i=1:n • xi = x(:, i) • yi = eval_MLP2(xi,r,a,b) • ei=yi-y(i) • Add the square of ei to E E=E/n

  24. DDFA demo_fa2d.m fa1d.m

More Related