1.0.25 • Published 10 months ago

b3-bnn v1.0.25

Weekly downloads
-
License
ISC
Repository
-
Last release
10 months ago

🍌 Naive Bayes classifier

npm i b3-bnn

Initialization and configuration

import BNN from "b3-bnn";

// Classifier instance
const bayes = BNN();

// Add layer (classifier)
const sLayer = bayes.addLayer("thread-length");

// Set normalizer for input string
sLayer.setNormalizer((phrase) => {
  // Remove standard spaces
  return phrase.replace(/((DIN)|(GOST))\s*(\d+)/gm, "$1:$2");
});

Learning

await sLayer.learn(
  "The bolt GOST 7798 with dimensions of 6x20 has a thread length",
  "fully"
);
await sLayer.learn(
  "The bolt GOST 7798 with dimensions of 6x80 has a thread length",
  "partly"
);

await sLayer.learn(
  "The bolt DIN 933 with dimensions of 6x20 has a thread length",
  "fully"
);
await sLayer.learn(
  "The bolt DIN 933 with dimensions of 6x80 has a thread length",
  "fully"
);

await sLayer.learn(
  "The bolt DIN 931 with dimensions of 6x20 has a thread length",
  "partly"
);
await sLayer.learn(
  "The bolt DIN 931 with dimensions of 6x80 has a thread length",
  "partly"
);

Promt

const answers = await sLayer.classify(
  "What is the thread length of the DIN 933 bolt with dimensions 6x80?"
);
1.0.25

10 months ago

1.0.24

10 months ago

1.0.23

11 months ago

1.0.19

2 years ago

1.0.18

2 years ago

1.0.17

2 years ago

1.0.16

2 years ago

1.0.20

2 years ago

1.0.14

2 years ago

1.0.13

2 years ago

1.0.12

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.8

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago