Spaces:
Runtime error
Runtime error
File size: 1,365 Bytes
d6b7dee 19752d4 c34d8f1 b86c3d4 c34d8f1 b86c3d4 c34d8f1 b86c3d4 d6b7dee af9f583 d6b7dee 2f7106e f97bd22 2f7106e d6b7dee f51f824 b86c3d4 d6b7dee c34d8f1 f51f824 2f7106e d6b7dee c34d8f1 f51f824 b86c3d4 c34d8f1 b86c3d4 d6b7dee c34d8f1 b86c3d4 d6b7dee |
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 |
import os
import pandas as pd
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('anomaly')
insurance_claims = pd.read_csv ("./fraud_oracle.csv")
s = setup(insurance_claims, session_id = 123)
# exp_clustering = ClusteringExperiment()
exp_anomaly = AnomalyExperiment()
# init setup on exp
# exp_clustering.setup(data, session_id = 123)
exp_anomaly.setup(insurance_claims, 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() |