R and Bigdata and wolfram mathematica

profileoveleberry
bigdata.zip

BD_Prj_1.pdf

Big Data Analytics - Spring 2016 - Project 1 Calibration Problem

In this project you will implement and demonstrate optimal calibration for a linear estimation. The underlying process imitates a simple signal measurement experiment and is heavily based on Homework 4. Here are suggested phases of the project.

1. Measurement Simulation:

(a) Randomly generate some “unknown” profile x ∼ (0, F). (b) Create a matrix A.

(c) Simulate a measurement

y = Ax + ν, ν ∼ (0, σ2 I).

2. Calibration (assuming that A is unknown):

(a) Randomly generate calibration signals ϕk, k = 1, . . . , K in the same way as you generated x.

(b) Simulate calibration measurements

ψk = A ϕk + νk.

(c) Collect canonical calibration information (G, H).

(d) Compute A0 (an estimate of A) and J.

3. Using your simulated observation y construct an optimal linear esti- mate x̂ and the variance matrix Var(x̂ − x). Show on the same graph:

(a) The original signal x (a curve with components xi),

(b) Its estimate x̂ (a curve with components x̂i),

1

(c) Standard deviations for the estimates x̂i√ E(x̂i − xi)2 =

√ Var(x̂ − x)ii =

√ Qii

can be illustrated by showing the corresponding “corridor” around x̂i).

4. Illustrate estimation (Phase 3) when you not only increase the num- ber of calibration measurements K but also measure the original sig- nal x N times:

(a) Simulate N measurements yn = Ax + νn for n = 1, . . . , N and collect the appropriate information.

(b) Simulate K calibration measurements, collect canonical calibra- tion information, and compute A0 and J.

(c) Using these two types of information construct and show (as in Phase 3) an optimal linear estimate x̂ and its precision.

(d) Using these two types of information construct and show (as in Phase 3) an optimal linear estimate x̂ and its precision.

(e) Do the above for several cases with numbers N and K “small” “medium”, and “large”.

(f) Show how estimation precision depends on N and K. To do that you could show total estimation error

E||x̂ − x||2 = trQ

as a function of N and K. To illustrate a function of two variables you can show it, e.g., as a surface or as a pseudocolor image. It might be interesting to indicate contour lines (curve along which the function has a constant value).

Please do not hesitate to ask questions. For more details please see lectures and the sample code from: http://www.math.umt.edu/golubtsov/BD 2016 S/HW4 Demo/Signal 2.m

2

__MACOSX/._BD_Prj_1.pdf

BD_Prj_2.pdf

Big Data Analytics - Spring 2016 - Project 2 Real Time Signal Processing

In this project you will implement and demonstrate optimal signal pro- cessing with a sliding window. Some parts of this project are related to Homework 4. Here are suggested phases of the project.

1. Specifying problem settings:

(a) Specify main ingredients of your simulated measurement system a, f , σ2:

i. Symmetric point spread function (influence function) a, ii. Covariance function f for the signal x:

f = Cov(x) = b ∗ b∗.

For that you need to specify some “smoothing” function b first. iii. Variance σ2 of independent components of the additive ran-

dom noise ν. y = a ∗ x + ν, ν ∼ (0, σ2δ).

(b) Choose some symmetric support interval ∆ = [−d, d] for the point spread function of the processing algorithm, where d ≥ 0 is a parameter.

2. Computing optimal influence function r:

(a) Compute p = a ∗ f ∗ a∗ + s and p = f ∗ a∗. (b) Construct matrix P.

(c) Using p and q find r.

(d) Show graphs for a, f , r, and r ∗ a. (e) Do that for a range of parameters d and show how estimation

precision H(d) = E(x̂i − xi)2 = f0 −〈q, P−1q〉∆

1

depends on parameter d. (f) Using this graph determine a “good” choice for your parameter

d.

3. Simulation of Measurement and Processing:

(a) Randomly generate some “unknown” profile x ∼ (0, f ). To do that you will need to generate random signal µ with i.i.d. compo- nents and “smooth” it with b by computing a convolution b ∗ µ (to be more specific, take the “internal” part of convolution).

(b) Simulate a measurement

y = a ∗ x + ν, ν ∼ (0, σ2δ).

Here again take the “internal” part of convolution. (c) Produce an estimate of x

x̂ = r ∗ y.

Again take the “internal” part of convolution.

4. Illustrate results of estimation. Show:

(a) The original signal x (a curve with components xi), (b) Observation y (a curve with components yi), (c) Estimate of x: x̂ (a curve with components x̂i), (d) Standard deviations for the estimates x̂i√

E(x̂i − xi)2 = √

H

can be illustrated by the corresponding “corridor” around x̂i).

Please do not hesitate to ask questions. For more details please see lectures and the sample code from: http://www.math.umt.edu/golubtsov/BD 2014 S/Prj2 Demo.

2

__MACOSX/._BD_Prj_2.pdf

BD_Prj_3.pdf

Big Data Analytics - Spring 2016 - Project 3 Time Series Processing

In this project you will implement and demonstrate optimal time series processing with a sliding window. Some parts of this project are related to Homework 4. Here are suggested phases of the project.

1 Specifying problem settings:

(a) Specify main ingredients of your simulated measurement system a, f , σ2: i. Asymmetric (only previous and current values of signal x can

influence current value of measurement y) point spread func- tion (influence function) a,

ii. Covariance function f for the signal x:

f = Cov(x) = b ∗ b∗.

For that you need to specify some “smoothing” function b first. iii. Variance σ2 of independent components of the additive ran-

dom noise ν. y = a ∗ x + ν, ν ∼ (0, σ2δ).

(b) Choose some (possibly asymmetric) support interval ∆ = [−T, τ] for the point spread function of the processing algorithm. Here T ≥ 0 and τ ≥ 0 (prediction delay) are parameters.

2 Computing optimal influence function r:

(a) Compute p = a ∗ f ∗ a∗ + s and p = f ∗ a∗. (b) Construct matrix P. (c) Using p and q find r. (d) Show graphs for a, f , r, and r ∗ a. (e) Do that for a range of parameters T and τ and show how estima-

tion precision

H(T, τ) = E(x̂i − xi)2 = f0 −〈q, P−1q〉∆

1

depends on parameters. To illustrate a function of two variables you can show it, e.g., as a surface or as a pseudocolor image. It might be interesting to indicate contour lines (curve along which the function has a constant value).

(f) Using this graph determine a “good” choice for parameters T, τ.

3 Simulation of Measurement and Processing:

(a) Randomly generate some “unknown” profile x ∼ (0, f ). To do that you will need to generate random signal µ with i.i.d. compo- nents and “smooth” it with b by computing a convolution b ∗ µ (to be more specific, take the “intenal” part of convolution).

(b) Simulate a measurement

y = a ∗ x + ν, ν ∼ (0, σ2δ).

Here again take the “intenal” part of convolution. (c) Produce an estimate of x

x̂ = r ∗ y.

Again take the “intenal” part of convolution.

4 Illustrate results of estimation. Show:

(a) The original signal x (a curve with components xi), (b) Observation y (a curve with components yi), (c) Estimate of x: x̂ (a curve with components x̂i), (d) Standard deviations for the estimates x̂i√

E(x̂i − xi)2 = √

H

can be illustrated by the corresponding “corridor” around x̂i).

Please do not hesitate to ask questions. For more details please see lectures and the sample code from: http://www.math.umt.edu/golubtsov/BD 2014 S/Prj2 Demo.

2

__MACOSX/._BD_Prj_3.pdf

BD_Prj_4.pdf

Big Data Analytics - Spring 2016 - Project 4 Real Time Image Processing

In this project you will implement and demonstrate optimal image pro- cessing with a sliding window. All point spread functions and covari- ance functions in this project are two-dimensional. Some parts of this project are related to Homework 4. Here are suggested phases of the project.

1. Specifying problem settings:

(a) Specify main ingredients of your simulated measurement system a, f , σ2: i. Symmetric point spread function (influence function) a,

ii. Covariance function f for the signal x:

f = Cov(x) = b ∗ b∗.

For that you need to specify some “smoothing” function b first. iii. Variance σ2 of the independent components of the additive ran-

dom noise ν. y = a ∗ x + ν, ν ∼ (0, σ2δ).

(b) Choose some symmetric (square or circle) support set ∆ = [−d, d] for the point spread function of the processing algorithm, where d ≥ 0 is a parameter. For the square support ∆ = {(i, j)|− d ≤ i, j ≤ d}, for the circle one: ∆ = {(i, j)|i2 + j2 ≤ d2}.

2. Computing optimal influence function r:

(a) Compute p = a ∗ f ∗ a∗ + s and p = f ∗ a∗. (b) Construct matrix P. (c) Using p and q find r. (d) Show graphs for a, f , r, and r ∗ a.

1

(e) Do that for a range of parameters d and show on a graph how estimation precision

H(d) = E(x̂ij − xij)2 = f0 −〈q, P−1q〉∆

depends on parameter d. (f) Using this graph determine a “good” choice for parameter d.

3. Simulation of Measurement and Processing:

(a) Randomly generate some “unknown” profile x ∼ (0, f ). To do that you will need to generate random signal µ with i.i.d. compo- nents and “smooth” it with b by computing a convolution b ∗ µ (to be more specific, take the “internal” part of convolution).

(b) Simulate a measurement

y = a ∗ x + ν, ν ∼ (0, σ2δ).

Here again take the “internal” part of convolution. (c) Produce an estimate of x

x̂ = r ∗ y.

Again take the “internal” part of convolution.

4. Illustrate results of estimation. Show:

(a) The original image x (with components xij), (b) Observation y (an image with components yij), (c) Estimate of x: x̂ (a image with components x̂ij), (d) Compute the standard deviations for the estimates x̂ij√

E(x̂ij − xij)2 = √

H.

Please do not hesitate to ask questions. For more details please see lectures and the sample code from: http://www.math.umt.edu/golubtsov/BD 2014 S/Prj2 Demo.

2

__MACOSX/._BD_Prj_4.pdf

EXAM CODE.pdf

% Homework #4 Tempate M = 100; % Dimension of Unknown Signal x s = .1; % Standard deviation for random noise (Var = s^2)

g = randn(M,1);

figure(1); plot(g,'linewidth',3); title('Uncorrelated Random Signal \mu to generate x','FontSize',14);

b0 = 7:-1:1; b = [b0 zeros(1,M-size(b0,2))]; % B = toeplitz(b); % Symmetric Toeplitz matrix with "triangular" profile

F = B*B'; % Variance matrix for x

x = B*g; % Random signal with variance matrix F

figure(2); plot(x,'linewidth',3); title('Input Signal x','FontSize',14);

% Profile of he Point Spread Function a d=9; al=-d; ar=d; a = ones(1,ar-al+1); % Rectangular Profile % d=9; al=-d; ar=d; a = [1:d+1 d:-1:1]; % Triangular Profile % d=12; al=-d; ar=d; a = (d+1)^2-(-d:d).^2; % Parabolic Profile % d=10; al=-d; ar=d; a = exp(-(-d:d).^2/(2*(d/3)^2)); % Gaussian Profile % d=50; al=0; ar=d; a = exp(-(0:d)/(d/4)); % Exponential (asymmetric) Profile

a = a/sum(a); % 'Normalized' PSF: sum a_i = 1

figure(3); plot(al-1:ar+1,[0 a 0],'linewidth',3); title('Point Spread Function a','FontSize',14);

N = M + ar-al; % Dimension of observed signal y

A = zeros(N,M); % Matrix A determined by PSF a for j=1:M A(j+(0:ar-al),j) = a; end

y = A*x + s*randn(N,1); % Measurement

figure(4); plot(y,'linewidth',3); title('Observation y = Ax + \nu','FontSize',14);

figure(5); plot([1+al M+ar],[0 0],'k','linewidth',2); hold on hx=plot(1:M,x,'linewidth',3); hy=plot(1+al:M+ar,y,'r','linewidth',3);

hold off title('Signal x and Observation y','FontSize',14); legend([hx hy],'x','y'); grid on ax=axis; axis([1+al M+ar ax(3:4)]);

Part2 classdef FinSupFun % Finite Support Function properties (SetAccess = private) l = Inf; r = -Inf; f = []; % Function w support [l,r] end methods function c = FinSupFun(F,L) % Constructor if nargin == 0 % Empty function c.l = Inf; c.r = -Inf; c.f = []; % Function w support [l,r] elseif nargin == 1 % Symmetric (even) function c.r = size(F,2)-1; c.l = -c.r; c.f = [fliplr(F) F(2:c.r+1)]; % c.l = 0; % c.r = size(F,2)-1; % c.f = F; elseif nargin == 2 c.l = L; c.r = L+size(F,2)-1; c.f = F; end end function c = plus(a,b) % Addition L = min(a.l, b.l); R = max(a.r, b.r); F = zeros(1, R-L+1); F((a.l:a.r)-L+1) = a.f; F((b.l:b.r)-L+1) = F((b.l:b.r)-L+1) + b.f; c = FinSupFun(F, L); end function c = mtimes(a,b) % * Convolution Full c = FinSupFun(conv(a.f,b.f), a.l + b.l); end

function c = times(a,b) % .* Convolution Internal c = FinSupFun(conv(b.f,a.f,'valid'), b.l + a.r); end function b = ctranspose(a) % ' Reverse (transposed) b = FinSupFun(fliplr(a.f), -a.r); end end end % classdef

part3 % FinSupFun_Demo_AS

s = .1;

mu = FinSupFun(randn(1,200),0); b = FinSupFun(.03*(7:-1:1)); x = b .* mu; a = FinSupFun(.2*exp(-.1*(0:40)),0); y0 = a .* x; y = y0 + FinSupFun(s*randn(size(y0.f)), y0.l); phi = b*b'; p = a*phi*a' + FinSupFun(s^2);

figure(1); hm = plot(mu.l:mu.r, mu.f,'g','LineWidth',3); hold on hx = plot(x.l:x.r, x.f,'b','LineWidth',3); hy = plot(y.l:y.r, y.f,'r','LineWidth',3); hold off grid on legend([hm hx hy], '\mu', 'x', 'y');

figure(2); hb = plot(b.l:b.r, b.f,'g','LineWidth',3); hold on hf = plot(phi.l:phi.r, phi.f,'m','LineWidth',3); ha = plot(a.l:a.r, a.f,'b','LineWidth',3); hp = plot(p.l:p.r, p.f,'r','LineWidth',3); hold off grid on legend([hb hf ha hp], 'b', '\phi', 'a', ‘p');

part4 % FinSupFun_Demo_Sym

s = .1;

mu = FinSupFun(randn(1,200),0); b = FinSupFun(.03*(7:-1:1)); x = b .* mu; a = FinSupFun(.1+0*(1:15)); y0 = a .* x; y = y0 + FinSupFun(s*randn(size(y0.f)), y0.l); phi = b*b'; p = a*phi*a' + FinSupFun(s^2);

figure(1); hm = plot(mu.l:mu.r, mu.f,'g','LineWidth',3); hold on hx = plot(x.l:x.r, x.f,'b','LineWidth',3); hy = plot(y.l:y.r, y.f,'r','LineWidth',3); hold off grid on legend([hm hx hy], '\mu', 'x', 'y');

figure(2); hb = plot(b.l:b.r, b.f,'g','LineWidth',3); hold on hf = plot(phi.l:phi.r, phi.f,'m','LineWidth',3); ha = plot(a.l:a.r, a.f,'b','LineWidth',3); hp = plot(p.l:p.r, p.f,'r','LineWidth',3); hold off grid on legend([hb hf ha hp], 'b', '\phi', 'a', 'p');

__MACOSX/._EXAM CODE.pdf