Skip to content

Commit

Permalink
First Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
christinoleo committed Jun 1, 2021
0 parents commit 4dd99b7
Show file tree
Hide file tree
Showing 18 changed files with 2,370 additions and 0 deletions.
213 changes: 213 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,213 @@
local_storage/

# Created by .ignore support plugin (hsz.mobi)
### Python template
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover
.hypothesis/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# IPython Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# dotenv
.env

# virtualenv
venv/
ENV/

# Spyder project settings
.spyderproject

# Rope project settings
.ropeproject
### VirtualEnv template
# Virtualenv
# http://iamzed.com/2009/05/07/a-primer-on-virtualenv/
.Python
[Bb]in
[Ii]nclude
[Ll]ib
[Ll]ib64
[Ll]ocal
[Ss]cripts
pyvenv.cfg
.venv
pip-selfcheck.json
### JetBrains template
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff:
.idea/workspace.xml
.idea/tasks.xml
.idea/dictionaries
.idea/vcs.xml
.idea/jsLibraryMappings.xml

# Sensitive or high-churn files:
.idea/dataSources.ids
.idea/dataSources.xml
.idea/dataSources.local.xml
.idea/sqlDataSources.xml
.idea/dynamic.xml
.idea/uiDesigner.xml

# Gradle:
.idea/gradle.xml
.idea/libraries

# Mongo Explorer plugin:
.idea/mongoSettings.xml

.idea/

## File-based project format:
*.iws

## Plugin-specific files:

# IntelliJ
/out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

.nox/
*.cover
*.py,cover
.pytest_cache/
cover/
db.sqlite3
db.sqlite3-journal
.pybuilder/

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
env.bak/
venv.bak/

# Spyder project settings
.spyproject

# Rope project settings

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/
21 changes: 21 additions & 0 deletions LICENCE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2021 Fernando Paulovich, Leonardo Christino

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Empty file added MANIFEST.in
Empty file.
71 changes: 71 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# NeoForceScheme

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

## QuickStart

You can find examples for [simple data](./examples/mammals_cpu.py), [large data with cpu](./examples/mammmals_large_cpu.py),
and [large data with gpu](./examples/mammmals_large_gpu.py)

To run the projection:
```python
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.
```python
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
```python
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
```python
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()
```

## API
More information can be found at [our documentation page](#)
1 change: 1 addition & 0 deletions examples/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
old
Empty file added examples/__init__.py
Empty file.
Loading

0 comments on commit 4dd99b7

Please sign in to comment.