protom

1.0.3 • Public • Published

logo Protom

license version

Abstract

Protom is mathematical base to work with modern concept such like Machine Learning, Deep Learning, Quantum machine, 3D render or Data Analyze. The goal is to teach one language for many applications with an identical process. Behind your jobs, Protom can optimize the algorithms with the same solutions: balance between CPU / GPU / RAM, compression and standardization of data, easy import / export and compatibility.

The core of Protom is developed in Javascript. You can use it in your web and/or desktop applications. The Gitlab deposit is open source, you can fork or contribute. I will ask you to create units tests and comment your code.

Prerequisites

You should have to install Node.js on your computer (Windows / Linux / Mac / ARM systems).

Download here

Install

You can clone the project and install the node modules:

git clone https://gitlab.com/Yarflam/protom.git &&\
cd protom &&\
npm install

How to use it?

I write some papers in the /docs/papers folder:

Explore

Tree view

  • core
    • bayes
      • Bayes.js: first test to apply Bayes' theorem
    • helpers
      • gentools.js: access to random tools
        • Lack of clarity -> refactoring is required
    • quantum
      • Qubit: simple quantum unit.
      • Qureg: Quantum Register (aka Q-System or Q-Space) - manipulate entranglement, quantum gates and measure.
    • struct
      • controllers
        • Activation.js: activation functions
          • { Machine Learning }
        • Caller.js
          • Role: call a specific function in data type classes
          • Example: convert to another type
        • Operation.js
          • Role: perform a mathematical operation
        • Optimizer.js: use loss functions to minimize the errors
          • Example: Gradient descent
          • { Machine Learning }
      • datatypes
        • Complex.js: define a complex number
          • Example: 4 + 2i
        • Matrix.js: define a matrix
          • Notice: division is not supported
          • Example: [ 2, 5, 11 ]
        • Num.js: define a number
          • Example: 133.7
        • Quaternion.js: define a quaternion
          • Example: 20 + 21i + 7j + 8k
        • Tensor.js: define a tensor
          • Example: [ <vect1>, <vect2> ... <vectN> ]
        • Vector.js: define a vector
          • Example: < 3.1, 4.15, 1, 0, 1 >
      • nodes
        • Const: constants
        • Placeholder: dynamic values
        • Var: variables
    • Protom.js: main application.
      • Role: manage the structures and orchestrates the operations
    • index.js & web.js: different entry points (Node.js or web front)
  • docs
    • draft
      • zun3D: 3D engine
    • papers
      • DevelopmentPaper.ipynb: general
      • Quantum Programming.ipynb: quantum mechanics application
  • public: front pages (web)
  • sandbox:
    • dev-playground.js: my tests on the Protom core (Yarflam)
    • search-bayes: Test in application of Bayes' theorem
    • search-map.js & search-map2.js: generate maps in command line (just for fun)
  • test: automated tests with Jest
    • protom-func.spec.js: check the Protom core
    • struct-datatypes.spec.js: check the data types (num, complex, quaternion, vector, matrix, tensor)
    • struct-nodes.spec.js: check the nodes (const, var, placeholder)

Data types

Type About Refers to Example
Num Simple number 2.75
Complex Complex number (real + imaginary) Num 4 + 2i
Quaternion Quaternion (w, i, j, k) Num 20 + 21i + 7j + 8k
Vector One dimension D Num, Complex, Quaternion <0.73, 0.12>
Matrix Two dimensions DxD Num, Complex, Quaternion [[ 1, 2 ], [ 3, 4 ]]
Tensor Multiple dimensions DxDx...D Num, Complex, Quaternion, Vector, Matrix [[ 1, 2 ], [ 3, 4 ]]

Nodes

Node About
Const Constant value
Var Dynamic value, it can evolve by optimizer algorithms
Placeholder Free space to have fill by inputs

Controllers

Controller About Elements
Activation Activation function
  • Gauss
  • Heaviside
  • Leaky-Relu
  • ReLU
  • Sigmoid / Logistic
  • Softmax [N.I.]
  • Softplus [N.I.]
  • Softsign [N.I.]
  • Swish
  • Tanh
Optimizer Algorithm to optimize learning
  • Adadelta
  • Adagrad
  • Adam
  • Adamax
  • Ftrl
  • Gradient Descent
  • Momentum
  • Proximal Adagrad
  • Proximal Gradient Descent
  • RMS Prop
  • SDCA
  • SyncReplicas
Loss Loss function
Caller Call a specific method of node
Operation Calculate node in the graph

Engines

Summary

Name About
Neural Network Multilayer perceptron
Quantum System Simulation of a quantum computer
3D render Orthogonal projections
Data tools Statistics

Quantum System

In development...

Standards

Sequence of Q-bytes:

All gates are written in big-endian - an easy-to-use common representation - but they are executed in little-endian.

Compatibility with numbers:

You can use Number (or Num object) and Complex number.

Gates

Gates Code Params Matrix
PauliX / SigmaX X 1 [[ 0, 1 ], [ 1, 0 ]]
PauliY / SigmaY Y 1 [[ 0, -i ], [ i, 0 ]]
PauliZ / SigmaZ Z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],
 [ 0, 0, 0, 1, 0, 0, 0, 0 ],
 [ 0, 0, 0, 0, 1, 0, 0, 0 ],
 [ 0, 0, 0, 0, 0, 0, 1, 0 ],
 [ 0, 0, 0, 0, 0, 1, 0, 0 ],
 [ 0, 0, 0, 0, 0, 0, 0, 1 ]]

Authors

  • Yarflam - initial work

License

The project is licensed under Creative Commons (BY-NC-SA) - see the LICENSE.md file for details.

Package Sidebar

Install

npm i protom

Weekly Downloads

1

Version

1.0.3

License

Creative Commons BY-NC-SA License 3.0

Unpacked Size

138 kB

Total Files

34

Last publish

Collaborators

  • yarflam