forked from waylongo/gmm-for-early-detection
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgmm_main.m
27 lines (23 loc) · 908 Bytes
/
gmm_main.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
% Sequential Possibilistic One-Means Clustering
% For streaming clustering to detect outliers and trajectory trends
% In Gaussian Mixture Model
% @author: Wenlong Wu
% @date: 08/29/2018
% @email: [email protected]
% @University of Missouri-Columbia
% This code is only for demonstrating ideas, please visit
% https://ieeexplore.ieee.org/abstract/document/8858874
% for more details of the paper.
close all;
clear;clc;
% import data
addpath(genpath(pwd));
all_data = importdata('data/weather_1h.dat'); N = size(all_data,1); piece=5;
% use 1/5 of data to find prototype, use the rest as streaming data
data = all_data(1:round(N / piece),:);
stream = all_data(round(N / piece)+1:N,:);
%% Use current data to find prototype
figure(1);plot(data(:,1),data(:,2),'.b');hold on
[model, anormaly] = sp1m(data);
%% Use streaming data to update prototype
[model, anormaly] = sp1ms(stream, model, anormaly);