<｜begin▁of▁sentence｜>### Instruction:
Given a synthetic dataset with 100 samples and 3 features, how can you use the KMeansCluster class from graspologic to find the optimal number of clusters based on the silhouette score and assign cluster labels to each sample?
### Response:
import numpy as np
from graspologic.cluster import KMeansCluster

# Synthetic dataset with 3 features
np.random.seed(42)
X = np.random.rand(100, 3)

# Assuming we don't have ground truth labels for the dataset
kmeans_cluster = KMeansCluster(max_clusters=5, random_state=42)
kmeans_cluster.fit(X)

# Getting the optimal number of clusters based on silhouette score
optimal_clusters = kmeans_cluster.n_clusters_

# Predicting the cluster labels
labels = kmeans_cluster.fit_predict(X)

# Getting silhouette scores for each cluster count
silhouette_scores = kmeans_cluster.silhouette_list_

print('Optimal number of clusters:', optimal_clusters)
print('Silhouette scores:', silhouette_scores)
print('Cluster labels:', labels)
<|EOT|>
