Skip to content

NeoForceSceme, an extention of the original ForceScheme with performance improvements using Numba and CUDA

License

Notifications You must be signed in to change notification settings

visml/neo_force_scheme

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NeoForceScheme

DOI

A new library for extended and performance-focused ForceScheme implementation.

Installation

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

QuickStart

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)

Kruskal Stress

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)

Plot with matplotlib

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()

Plot with plotly

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()

API

More information can be found at our documentation page

CITATION

@software{qiaodan_luo_2022_7379477,
  author       = {Qiaodan Luo and
                  Leonardo Christino and
                  Fernando Paulovich},
  title        = {visml/neo\_force\_scheme: Eurovis Submission},
  month        = nov,
  year         = 2022,
  publisher    = {Zenodo},
  version      = {0.0.3},
  doi          = {10.5281/zenodo.7379477},
  url          = {https://doi.org/10.5281/zenodo.7379477}
}

About

NeoForceSceme, an extention of the original ForceScheme with performance improvements using Numba and CUDA

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages