sst
synaptic-simple-trainer
npm i synaptic-simple-trainer
Deprecated!
Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
sst

synaptic-simple-trainer

A ready to go text classification trainer based on synaptic (https://github.com/cazala/synaptic)

by Borut Balazek

0.2.0 (see all)License:MITTypeScript:Not Found
npm i synaptic-simple-trainer
Readme

Synaptic Simple Trainer

A ready to go text classification trainer based on synaptic

Installation

npm install synaptic-simple-trainer --save

How to use

data.js

var data = {
    train: [
        {
            text: 'that was a very good movie',
            class: 'positive',
        },
        {
            text: 'this was a great movie',
            class: 'positive',
        },
        {
            text: 'the movie was awesome',
            class: 'positive',
        },
        {
            text: 'I absolutely loved the movie',
            class: 'positive',
        },
        {
            text: 'the movie was pretty bad',
            class: 'positive',
        },
    ],
    test: [
        {
            text: 'it was a good movie',
            class: 'positive',
        },
        {
            text: 'it was bad',
            class: 'negative',
        },
    ],
};

module.exports = data;

train.js

var trainer = require('synaptic-simple-trainer');
var data = require('./data');

trainer.trainData = data.train;
trainer.testData = data.test;

trainer.prepareData();
trainer.run(function() {
    process.exit();
});

test.js

var trainer = require('synaptic-simple-trainer');
var data = require('./data');

trainer.trainData = data.train;
trainer.testData = data.test;

trainer.test();
trainer.completed();

process.exit();

Once everything is ready, just run node example/train.js. After it's run at least once, you'll be able to test it with node example/test.js, because the brain (network) was saved, and will be reused.

For a more detailed example, please view the /example folder.

Note: If you add new words / classes to your trainData (trainingSet), you will need to re-train the network again! In case you have a larger training set, you may not need to re-train (but only, if all the existing words / classes already exist)!

Changelog

0.2.0

  • Added removeStopWords option
  • Readme updates
  • Added example of continuous training
  • Added continuousTraining option

0.1.0

  • Initial release

Todo

  • documentation
  • word2vec implementation

License

Synaptic Simple Trainer is licensed under the MIT license.

Downloads/wk

12

GitHub Stars

19

LAST COMMIT

6yrs ago

MAINTAINERS

1

CONTRIBUTORS

0

OPEN ISSUES

1

OPEN PRs

0
VersionTagPublished
0.2.0
latest
6yrs ago
No alternatives found
No tutorials found
Add a tutorial

Rate & Review

100
No reviews found
Be the first to rate