JSPM

@ector/state

1.0.3
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2
  • Score
    100M100P100Q30043F
  • License MIT

Allows activation values propagation within a weighted directed graph

Package Exports

  • @ector/state

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@ector/state) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@ector/state

npm version

@ector/state allows activation value propagation within a @ector/concept-network.

Usage

const conceptNetwork = require('@ector/concept-network');
const cns = require('@ector/state');

let cn = conceptNetwork.addNode({}, 'ECTOR');
cn = conceptNetwork.addNode(cn, 'knows');
cn = conceptNetwork.addNode(cn, 'Achille');

cn = conceptNetwork.addLink(cn, 'ECTOR', 'knows');
cn = conceptNetwork.addLink(cn, 'knows', 'Achille');

let cns = cns.activate({}, 'ECTOR');
cns = cnsPropagate(cn, cns);

will give

{ "ECTOR": { "value": 59.500004166625004, "age": 1, "old": 100 },
  "knows": { "value": 63.40844023393148, "age": 0, "old": 0 } }

Functions

Table of Contents

ConceptNetworkState

Type: (Object<string, ConceptNetworkNodeState> | {})

ConceptNetworkNodeState

Type: Object<string, any>

Properties

  • value number Node's activation value
  • old number? Node's old activation value
  • age number? Number of propagations

activate

Activate the node which label is given

Parameters

Returns ConceptNetworkState

getActivationValue

Get the activation value of the node which label is given

Parameters

Returns (number | undefined)

getOldActivationValue

Get the activation value of a node (which label is given)

Parameters

Returns (number | undefined)

getMaxActivationValue

Get the maximum activation value of all nodes which label starts with beginning.

Parameters

Returns number

getActivatedTypedNodes

Return an object associating nodes labels with their activation values, but only for labels starting with beginning and activation values greater or equal to threshold.

Parameters

setActivationValue

Set the activation value of a node label.

Parameters

Returns ConceptNetworkState

propagate

Propagate the activation values along the links.

Parameters

  • cn ConceptNetwork
  • cns ConceptNetworkState
  • options (optional, default {decay:40,memoryPerf:100})

Returns ConceptNetworkState

mapObjIndexed

influenceNb

influenceValue