%PS2 Solution %1. Floor data using smooth function, take log %2. Compute normalization constants for ML and MAP estimation. Normalize % data using the following norm methods: % Max Likelihood % Max a Posteriori % Whole chip % Arithmetic mean % No normalization %Call the dataset being normalized unnorm_data. That way you %only have to change the name in one place to go from normalizing %the test data to normalizing the real data. unnorm_data = test; %control_rows is the number of rows containing "controls". %For test, it's 5, for PS2 it's 15. control_rows = 5; %get the total number of rows being normalized, find missing data total_rows = size(unnorm_data,1); missing_data = unnorm_data==-1000; %1. Floor data using a smooth function such that values less than 40 % (including negativevalues) are all compacted into the range % between 0 and 40. Use the following transform: % x --> x x in (40,INF) % x --> (x^2)/160 + x/2 + 10 x in [-35,40] % x --> 0.15625 x in (-INF,-35) % % Then, take the log. %!YOUR CODE HERE, you should end up with 2 new data sets, log_floor_data and floor_data %2. Compute Max Likelihood and MAP of normalization parameters % Using functions that you have written (added code to) % ML_norm takes as input the unnormalized (log) controls, % and returns the normalization (log) constants % MAP_norm takes as input the unnormalized (log) controls, % and two constants, alpha and t. % Those are currently set as 3 and 1, you can change them if you like % and see what the effects are. % MAP_norm also returns the normalization (log) constants. % %calculate normalization constants for the ML and MAP methods ML_norm_consts = ML_norm(log_floor_data(1:control_rows,:)); MAP_norm_consts = MAP_norm(log_floor_data(1:control_rows,:),3,1); %normalize the data norm_ML = log_floor_data-repmat(ML_norm_consts,total_rows,1); norm_ML(missing_data) = -1000; norm_MAP = log_floor_data-repmat(MAP_norm_consts,total_rows,1); norm_MAP(missing_data) = -1000; norm_WC = log(WC_normalize(floor_data, missing_data,WC_data)); norm_AM = log(AM_normalize(floor_data, missing_data,control_rows));