⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 outlier_variogram.m

📁 空间数据挖掘的又一个matlab例外点检测程序
💻 M
字号:
% 			README of Spatial Outlier Detection
% 				S. Shekhar & P. Zhang
% 				University of Minnesota
% 				
% Objective:
% 	Better understand concepts and methods for spatial outlier detection
% 	comparing to traditional ones.
% Requirement:
% 	Matlab
% 		
% Data:
% data.txt is an example dataset for spatial outlier detection illustration.
% It's a 30 x 2 matrix: first column is the spatial coordinates, and second
% column is the attribute value at the location. Each row is an instance.
% 
% Procedure:
% Open matlab, then type the script name for the spatial outlier detection
% demo.
% 
% The running script for spatial outlier detection is named Outlier_Demo.m
% In this script, the data were loaded into workspace. Then users have
% several sub-scripts to play with. It will calculate different outliers,
% and generate the figures used in the spatial outlier subsection in 
% the spatial data mining book chapter[SDM03].
% 
% (1)Show raw data 
% run Show_Data.m (remove % before Show_Data in the Outlier_Demo script)
% or type Show_Data in command line
% Output: Generate the Figure 3.4(a) in [SDM03]
% 
% (2)Show histogram for the attribute in data
% run Show_Hist.m (remove % before Show_Hist in the Outlier_Demo script)
% or type Show_Hist in command line
% Output: Generate the Figure 3.4 (b) in [SDM03]
% 
% (2)Global outlier detection
% run Outlier_Global.m (remove % before Outlier_Global in the Outlier_Demo script)
% or type Outlier_Global in command line
% Output: Generate a figure to show that G, the max value in the data, is the global outlier
% 
% (3)Outlier detection using Scatter Plot 
% run Outlier_Scatter.m (remove % before Outlier_Scatter in the Outlier_Demo script)
% or type Outlier_Scatter in command line
% Output: Generate the Figure 3.6(a) in [SDM03]
% 
% (4)Outlier detection using Variogram
% run Outlier_Variogram.m (remove % before Outlier_Variogram in the Outlier_Demo script)
% or type Outlier_Variogram in command line
% Output: Generate the Figure 3.5(a) in [SDM03]
% 
% (5)Outlier detection using Spatial test [GeoInfo03]
% run Outlier_Test.m (remove % before Outlier_Test in the Outlier_Demo script)
% or type Outlier_Test in command line
% Output: Generate the Figure 3.6(b) in [SDM03]
% 
% References:
% 
% [SDM03] Shashi Shekhar, Pusheng Zhang, Yan Huang, and Ranga Raju Vatsavai, "Spatial Data 
% Mining", as a book chapter to appear in "Data Mining: Next Generation Challenges and 
% Future Directions", Hillol Kargupta and Anupam Joshi(editors), AAAI/MIT Press, 2003
% 
% [GeoInfo03] Shashi Shekhar, Chang-Tien Lu, and Pusheng Zhang, A Unified Approach 
% to Detecting Spatial Outliers, GeoInformatica, An International Journal on 
% Advances of Computer Science for Geographic Information Systems, Volume 7, 
% Issue 2, 139-166, Kluwer Academic Publishers, June 2003, 

vari = zeros(m,n);
for j=1:m-1
    vari(j,1)=data(j+1,1)-data(j,1); %distance
    vari(j,2)=sqrt(abs(data(j+1,2)-data(j,2))); ;%square root of absolute diff
end;

figure;
plot(vari(:,1),vari(:,2),'ro','LineWidth',2,...
                'MarkerEdgeColor','k',...
                'MarkerFaceColor','g',...
                'MarkerSize',6);
title('Variogram Cloud','fontsize',22);
xlabel('Pairwise Distance','fontsize',16);
ylabel('Square Root of Absolute Difference of Attribute Values','fontsize',16);
text(0.6,2.05, '\leftarrow (Q,S)','FontSize', 14);
text(0.5,1.59, '\leftarrow (P,S)','FontSize', 14);

%print -djpeg90 vari2.jpg

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -