Upload
devmorgan
View
218
Download
0
Embed Size (px)
Citation preview
8/11/2019 fix bayes
1/19
functionvarargout = NaiveBayesClassifier(varargin)% NAIVEBAYESCLASSIFIER M-file for NaiveBayesClassifier.fig% NAIVEBAYESCLASSIFIER, by itself, creates a new NAIVEBAYESCLASSIFIER orraises the existing% singleton*.%% H = NAIVEBAYESCLASSIFIER returns the handle to a newNAIVEBAYESCLASSIFIER or the handle to% the existing singleton*.%% NAIVEBAYESCLASSIFIER('CALLBACK',hObject,eventData,handles,...) callsthe local% function named CALLBACK in NAIVEBAYESCLASSIFIER.M with the given inputarguments.%% NAIVEBAYESCLASSIFIER('Property','Value',...) creates a newNAIVEBAYESCLASSIFIER or raises the% existing singleton*. Starting from the left, property value pairs are% applied to the GUI before NaiveBayesClassifier_OpeningFcn gets called.An
% unrecognized property name or invalid value makes property application% stop. All inputs are passed to NaiveBayesClassifier_OpeningFcn viavarargin.%% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one% instance to run (singleton)".%% See also: GUIDE, GUIDATA, GUIHANDLES
% Edit the above text to modify the response to help NaiveBayesClassifier
% Last Modified by GUIDE v2.5 16-Mar-2013 13:34:53
% Begin initialization code - DO NOT EDITgui_Singleton = 1;gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...'gui_OpeningFcn', @NaiveBayesClassifier_OpeningFcn, ...'gui_OutputFcn', @NaiveBayesClassifier_OutputFcn, ...'gui_LayoutFcn', [] , ...'gui_Callback', []);
ifnargin && ischar(varargin{1})gui_State.gui_Callback = str2func(varargin{1});clc;
% set posisi window (get_size_layar/gsl_)
gsl_ = get(0,'ScreenSize');
end
ifnargout[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
elsegui_mainfcn(gui_State, varargin{:});
end% End initialization code - DO NOT EDIT
8/11/2019 fix bayes
2/19
% --- Executes just before NaiveBayesClassifier is made visible.functionNaiveBayesClassifier_OpeningFcn(hObject, eventdata, handles,varargin)% This function has no output args, see OutputFcn.
% hObject handle to figure% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)% varargin command line arguments to NaiveBayesClassifier (see VARARGIN)
% Choose default command line output for NaiveBayesClassifierhandles.output = hObject;
% Update handles structureguidata(hObject, handles);
% UIWAIT makes NaiveBayesClassifier wait for user response (see UIRESUME)% uiwait(handles.NaiveBayesClassifier);
% --- Outputs from this function are returned to the command line.functionvarargout = NaiveBayesClassifier_OutputFcn(hObject, eventdata,handles)% varargout cell array for returning output args (see VARARGOUT);% hObject handle to figure% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structurevarargout{1} = handles.output;
% --- Executes on button press in NaiveBayesClassifier.functiontrainingdata_Callback(hObject, eventdata, handles)% hObject handle to NaiveBayesClassifier (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)NaiveBayesClassifierProject=guidata(gcbo);GetCitraTraining=get(NaiveBayesClassifierProject.CitraTraining, 'Userdata');
% menentukan path data trainingpath_data_train=strrep(cd,...
'Matlab_Code_Rempah','CitraRempah\Data Training');
% data training citra jahebyk_data_train_jn=20;
% data training citra kunyitbyk_data_train_jl=15;
% data training citra temukuncibyk_data_train_jm=7;
8/11/2019 fix bayes
3/19
byk_fitur=4;byk_kelas=3;
% menginisialisasi matrik datasetdataset=zeros(byk_data_train_jn,byk_fitur);
fori=1:(byk_data_train_jn+byk_data_train_jl+byk_data_train_jm)
if(i
8/11/2019 fix bayes
4/19
set(handles.NamaCitraTraining,'String',sprintf(strcat('Citra Training Ke=',num2str(i))));
%% membuat citra gray-scale (abu-abu)I_gray=Function_ColorToGray(I);
%axes(handles.CitraGray);%imshow(I_gray);
%%
%% membuat citra biner (hitam-putih)% level=graythresh(I);% I_biner=im2bw(I_gray,level);
I_biner=zeros(size(I_gray,1),size(I_gray,2));I_biner(find(I_gray=3windowing_size=5;max_filter_I_biner=Function_MaxFilterBiner_(I_biner,windowing_size);
% axes(handles.CitraMaxFilter);%imshow(max_filter_I_biner);
%% menghitung diameter dengan satuan panjang per piksel% menentukan index yang memuat nilai 1[idx_,idy_]=find(max_filter_I_biner==1);diameter=idy_(numel(idy_))-idy_(1)+1;
%% membuat garis pembatas pada diameter
%numel((XY2Index(1,idy_(1),size(I_gray,1)):XY2Index(size(I_gray,1),idy_(numel(idy_)),size(I_gray,1)))')
% mereplace nilai pikselI_red=I(:,:,1);
I_red(:,idy_(1):(idy_(1)+10))=105;I_red(:,(idy_(numel(idy_))-10):idy_(numel(idy_)))=105;I(:,:,1)=I_red;
I_green=I(:,:,2);I_green(:,idy_(1):(idy_(1)+10))=75;I_green(:,(idy_(numel(idy_))-10):idy_(numel(idy_)))=75;I(:,:,2)=I_green;
I_blue=I(:,:,3);
8/11/2019 fix bayes
5/19
I_blue(:,idy_(1):(idy_(1)+10))=245;I_blue(:,(idy_(numel(idy_))-10):idy_(numel(idy_)))=245;I(:,:,3)=I_blue;
axes(handles.CitraTraining);
imshow(I);
% menampung nilai fiturdataset(i,:)=[mean_red mean_green mean_blue diameter];
end
Kelas';%% dataset_Kelas{1}={mat2cell(dataset) Kelas{1}'}%% dataset_Kelas{1}
dataset;
set(handles.NamaCitraTraining,'String',sprintf(strcat('Citra Training telahmasuk !')));
merge_data={dataset,Kelas'};
% jumlah data dikalikan dengan banyak fiturdata_kali_fitur=(byk_data_train_jn+byk_data_train_jl+byk_data_train_jm)*byk_fitur;
fori=1:data_kali_fiturdat_init{i}=num2str(merge_data{1}(i),'%.3f');
end
forj=1:(byk_data_train_jn+byk_data_train_jl+byk_data_train_jm)dat_init{data_kali_fitur+j}=char(merge_data{2}(j));
end
dat=reshape(dat_init,[(byk_data_train_jn+byk_data_train_jl+byk_data_train_jm)(byk_fitur+1)]);
%hanis set(NaiveBayesClassifierProject.DataTraining,'Userdata',dat);
% % memasukkan data kedalam dataset
% uitabledataset('Data', dataset , 'ColumnName',...% {'R (Red)', 'G (Green)', 'B (Blue)', 'D (Diameter)'},...% 'Position', [20 20 500 150]);
% uitable('Data', [dataset double(cell2mat(Kelas'))], 'ColumnName',...% {'R (Red)', 'G (Green)', 'B (Blue)', 'D (Diameter)','Kelas'},...% 'Position', [20 20 500 150]);
%hanis t=uitable('Data', dat, 'ColumnName',...
8/11/2019 fix bayes
6/19
% {'R (Red)', 'G (Green)', 'B (Blue)', 'D (Diameter)','Kelas(Rempah)'},...
% 'Position', [20 20 430 150]);
%% menghitung & menyimpan hasil mean dan varian setiap fitur & kelas% inisialisasi
mean_varian=zeros(2*byk_kelas,byk_fitur);
fori=1:byk_fitur% set fitur 1 utk R, 2 utk G, 3 utk B, 4 utk Dfitur_rgbd=dataset(:,i);
% menghitung mean_kelas_jahe,kunyit,temukuncimean_fitur_rgbd_jn=mean(fitur_rgbd(1:byk_data_train_jn));mean_fitur_rgbd_jl=mean(fitur_rgbd(...
(byk_data_train_jn+1):(byk_data_train_jn+byk_data_train_jl)));mean_fitur_rgbd_jm=mean(fitur_rgbd(...
(byk_data_train_jn+byk_data_train_jl+1):...(byk_data_train_jn+byk_data_train_jl+byk_data_train_jm)));
% menghitung varian_kelas_jahe,kunyit,kuncivarian_fitur_rgbd_jn=var(fitur_rgbd(1:byk_data_train_jn));varian_fitur_rgbd_jl=var(fitur_rgbd(...
(byk_data_train_jn+1):(byk_data_train_jn+byk_data_train_jl)));varian_fitur_rgbd_jm=var(fitur_rgbd(...
(byk_data_train_jn+byk_data_train_jl+1):...(byk_data_train_jn+byk_data_train_jl+byk_data_train_jm)));
mean_varian(:,i)=[mean_fitur_rgbd_jn,mean_fitur_rgbd_jl,...mean_fitur_rgbd_jm,varian_fitur_rgbd_jn,varian_fitur_rgbd_jl, ...varian_fitur_rgbd_jm];
end
set(NaiveBayesClassifierProject.mean_varian_semua_fitur_kelas, 'Userdata',mean_varian);
% --- Executes during object creation, after setting all properties.functionUkuranCitraTraining_CreateFcn(hObject, eventdata, handles)% hObject handle to UkuranCitraTraining (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called
% --- Executes during object creation, after setting all properties.
functionUkuranCitraTesting_CreateFcn(hObject, eventdata, handles)% hObject handle to UkuranCitraTesting (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called
% --- Executes during object creation, after setting all properties.functionNamaCitraTraining_CreateFcn(hObject, eventdata, handles)% hObject handle to NamaCitraTraining (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB
8/11/2019 fix bayes
7/19
% handles empty - handles not created until after all CreateFcns called
% --- Executes during object creation, after setting all properties.functionuitabledataset_CreateFcn(hObject, eventdata, handles)% hObject handle to uitabledataset (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called
% --- Executes when entered data in editable cell(s) in uitabledataset.functionuitabledataset_CellEditCallback(hObject, eventdata, handles)% hObject handle to uitabledataset (see GCBO)% eventdata structure with the following fields (see UITABLE)% Indices: row and column indices of the cell(s) edited% PreviousData: previous data for the cell(s) edited% EditData: string(s) entered by the user% NewData: EditData or its converted form set on the Data property. Emptyif Data was not changed
% Error: error string when failed to convert EditData to appropriate valuefor Data% handles structure with handles and user data (see GUIDATA)
% --- Executes when selected cell(s) is changed in uitabledataset.functionuitabledataset_CellSelectionCallback(hObject, eventdata, handles)% hObject handle to uitabledataset (see GCBO)% eventdata structure with the following fields (see UITABLE)% Indices: row and column indices of the cell(s) currently selecteds% handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in testingdata.functiontestingdata_Callback(hObject, eventdata, handles)% hObject handle to testingdata (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)NaiveBayesClassifierProject=guidata(gcbo);
% data training citra jahebyk_data_train_jn=20;
% data training citra kunyitbyk_data_train_jl=15;
% data training citra temukuncibyk_data_train_jm=7;
byk_fitur=4;byk_kelas=3;
[basefilename,path]= uigetfile({'*.*'},'Open All Image File');filename= fullfile(path, basefilename);
8/11/2019 fix bayes
8/19
ifsum(strfind(lower(basefilename), '.'))==0else
I_testing = imread (filename);
% if I = [MxNx4]
if(size(I_testing,3)==4)I_testing(:,:,1)=[]; % convert to I = [MxNx3]end
%set(NaiveBayesClassifierProject.NaiveBayesClassifier,'CurrentAxes',NaiveBayesClassifierProject.CitraTraining);
%set (imshow(I));
axes(handles.CitraTesting);imshow(I_testing);
% hitung mean Red, Green, Blue
mean_red_testing=mean(mean(I_testing(:,:,1)));mean_green_testing=mean(mean(I_testing(:,:,2)));mean_blue_testing=mean(mean(I_testing(:,:,3)));
%set(NaiveBayesClassifierProject.var_mean_red_testing,...% 'String',num2str(mean_red_testing,'%.3f'));
% set(NaiveBayesClassifierProject.var_mean_green_testing,...% 'String',num2str(mean_green_testing,'%.3f'));
%set(NaiveBayesClassifierProject.var_mean_blue_testing,...%'String',num2str(mean_blue_testing,'%.3f'));
set(NaiveBayesClassifierProject.CitraTesting,'Userdata',I_testing);
SizeCitraTesting=size(I_testing);
StringSizeCitraTesting=sprintf(strcat(num2str(SizeCitraTesting(1)), 'x',num2str(SizeCitraTesting(2)),'x',num2str(SizeCitraTesting(3))));
StringSizeCitraTesting = strrep(StringSizeCitraTesting,'x',' x ');
%set(handles.UkuranCitraTesting,'String',StringSizeCitraTesting);
%% membuat citra gray-scale (abu-abu)I_gray_testing=Function_ColorToGray(I_testing);
%axes(handles.CitraGrayTesting);%imshow(I_gray_testing);
%%
%% membuat citra biner (hitam-putih) _testing% level=graythresh(I_testing);% I_biner_testing=im2bw(I_gray_testing,level);
8/11/2019 fix bayes
9/19
I_biner_testing=zeros(size(I_gray_testing,1),size(I_gray_testing,2));I_biner_testing(find(I_gray_testing=3windowing_size=5;
max_filter_I_biner_testing=Function_MaxFilterBiner_(I_biner_testing,windowing_size);
%axes(handles.CitraMaxFilterTesting);%imshow(max_filter_I_biner_testing);
%% menghitung diameter dengan satuan panjang per piksel% menentukan index yang memuat nilai 1
[idx_,idy_]=find(max_filter_I_biner_testing==1);diameter_testing=idy_(numel(idy_))-idy_(1)+1;
%set(NaiveBayesClassifierProject.var_diameter_testing,...%'String',num2str(diameter_testing,'%.2f'));
% menampung nilai fiturdataset(1,:)=[mean_red_testing mean_green_testing mean_blue_testing
diameter_testing];
if(isempty(strfind(basefilename, 'jahe'))==0)Kelas_testing{1}='jahe';
elseif(isempty(strfind(basefilename, 'kunyit'))==0)
Kelas_testing{1}='kunyit';else
Kelas_testing{1}='temukunci';end
Kelas_testing{1}
%set(NaiveBayesClassifierProject.var_kelas_testing,...% 'String',char(Kelas_testing{1}));
% mereplace nilai pikselI_red=I_testing(:,:,1);I_red(:,idy_(1):(idy_(1)+10))=105;I_red(:,(idy_(numel(idy_))-10):idy_(numel(idy_)))=105;I_testing(:,:,1)=I_red;
I_green=I_testing(:,:,2);I_green(:,idy_(1):(idy_(1)+10))=75;I_green(:,(idy_(numel(idy_))-10):idy_(numel(idy_)))=75;I_testing(:,:,2)=I_green;
I_blue=I_testing(:,:,3);
8/11/2019 fix bayes
10/19
I_blue(:,idy_(1):(idy_(1)+10))=245;I_blue(:,(idy_(numel(idy_))-10):idy_(numel(idy_)))=245;I_testing(:,:,3)=I_blue;
axes(handles.CitraTesting);
imshow(I_testing);
%% penghitungan Probabilitas Posterior%GetDataTraining=get(NaiveBayesClassifierProject.DataTraining,'User%data');
Getmean_varian=get(NaiveBayesClassifierProject.mean_varian_semua_fitur_kelas,'Userdata');
Xrgbd=[mean_red_testing;mean_green_testing;mean_blue_testing; ...diameter_testing];
% Menghitung Probabilitas PriorP_Prior_jn=byk_data_train_jn/(byk_data_train_jn+...byk_data_train_jl+byk_data_train_jm);P_Prior_jl=byk_data_train_jl/(byk_data_train_jn+...
byk_data_train_jl+byk_data_train_jm);P_Prior_jm=byk_data_train_jm/(byk_data_train_jn+...
byk_data_train_jl+byk_data_train_jm);
% Inisialisasi Nilai Probabilitas PosteriorP_Posterior_jn=1*P_Prior_jnP_Posterior_jl=1*P_Prior_jlP_Posterior_jm=1*P_Prior_jm
% Menghitung Probabilitas Likelihood dari fitur RBGDfori=1:byk_fitur
mean_varian_RGBD=Getmean_varian(:,i);P_Likelihood_x_RGB_to_jn=...
(1/sqrt(2*(22/7)*mean_varian_RGBD(4)))...*exp(-1*(((Xrgbd(i)-
mean_varian_RGBD(1))^2)/(2*mean_varian_RGBD(4))))P_Posterior_jn=P_Posterior_jn*P_Likelihood_x_RGB_to_jn
mean_varian_RGBD(5)mean_varian_RGBD(2)Xrgbd(i)P_Likelihood_x_RGB_to_jl=...
(1/sqrt(2*(22/7)*mean_varian_RGBD(5)))...*exp(-1*(((Xrgbd(i)-mean_varian_RGBD(2))^2)/(2*mean_varian_RGBD(5))))
P_Posterior_jl=P_Posterior_jl*P_Likelihood_x_RGB_to_jl
P_Likelihood_x_RGB_to_jm=...(1/sqrt(2*(22/7)*mean_varian_RGBD(6)))...*exp(-1*(((Xrgbd(i)-
mean_varian_RGBD(3))^2)/(2*mean_varian_RGBD(6))))P_Posterior_jm=P_Posterior_jm*P_Likelihood_x_RGB_to_jm
8/11/2019 fix bayes
11/19
end
%set(NaiveBayesClassifierProject.posterior_kelas_jn,...%'String',strcat(num2str(P_Posterior_jn,'%.20f'),{'
('},num2str(P_Posterior_jn),')'));%set(NaiveBayesClassifierProject.posterior_kelas_jl,...
%'String',strcat(num2str(P_Posterior_jl,'%.20f'),{'('},num2str(P_Posterior_jl),')'));%set(NaiveBayesClassifierProject.posterior_kelas_jm,...%'String',strcat(num2str(P_Posterior_jm,'%.20f'),{'
('},num2str(P_Posterior_jm),')'));
Semua_P_Posterior=[P_Posterior_jn;P_Posterior_jl;P_Posterior_jm];
[vmax_Posterior,idxmax_Posterior]=max(Semua_P_Posterior);
Keputusan_Klasifikasi='';if(idxmax_Posterior==1)
Keputusan_Klasifikasi='jahe';
elseif(idxmax_Posterior==2)Keputusan_Klasifikasi='kunyit';else
Keputusan_Klasifikasi='temukunci';end
set(NaiveBayesClassifierProject.hasil_klasifikasi,...'String',Keputusan_Klasifikasi);
end
functionvar_mean_red_testing_Callback(hObject, eventdata, handles)% hObject handle to var_mean_red_testing (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of var_mean_red_testing astext% str2double(get(hObject,'String')) returns contents ofvar_mean_red_testing as a doubleNaiveBayesClassifierProject = guidata(gcbo);var_mean_red_testing = str2double(get(hObject, 'String'));NaiveBayesClassifierProject.var_mean_red_testing = var_mean_red_testing;
% --- Executes during object creation, after setting all properties.functionvar_mean_red_testing_CreateFcn(hObject, eventdata, handles)% hObject handle to var_mean_red_testing (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.
8/11/2019 fix bayes
12/19
ifispc && isequal(get(hObject,'BackgroundColor'),get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');end
functionvar_mean_green_testing_Callback(hObject, eventdata, handles)% hObject handle to var_mean_green_testing (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of var_mean_green_testing astext% str2double(get(hObject,'String')) returns contents ofvar_mean_green_testing as a doubleNaiveBayesClassifierProject = guidata(gcbo);var_mean_green_testing = str2double(get(hObject, 'String'));NaiveBayesClassifierProject.var_mean_green_testing = var_mean_green_testing;
% --- Executes during object creation, after setting all properties.functionvar_mean_green_testing_CreateFcn(hObject, eventdata, handles)% hObject handle to var_mean_green_testing (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.ifispc && isequal(get(hObject,'BackgroundColor'),get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
functionvar_mean_blue_testing_Callback(hObject, eventdata, handles)% hObject handle to var_mean_blue_testing (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of var_mean_blue_testing astext% str2double(get(hObject,'String')) returns contents ofvar_mean_blue_testing as a doubleNaiveBayesClassifierProject = guidata(gcbo);var_mean_blur_testing = str2double(get(hObject, 'String'));NaiveBayesClassifierProject.var_mean_blue_testing = var_mean_blue_testing;
% --- Executes during object creation, after setting all properties.functionvar_mean_blue_testing_CreateFcn(hObject, eventdata, handles)% hObject handle to var_mean_blue_testing (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB
8/11/2019 fix bayes
13/19
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.ifispc && isequal(get(hObject,'BackgroundColor'),get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');end
functionvar_diameter_testing_Callback(hObject, eventdata, handles)% hObject handle to var_diameter_testing (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of var_diameter_testing astext% str2double(get(hObject,'String')) returns contents of
var_diameter_testing as a doubleNaiveBayesClassifierProject = guidata(gcbo);var_diameter_testing = str2double(get(hObject, 'String'));NaiveBayesClassifierProject.var_diameter_testing = var_diameter_testing;
% --- Executes during object creation, after setting all properties.functionvar_diameter_testing_CreateFcn(hObject, eventdata, handles)% hObject handle to var_diameter_testing (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.ifispc && isequal(get(hObject,'BackgroundColor'),get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');end
%function var_kelas_testing_Callback(hObject, eventdata, handles)% hObject handle to var_kelas_testing (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of var_kelas_testing as text% str2double(get(hObject,'String')) returns contents ofvar_kelas_testing as a double%NaiveBayesClassifierProject = guidata(gcbo);%var_kelas_testing = str2double(get(hObject, 'String'));%NaiveBayesClassifierProject.var_kelas_testing = var_kelas_testing;
8/11/2019 fix bayes
14/19
% --- Executes during object creation, after setting all properties.functionvar_kelas_testing_CreateFcn(hObject, eventdata, handles)% hObject handle to var_kelas_testing (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.ifispc && isequal(get(hObject,'BackgroundColor'),get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');end
%function posterior_kelas_jn_Callback(hObject, eventdata, handles)% hObject handle to posterior_kelas_jn (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of posterior_kelas_jn as text% str2double(get(hObject,'String')) returns contents ofposterior_kelas_jn as a double%NaiveBayesClassifierProject = guidata(gcbo);%var_kelas_jn = str2double(get(hObject, 'String'));%NaiveBayesClassifierProject.var_kelas_jn = var_kelas_jn;
% --- Executes during object creation, after setting all properties.%function posterior_kelas_jn_CreateFcn(hObject, eventdata, handles)% hObject handle to posterior_kelas_jn (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.%if ispc && isequal(get(hObject,'BackgroundColor'),get(0,'defaultUicontrolBackgroundColor'))
% set(hObject,'BackgroundColor','white');%end
functionposterior_kelas_jl_Callback(hObject, eventdata, handles)% hObject handle to posterior_kelas_jl (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of posterior_kelas_jl as text% str2double(get(hObject,'String')) returns contents ofposterior_kelas_jl as a doubleNaiveBayesClassifierProject = guidata(gcbo);var_kelas_jl = str2double(get(hObject, 'String'));NaiveBayesClassifierProject.var_kelas_jl = var_kelas_jl;
8/11/2019 fix bayes
15/19
% --- Executes during object creation, after setting all properties.%function posterior_kelas_jl_CreateFcn(hObject, eventdata, handles)% hObject handle to posterior_kelas_jl (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.%if ispc && isequal(get(hObject,'BackgroundColor'),get(0,'defaultUicontrolBackgroundColor'))% set(hObject,'BackgroundColor','white');%end
functionposterior_kelas_jm_Callback(hObject, eventdata, handles)% hObject handle to posterior_kelas_jm (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of posterior_kelas_jm as text% str2double(get(hObject,'String')) returns contents ofposterior_kelas_jm as a doubleNaiveBayesClassifierProject = guidata(gcbo);var_kelas_jm = str2double(get(hObject, 'String'));NaiveBayesClassifierProject.var_kelas_jm = var_kelas_jm;
% --- Executes during object creation, after setting all properties.%function posterior_kelas_jm_CreateFcn(hObject, eventdata, handles)% hObject handle to posterior_kelas_jm (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.%if ispc && isequal(get(hObject,'BackgroundColor'),get(0,'defaultUicontrolBackgroundColor'))% set(hObject,'BackgroundColor','white');%end
functionmean_kelas_jn_Callback(hObject, eventdata, handles)% hObject handle to txt_mean_var (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of txt_mean_var as text% str2double(get(hObject,'String')) returns contents of txt_mean_varas a doubleNaiveBayesClassifierProject = guidata(gcbo);mean_kelas_jn = str2double(get(hObject, 'String'));NaiveBayesClassifierProject.mean_kelas_jn = mean_kelas_jn;
8/11/2019 fix bayes
16/19
% --- Executes during object creation, after setting all properties.%function mean_kelas_jn_CreateFcn(hObject, eventdata, handles)% hObject handle to txt_mean_var (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.%if ispc && isequal(get(hObject,'BackgroundColor'),get(0,'defaultUicontrolBackgroundColor'))
% set(hObject,'BackgroundColor','white');%end
functionvarian_kelas_jn_Callback(hObject, eventdata, handles)% hObject handle to varian_kelas_jn (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of varian_kelas_jn as text% str2double(get(hObject,'String')) returns contents ofvarian_kelas_jn as a doubleNaiveBayesClassifierProject = guidata(gcbo);varian_kelas_jn = str2double(get(hObject, 'String'));NaiveBayesClassifierProject.varian_kelas_jn = varian_kelas_jn;
% --- Executes during object creation, after setting all properties.functionvarian_kelas_jn_CreateFcn(hObject, eventdata, handles)% hObject handle to varian_kelas_jn (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.ifispc && isequal(get(hObject,'BackgroundColor'),get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');end
functionmean_kelas_jl_Callback(hObject, eventdata, handles)% hObject handle to mean_kelas_jl (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of mean_kelas_jl as text% str2double(get(hObject,'String')) returns contents of mean_kelas_jlas a doubleNaiveBayesClassifierProject = guidata(gcbo);mean_kelas_jl = str2double(get(hObject, 'String'));NaiveBayesClassifierProject.mean_kelas_jl = mean_kelas_jl;
8/11/2019 fix bayes
17/19
% --- Executes during object creation, after setting all properties.functionmean_kelas_jl_CreateFcn(hObject, eventdata, handles)% hObject handle to mean_kelas_jl (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.ifispc && isequal(get(hObject,'BackgroundColor'),get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');end
functionvarian_kelas_jl_Callback(hObject, eventdata, handles)% hObject handle to varian_kelas_jl (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of varian_kelas_jl as text% str2double(get(hObject,'String')) returns contents ofvarian_kelas_jl as a doubleNaiveBayesClassifierProject = guidata(gcbo);varian_kelas_jl = str2double(get(hObject, 'String'));NaiveBayesClassifierProject.varian_kelas_jl = varian_kelas_jl;
% --- Executes during object creation, after setting all properties.functionvarian_kelas_jl_CreateFcn(hObject, eventdata, handles)% hObject handle to varian_kelas_jl (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.ifispc && isequal(get(hObject,'BackgroundColor'),get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');end
functionmean_kelas_jm_Callback(hObject, eventdata, handles)% hObject handle to mean_kelas_jm (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of mean_kelas_jm as text% str2double(get(hObject,'String')) returns contents of mean_kelas_jmas a doubleNaiveBayesClassifierProject = guidata(gcbo);mean_kelas_jm = str2double(get(hObject, 'String'));NaiveBayesClassifierProject.mean_kelas_jm = mean_kelas_jm;
8/11/2019 fix bayes
18/19
% --- Executes during object creation, after setting all properties.functionmean_kelas_jm_CreateFcn(hObject, eventdata, handles)% hObject handle to mean_kelas_jm (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.ifispc && isequal(get(hObject,'BackgroundColor'),get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');end
%function varian_kelas_jm_Callback(hObject, eventdata, handles)% hObject handle to varian_kelas_jm (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of varian_kelas_jm as text% str2double(get(hObject,'String')) returns contents ofvarian_kelas_jm as a double%NaiveBayesClassifierProject = guidata(gcbo);%varian_kelas_jm = str2double(get(hObject, 'String'));%NaiveBayesClassifierProject.varian_kelas_jm = varian_kelas_jm;
% --- Executes during object creation, after setting all properties.%function varian_kelas_jm_CreateFcn(hObject, eventdata, handles)% hObject handle to varian_kelas_jm (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.% See ISPC and COMPUTER.%if ispc && isequal(get(hObject,'BackgroundColor'),get(0,'defaultUicontrolBackgroundColor'))
% set(hObject,'BackgroundColor','red');%end
functionhasil_klasifikasi_Callback(hObject, eventdata, handles)% hObject handle to hasil_klasifikasi (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of hasil_klasifikasi as text% str2double(get(hObject,'String')) returns contents ofhasil_klasifikasi as a double
% --- Executes during object creation, after setting all properties.
8/11/2019 fix bayes
19/19
functionhasil_klasifikasi_CreateFcn(hObject, eventdata, handles)% hObject handle to hasil_klasifikasi (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.ifispc && isequal(get(hObject,'BackgroundColor'),get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');end