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