nexus

Experimental tensor-typed deep learning

https://github.com/ctongfei/nexus

Science Score: 77.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 2 DOI reference(s) in README
  • Academic publication links
    Links to: arxiv.org, acm.org
  • Committers with academic emails
    2 of 7 committers (28.6%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (10.4%) to scientific vocabulary

Keywords

deep-learning differentiable-programming neural-network probabilistic-programming scala tensor
Last synced: 4 months ago · JSON representation ·

Repository

Experimental tensor-typed deep learning

Basic Info
  • Host: GitHub
  • Owner: ctongfei
  • License: mit
  • Language: Scala
  • Default Branch: master
  • Homepage: https://tongfei.me/nexus/
  • Size: 3.37 MB
Statistics
  • Stars: 257
  • Watchers: 25
  • Forks: 16
  • Open Issues: 21
  • Releases: 0
Topics
deep-learning differentiable-programming neural-network probabilistic-programming scala tensor
Created over 8 years ago · Last pushed over 6 years ago
Metadata Files
Readme License Citation

README.md

Nexus

🚧 Ongoing project 🚧 Status: Prototype 🚧

Nexus is a prototypical typesafe deep learning system in Scala.

Nexus is a departure from common deep learning libraries such as TensorFlow, PyTorch, MXNet, etc.

  • Ever been baffled by the axes of tensors? Which axis should I max out?
  • Ever got TypeErrors in Python?
  • Ever spending hours or days getting the tensors' axes and dimensions right?

Nexus' answer to these problems is static types. By specifying tensor axes' semantics in types exploiting Scala's expressive types, compilers can validate the program at compile time, freeing developers' burden of remembering axes by heart, and eliminating nearly all errors above before even running.

Nexus embraces declarative and functional programming: Neural networks are built using small composable components, making code very easy to follow, understand and maintain.

A first glance

A simple neural network for learning the XOR function can be found here.

Building a typesafe XOR network: ```scala class In extends Dim; val In = new In
class Hidden extends Dim; val Hidden = new Hidden class Out extends Dim; val Out = new Out // tensor axis labels declared as types and singletons

val x = InputFloatTensor[In] // input vectors val y = InputFloatTensor[Out] // gold labels

 val ŷ = x                     |> // type: Symbolic[FloatTensor[In]] Affine(In -> 2, Hidden -> 2) |> // type: Symbolic[FloatTensor[Hidden]] Logistic |> // type: Symbolic[FloatTensor[Hidden]] Affine(Hidden -> 2, Out -> 2) |> // type: Symbolic[FloatTensor[Out]] Softmax // type: Symbolic[FloatTensor[Out]]  val loss = CrossEntropy(y, ŷ)   // type: Symbolic[Float] ```

Design goals

  • Typeful. Each axis of a tensor is statically typed using tuples. For example, an image is typed as FloatTensor[(Width, Height, Channel)], whereas an embedded sentence is typed as FloatTensor[(Word, Embedding)]. This frees programmers from remembering what each axis stands for.
  • Typesafe. Very strong static type checking to eliminate most bugs at compile time.
  • Never, ever specify axis index again. For things like reduce_sum(x, axis=1), write x |> SumAlong(AxisName).
  • Automatic typeclass derivation: Differentiation through any case class (product type).
  • Versatile switching between eager and lazy evaluation.
  • [TODO] Typesafe tensor sizes using literal singleton types (Scala 2.13+).
  • [TODO] Automatic batching over sequences/trees (Neubig, Goldberg, Dyer, NIPS 2017). Free programmers from the pain of manual batching.
  • [TODO] GPU Acceleration. Reuse Torch C++ core through Swig (bindings).
  • [TODO] Multiple backends. Torch / MXNet? / TensorFlow.js for Scala.js? / libtorch for ScalaNative?
  • [TODO] Automatic operator fusion for optimization.
  • [TODO] Typesafe higher-order gradients / Jacobians.

Modules

Nexus is modularized. It contains the following modules:

| Module | Description | |----------------------|-----------------------------------------------------| | nexus-tensor | Foundations for typesafe tensors | | nexus-diff | Typesafe deep learning (differentiable programming) | | nexus-prob | Typesafe probabilistic programming | | nexus-ml | High-level machine learning abstractions / models | | nexus-jvm-backend | JVM reference backend (slow) | | nexus-torch | Torch native CPU backend | | nexus-torch-cuda | Torch CUDA GPU backend |

Citation

Please cite this in academic work as

bib @inproceedings{chen2017typesafe, author = {Chen, Tongfei}, title = {Typesafe Abstractions for Tensor Operations (Short Paper)}, booktitle = {Proceedings of the 8th ACM SIGPLAN International Symposium on Scala}, series = {SCALA 2017}, year = {2017}, pages = {45--50}, url = {http://doi.acm.org/10.1145/3136000.3136001}, doi = {10.1145/3136000.3136001} }

Owner

  • Name: Tongfei Chen
  • Login: ctongfei
  • Kind: user

(Natural | Programming) language processor

Citation (CITATION.bib)

@inproceedings{chen2017typesafe,
 author = {Chen, Tongfei},
 title = {Typesafe Abstractions for Tensor Operations (Short Paper)},
 booktitle = {Proceedings of the 8th ACM SIGPLAN International Symposium on Scala},
 series = {SCALA 2017},
 year = {2017},
 pages = {45--50},
 url = {http://doi.acm.org/10.1145/3136000.3136001},
 doi = {10.1145/3136000.3136001}
}

GitHub Events

Total
  • Watch event: 2
  • Fork event: 1
Last Year
  • Watch event: 2
  • Fork event: 1

Committers

Last synced: about 1 year ago

All Time
  • Total Commits: 140
  • Total Committers: 7
  • Avg Commits per committer: 20.0
  • Development Distribution Score (DDS): 0.407
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
ctongfei c****i@g****m 83
Tongfei Chen t****i@p****m 23
Tongfei Chen c****i 21
Frank van Lankvelt f****k@a****l 8
Tongfei Chen t****i@j****u 3
Tongfei Chen T****n 1
khashab2 k****2@i****u 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 8 months ago

All Time
  • Total issues: 29
  • Total pull requests: 13
  • Average time to close issues: 12 days
  • Average time to close pull requests: 2 months
  • Total issue authors: 9
  • Total pull request authors: 6
  • Average comments per issue: 1.76
  • Average comments per pull request: 0.85
  • Merged pull requests: 8
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • ctongfei (14)
  • fvlankvelt (3)
  • danyaljj (3)
  • emilyaherbert (2)
  • dansuh17 (2)
  • doofin (2)
  • ryan-williams (1)
  • kitsing (1)
  • EmergentOrder (1)
Pull Request Authors
  • fvlankvelt (5)
  • ctongfei (3)
  • gitviscode (1)
  • dansuh17 (1)
  • drewnoff (1)
  • danyaljj (1)
Top Labels
Issue Labels
typing (6) feature (5) performance (4) backend:torch (4) meta (3) documentation (1)
Pull Request Labels
backend:nd4j (1)