Skip to content

Problem with Question 8 #1

@adrwend

Description

@adrwend

@fstella I have problems with accurately applying the bayesian decoding to the 2D simulation data. I have identified the problem: xy_sampling is 2D now (x + y dimension), it needs to be compared to a 2D xy_decoded. The problem is, I don't understand how to decode each dimension individually so that xy_decoded has different values in both dimensions. I suspect to use different dimensions of the 2D estimated firing rate two calculate probabilities for x and y dimenstion individually, but I am unsure on how to do that. This is how I currently do it (I was not able to attach MatLab files to this Issue) :

% Identify precision via bayesian decoding and calculating median error
% estimated_firing_rate2D has more dimenstions than spikes2D, hence for comparison they need to be aligned:

aligned_estim_firing_rate2D = reshape(estim_firing_rate2D, [], n_cells2D ); % I am not sure whether this reshaping is correct

xy_decoded=zeros(size(spikes2D,2),2); % This needs to be 2D, too

for t_bin = 1:size(spikes2D,2)
    
    if(sum(spikes2D(:,t_bin),1)>0) % Check if the time window contains spikes
    
    Post_p2D=NaN(size(aligned_estim_firing_rate2D,2),2); % Column dimension 2 for now
    
    for i=1:size(aligned_estim_firing_rate2D,1)
        
        % Note that we work with log so that we can sum probabilities instead of multiplying them
        % Here I need to somehow calculate probabilities for 2 dimensions individually:
        Post_p2D(i,1)=sum(log(poisspdf(spikes2D(:,t_bin),aligned_estim_firing_rate2D(:,i)/sampling_rate2D))); 
        Post_p2D(i,2)=
        
    end
          
    xy_decoded(t_bin,:) = find(Post_p2D==nanmax(Post_p2D),1,'first');

    else
        
    xy_decoded(t_bin,:) = NaN;   
    
    end
end

bayesian_mederr2D = nanmean(nanmedian(sqrt(((xy_sampling-xy_decoded*bin_size2D).^2))))
% The resulting median error coming from this code is 400+, probably because both columns of xy_decoded have identical values.

Any help would be appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions