Here I have a group of data which following the Gamma distribution and now I want to use Naive Bayes method to fit this data. I tried the original function named 'fitcnb' and knowing that it providing 4 types of distribution: 'box', 'epanechnikov', 'normal' and 'triangle'. Now I want to revise this fitcnb function through adding Gamma distribution kernel into its original code. But I'm not sure how to implement that, can anyone give me some hint or example code?
Many thanks for that.
NOTE:-
dataSamp = gamrnd(9,0.5,1e5,1); % Gamma Samples. histogram(dataSamp,'Normalization','pdf') % Visualize pdf
Fit a Kernel distribution (tablecloth) with the restriction that the support is positive (as is the case with the Gamma distribution).
dist = fitdist(dataSamp,'kernel','Kernel','normal','Support','positive');
Evaluate the pdf of the distribution and plot on the histogram
xVals = linspace(0,15,1000); % x Values to evaluate the pdf yFit = pdf(dist,xVals); % pdf values at each xVals hold on plot(xVals,yFit,'LineWidth',2) % Plot the fitted pdf. hold off
This is exactly what is happening in fitcnb when you use the same calls
Comments
Post a Comment