MarkovSet:
Filter:
Classes (extension) | Collections > Unordered | Libraries > MathLib > Markov & Fuzzy

MarkovSet : Object
ExtensionExtension

first order markov set
Source: MarkovSet.sc
Subclasses: IdentityMarkovSet

Description

MarkovSet is a Dictionary that contains keys pointing to WeighBags that contain objects and their probabilities. By parsing in a stream the Set "learns" what element can possibly follow another.1

Part of MathLib, a diverse library of mathematical functions.

Class Methods

MarkovSet.new(args, updateSeeds: false)

Arguments:

args

A list of arrays that each represent one node in the set:

[element, [next_elements], [weigths]]

next_elementsThe next node is searched by simple equality. If nil, this is a terminator node
weightsThe array is normalized. If weigths is nil, equal weight is used.

If args is nil, the set is created and may be trained by the other methods.

updateSeeds

If set to true, each element is always added to the seeds

MarkovSet.fill(length, stream)

Arguments:

length

Number of items to read.

stream

A function or stream that returns items to read.

Inherited class methods

Instance Methods

.read(prevkey, nextkey)

Read a pair of values.

.put(prevkey, nextkeys, weights, precision: 0.01)

Insert a node. Any old node is overwritten.

.remove(key, nextKey)

Remove a pair of values.

.next(prevKey)

Return a next item for the arg value. If arg is nil, choose from seeds.

.parse(pattern, length: inf)

Read length items into the set from the stream.

.asStream

Returns a stream that creates a markov chain.

Inherited instance methods

Undocumented instance methods

.addExits(terminators)

.choose

.dict

.embedInStream(inval, repeats: inf)

.embedSpyInStream(pattern, repeats: inf, inval)

.equalize

.get(key)

.makeSeeds

.manipulate(func)

.nodeClass

.normalize

.order

.parseFile(path, delimiter: $ , blockSize: 0, completionFunc)

.parseIO(iostream, delimiter: $ , blockSize: 0, completionFunc, maxLength: 32)

.putAll(args)

.seeds

.seeds = collection

.size

.storeItemsOn(stream, itemsPerLine: 1)

.updateSeeds

.updateSeeds = value

.writeHtml(argPath: "supermarkov", nPages: 5, pagelength: 60, style)

From extension in /home/stefan/.local/share/SuperCollider/downloaded-quarks/MathLib/classes/MarkovSet/extHTML.sc

Examples

direct node definition

training by a stream

training bit by bit

creating streams

supermarkov

Authors

Julian Rohrhuber, 2004, 2007.