File size: 853 Bytes
d6b7dee
c34d8f1
 
 
 
 
 
d6b7dee
 
 
 
 
 
 
 
 
 
 
c34d8f1
 
d6b7dee
c34d8f1
d6b7dee
c34d8f1
 
d6b7dee
c34d8f1
 
 
 
 
d6b7dee
 
c34d8f1
 
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
import os
import pycaret
from pycaret.datasets import get_data
# import pycaret clustering and init setup
from pycaret.clustering import *
# import ClusteringExperiment and init the class
from pycaret.clustering import ClusteringExperiment

import matplotlib.pyplot as plt
import matplotlib as mpl

import numpy as np
import streamlit as st

# For measuring the inference time.
import time

def main():
    data = get_data('jewellery')
    s = setup(data, session_id = 123)

    exp = ClusteringExperiment()

    # init setup on exp
    exp.setup(data, session_id = 123)

    # train kmeans model
    kmeans = create_model('kmeans')

    kmeans_cluster = assign_model(kmeans)
    kmeans_cluster

    if st.button("Prediction"):
        # plot pca cluster plot 
        plot_model(kmeans, plot = 'cluster')

        
if __name__ == '__main__':
    main()