Comments (3)
Is your suggestion to only return fig and not ax?
from flameplot.
Current edit might makes things clearer, it might be good to always return fig and ax, and have the documentation match the standard output.
!pip install umap-learn trimap pacmap
from sklearn.decomposition import PCA
from sklearn.manifold import TSNE
from umap import UMAP # https://github.com/lmcinnes/umap
from trimap import TRIMAP # https://github.com/eamid/trimap
from pacmap import PaCMAP # https://github.com/YingfanWang/PaCMAP
k = 3
mapper = [TSNE(n_components=k), UMAP(n_components=k), TRIMAP(n_dims=k), PaCMAP(n_components=k)]
from flameplot import scatter, compare, plot
pca_standard = PCA().fit_transform(X.to_numpy())
def scatter_maker(transformed, title, labels=y['country']):
fig1, _ = scatter(transformed[:,0], transformed[:,1], labels=y, s=75, title=title)
# documentation claimed there is only `(fig)` and not `(fig, ax)`
# https://github.com/erdogant/scatterd/blob/master/scatterd/scatterd.py#L156
# https://github.com/erdogant/flameplot/blob/master/flameplot/flameplot.py#L161
fig1.savefig(title+'_2D.png')
pass
def compare_maker(transformed, title, pca_standard=pca_standard):
scores = compare(pca_standard, transformed, n_steps=5)
fig2 = plot(scores, xlabel='PCA', ylabel=title) # not follow the `(fig, ax)` design pattern
# https://github.com/erdogant/imagesc/blob/master/imagesc/imagesc.py#L243
# https://github.com/erdogant/flameplot/blob/master/flameplot/flameplot.py#L138
fig2.savefig(title+'_factors.png')
pass
for i in mapper:
title = type(i).__name__ # name of the object class
transformed = i.fit_transform(X.to_numpy())
# to_numpy is needed for TriMAP and PaCMAP
scatter_maker(transformed, title, y)
compare_maker(transformed, title, pca_standard=pca_standard)
from flameplot.
Agree. The output is now (fig, ax) and is also changed in the documentation pages.
Update to the latest version with:
pip install -U flameplot
from flameplot.
Related Issues (2)
- Module Import Error HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flameplot.