📄 mainsvc.asv
字号:
%=====================================================================% % Final Project in Machine Learning% ----------------------------------%% Submitted By:% % Ofer Pasternak% Elhanan Borshtain % Orit Kliper%% -------------------------% Support Vector Clustring % -------------------------% A non-parametric clustring algorithm based on support vector % approach.%% Reference: % A.Ben-Hur,D.Horn,H.T.Siegelmann and V.Vapnik.% Support Vector Clustring.% Journal of Machine Learning Research 2(2001)125-137%% Parameters:% % example_set - integer number coding the wanted Sample set.% C - Defines the fraction of points which are allowed% to become outliers.% (p = 1/CN where N is the the total sampels number).% qvec - vector of q values for multiple runs over the chosen sample set.% each q value is a different width of the gaussian kernel.% filename - a name for a file to hold the results.% %=====================================================================function [] = MainSVC(example_set,C,qvec,filename);clc;clear;time1=cputime;% start clockticcount_q = 0;% 自己设置的参数 2006.1.7example_set=3;C=500;q=10; % Samples from a given example set: % seperate the Sample set and the classification vector% also reads the samples number, and dimention[Samples, N, classifications] = ReadData(example_set);if Samples == 0 fprintf('invalid example set\n'); return; end% Each Sample set is analyzed using different q value, set by qvec.%for q=qvec % Preforms Support Vector Clustering [SV,BSV,beta,quad,R] = SVC(Samples,C,q); if(R == -1) return; end % Finds the clusters assignments [clusters_assignments,maj_class, mis_class,nof_samples_per_class_per_cluster] =... SeperateClusters(Samples,beta,quad,R,q,classifications); %Maps the Sphere back to the data space [grids, grids_sizes] = MappingAnalysis(Samples,R,beta,quad,q); % Shows graphic Results: ShowResults(Samples,SV,BSV,R,beta,quad,q,clusters_assignments, grids, grids_sizes,classifications,nof_samples_per_class_per_cluster); count_q = count_q+1; mis_per_q(count_q) = 100*sum(mis_class)/N; cluster_per_q(count_q) = max(clusters_assignments); %save (strcat(filename,'q',num2str(q))); MisPercentQ=100*sum(mis_class)/N; ClusterPerQ = max(clusters_assignments); runtime=cputime-time1; save SVCresult MisPercentQ ClusterPerQ clusters_assignments runtime%end% shows Total results varying over q values.%figure;%plot(qvec,mis_per_q);%title('Misclassifications over Ranging Values of q');%xlabel('q');%ylabel('Misclassifications (%)')%figure%plot(qvec,cluster_per_q);%title('Change of the Number of Clusters over Ranging Values of q');%xlabel('q');%ylabel('Number of Clusters');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -