-
Notifications
You must be signed in to change notification settings - Fork 2
/
change_Detection.py
63 lines (49 loc) · 2.44 KB
/
change_Detection.py
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# change detection and pop up
import numpy as np
import pandas as pd
import streamlit as st
import seaborn as sns
import base64
import altair as alt
def app():
@st.cache(allow_output_mutation=True)
def get_base64_of_bin_file(bin_file):
with open(bin_file, 'rb') as f:
data = f.read()
return base64.b64encode(data).decode()
menu1 = ["age", "sex", "steroid", "antivirals", "fatigue", "malaise", "anorexia", "liver_big", "liver_firm",
"spleen_palable", "spiders", "ascites", "varices", "bilirubin", "alk_phosphate", "sgot", "albumin",
"protime", "histology"]
menu2 = ["sex","age", "steroid", "antivirals", "fatigue", "malaise", "anorexia", "liver_big", "liver_firm", "spleen_palable", "spiders", "ascites","varices","bilirubin","alk_phosphate","sgot","albumin","protime","histology"]
choice1 = st.sidebar.selectbox("Attribute 1", menu1)
choice2 = st.sidebar.selectbox("Attribute 2", menu2)
st.markdown("<h1 style='text-align: center; color: #7b113a;'>Change in Trends and Values</h1>",
unsafe_allow_html=True)
st.subheader('**INTRODUCTION**')
st.write('Changes in attribute corresponding to the other attributes and corresponding to the live and '
'death percentages. Select the attribute among which the changes are required to be seen from '
'the side menu 1st attribute refers to attribute corresponding to the X-axis, and similarly '
'2nd attribute refers to the attribute corresponding to the Y-axis ')
dx = pd.read_csv('Dataset/hepatitis.csv')
df = pd.DataFrame(
dx,
columns=[choice1, choice2, 'class']
)
c = alt.Chart(df).mark_circle().encode(
x=choice1, y=choice2, size='class', color='class', tooltip=[choice1, choice2, 'class'])
st.altair_chart(c, use_container_width=True)
st.title("Hepatitis Dataset Correlation Matrix")
st.write(sns.heatmap(dx.corr()))
st.pyplot()
st.markdown(
f"""
<style>
.reportview-container {{
background: #E55D87; /* fallback for old browsers */
background: -webkit-linear-gradient(to right, #5FC3E4, #E55D87); /* Chrome 10-25, Safari 5.1-6 */
background: linear-gradient(to right, #5FC3E4, #E55D87); /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */
}}
</style>
""",
unsafe_allow_html=True
)