The Core-Feature Matrix
Свайпніть щоб показати меню
Understanding how users interact with product features is central to data-driven product improvement. Three key metrics—breadth, depth, and frequency—offer a multidimensional view of feature adoption. Breadth measures how many unique users engage with a feature, depth captures how often each user interacts with it, and frequency examines the regularity of those interactions over time. Analyzing these dimensions allows you to distinguish between features that are broadly popular, those that inspire deep engagement, and those that are used habitually, each offering unique insights for product strategy and user experience optimization.
Breadth: The number of unique users who have interacted with a feature.
Example: If 120 users clicked the Share button at least once, the breadth for Share is 120.
Depth: The average number of times each user interacts with a feature.
Example: If those 120 users clicked Share a total of 480 times, the depth is 480/120 = 4 interactions per user.
Frequency: The mean number of days between a user's interactions with a feature.
Example: If a user uses Share on average every 5 days, the frequency is 5 days.
These metrics serve different purposes: breadth highlights reach, depth shows engagement intensity, and frequency uncovers usage patterns over time.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546import pandas as pd import numpy as np # Example event log DataFrame data = { 'user_id': [1, 2, 1, 3, 2, 1, 4, 2, 3, 4, 1, 3], 'feature': ['A', 'A', 'B', 'A', 'C', 'A', 'B', 'C', 'C', 'B', 'C', 'A'], 'timestamp': [ '2024-06-01', '2024-06-01', '2024-06-02', '2024-06-03', '2024-06-03', '2024-06-04', '2024-06-04', '2024-06-05', '2024-06-06', '2024-06-07', '2024-06-08', '2024-06-09' ] } df = pd.DataFrame(data) df['timestamp'] = pd.to_datetime(df['timestamp']) # Breadth: unique users per feature breadth = df.groupby('feature')['user_id'].nunique() # Depth: average interactions per user per feature depth = df.groupby('feature').apply(lambda x: x.shape[0] / x['user_id'].nunique()) # Frequency: mean days between interactions per user per feature def mean_days_between(group): group = group.sort_values('timestamp') diffs = group['timestamp'].diff().dt.days.dropna() return diffs.mean() if not diffs.empty else np.nan freqs = ( df.sort_values('timestamp') .groupby(['feature', 'user_id']) .apply(mean_days_between) .reset_index(name='mean_days') ) # Average frequency per feature frequency = freqs.groupby('feature')['mean_days'].mean() # Combine into a core-feature matrix core_feature_matrix = pd.DataFrame({ 'breadth': breadth, 'depth': depth, 'frequency': frequency }) print(core_feature_matrix)
To build these feature adoption metrics, you begin by grouping your event log by feature and aggregating the relevant user and timestamp data. First, you calculate breadth by counting the number of unique user_id values for each feature using groupby('feature')['user_id'].nunique(). For depth, you divide the total number of interactions for each feature by the number of unique users, which is efficiently done with a groupby and a lambda function that computes the ratio of row count to unique users.
Frequency is calculated by examining the time gaps between consecutive interactions for each user-feature pair. This involves sorting the DataFrame by timestamp, then grouping by both feature and user_id. For each group, you compute the differences between consecutive timestamps, take the mean, and finally average these values across all users of a given feature. The resulting core-feature matrix summarizes these metrics for every feature, providing a compact yet powerful view of feature adoption dynamics.
1234567891011121314151617181920212223import matplotlib.pyplot as plt # Assume core_feature_matrix from previous code features = core_feature_matrix.index fig, ax1 = plt.subplots(figsize=(7, 4)) # Bar plot for breadth and depth ax1.bar(features, core_feature_matrix['breadth'], color='skyblue', label='Breadth', alpha=0.7) ax1.bar(features, core_feature_matrix['depth'], color='orange', label='Depth', alpha=0.7, bottom=core_feature_matrix['breadth']) ax1.set_ylabel('Breadth / Depth') ax1.set_xlabel('Feature') ax1.legend(loc='upper left') # Line plot for frequency ax2 = ax1.twinx() ax2.plot(features, core_feature_matrix['frequency'], color='green', marker='o', label='Frequency (days)') ax2.set_ylabel('Frequency (mean days)') ax2.legend(loc='upper right') plt.title('Core-Feature Matrix: Breadth, Depth, Frequency by Feature') plt.tight_layout() plt.show()
Дякуємо за ваш відгук!
Запитати АІ
Запитати АІ
Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат