Spaces:
Runtime error
Runtime error
| import streamlit as st | |
| import numpy as np | |
| import pandas as pd | |
| import pickle | |
| from PIL import Image | |
| image = Image.open('pic2.jpg') | |
| st.image(image,caption = 'Network Data Anomaly',width =1000) | |
| st.title("Network Data Anomaly") | |
| st.write("""An anomaly (also known as an outlier) is when something happens that is outside of the norm, | |
| when it stands out or deviates from what is expected. There are different kinds of anomalies in an e-commerce setting, | |
| they can be product anomaly, conversion anomaly or marketing anomaly. | |
| The model used is Isolation Forest, which is built based on decision trees and is an unsupervised model. | |
| Isolation forests can be used to detect anomaly in high dimensional and large datasets, with no labels. | |
| """) | |
| with open("./median.pickle", 'rb') as f: | |
| MED = pickle.load(f) | |
| with open("./mad.pickle", 'rb') as g: | |
| MA = pickle.load(g) | |
| def ZRscore_outlier(packet,med,ma): | |
| z = (0.6745*(packet-med))/ (np.median(ma)) | |
| if np.abs(z) > 3: | |
| return "Outlier" | |
| else: | |
| return "Not an Outlier" | |
| packet = st.number_input("Packet Number",step=1) | |
| st.header(ZRscore_outlier(packet,MED,MA)) | |
| st.write(""" | |
| For a detailed description please look through our Documentation | |
| """) | |
| url = 'https://huggingface.co/spaces/ThirdEyeData/Network_Data_Anomaly/blob/main/README.md' | |
| st.markdown(f''' | |
| <a href={url}><button style="background-color: #668F45;">Documentation</button></a> | |
| ''', | |
| unsafe_allow_html=True) |