import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
# Create a sample dataset
data = pd.DataFrame({'values': [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]})
# Compute the KDE-augmented dataset
def compute_augmented_data(data):
# Compute the KDE estimate
kde = data.kde()
# Add a column of uniform values to the dataframe
data['uniform'] = np.linspace(data.min(), data.max(), len(data))
# Compute the ECDF for the augmented dataset
augmented_data = data.T.stack().T.plot(kind='kde')
# Plot the original data as a vertical line
ax = augmented_data.axes[0]
ax.axvline(x=data.min(), color='r', linestyle='--', label='Original Data')
return augmented_data
# Plot the ECDF of the augmented dataset
sns.kdeplot(compute_augmented_data(data), label='Augmented Data')
# Add a legend
plt.legend()
# Show the plot
plt.show()
In this example, we first create a sample dataset with a single column of values. We then define a function compute_augmented_data that computes the KDE-augmented dataset by first computing the KDE estimate of the data, adding a column of uniform values to the dataframe, and finally plotting the ECDF of the augmented dataset using Seaborn's kdeplot function. We also plot the original data as a vertical line and add a legend to the plot. Finally, we show the plot using plt.show().