Created
July 8, 2026 08:49
-
-
Save Dirga36/a17d211f696b4620064da5eb0ddd862d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from sklearn.cluster import KMeans | |
| import pandas as pd | |
| def classify_workload_patterns(usage_df, n_clusters=4): | |
| """ | |
| Cluster storage volumes by access frequency, size, and | |
| read/write ratio to recommend appropriate storage tiers. | |
| """ | |
| features = usage_df[["avg_daily_accesses", "size_gb", "read_write_ratio"]] | |
| kmeans = KMeans(n_clusters=n_clusters, random_state=42, n_init=10) | |
| usage_df["cluster"] = kmeans.fit_predict(features) | |
| tier_map = { | |
| 0: "hot_storage", | |
| 1: "standard_storage", | |
| 2: "infrequent_access", | |
| 3: "archive" | |
| } | |
| usage_df["recommended_tier"] = usage_df["cluster"].map(tier_map) | |
| return usage_df | |
| volumes = pd.read_csv("volume_usage_metrics.csv") | |
| recommendations = classify_workload_patterns(volumes) | |
| print(recommendations[["volume_id", "recommended_tier"]].head(10)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment