-
Notifications
You must be signed in to change notification settings - Fork 184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Projection functions #173
Comments
These are not in the current project set, but contributions to the lens library are very welcome! I think you can manually do Gaussian Kernel Density Estimation to build a lens with this code: import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from sklearn.datasets import load_iris
from scipy import stats # Relevant import
data, y = load_iris().data, load_iris().target
# Transpose the data, fit Kernel Density Estimation, calculate density lens
values = data.T
kde = stats.gaussian_kde(values)
density_lens = kde(values)
fig, ax = plt.subplots(subplot_kw=dict(projection='3d'))
x, y, w, z = values
ax.scatter(x, y, z, c=density_lens)
plt.savefig("density.png") Then use like: graph = mapper.map(density_lens, data, cover=km.Cover(n_cubes=10)) For eccentricity I am not sure. Going by the mathematical definition here: http://danifold.net/mapper/filters.html#mathematical-definition Maybe someone else can contribute code for this. I'll look at adding density estimation to the filter function/lens library, or you are free to contribute (if the example I gave works for you). |
Here, dists is distance matrix calculated by sklearn.metrics.pairwise_distances(X). This can also be re-used in the mapper with precomputed=True.
|
Thanks for the effort. I was checking the lens/projection functions, I could not find the functions that are used in Singh original paper such as gaussian density or eccentricity. May I ask if these are available in the current projection set or not.
The text was updated successfully, but these errors were encountered: