dperales's picture
Update app.py
f51f824
raw
history blame
1.26 kB
import os
import pycaret
from pycaret.datasets import get_data
# import pycaret clustering
from pycaret.clustering import *
# import pycaret anomaly
from pycaret.anomaly import *
# import ClusteringExperiment
from pycaret.clustering import ClusteringExperiment
# import AnomalyExperiment
from pycaret.anomaly import AnomalyExperiment
import matplotlib.pyplot as plt
import matplotlib as mpl
import numpy as np
import streamlit as st
import plotly.graph_objs as go
def main():
data = get_data('jewellery')
s = setup(data, session_id = 123)
# exp_clustering = ClusteringExperiment()
exp_anomaly = AnomalyExperiment()
# init setup on exp
# exp_clustering.setup(data, session_id = 123)
exp_anomaly.setup(data, session_id = 123)
# train kmeans model
# kmeans = create_model('kmeans')
iforest = create_model('iforest')
# kmeans_cluster = assign_model(kmeans)
# kmeans_cluster
iforest_anomalies = assign_model(iforest)
iforest_anomalies
if st.button("Prediction"):
# plot pca cluster plot
# plot_model(kmeans, plot = 'cluster', display_format = 'streamlit')
plot_model(iforest, plot = 'tsne', display_format = 'streamlit')
if __name__ == '__main__':
main()