A new library for extended and performance-focused ForceScheme implementation.
Until we set up a pypi package, you can test the library with
pip install git+https://github.com/visml/neo_force_scheme@0.0.1
You can find examples for simple data, large data with cpu, and large data with gpu
To run the projection:
import numpy as np
from neo_force_scheme import NeoForceScheme
dataset = np.random.random((100, 100)) # Some dataset
nfs = NeoForceScheme()
projection = nfs.fit_transform(dataset)
To use GPU, be sure to have CUDA toolkit installed.
import numpy as np
from neo_force_scheme import NeoForceScheme
dataset = np.random.random((100, 100)) # Some dataset
nfs = NeoForceScheme(cuda=True)
projection = nfs.fit_transform(dataset)
import numpy as np
from neo_force_scheme import NeoForceScheme, kruskal_stress
dataset = np.random.random((100, 100)) # Some dataset
nfs = NeoForceScheme(cuda=True)
projection = nfs.fit_transform(dataset)
stress = kruskal_stress(nfs.embedding_, projection)
import matplotlib.pyplot as plt
import numpy as np
from neo_force_scheme import NeoForceScheme
from matplotlib.colors import ListedColormap
dataset = np.random.random((100, 100)) # Some dataset without labels
labels = np.random.random(100) # Per-row labels
nfs = NeoForceScheme(cuda=True)
projection = nfs.fit_transform(dataset)
plt.figure()
plt.scatter(projection[:, 0],
projection[:, 1],
c=labels,
cmap=ListedColormap(['blue', 'red', 'green']),
edgecolors='face',
linewidths=0.5,
s=4)
plt.grid(linestyle='dotted')
plt.show()
import numpy as np
from neo_force_scheme import NeoForceScheme
# NOTE: plotly is not is not included in the package's dependencies
# so that it need to be installed seperately.
import plotly.graph_objects as go
dataset = np.random.random((100, 100)) # Some dataset without labels
labels = np.random.random(100) # Per-row labels
nfs = NeoForceScheme(cuda=True)
projection = nfs.fit_transform(dataset)
fig = go.Figure(data=
go.Scatter(x=projection[:, 0],
y=projection[:, 1],
mode='markers',
marker=dict(
size=16,
color=np.random.randn(100),
colorscale='Viridis',
showscale=True)
)
)
fig.show()
More information can be found at our documentation page
@misc{christino_paulovich_4891820,
author = {Paulovich, Fernando and Christino, Leonardo},
title = {NeoForceScheme},
version = {0.0.2},
publisher = {Zenodo},
month = may,
year = 2021,
doi = {10.5281/zenodo.4891820},
url = {http://dx.doi.org/10.5281/zenodo.4891820}
}