import numpy as np from sklearn.cluster import KMeans import matplotlib.pyplot as plt # Sample data: customer_id, total_purchases, avg_time_between_purchases (hours) customer_data = np.array([ [1, 25, 0.5], [2, 10, 5], [3, 15, 2], [4, 30, 1], [5, 7, 10], [6, 20, 3], [7, 12, 7], [8, 28, 0.8], [9, 6, 12], [10, 18, 1.5] ]) # Extract customer IDs and feature data customer_ids = customer_data[:, 0].astype(int) features = customer_data[:, 1:] # Perform k-means clustering n_clusters = 2 kmeans = KMeans(n_clusters=n_clusters, random_state=42) cluster_labels = kmeans.fit_predict(features) # Find the cluster with the lowest average time between purchases impulsive_cluster = np.argmin(kmeans.cluster_centers_[:, 1]) # Get the customer IDs in the impulsive cluster impulsive_buyers = customer_ids[cluster_labels == impulsive_cluster] print("Impulsive buyers:", impulsive_buyers) # Visualize the clustering results (optional) plt.scatter(features[:, 0], features[:, 1], c=cluster_labels, cmap='viridis') plt.scatter(kmeans.cluster_centers_[:, 0], kmeans.cluster_centers_[:, 1], c='red', marker='x') plt.xlabel('Total Purchases') plt.ylabel('Average Time Between Purchases (hours)') plt.show()
top of page

Choose your pricing plan

  • Diamond subscription

    1,200$
    Every year
    Prefect for those who want unlimited access
     30 day free trial
    • VIP tickets
    • Unlimited access to the label and artist
    • Unlimited access to Festival TV
    • Priority seating for all concerts and venues
    • Unlimited food/drink pass at all events
    • Unlimited access to all insider info
    • Unlimited access to all Digital products
  • Silver subscription

    35$
    Every month
    For the home producers
     30 day free trial
    • Educational videos
    • How to tutorials
    • AVOS Festival TV
    • Ad-free music listening
  • ENT package

    21$
    Every month
    The entertainment package
     30 day free trial
    • AVOS Festival TV
    • AVOS Family Podcast
    • 24/7 - customer/tech support
    • weekly entertainment news letter
    • All access to AVOS After Party
  • AVOS Family

    9.99$
    Every month
    The backbone of the label
     30 day free trial
    • Ad-free music listening
    • all access to sample packs and digital downloads
  • Gold subscription

    50$
    Every month
    Perfect for those who seek Adventure
     30 day free trial
    • Access to all new blogs and stories
    • AVOS festival TV
    • AVOS Family podcast
    • Exclusive content
    • Express line pass
  • AVOS Associate

    0$
     
    Be in the know
    Free Plan
    • Monthly updates on events and releases
  • STUDENT PLAN

    1$
    Every month
    Valid for 12 months
    Plans & Pricing: PaidPlans
    bottom of page