Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cat-markov

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cat-markov - npm Package Compare versions

Comparing version 1.1.1 to 1.1.2

1

dist/Markov.d.ts

@@ -37,2 +37,3 @@ import * as gaussian from 'gaussian';

next(): MarkovKey;
gaus(links: Map<string | SpecialKey, MarkovAssociation>, curve: MarkovKeyCurve): MarkovKey;
randNext(): MarkovKey;

@@ -39,0 +40,0 @@ gausNext(): MarkovKey;

33

dist/Markov.js

@@ -96,11 +96,7 @@ "use strict";

}
randNext() {
const asses = Array.from(this.links.values());
return asses[Math.floor(Math.random() * asses.length)].keyRef;
}
gausNext() {
gaus(links, curve) {
let sum = 0;
const pairs = [];
for (const ass of this.links.values()) {
const prob = this.curve.gaussian.cdf(ass.associations);
for (const ass of links.values()) {
const prob = curve.gaussian.cdf(ass.associations) * 100;
pairs.push([ass.keyRef, prob]);

@@ -118,2 +114,9 @@ sum += prob;

}
randNext() {
const asses = Array.from(this.links.values());
return asses[Math.floor(Math.random() * asses.length)].keyRef;
}
gausNext() {
return this.gaus(this.links, this.curve);
}
prev() {

@@ -133,17 +136,3 @@ const seed = Math.floor(Math.random() * this.parentWeightSum);

gausPrev() {
let sum = 0;
const pairs = [];
for (const ass of this.parents.values()) {
const prob = this.parentCurve.gaussian.cdf(ass.associations);
pairs.push([ass.keyRef, prob]);
sum += prob;
}
const seed = Math.random() * sum;
let accu = 0;
for (const ass of pairs) {
accu += ass[1];
if (accu >= seed) {
return ass[0];
}
}
return this.gaus(this.parents, this.parentCurve);
}

@@ -150,0 +139,0 @@ toString() {

{
"name": "cat-markov",
"version": "1.1.1",
"version": "1.1.2",
"description": "A library to generate markov chains.",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc