Example #1
0
frequent_itemsets_eclat =  fp.eclat(frequent_itemsets_apriori,min)
print(frequent_itemsets_eclat.sort_values(by=['support'],ascending=False))

list_of_datasets = [frequent_itemsets_apriori, frequent_itemsets_fpgrowth, frequent_itemsets_eclat]
min_supports = [0.100, 0.150, 0.200]
def get_all_graphs(list_of_datasets,min_supports):
    for dataset in list_of_datasets:
        gr.get_single_graph(dataset)
        for support in min_supports:
            gr.get_single_graph(dataset,support)
    gr.get_multiple_graph(list_of_datasets[0], list_of_datasets[1], list_of_datasets[2])
    for support in min_supports:
        gr.get_multiple_graph(list_of_datasets[0], list_of_datasets[1], list_of_datasets[2],filter_support=support)

get_all_graphs(list_of_datasets,min_supports)

df = pd.read_csv("data.csv")
df.drop(['Channel', 'Region'], axis=1)
colors = ['red', 'green', 'blue', 'orange']
pca = PCA(n_components=2, random_state=1)
pca_result = pca.fit_transform(df)
# Determine the number of clusters for KMeans and AGNES algorithms
n_clusters_kmeans = clustering.elbow_chart(df, model_type='Kmeans')
n_clusters_agnes = clustering.elbow_chart(df, model_type='AGNES')
clustering.kmeans_clustering(df, pca_result, colors, n_clusters_kmeans)
clustering.agnes_clustering(df, pca_result, colors, n_clusters_agnes)
# Selecting epsilon for DBSCAN by running an NearestNeighbours algorihm
# The optimal eps value is 0.3 as can be shown from the plot
clustering.eps_selection(pca_result)
clustering.dbscan_clustering(df, pca_result, eps=0.3, min_samples=15)