polymacsdeprecated

A no-nonsense machine learning library to generate output from binary learning data

Usage no npm install needed!

<script type="module">
  import polymacs from 'https://cdn.skypack.dev/polymacs';
</script>

README

polymacs

A no-nonsense machine learning library to generate output from binary learning data.

Please note that this documentation is for version 0.2.0 of polymacs, and that only create(), importer() and exporter() are currently available as functions.

Preamble

Often when people are introduced to machine learning and its capabilities, they are amazed at the possibilities, however the actual learning curve is very steep. Great tools such as TensorFlow are very comprehensive and well-made, but for people who find it confusing and convoluted (like I did at one point), a simpler solution is needed. The aim of the polymacs package is to bridge the gap between people who want to use machine learning and the wonders of machine learning itself.

The foundational component of the polymacs package, a macro, is a simplification of neural networks. Using the macro doesn't require as many lines of code when compared to standard machine learning libraries.

You can find polymacs on both npm and GitHub.

Note: The main component of polymacs is called a macro because the definition of the word describes their purpose, i.e. "an instruction that represents a sequence of instructions in abbreviated form" - Dictionary.com

Installation

To install polymacs, run:

npm i polymacs

Usage

Every program where you want to use the polymacs package needs to start with:

const polymacs = require("polymacs");

Macros

The main component of polymacs explained in the preamble, a macro, is simply an easy-to-use neural network. You can create a new macro with:

polymacs.create((err, res) => {
  // your code here
});
  • err is any error that may occur while creating the macro
  • res is the newly created macro

After you create your macro, there are three main actions you can perform with your macro: training, predicting and then exporting.

You can also import macros instead of creating new ones.

Training

To train your macro on a dataset, use the train() command like this:

polymacs.train(macro, dataset, (err, res) => {
  // your code here
});
  • macro is the macro you created using the create() command
  • dataset is all your training data in a Readable Stream
  • err is any error that may occur while training
  • res is the macro newly trained on your data

Note: Currently, only text input is fully supported. In future versions, more formats may be supported, but while still in the development stage, only text will be available in polymacs. You can still convert MIDI files or other formats to some kind of pseudo-text, but this isn't optimised to work as well as normal text would.

Predicting

Once you have trained your macro, you can begin using it to actually generate new data. The function is very similar to that of the train() function. Prediction is done with:

polymacs.predict(macro, (err, res) => {
  // your code here
});
  • macro is the macro you created and trained
  • err is any error that may occur while computing
  • res the resulting text

Exporting

Once you have performed all the operations you want on your macro, you can export your model to the HDF5 (.h5) format, which is compatible with Keras, TensorFlow, CNTK and Theano. You can export with:

polymacs.exporter(macro, file, (err) => {
  // your error handling here
});
  • macro is the macro you want to export
  • file is a Writable Stream where the HDF5 file will be exported
  • err is any error that may occur while exporting

Importing

In addition to exporting, you can also import macros from an HDF5 file with:

polymacs.importer(file, (err, res) => {
  // your code here
});
  • file is your HDF5 file in a Readable Stream
  • err is any error that may occur while importing
  • res is the imported macro

Other Stuff

Issues

Please put all your issues onto the issues page. I'll try to solve your problems as quick as I can, but responses may take time.

Contributing

If you would like to contribute to polymacs, fork the repository, make your changes and then create a pull request. Expect a reply within 3-5 business days :)

Changelog

0.1.1

  • added importer() function
  • added exporter() function

0.1.0

  • added create() function

0.0.2

  • created documentation (for v0.2.0)

0.0.1

  • created npm package
  • created license