saritha5 commited on
Commit
fdbed18
1 Parent(s): ced361b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +47 -0
app.py CHANGED
@@ -1,10 +1,57 @@
1
 
 
 
 
2
  import streamlit as st
 
 
 
3
 
4
 
5
  st.title("Change Point Detection")
6
  # Generating Signal
7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
 
9
 
10
 
 
1
 
2
+ import numpy as np
3
+ import matplotlib.pylab as plt
4
+ import ruptures as rpt
5
  import streamlit as st
6
+ from ruptures.metrics import precision_recall
7
+ from ruptures.metrics import hausdorff
8
+ from ruptures.metrics import randindex
9
 
10
 
11
  st.title("Change Point Detection")
12
  # Generating Signal
13
 
14
+ def pw_constant_input(n,dim,n_bkps,sigma):
15
+ """Piecewise constant (pw_constant)"""
16
+ # n, dim # number of samples, dimension
17
+ # n_bkps, sigma # number of change points, noise standard deviation
18
+ signal, bkps = rpt.pw_constant(n, dim, n_bkps, noise_std=sigma)
19
+ rpt.display(signal, bkps)
20
+ return signal,bkps
21
+
22
+ def pw_linear_input(n,dim,n_bkps,sigma):
23
+ """Piecewise Linear"""
24
+ # creation of data
25
+ # n, dim = 500, 3 # number of samples, dimension of the covariates
26
+ # n_bkps, sigma = 3, 5 # number of change points, noise standart deviation
27
+ signal, bkps = rpt.pw_linear(n, dim, n_bkps, noise_std=sigma)
28
+ rpt.display(signal, bkps)
29
+ return signal,bkps
30
+
31
+ def pw_normal_input(n,dim,n_bkps,sigma):
32
+ """Piecewise 2D Gaussian process (pw_normal)#"""
33
+ # creation of data
34
+ #n = 500 # number of samples
35
+ #n_bkps = 3 # number of change points
36
+ signal, bkps = rpt.pw_normal(n, n_bkps)
37
+ rpt.display(signal, bkps)
38
+ return signal,bkps
39
+
40
+ def pw_wavy_input(n,dim,n_bkps,sigma):
41
+ # creation of data
42
+ #n, dim = 500, 3 # number of samples, dimension
43
+ #n_bkps, sigma = 3, 5 # number of change points, noise standart deviation
44
+ signal, bkps = rpt.pw_wavy(n, n_bkps, noise_std=sigma)
45
+ rpt.display(signal, bkps)
46
+ return signal,bkps
47
+
48
+ input_list = ['piecewiseConstant','piecewiseLinear','piecewiseNormal','piecewiseSinusoidal']
49
+ generate_signal = st.selectbox(label = "Choose an input signal", options = input_list)
50
+
51
+
52
+
53
+
54
+
55
 
56
 
57