nuget server logo nuget api documents
↑

API Docs / Microsoft.VisualBasic.Data.GraphTheory / SequenceGraphTransform

SequenceGraphTransform

Full name Microsoft.VisualBasic.Data.GraphTheory.SequenceGraphTransform Assembly Microsoft.VisualBasic.Data.GraphTheory Members 13

Sequence Graph Transform (SGT) — Sequence Embedding for Clustering, Classification, and Search

Sequence Graph Transform (SGT) is a sequence embedding function. SGT extracts the short- and long-term sequence features and embeds them in a finite-dimensional feature space. The long and short term patterns embedded in SGT can be tuned without any increase in the computation.

https://github.com/cran2367/sgt/blob/25bf28097788fbbf9727abad91ec6e59873947cc/python/sgt-package/sgt/sgt.py

00 Remarks

Compute embedding of a single or a collection of discrete item sequences. A discrete item sequence is a sequence made from a set discrete elements, also known as alphabet set. For example, suppose the alphabet set is the set of roman letters, {A, B, ..., Z}. This set is made of discrete elements. Examples of sequences from such a set are AABADDSA, UADSFJPFFFOIHOUGD, etc. Such sequence datasets are commonly found in online industry, for example, item purchase history, where the alphabet set is the set of all product items. Sequence datasets are abundant in bioinformatics as protein sequences. Using the embeddings created here, classification and clustering models can be built for sequence datasets. Read more in https://arxiv.org/pdf/1608.03533.pdf

01 Syntax

Microsoft.VisualBasic.Data.GraphTheory.SequenceGraphTransform

02 Methods

NameOverloadsSummary
.ctor 1
get_positions 1 Compute index position elements in the sequence given alphabets Set.
set_alphabets 1 set the alphabet data
__set_feature_name 1
fit 1 Extract Sequence Graph Transform features using Algorithm-2.
SafeStrip 1 Strip of the unexpected alphabets that not existed in current embedding index
CombinePartial 1 for save the memory and make the algorithm faster when deal with a long sequence data
estimate_alphabets 1
fitVector 1
TranslateMatrix 1

03 Properties

NameOverloadsSummary
feature_names 1 the feature name is the combination of SequenceGraphTransform.alphabets
alphabets 1

04 Fields

NameOverloadsSummary
mode 1 algorithm applied for check position

05 Members

method .ctor #
#ctor(Char(), Double, Boolean, Modes)
Parameters
NameTypeDescription
alphabetsChar()

Optional, except if mode is Spark. The set of alphabets that make up all the sequences in the dataset. If not passed, the alphabet set is automatically computed as the unique set of elements that make all the sequences. A list or 1d-array of the set of elements that make up the sequences. For example, np.array(["A", "B", "C"]. If mode is 'spark', the alphabets are necessary.

kappaDouble

Tuning parameter, kappa > 0, to change the extraction of long-term dependency. Higher the value the lesser the long-term dependency captured in the embedding. Typical values for kappa are 1, 5, 10.

lengthsensitiveBoolean

Default False. This is set to true if the embedding of should have the information of the length of the sequence. If set to false then the embedding of two sequences with similar pattern but different lengths will be the same. lengthsensitive = false is similar to length-normalization.

method get_positions #
get_positions(String, Char())

Compute index position elements in the sequence given alphabets Set.

Parameters
NameTypeDescription
sequenceString

-

alphabetsChar()

-

Returns

Return list Of tuples [(value, position)]

method set_alphabets #
set_alphabets(String())

set the alphabet data

Remarks
  1. set the alphabet vector
  1. then set the feature names for the transformation output
  2. finally create the graph matrix index in this function
Parameters
NameTypeDescription
corpusString()

-

method __set_feature_name #
__set_feature_name(Char())
Parameters
NameTypeDescription
alphabetsChar()

-

Returns

returns an array of x,y combination result

method fit #
fit(String)

Extract Sequence Graph Transform features using Algorithm-2.

Parameters
NameTypeDescription
sequenceString

-

Returns

sgt matrix or vector (depending on Flatten==False or True)

method SafeStrip #
SafeStrip(String)

Strip of the unexpected alphabets that not existed in current embedding index

Parameters
NameTypeDescription
seqString

-

method CombinePartial #
CombinePartial(Int32(), Int32())

for save the memory and make the algorithm faster when deal with a long sequence data

Parameters
NameTypeDescription
UInt32()

-

VInt32()

-

property feature_names #
feature_names

the feature name is the combination of SequenceGraphTransform.alphabets

field mode #
mode

algorithm applied for check position

property alphabets #
alphabets
method estimate_alphabets #
estimate_alphabets(String())
method fitVector #
fitVector(String)
method TranslateMatrix #
TranslateMatrix(Dictionary(Of String, Double))