From 22db7d9db6e735736e59c1eb4074223d1af92007 Mon Sep 17 00:00:00 2001 From: Quan Wang Date: Sat, 21 Sep 2024 17:23:41 -0400 Subject: [PATCH] use colortimelog --- docs/search.js | 2 +- docs/uisrnn.html | 1980 +++++----- docs/uisrnn/arguments.html | 18 +- docs/uisrnn/contrib.html | 6 +- docs/uisrnn/contrib/contrib_template.html | 6 +- .../contrib/range_search_crp_alpha.html | 16 +- docs/uisrnn/evals.html | 6 +- docs/uisrnn/loss_func.html | 6 +- docs/uisrnn/uisrnn.html | 3260 +++++++++-------- docs/uisrnn/utils.html | 1240 +++---- setup.py | 2 +- tests/integration_test.py | 16 +- uisrnn/arguments.py | 6 +- uisrnn/uisrnn.py | 3 +- uisrnn/utils.py | 17 - 15 files changed, 3236 insertions(+), 3348 deletions(-) diff --git a/docs/search.js b/docs/search.js index fef9748..1876d85 100644 --- a/docs/search.js +++ b/docs/search.js @@ -1,6 +1,6 @@ window.pdocSearch = (function(){ /** elasticlunr - http://weixsong.github.io * Copyright (C) 2017 Oliver Nightingale * Copyright (C) 2017 Wei Song * MIT Licensed */!function(){function e(e){if(null===e||"object"!=typeof e)return e;var t=e.constructor();for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}var t=function(e){var n=new t.Index;return n.pipeline.add(t.trimmer,t.stopWordFilter,t.stemmer),e&&e.call(n,n),n};t.version="0.9.5",lunr=t,t.utils={},t.utils.warn=function(e){return function(t){e.console&&console.warn&&console.warn(t)}}(this),t.utils.toString=function(e){return void 0===e||null===e?"":e.toString()},t.EventEmitter=function(){this.events={}},t.EventEmitter.prototype.addListener=function(){var e=Array.prototype.slice.call(arguments),t=e.pop(),n=e;if("function"!=typeof t)throw new TypeError("last argument must be a function");n.forEach(function(e){this.hasHandler(e)||(this.events[e]=[]),this.events[e].push(t)},this)},t.EventEmitter.prototype.removeListener=function(e,t){if(this.hasHandler(e)){var n=this.events[e].indexOf(t);-1!==n&&(this.events[e].splice(n,1),0==this.events[e].length&&delete this.events[e])}},t.EventEmitter.prototype.emit=function(e){if(this.hasHandler(e)){var t=Array.prototype.slice.call(arguments,1);this.events[e].forEach(function(e){e.apply(void 0,t)},this)}},t.EventEmitter.prototype.hasHandler=function(e){return e in this.events},t.tokenizer=function(e){if(!arguments.length||null===e||void 0===e)return[];if(Array.isArray(e)){var n=e.filter(function(e){return null===e||void 0===e?!1:!0});n=n.map(function(e){return t.utils.toString(e).toLowerCase()});var i=[];return n.forEach(function(e){var n=e.split(t.tokenizer.seperator);i=i.concat(n)},this),i}return e.toString().trim().toLowerCase().split(t.tokenizer.seperator)},t.tokenizer.defaultSeperator=/[\s\-]+/,t.tokenizer.seperator=t.tokenizer.defaultSeperator,t.tokenizer.setSeperator=function(e){null!==e&&void 0!==e&&"object"==typeof e&&(t.tokenizer.seperator=e)},t.tokenizer.resetSeperator=function(){t.tokenizer.seperator=t.tokenizer.defaultSeperator},t.tokenizer.getSeperator=function(){return t.tokenizer.seperator},t.Pipeline=function(){this._queue=[]},t.Pipeline.registeredFunctions={},t.Pipeline.registerFunction=function(e,n){n in t.Pipeline.registeredFunctions&&t.utils.warn("Overwriting existing registered function: "+n),e.label=n,t.Pipeline.registeredFunctions[n]=e},t.Pipeline.getRegisteredFunction=function(e){return e in t.Pipeline.registeredFunctions!=!0?null:t.Pipeline.registeredFunctions[e]},t.Pipeline.warnIfFunctionNotRegistered=function(e){var n=e.label&&e.label in this.registeredFunctions;n||t.utils.warn("Function is not registered with pipeline. This may cause problems when serialising the index.\n",e)},t.Pipeline.load=function(e){var n=new t.Pipeline;return e.forEach(function(e){var i=t.Pipeline.getRegisteredFunction(e);if(!i)throw new Error("Cannot load un-registered function: "+e);n.add(i)}),n},t.Pipeline.prototype.add=function(){var e=Array.prototype.slice.call(arguments);e.forEach(function(e){t.Pipeline.warnIfFunctionNotRegistered(e),this._queue.push(e)},this)},t.Pipeline.prototype.after=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var i=this._queue.indexOf(e);if(-1===i)throw new Error("Cannot find existingFn");this._queue.splice(i+1,0,n)},t.Pipeline.prototype.before=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var i=this._queue.indexOf(e);if(-1===i)throw new Error("Cannot find existingFn");this._queue.splice(i,0,n)},t.Pipeline.prototype.remove=function(e){var t=this._queue.indexOf(e);-1!==t&&this._queue.splice(t,1)},t.Pipeline.prototype.run=function(e){for(var t=[],n=e.length,i=this._queue.length,o=0;n>o;o++){for(var r=e[o],s=0;i>s&&(r=this._queue[s](r,o,e),void 0!==r&&null!==r);s++);void 0!==r&&null!==r&&t.push(r)}return t},t.Pipeline.prototype.reset=function(){this._queue=[]},t.Pipeline.prototype.get=function(){return this._queue},t.Pipeline.prototype.toJSON=function(){return this._queue.map(function(e){return t.Pipeline.warnIfFunctionNotRegistered(e),e.label})},t.Index=function(){this._fields=[],this._ref="id",this.pipeline=new t.Pipeline,this.documentStore=new t.DocumentStore,this.index={},this.eventEmitter=new t.EventEmitter,this._idfCache={},this.on("add","remove","update",function(){this._idfCache={}}.bind(this))},t.Index.prototype.on=function(){var e=Array.prototype.slice.call(arguments);return this.eventEmitter.addListener.apply(this.eventEmitter,e)},t.Index.prototype.off=function(e,t){return this.eventEmitter.removeListener(e,t)},t.Index.load=function(e){e.version!==t.version&&t.utils.warn("version mismatch: current "+t.version+" importing "+e.version);var n=new this;n._fields=e.fields,n._ref=e.ref,n.documentStore=t.DocumentStore.load(e.documentStore),n.pipeline=t.Pipeline.load(e.pipeline),n.index={};for(var i in e.index)n.index[i]=t.InvertedIndex.load(e.index[i]);return n},t.Index.prototype.addField=function(e){return this._fields.push(e),this.index[e]=new t.InvertedIndex,this},t.Index.prototype.setRef=function(e){return this._ref=e,this},t.Index.prototype.saveDocument=function(e){return this.documentStore=new t.DocumentStore(e),this},t.Index.prototype.addDoc=function(e,n){if(e){var n=void 0===n?!0:n,i=e[this._ref];this.documentStore.addDoc(i,e),this._fields.forEach(function(n){var o=this.pipeline.run(t.tokenizer(e[n]));this.documentStore.addFieldLength(i,n,o.length);var r={};o.forEach(function(e){e in r?r[e]+=1:r[e]=1},this);for(var s in r){var u=r[s];u=Math.sqrt(u),this.index[n].addToken(s,{ref:i,tf:u})}},this),n&&this.eventEmitter.emit("add",e,this)}},t.Index.prototype.removeDocByRef=function(e){if(e&&this.documentStore.isDocStored()!==!1&&this.documentStore.hasDoc(e)){var t=this.documentStore.getDoc(e);this.removeDoc(t,!1)}},t.Index.prototype.removeDoc=function(e,n){if(e){var n=void 0===n?!0:n,i=e[this._ref];this.documentStore.hasDoc(i)&&(this.documentStore.removeDoc(i),this._fields.forEach(function(n){var o=this.pipeline.run(t.tokenizer(e[n]));o.forEach(function(e){this.index[n].removeToken(e,i)},this)},this),n&&this.eventEmitter.emit("remove",e,this))}},t.Index.prototype.updateDoc=function(e,t){var t=void 0===t?!0:t;this.removeDocByRef(e[this._ref],!1),this.addDoc(e,!1),t&&this.eventEmitter.emit("update",e,this)},t.Index.prototype.idf=function(e,t){var n="@"+t+"/"+e;if(Object.prototype.hasOwnProperty.call(this._idfCache,n))return this._idfCache[n];var i=this.index[t].getDocFreq(e),o=1+Math.log(this.documentStore.length/(i+1));return this._idfCache[n]=o,o},t.Index.prototype.getFields=function(){return this._fields.slice()},t.Index.prototype.search=function(e,n){if(!e)return[];e="string"==typeof e?{any:e}:JSON.parse(JSON.stringify(e));var i=null;null!=n&&(i=JSON.stringify(n));for(var o=new t.Configuration(i,this.getFields()).get(),r={},s=Object.keys(e),u=0;u0&&t.push(e);for(var i in n)"docs"!==i&&"df"!==i&&this.expandToken(e+i,t,n[i]);return t},t.InvertedIndex.prototype.toJSON=function(){return{root:this.root}},t.Configuration=function(e,n){var e=e||"";if(void 0==n||null==n)throw new Error("fields should not be null");this.config={};var i;try{i=JSON.parse(e),this.buildUserConfig(i,n)}catch(o){t.utils.warn("user configuration parse failed, will use default configuration"),this.buildDefaultConfig(n)}},t.Configuration.prototype.buildDefaultConfig=function(e){this.reset(),e.forEach(function(e){this.config[e]={boost:1,bool:"OR",expand:!1}},this)},t.Configuration.prototype.buildUserConfig=function(e,n){var i="OR",o=!1;if(this.reset(),"bool"in e&&(i=e.bool||i),"expand"in e&&(o=e.expand||o),"fields"in e)for(var r in e.fields)if(n.indexOf(r)>-1){var s=e.fields[r],u=o;void 0!=s.expand&&(u=s.expand),this.config[r]={boost:s.boost||0===s.boost?s.boost:1,bool:s.bool||i,expand:u}}else t.utils.warn("field name in user configuration not found in index instance fields");else this.addAllFields2UserConfig(i,o,n)},t.Configuration.prototype.addAllFields2UserConfig=function(e,t,n){n.forEach(function(n){this.config[n]={boost:1,bool:e,expand:t}},this)},t.Configuration.prototype.get=function(){return this.config},t.Configuration.prototype.reset=function(){this.config={}},lunr.SortedSet=function(){this.length=0,this.elements=[]},lunr.SortedSet.load=function(e){var t=new this;return t.elements=e,t.length=e.length,t},lunr.SortedSet.prototype.add=function(){var e,t;for(e=0;e1;){if(r===e)return o;e>r&&(t=o),r>e&&(n=o),i=n-t,o=t+Math.floor(i/2),r=this.elements[o]}return r===e?o:-1},lunr.SortedSet.prototype.locationFor=function(e){for(var t=0,n=this.elements.length,i=n-t,o=t+Math.floor(i/2),r=this.elements[o];i>1;)e>r&&(t=o),r>e&&(n=o),i=n-t,o=t+Math.floor(i/2),r=this.elements[o];return r>e?o:e>r?o+1:void 0},lunr.SortedSet.prototype.intersect=function(e){for(var t=new lunr.SortedSet,n=0,i=0,o=this.length,r=e.length,s=this.elements,u=e.elements;;){if(n>o-1||i>r-1)break;s[n]!==u[i]?s[n]u[i]&&i++:(t.add(s[n]),n++,i++)}return t},lunr.SortedSet.prototype.clone=function(){var e=new lunr.SortedSet;return e.elements=this.toArray(),e.length=e.elements.length,e},lunr.SortedSet.prototype.union=function(e){var t,n,i;this.length>=e.length?(t=this,n=e):(t=e,n=this),i=t.clone();for(var o=0,r=n.toArray();oThe module for Unbounded Interleaved-State Recurrent Neural Network.

\n\n

An introduction is available at [README.md].

\n"}, {"fullname": "uisrnn.parse_arguments", "modulename": "uisrnn", "qualname": "parse_arguments", "kind": "function", "doc": "

Parse arguments.

\n\n

Returns:\n A tuple of:

\n\n
- `model_args`: model arguments\n- `training_args`: training arguments\n- `inference_args`: inference arguments\n
\n", "signature": "():", "funcdef": "def"}, {"fullname": "uisrnn.compute_sequence_match_accuracy", "modulename": "uisrnn", "qualname": "compute_sequence_match_accuracy", "kind": "function", "doc": "

Compute the accuracy between two sequences by finding optimal matching.

\n\n

Args:\n sequence1: A list of integers or strings.\n sequence2: A list of integers or strings.

\n\n

Returns:\n accuracy: sequence matching accuracy as a number in [0.0, 1.0]

\n\n

Raises:\n TypeError: If sequence1 or sequence2 is not list.\n ValueError: If sequence1 and sequence2 are not same size.

\n", "signature": "(sequence1, sequence2):", "funcdef": "def"}, {"fullname": "uisrnn.output_result", "modulename": "uisrnn", "qualname": "output_result", "kind": "function", "doc": "

Produce a string to summarize the experiment.

\n", "signature": "(model_args, training_args, test_record):", "funcdef": "def"}, {"fullname": "uisrnn.UISRNN", "modulename": "uisrnn", "qualname": "UISRNN", "kind": "class", "doc": "

Unbounded Interleaved-State Recurrent Neural Networks.

\n"}, {"fullname": "uisrnn.UISRNN.__init__", "modulename": "uisrnn", "qualname": "UISRNN.__init__", "kind": "function", "doc": "

Construct the UISRNN object.

\n\n

Args:\n args: Model configurations. See arguments.py for details.

\n", "signature": "(args)"}, {"fullname": "uisrnn.UISRNN.observation_dim", "modulename": "uisrnn", "qualname": "UISRNN.observation_dim", "kind": "variable", "doc": "

\n"}, {"fullname": "uisrnn.UISRNN.device", "modulename": "uisrnn", "qualname": "UISRNN.device", "kind": "variable", "doc": "

\n"}, {"fullname": "uisrnn.UISRNN.rnn_model", "modulename": "uisrnn", "qualname": "UISRNN.rnn_model", "kind": "variable", "doc": "

\n"}, {"fullname": "uisrnn.UISRNN.rnn_init_hidden", "modulename": "uisrnn", "qualname": "UISRNN.rnn_init_hidden", "kind": "variable", "doc": "

\n"}, {"fullname": "uisrnn.UISRNN.estimate_sigma2", "modulename": "uisrnn", "qualname": "UISRNN.estimate_sigma2", "kind": "variable", "doc": "

\n"}, {"fullname": "uisrnn.UISRNN.estimate_transition_bias", "modulename": "uisrnn", "qualname": "UISRNN.estimate_transition_bias", "kind": "variable", "doc": "

\n"}, {"fullname": "uisrnn.UISRNN.sigma2", "modulename": "uisrnn", "qualname": "UISRNN.sigma2", "kind": "variable", "doc": "

\n"}, {"fullname": "uisrnn.UISRNN.transition_bias", "modulename": "uisrnn", "qualname": "UISRNN.transition_bias", "kind": "variable", "doc": "

\n"}, {"fullname": "uisrnn.UISRNN.transition_bias_denominator", "modulename": "uisrnn", "qualname": "UISRNN.transition_bias_denominator", "kind": "variable", "doc": "

\n"}, {"fullname": "uisrnn.UISRNN.crp_alpha", "modulename": "uisrnn", "qualname": "UISRNN.crp_alpha", "kind": "variable", "doc": "

\n"}, {"fullname": "uisrnn.UISRNN.logger", "modulename": "uisrnn", "qualname": "UISRNN.logger", "kind": "variable", "doc": "

\n"}, {"fullname": "uisrnn.UISRNN.save", "modulename": "uisrnn", "qualname": "UISRNN.save", "kind": "function", "doc": "

Save the model to a file.

\n\n

Args:\n filepath: the path of the file.

\n", "signature": "(self, filepath):", "funcdef": "def"}, {"fullname": "uisrnn.UISRNN.load", "modulename": "uisrnn", "qualname": "UISRNN.load", "kind": "function", "doc": "

Load the model from a file.

\n\n

Args:\n filepath: the path of the file.

\n", "signature": "(self, filepath):", "funcdef": "def"}, {"fullname": "uisrnn.UISRNN.fit_concatenated", "modulename": "uisrnn", "qualname": "UISRNN.fit_concatenated", "kind": "function", "doc": "

Fit UISRNN model to concatenated sequence and cluster_id.

\n\n

Args:\n train_sequence: the training observation sequence, which is a\n 2-dim numpy array of real numbers, of size N * D.

\n\n
- `N`: summation of lengths of all utterances.\n- `D`: observation dimension.\n\nFor example,\n
\n\n

train_sequence =\n[[1.2 3.0 -4.1 6.0]    --> an entry of speaker #0 from utterance 'iaaa'\n [0.8 -1.1 0.4 0.5]    --> an entry of speaker #1 from utterance 'iaaa'\n [-0.2 1.0 3.8 5.7]    --> an entry of speaker #0 from utterance 'iaaa'\n [3.8 -0.1 1.5 2.3]    --> an entry of speaker #0 from utterance 'ibbb'\n [1.2 1.4 3.6 -2.7]]   --> an entry of speaker #0 from utterance 'ibbb'

\n\n
\n Here `N=5`, `D=4`.\n
We concatenate all training utterances into this single sequence.\n\n

\n train_cluster_id: the speaker id sequence, which is 1-dim list or\n numpy array of strings, of size N.\n For example,\n
train_cluster_id =\n  ['iaaa_0', 'iaaa_1', 'iaaa_0', 'ibbb_0', 'ibbb_0']\n
\n 'iaaa_0' means the entry belongs to speaker #0 in utterance 'iaaa'.

\n\n
Note that the order of entries within an utterance are preserved,\nand all utterances are simply concatenated together.\n
\n\n

args: Training configurations. See arguments.py for details.

\n\n

Raises:\n TypeError: If train_sequence or train_cluster_id is of wrong type.\n ValueError: If train_sequence or train_cluster_id has wrong dimension.

\n", "signature": "(self, train_sequence, train_cluster_id, args):", "funcdef": "def"}, {"fullname": "uisrnn.UISRNN.fit", "modulename": "uisrnn", "qualname": "UISRNN.fit", "kind": "function", "doc": "

Fit UISRNN model.

\n\n

Args:\n train_sequences: Either a list of training sequences, or a single\n concatenated training sequence:

\n\n
1. train_sequences is list, and each element is a 2-dim numpy array\n   of real numbers, of size: `length * D`.\n   The length varies among different sequences, but the D is the same.\n   In speaker diarization, each sequence is the sequence of speaker\n   embeddings of one utterance.\n2. train_sequences is a single concatenated sequence, which is a\n   2-dim numpy array of real numbers. See `fit_concatenated()`\n   for more details.\n
\n\n

train_cluster_ids: Ground truth labels for train_sequences:

\n\n
1. if train_sequences is a list, this must also be a list of the same\n   size, each element being a 1-dim list or numpy array of strings.\n2. if train_sequences is a single concatenated sequence, this\n   must also be the concatenated 1-dim list or numpy array of strings\n
\n\n

args: Training configurations. See arguments.py for details.

\n\n

Raises:\n TypeError: If train_sequences or train_cluster_ids is of wrong type.

\n", "signature": "(self, train_sequences, train_cluster_ids, args):", "funcdef": "def"}, {"fullname": "uisrnn.UISRNN.predict_single", "modulename": "uisrnn", "qualname": "UISRNN.predict_single", "kind": "function", "doc": "

Predict labels for a single test sequence using UISRNN model.

\n\n

Args:\n test_sequence: the test observation sequence, which is 2-dim numpy array\n of real numbers, of size N * D.

\n\n
- `N`: length of one test utterance.\n- `D` : observation dimension.\n\nFor example:\n
\n\n

test_sequence =\n[[2.2 -1.0 3.0 5.6]    --> 1st entry of utterance 'iccc'\n [0.5 1.8 -3.2 0.4]    --> 2nd entry of utterance 'iccc'\n [-2.2 5.0 1.8 3.7]    --> 3rd entry of utterance 'iccc'\n [-3.8 0.1 1.4 3.3]    --> 4th entry of utterance 'iccc'\n [0.1 2.7 3.5 -1.7]]   --> 5th entry of utterance 'iccc'\n
\n Here N=5, D=4.\n args: Inference configurations. See arguments.py for details.

\n\n

Returns:\n predicted_cluster_id: predicted speaker id sequence, which is\n an array of integers, of size N.\n For example, predicted_cluster_id = [0, 1, 0, 0, 1]

\n\n

Raises:\n TypeError: If test_sequence is of wrong type.\n ValueError: If test_sequence has wrong dimension.

\n", "signature": "(self, test_sequence, args):", "funcdef": "def"}, {"fullname": "uisrnn.UISRNN.predict", "modulename": "uisrnn", "qualname": "UISRNN.predict", "kind": "function", "doc": "

Predict labels for a single or many test sequences using UISRNN model.

\n\n

Args:\n test_sequences: Either a list of test sequences, or a single test\n sequence. Each test sequence is a 2-dim numpy array\n of real numbers. See predict_single() for details.\n args: Inference configurations. See arguments.py for details.

\n\n

Returns:\n predicted_cluster_ids: Predicted labels for test_sequences.

\n\n
1. if test_sequences is a list, predicted_cluster_ids will be a list\n   of the same size, where each element being a 1-dim list of strings.\n2. if test_sequences is a single sequence, predicted_cluster_ids will\n   be a 1-dim list of strings\n
\n\n

Raises:\n TypeError: If test_sequences is of wrong type.

\n", "signature": "(self, test_sequences, args):", "funcdef": "def"}, {"fullname": "uisrnn.parallel_predict", "modulename": "uisrnn", "qualname": "parallel_predict", "kind": "function", "doc": "

Run prediction in parallel using torch.multiprocessing.

\n\n

This is a beta feature. It makes prediction slower on CPU. But it's reported\nthat it makes prediction faster on GPU.

\n\n

Args:\n model: instance of UISRNN model\n test_sequences: a list of test sequences, or a single test\n sequence. Each test sequence is a 2-dim numpy array\n of real numbers. See predict_single() for details.\n args: Inference configurations. See arguments.py for details.\n num_processes: number of parallel processes.

\n\n

Returns:\n a list of the same size as test_sequences, where each element\n being a 1-dim list of strings.

\n\n

Raises:\n TypeError: If test_sequences is of wrong type.

\n", "signature": "(model, test_sequences, args, num_processes=4):", "funcdef": "def"}, {"fullname": "uisrnn.arguments", "modulename": "uisrnn.arguments", "kind": "module", "doc": "

Arguments for UISRNN.

\n"}, {"fullname": "uisrnn.arguments.str2bool", "modulename": "uisrnn.arguments", "qualname": "str2bool", "kind": "function", "doc": "

A function to convert string to bool value.

\n", "signature": "(value):", "funcdef": "def"}, {"fullname": "uisrnn.arguments.parse_arguments", "modulename": "uisrnn.arguments", "qualname": "parse_arguments", "kind": "function", "doc": "

Parse arguments.

\n\n

Returns:\n A tuple of:

\n\n
- `model_args`: model arguments\n- `training_args`: training arguments\n- `inference_args`: inference arguments\n
\n", "signature": "():", "funcdef": "def"}, {"fullname": "uisrnn.contrib", "modulename": "uisrnn.contrib", "kind": "module", "doc": "

The module for community contributed code.

\n\n

An introduction is available at [README.md].

\n"}, {"fullname": "uisrnn.contrib.contrib_template", "modulename": "uisrnn.contrib.contrib_template", "kind": "module", "doc": "

This is a template for community contributions.

\n"}, {"fullname": "uisrnn.contrib.contrib_template.example_function", "modulename": "uisrnn.contrib.contrib_template", "qualname": "example_function", "kind": "function", "doc": "

This is an example function.

\n", "signature": "():", "funcdef": "def"}, {"fullname": "uisrnn.contrib.range_search_crp_alpha", "modulename": "uisrnn.contrib.range_search_crp_alpha", "kind": "module", "doc": "

This module implements method to search for best crp_alpha within a range for\na given data set.\n For example\n

  train_cluster_id = np.array(\n    ['0_0', '0_0', '0_1', '0_1', '0_1', '0_0', '0_0', '1_0', '1_0', '1_0',\n    '1_1', '1_1', '1_1', '1_0', '1_0','1_0', '1_2', '1_2', '1_2'])\n  print(estimate_crp_alpha(train_cluster_id))\n  0.5\n
\n Function for user:\n estimate_crp_alpha: see docstring for details.\n Internal functions:\n _get_cdf: see docstring for details.\n _get_cdf_single: see docstring for details.\n _get_k_t: see docstring for details.\n _get_n_kt: see docstring for details.\n _get_cluster_id_single: see docstring for details.\n _get_normalized_id: see docstring for details.

\n"}, {"fullname": "uisrnn.contrib.range_search_crp_alpha.estimate_crp_alpha", "modulename": "uisrnn.contrib.range_search_crp_alpha", "qualname": "estimate_crp_alpha", "kind": "function", "doc": "

Iterate through a range of alpha, return alpha with maximum cdf P{Y|Z}.

\n\n

Args:\n train_cluster_id: same as train_cluster_id in demo.py. See demo.py for\n details.\n search_range: the range to search for crp_alpha.\n search_step: the step to search for crp_alpha.\nReturns:\n cur_alpha: a float variable.

\n", "signature": "(train_cluster_id, search_range=1, search_step=0.01):", "funcdef": "def"}, {"fullname": "uisrnn.evals", "modulename": "uisrnn.evals", "kind": "module", "doc": "

Utils for model evaluation.

\n"}, {"fullname": "uisrnn.evals.get_list_inverse_index", "modulename": "uisrnn.evals", "qualname": "get_list_inverse_index", "kind": "function", "doc": "

Get value to position index from a list of unique ids.

\n\n

Args:\n unique_ids: A list of unique integers of strings.

\n\n

Returns:\n result: a dict from value to position

\n\n

Raises:\n TypeError: If unique_ids is not a list.

\n", "signature": "(unique_ids):", "funcdef": "def"}, {"fullname": "uisrnn.evals.compute_sequence_match_accuracy", "modulename": "uisrnn.evals", "qualname": "compute_sequence_match_accuracy", "kind": "function", "doc": "

Compute the accuracy between two sequences by finding optimal matching.

\n\n

Args:\n sequence1: A list of integers or strings.\n sequence2: A list of integers or strings.

\n\n

Returns:\n accuracy: sequence matching accuracy as a number in [0.0, 1.0]

\n\n

Raises:\n TypeError: If sequence1 or sequence2 is not list.\n ValueError: If sequence1 and sequence2 are not same size.

\n", "signature": "(sequence1, sequence2):", "funcdef": "def"}, {"fullname": "uisrnn.loss_func", "modulename": "uisrnn.loss_func", "kind": "module", "doc": "

Loss functions for training.

\n"}, {"fullname": "uisrnn.loss_func.weighted_mse_loss", "modulename": "uisrnn.loss_func", "qualname": "weighted_mse_loss", "kind": "function", "doc": "

Compute weighted MSE loss.

\n\n

Note that we are doing weighted loss that only sum up over non-zero entries.

\n\n

Args:\n input_tensor: input tensor\n target_tensor: target tensor\n weight: weight tensor, in this case 1/sigma^2

\n\n

Returns:\n the weighted MSE loss

\n", "signature": "(input_tensor, target_tensor, weight=1):", "funcdef": "def"}, {"fullname": "uisrnn.loss_func.sigma2_prior_loss", "modulename": "uisrnn.loss_func", "qualname": "sigma2_prior_loss", "kind": "function", "doc": "

Compute sigma2 prior loss.

\n\n

Args:\n num_non_zero: since rnn_truth is a collection of different length sequences\n padded with zeros to fit them into a tensor, we count the sum of\n 'real lengths' of all sequences\n sigma_alpha: inverse gamma shape\n sigma_beta: inverse gamma scale\n sigma2: sigma squared

\n\n

Returns:\n the sigma2 prior loss

\n", "signature": "(num_non_zero, sigma_alpha, sigma_beta, sigma2):", "funcdef": "def"}, {"fullname": "uisrnn.loss_func.regularization_loss", "modulename": "uisrnn.loss_func", "qualname": "regularization_loss", "kind": "function", "doc": "

Compute regularization loss.

\n\n

Args:\n params: iterable of all parameters\n weight: weight for the regularization term

\n\n

Returns:\n the regularization loss

\n", "signature": "(params, weight):", "funcdef": "def"}, {"fullname": "uisrnn.uisrnn", "modulename": "uisrnn.uisrnn", "kind": "module", "doc": "

The UIS-RNN model.

\n"}, {"fullname": "uisrnn.uisrnn.CoreRNN", "modulename": "uisrnn.uisrnn", "qualname": "CoreRNN", "kind": "class", "doc": "

The core Recurent Neural Network used by UIS-RNN.

\n", "bases": "torch.nn.modules.module.Module"}, {"fullname": "uisrnn.uisrnn.CoreRNN.__init__", "modulename": "uisrnn.uisrnn", "qualname": "CoreRNN.__init__", "kind": "function", "doc": "

Initializes internal Module state, shared by both nn.Module and ScriptModule.

\n", "signature": "(input_dim, hidden_size, depth, observation_dim, dropout=0)"}, {"fullname": "uisrnn.uisrnn.CoreRNN.hidden_size", "modulename": "uisrnn.uisrnn", "qualname": "CoreRNN.hidden_size", "kind": "variable", "doc": "

\n"}, {"fullname": "uisrnn.uisrnn.CoreRNN.linear_mean1", "modulename": "uisrnn.uisrnn", "qualname": "CoreRNN.linear_mean1", "kind": "variable", "doc": "

\n"}, {"fullname": "uisrnn.uisrnn.CoreRNN.linear_mean2", "modulename": "uisrnn.uisrnn", "qualname": "CoreRNN.linear_mean2", "kind": "variable", "doc": "

\n"}, {"fullname": "uisrnn.uisrnn.CoreRNN.forward", "modulename": "uisrnn.uisrnn", "qualname": "CoreRNN.forward", "kind": "function", "doc": "

The forward function of the module.

\n", "signature": "(self, input_seq, hidden=None):", "funcdef": "def"}, {"fullname": "uisrnn.uisrnn.BeamState", "modulename": "uisrnn.uisrnn", "qualname": "BeamState", "kind": "class", "doc": "

Structure that contains necessary states for beam search.

\n"}, {"fullname": "uisrnn.uisrnn.BeamState.__init__", "modulename": "uisrnn.uisrnn", "qualname": "BeamState.__init__", "kind": "function", "doc": "

\n", "signature": "(source=None)"}, {"fullname": "uisrnn.uisrnn.BeamState.append", "modulename": "uisrnn.uisrnn", "qualname": "BeamState.append", "kind": "function", "doc": "

Append new item to the BeamState.

\n", "signature": "(self, mean, hidden, cluster):", "funcdef": "def"}, {"fullname": "uisrnn.uisrnn.UISRNN", "modulename": "uisrnn.uisrnn", "qualname": "UISRNN", "kind": "class", "doc": "

Unbounded Interleaved-State Recurrent Neural Networks.

\n"}, {"fullname": "uisrnn.uisrnn.UISRNN.__init__", "modulename": "uisrnn.uisrnn", "qualname": "UISRNN.__init__", "kind": "function", "doc": "

Construct the UISRNN object.

\n\n

Args:\n args: Model configurations. See arguments.py for details.

\n", "signature": "(args)"}, {"fullname": "uisrnn.uisrnn.UISRNN.observation_dim", "modulename": "uisrnn.uisrnn", "qualname": "UISRNN.observation_dim", "kind": "variable", "doc": "

\n"}, {"fullname": "uisrnn.uisrnn.UISRNN.device", "modulename": "uisrnn.uisrnn", "qualname": "UISRNN.device", "kind": "variable", "doc": "

\n"}, {"fullname": "uisrnn.uisrnn.UISRNN.rnn_model", "modulename": "uisrnn.uisrnn", "qualname": "UISRNN.rnn_model", "kind": "variable", "doc": "

\n"}, {"fullname": "uisrnn.uisrnn.UISRNN.rnn_init_hidden", "modulename": "uisrnn.uisrnn", "qualname": "UISRNN.rnn_init_hidden", "kind": "variable", "doc": "

\n"}, {"fullname": "uisrnn.uisrnn.UISRNN.estimate_sigma2", "modulename": "uisrnn.uisrnn", "qualname": "UISRNN.estimate_sigma2", "kind": "variable", "doc": "

\n"}, {"fullname": "uisrnn.uisrnn.UISRNN.estimate_transition_bias", "modulename": "uisrnn.uisrnn", "qualname": "UISRNN.estimate_transition_bias", "kind": "variable", "doc": "

\n"}, {"fullname": "uisrnn.uisrnn.UISRNN.sigma2", "modulename": "uisrnn.uisrnn", "qualname": "UISRNN.sigma2", "kind": "variable", "doc": "

\n"}, {"fullname": "uisrnn.uisrnn.UISRNN.transition_bias", "modulename": "uisrnn.uisrnn", "qualname": "UISRNN.transition_bias", "kind": "variable", "doc": "

\n"}, {"fullname": "uisrnn.uisrnn.UISRNN.transition_bias_denominator", "modulename": "uisrnn.uisrnn", "qualname": "UISRNN.transition_bias_denominator", "kind": "variable", "doc": "

\n"}, {"fullname": "uisrnn.uisrnn.UISRNN.crp_alpha", "modulename": "uisrnn.uisrnn", "qualname": "UISRNN.crp_alpha", "kind": "variable", "doc": "

\n"}, {"fullname": "uisrnn.uisrnn.UISRNN.logger", "modulename": "uisrnn.uisrnn", "qualname": "UISRNN.logger", "kind": "variable", "doc": "

\n"}, {"fullname": "uisrnn.uisrnn.UISRNN.save", "modulename": "uisrnn.uisrnn", "qualname": "UISRNN.save", "kind": "function", "doc": "

Save the model to a file.

\n\n

Args:\n filepath: the path of the file.

\n", "signature": "(self, filepath):", "funcdef": "def"}, {"fullname": "uisrnn.uisrnn.UISRNN.load", "modulename": "uisrnn.uisrnn", "qualname": "UISRNN.load", "kind": "function", "doc": "

Load the model from a file.

\n\n

Args:\n filepath: the path of the file.

\n", "signature": "(self, filepath):", "funcdef": "def"}, {"fullname": "uisrnn.uisrnn.UISRNN.fit_concatenated", "modulename": "uisrnn.uisrnn", "qualname": "UISRNN.fit_concatenated", "kind": "function", "doc": "

Fit UISRNN model to concatenated sequence and cluster_id.

\n\n

Args:\n train_sequence: the training observation sequence, which is a\n 2-dim numpy array of real numbers, of size N * D.

\n\n
- `N`: summation of lengths of all utterances.\n- `D`: observation dimension.\n\nFor example,\n
\n\n

train_sequence =\n[[1.2 3.0 -4.1 6.0]    --> an entry of speaker #0 from utterance 'iaaa'\n [0.8 -1.1 0.4 0.5]    --> an entry of speaker #1 from utterance 'iaaa'\n [-0.2 1.0 3.8 5.7]    --> an entry of speaker #0 from utterance 'iaaa'\n [3.8 -0.1 1.5 2.3]    --> an entry of speaker #0 from utterance 'ibbb'\n [1.2 1.4 3.6 -2.7]]   --> an entry of speaker #0 from utterance 'ibbb'

\n\n
\n Here `N=5`, `D=4`.\n
We concatenate all training utterances into this single sequence.\n\n

\n train_cluster_id: the speaker id sequence, which is 1-dim list or\n numpy array of strings, of size N.\n For example,\n
train_cluster_id =\n  ['iaaa_0', 'iaaa_1', 'iaaa_0', 'ibbb_0', 'ibbb_0']\n
\n 'iaaa_0' means the entry belongs to speaker #0 in utterance 'iaaa'.

\n\n
Note that the order of entries within an utterance are preserved,\nand all utterances are simply concatenated together.\n
\n\n

args: Training configurations. See arguments.py for details.

\n\n

Raises:\n TypeError: If train_sequence or train_cluster_id is of wrong type.\n ValueError: If train_sequence or train_cluster_id has wrong dimension.

\n", "signature": "(self, train_sequence, train_cluster_id, args):", "funcdef": "def"}, {"fullname": "uisrnn.uisrnn.UISRNN.fit", "modulename": "uisrnn.uisrnn", "qualname": "UISRNN.fit", "kind": "function", "doc": "

Fit UISRNN model.

\n\n

Args:\n train_sequences: Either a list of training sequences, or a single\n concatenated training sequence:

\n\n
1. train_sequences is list, and each element is a 2-dim numpy array\n   of real numbers, of size: `length * D`.\n   The length varies among different sequences, but the D is the same.\n   In speaker diarization, each sequence is the sequence of speaker\n   embeddings of one utterance.\n2. train_sequences is a single concatenated sequence, which is a\n   2-dim numpy array of real numbers. See `fit_concatenated()`\n   for more details.\n
\n\n

train_cluster_ids: Ground truth labels for train_sequences:

\n\n
1. if train_sequences is a list, this must also be a list of the same\n   size, each element being a 1-dim list or numpy array of strings.\n2. if train_sequences is a single concatenated sequence, this\n   must also be the concatenated 1-dim list or numpy array of strings\n
\n\n

args: Training configurations. See arguments.py for details.

\n\n

Raises:\n TypeError: If train_sequences or train_cluster_ids is of wrong type.

\n", "signature": "(self, train_sequences, train_cluster_ids, args):", "funcdef": "def"}, {"fullname": "uisrnn.uisrnn.UISRNN.predict_single", "modulename": "uisrnn.uisrnn", "qualname": "UISRNN.predict_single", "kind": "function", "doc": "

Predict labels for a single test sequence using UISRNN model.

\n\n

Args:\n test_sequence: the test observation sequence, which is 2-dim numpy array\n of real numbers, of size N * D.

\n\n
- `N`: length of one test utterance.\n- `D` : observation dimension.\n\nFor example:\n
\n\n

test_sequence =\n[[2.2 -1.0 3.0 5.6]    --> 1st entry of utterance 'iccc'\n [0.5 1.8 -3.2 0.4]    --> 2nd entry of utterance 'iccc'\n [-2.2 5.0 1.8 3.7]    --> 3rd entry of utterance 'iccc'\n [-3.8 0.1 1.4 3.3]    --> 4th entry of utterance 'iccc'\n [0.1 2.7 3.5 -1.7]]   --> 5th entry of utterance 'iccc'\n
\n Here N=5, D=4.\n args: Inference configurations. See arguments.py for details.

\n\n

Returns:\n predicted_cluster_id: predicted speaker id sequence, which is\n an array of integers, of size N.\n For example, predicted_cluster_id = [0, 1, 0, 0, 1]

\n\n

Raises:\n TypeError: If test_sequence is of wrong type.\n ValueError: If test_sequence has wrong dimension.

\n", "signature": "(self, test_sequence, args):", "funcdef": "def"}, {"fullname": "uisrnn.uisrnn.UISRNN.predict", "modulename": "uisrnn.uisrnn", "qualname": "UISRNN.predict", "kind": "function", "doc": "

Predict labels for a single or many test sequences using UISRNN model.

\n\n

Args:\n test_sequences: Either a list of test sequences, or a single test\n sequence. Each test sequence is a 2-dim numpy array\n of real numbers. See predict_single() for details.\n args: Inference configurations. See arguments.py for details.

\n\n

Returns:\n predicted_cluster_ids: Predicted labels for test_sequences.

\n\n
1. if test_sequences is a list, predicted_cluster_ids will be a list\n   of the same size, where each element being a 1-dim list of strings.\n2. if test_sequences is a single sequence, predicted_cluster_ids will\n   be a 1-dim list of strings\n
\n\n

Raises:\n TypeError: If test_sequences is of wrong type.

\n", "signature": "(self, test_sequences, args):", "funcdef": "def"}, {"fullname": "uisrnn.uisrnn.parallel_predict", "modulename": "uisrnn.uisrnn", "qualname": "parallel_predict", "kind": "function", "doc": "

Run prediction in parallel using torch.multiprocessing.

\n\n

This is a beta feature. It makes prediction slower on CPU. But it's reported\nthat it makes prediction faster on GPU.

\n\n

Args:\n model: instance of UISRNN model\n test_sequences: a list of test sequences, or a single test\n sequence. Each test sequence is a 2-dim numpy array\n of real numbers. See predict_single() for details.\n args: Inference configurations. See arguments.py for details.\n num_processes: number of parallel processes.

\n\n

Returns:\n a list of the same size as test_sequences, where each element\n being a 1-dim list of strings.

\n\n

Raises:\n TypeError: If test_sequences is of wrong type.

\n", "signature": "(model, test_sequences, args, num_processes=4):", "funcdef": "def"}, {"fullname": "uisrnn.utils", "modulename": "uisrnn.utils", "kind": "module", "doc": "

Utils for UIS-RNN.

\n"}, {"fullname": "uisrnn.utils.Logger", "modulename": "uisrnn.utils", "qualname": "Logger", "kind": "class", "doc": "

A class for printing logging information to screen.

\n"}, {"fullname": "uisrnn.utils.Logger.__init__", "modulename": "uisrnn.utils", "qualname": "Logger.__init__", "kind": "function", "doc": "

\n", "signature": "(verbosity)"}, {"fullname": "uisrnn.utils.Logger.print", "modulename": "uisrnn.utils", "qualname": "Logger.print", "kind": "function", "doc": "

Print a message if level is not higher than verbosity.

\n\n

Args:\n level: the level of this message, smaller value means more important\n message: the message to be printed

\n", "signature": "(self, level, message):", "funcdef": "def"}, {"fullname": "uisrnn.utils.generate_random_string", "modulename": "uisrnn.utils", "qualname": "generate_random_string", "kind": "function", "doc": "

Generate a random string of upper case letters and digits.

\n\n

Args:\n length: length of the generated string

\n\n

Returns:\n the generated string

\n", "signature": "(length=6):", "funcdef": "def"}, {"fullname": "uisrnn.utils.enforce_cluster_id_uniqueness", "modulename": "uisrnn.utils", "qualname": "enforce_cluster_id_uniqueness", "kind": "function", "doc": "

Enforce uniqueness of cluster id across sequences.

\n\n

Args:\n cluster_ids: a list of 1-dim list/numpy.ndarray of strings

\n\n

Returns:\n a new list with same length of cluster_ids

\n\n

Raises:\n TypeError: if cluster_ids or its element has wrong type

\n", "signature": "(cluster_ids):", "funcdef": "def"}, {"fullname": "uisrnn.utils.concatenate_training_data", "modulename": "uisrnn.utils", "qualname": "concatenate_training_data", "kind": "function", "doc": "

Concatenate training data.

\n\n

Args:\n train_sequences: a list of 2-dim numpy arrays to be concatenated\n train_cluster_ids: a list of 1-dim list/numpy.ndarray of strings\n enforce_uniqueness: a boolean indicated whether we should enfore uniqueness\n to train_cluster_ids\n shuffle: whether to randomly shuffle input order

\n\n

Returns:\n concatenated_train_sequence: a 2-dim numpy array\n concatenated_train_cluster_id: a list of strings

\n\n

Raises:\n TypeError: if input has wrong type\n ValueError: if sizes/dimensions of input or their elements are incorrect

\n", "signature": "(\ttrain_sequences,\ttrain_cluster_ids,\tenforce_uniqueness=True,\tshuffle=True):", "funcdef": "def"}, {"fullname": "uisrnn.utils.sample_permuted_segments", "modulename": "uisrnn.utils", "qualname": "sample_permuted_segments", "kind": "function", "doc": "

Sample sequences with permuted blocks.

\n\n

Args:\n index_sequence: (integer array, size: L)\n - subsequence index\n For example, index_sequence = [1,2,6,10,11,12].\n number_samples: (integer)\n - number of subsampled block-preserving permuted sequences.\n For example, number_samples = 5

\n\n

Returns:\n sampled_index_sequences: (a list of numpy arrays) - a list of subsampled\n block-preserving permuted sequences. For example,\n

sampled_index_sequences =\n[[10,11,12,1,2,6],\n [6,1,2,10,11,12],\n [1,2,10,11,12,6],\n [6,1,2,10,11,12],\n [1,2,6,10,11,12]]\n
\n The length of \"sampled_index_sequences\" is \"number_samples\".

\n", "signature": "(index_sequence, number_samples):", "funcdef": "def"}, {"fullname": "uisrnn.utils.resize_sequence", "modulename": "uisrnn.utils", "qualname": "resize_sequence", "kind": "function", "doc": "

Resize sequences for packing and batching.

\n\n

Args:\n sequence: (real numpy matrix, size: seq_len*obs_size) - observed sequence\n cluster_id: (numpy vector, size: seq_len) - cluster indicator sequence\n num_permutations: int - Number of permutations per utterance sampled.

\n\n

Returns:\n sub_sequences: A list of numpy array, with obsevation vector from the same\n cluster in the same list.\n seq_lengths: The length of each cluster (+1).

\n", "signature": "(sequence, cluster_id, num_permutations=None):", "funcdef": "def"}, {"fullname": "uisrnn.utils.pack_sequence", "modulename": "uisrnn.utils", "qualname": "pack_sequence", "kind": "function", "doc": "

Pack sequences for training.

\n\n

Args:\n sub_sequences: A list of numpy array, with obsevation vector from the same\n cluster in the same list.\n seq_lengths: The length of each cluster (+1).\n batch_size: int or None - Run batch learning if batch_size is None. Else,\n run online learning with specified batch size.\n observation_dim: int - dimension for observation vectors\n device: str - Your device. E.g., cuda:0 or cpu.

\n\n

Returns:\n packed_rnn_input: (PackedSequence object) packed rnn input\n rnn_truth: ground truth

\n", "signature": "(sub_sequences, seq_lengths, batch_size, observation_dim, device):", "funcdef": "def"}, {"fullname": "uisrnn.utils.output_result", "modulename": "uisrnn.utils", "qualname": "output_result", "kind": "function", "doc": "

Produce a string to summarize the experiment.

\n", "signature": "(model_args, training_args, test_record):", "funcdef": "def"}, {"fullname": "uisrnn.utils.estimate_transition_bias", "modulename": "uisrnn.utils", "qualname": "estimate_transition_bias", "kind": "function", "doc": "

Estimate the transition bias.

\n\n

Args:\n cluster_id: Either a list of cluster indicator sequences, or a single\n concatenated sequence. The former is strongly preferred, since the\n transition_bias estimated from the latter will be inaccurate.\n smooth: int or float - Smoothing coefficient, avoids -inf value in np.log\n in the case of a sequence with a single speaker and division by 0 in the\n case of empty sequences. Using a small value for smooth decreases the\n bias in the calculation of transition_bias but can also lead to underflow\n in some remote cases, larger values are safer but less accurate.

\n\n

Returns:\n bias: Flipping coin head probability.\n bias_denominator: The denominator of the bias, used for multiple calls to\n fit().

\n", "signature": "(cluster_ids, smooth=1):", "funcdef": "def"}]; + /** pdoc search index */const docs = [{"fullname": "uisrnn", "modulename": "uisrnn", "kind": "module", "doc": "

The module for Unbounded Interleaved-State Recurrent Neural Network.

\n\n

An introduction is available at [README.md].

\n"}, {"fullname": "uisrnn.parse_arguments", "modulename": "uisrnn", "qualname": "parse_arguments", "kind": "function", "doc": "

Parse arguments.

\n\n

Returns:\n A tuple of:

\n\n
- `model_args`: model arguments\n- `training_args`: training arguments\n- `inference_args`: inference arguments\n
\n", "signature": "():", "funcdef": "def"}, {"fullname": "uisrnn.compute_sequence_match_accuracy", "modulename": "uisrnn", "qualname": "compute_sequence_match_accuracy", "kind": "function", "doc": "

Compute the accuracy between two sequences by finding optimal matching.

\n\n

Args:\n sequence1: A list of integers or strings.\n sequence2: A list of integers or strings.

\n\n

Returns:\n accuracy: sequence matching accuracy as a number in [0.0, 1.0]

\n\n

Raises:\n TypeError: If sequence1 or sequence2 is not list.\n ValueError: If sequence1 and sequence2 are not same size.

\n", "signature": "(sequence1, sequence2):", "funcdef": "def"}, {"fullname": "uisrnn.output_result", "modulename": "uisrnn", "qualname": "output_result", "kind": "function", "doc": "

Produce a string to summarize the experiment.

\n", "signature": "(model_args, training_args, test_record):", "funcdef": "def"}, {"fullname": "uisrnn.UISRNN", "modulename": "uisrnn", "qualname": "UISRNN", "kind": "class", "doc": "

Unbounded Interleaved-State Recurrent Neural Networks.

\n"}, {"fullname": "uisrnn.UISRNN.__init__", "modulename": "uisrnn", "qualname": "UISRNN.__init__", "kind": "function", "doc": "

Construct the UISRNN object.

\n\n

Args:\n args: Model configurations. See arguments.py for details.

\n", "signature": "(args)"}, {"fullname": "uisrnn.UISRNN.observation_dim", "modulename": "uisrnn", "qualname": "UISRNN.observation_dim", "kind": "variable", "doc": "

\n"}, {"fullname": "uisrnn.UISRNN.device", "modulename": "uisrnn", "qualname": "UISRNN.device", "kind": "variable", "doc": "

\n"}, {"fullname": "uisrnn.UISRNN.rnn_model", "modulename": "uisrnn", "qualname": "UISRNN.rnn_model", "kind": "variable", "doc": "

\n"}, {"fullname": "uisrnn.UISRNN.rnn_init_hidden", "modulename": "uisrnn", "qualname": "UISRNN.rnn_init_hidden", "kind": "variable", "doc": "

\n"}, {"fullname": "uisrnn.UISRNN.estimate_sigma2", "modulename": "uisrnn", "qualname": "UISRNN.estimate_sigma2", "kind": "variable", "doc": "

\n"}, {"fullname": "uisrnn.UISRNN.estimate_transition_bias", "modulename": "uisrnn", "qualname": "UISRNN.estimate_transition_bias", "kind": "variable", "doc": "

\n"}, {"fullname": "uisrnn.UISRNN.sigma2", "modulename": "uisrnn", "qualname": "UISRNN.sigma2", "kind": "variable", "doc": "

\n"}, {"fullname": "uisrnn.UISRNN.transition_bias", "modulename": "uisrnn", "qualname": "UISRNN.transition_bias", "kind": "variable", "doc": "

\n"}, {"fullname": "uisrnn.UISRNN.transition_bias_denominator", "modulename": "uisrnn", "qualname": "UISRNN.transition_bias_denominator", "kind": "variable", "doc": "

\n"}, {"fullname": "uisrnn.UISRNN.crp_alpha", "modulename": "uisrnn", "qualname": "UISRNN.crp_alpha", "kind": "variable", "doc": "

\n"}, {"fullname": "uisrnn.UISRNN.logger", "modulename": "uisrnn", "qualname": "UISRNN.logger", "kind": "variable", "doc": "

\n"}, {"fullname": "uisrnn.UISRNN.save", "modulename": "uisrnn", "qualname": "UISRNN.save", "kind": "function", "doc": "

Save the model to a file.

\n\n

Args:\n filepath: the path of the file.

\n", "signature": "(self, filepath):", "funcdef": "def"}, {"fullname": "uisrnn.UISRNN.load", "modulename": "uisrnn", "qualname": "UISRNN.load", "kind": "function", "doc": "

Load the model from a file.

\n\n

Args:\n filepath: the path of the file.

\n", "signature": "(self, filepath):", "funcdef": "def"}, {"fullname": "uisrnn.UISRNN.fit_concatenated", "modulename": "uisrnn", "qualname": "UISRNN.fit_concatenated", "kind": "function", "doc": "

Fit UISRNN model to concatenated sequence and cluster_id.

\n\n

Args:\n train_sequence: the training observation sequence, which is a\n 2-dim numpy array of real numbers, of size N * D.

\n\n
- `N`: summation of lengths of all utterances.\n- `D`: observation dimension.\n\nFor example,\n
\n\n

train_sequence =\n[[1.2 3.0 -4.1 6.0]    --> an entry of speaker #0 from utterance 'iaaa'\n [0.8 -1.1 0.4 0.5]    --> an entry of speaker #1 from utterance 'iaaa'\n [-0.2 1.0 3.8 5.7]    --> an entry of speaker #0 from utterance 'iaaa'\n [3.8 -0.1 1.5 2.3]    --> an entry of speaker #0 from utterance 'ibbb'\n [1.2 1.4 3.6 -2.7]]   --> an entry of speaker #0 from utterance 'ibbb'\n

\n\n
Here `N=5`, `D=4`.\n\nWe concatenate all training utterances into this single sequence.\n
\n\n

train_cluster_id: the speaker id sequence, which is 1-dim list or\n numpy array of strings, of size N.\n For example,

\n\n

train_cluster_id =\n  ['iaaa_0', 'iaaa_1', 'iaaa_0', 'ibbb_0', 'ibbb_0']\n

\n\n
'iaaa_0' means the entry belongs to speaker #0 in utterance 'iaaa'.\n\nNote that the order of entries within an utterance are preserved,\nand all utterances are simply concatenated together.\n
\n\n

args: Training configurations. See arguments.py for details.

\n\n

Raises:\n TypeError: If train_sequence or train_cluster_id is of wrong type.\n ValueError: If train_sequence or train_cluster_id has wrong dimension.

\n", "signature": "(self, train_sequence, train_cluster_id, args):", "funcdef": "def"}, {"fullname": "uisrnn.UISRNN.fit", "modulename": "uisrnn", "qualname": "UISRNN.fit", "kind": "function", "doc": "

Fit UISRNN model.

\n\n

Args:\n train_sequences: Either a list of training sequences, or a single\n concatenated training sequence:

\n\n
1. train_sequences is list, and each element is a 2-dim numpy array\n   of real numbers, of size: `length * D`.\n   The length varies among different sequences, but the D is the same.\n   In speaker diarization, each sequence is the sequence of speaker\n   embeddings of one utterance.\n2. train_sequences is a single concatenated sequence, which is a\n   2-dim numpy array of real numbers. See `fit_concatenated()`\n   for more details.\n
\n\n

train_cluster_ids: Ground truth labels for train_sequences:

\n\n
1. if train_sequences is a list, this must also be a list of the same\n   size, each element being a 1-dim list or numpy array of strings.\n2. if train_sequences is a single concatenated sequence, this\n   must also be the concatenated 1-dim list or numpy array of strings\n
\n\n

args: Training configurations. See arguments.py for details.

\n\n

Raises:\n TypeError: If train_sequences or train_cluster_ids is of wrong type.

\n", "signature": "(self, train_sequences, train_cluster_ids, args):", "funcdef": "def"}, {"fullname": "uisrnn.UISRNN.predict_single", "modulename": "uisrnn", "qualname": "UISRNN.predict_single", "kind": "function", "doc": "

Predict labels for a single test sequence using UISRNN model.

\n\n

Args:\n test_sequence: the test observation sequence, which is 2-dim numpy array\n of real numbers, of size N * D.

\n\n
- `N`: length of one test utterance.\n- `D` : observation dimension.\n\nFor example:\n
\n\n

test_sequence =\n[[2.2 -1.0 3.0 5.6]    --> 1st entry of utterance 'iccc'\n [0.5 1.8 -3.2 0.4]    --> 2nd entry of utterance 'iccc'\n [-2.2 5.0 1.8 3.7]    --> 3rd entry of utterance 'iccc'\n [-3.8 0.1 1.4 3.3]    --> 4th entry of utterance 'iccc'\n [0.1 2.7 3.5 -1.7]]   --> 5th entry of utterance 'iccc'\n

\n\n
Here `N=5`, `D=4`.\n
\n\n

args: Inference configurations. See arguments.py for details.

\n\n

Returns:\n predicted_cluster_id: predicted speaker id sequence, which is\n an array of integers, of size N.\n For example, predicted_cluster_id = [0, 1, 0, 0, 1]

\n\n

Raises:\n TypeError: If test_sequence is of wrong type.\n ValueError: If test_sequence has wrong dimension.

\n", "signature": "(self, test_sequence, args):", "funcdef": "def"}, {"fullname": "uisrnn.UISRNN.predict", "modulename": "uisrnn", "qualname": "UISRNN.predict", "kind": "function", "doc": "

Predict labels for a single or many test sequences using UISRNN model.

\n\n

Args:\n test_sequences: Either a list of test sequences, or a single test\n sequence. Each test sequence is a 2-dim numpy array\n of real numbers. See predict_single() for details.\n args: Inference configurations. See arguments.py for details.

\n\n

Returns:\n predicted_cluster_ids: Predicted labels for test_sequences.

\n\n
1. if test_sequences is a list, predicted_cluster_ids will be a list\n   of the same size, where each element being a 1-dim list of strings.\n2. if test_sequences is a single sequence, predicted_cluster_ids will\n   be a 1-dim list of strings\n
\n\n

Raises:\n TypeError: If test_sequences is of wrong type.

\n", "signature": "(self, test_sequences, args):", "funcdef": "def"}, {"fullname": "uisrnn.parallel_predict", "modulename": "uisrnn", "qualname": "parallel_predict", "kind": "function", "doc": "

Run prediction in parallel using torch.multiprocessing.

\n\n

This is a beta feature. It makes prediction slower on CPU. But it's reported\nthat it makes prediction faster on GPU.

\n\n

Args:\n model: instance of UISRNN model\n test_sequences: a list of test sequences, or a single test\n sequence. Each test sequence is a 2-dim numpy array\n of real numbers. See predict_single() for details.\n args: Inference configurations. See arguments.py for details.\n num_processes: number of parallel processes.

\n\n

Returns:\n a list of the same size as test_sequences, where each element\n being a 1-dim list of strings.

\n\n

Raises:\n TypeError: If test_sequences is of wrong type.

\n", "signature": "(model, test_sequences, args, num_processes=4):", "funcdef": "def"}, {"fullname": "uisrnn.arguments", "modulename": "uisrnn.arguments", "kind": "module", "doc": "

Arguments for UISRNN.

\n"}, {"fullname": "uisrnn.arguments.str2bool", "modulename": "uisrnn.arguments", "qualname": "str2bool", "kind": "function", "doc": "

A function to convert string to bool value.

\n", "signature": "(value):", "funcdef": "def"}, {"fullname": "uisrnn.arguments.parse_arguments", "modulename": "uisrnn.arguments", "qualname": "parse_arguments", "kind": "function", "doc": "

Parse arguments.

\n\n

Returns:\n A tuple of:

\n\n
- `model_args`: model arguments\n- `training_args`: training arguments\n- `inference_args`: inference arguments\n
\n", "signature": "():", "funcdef": "def"}, {"fullname": "uisrnn.contrib", "modulename": "uisrnn.contrib", "kind": "module", "doc": "

The module for community contributed code.

\n\n

An introduction is available at [README.md].

\n"}, {"fullname": "uisrnn.contrib.contrib_template", "modulename": "uisrnn.contrib.contrib_template", "kind": "module", "doc": "

This is a template for community contributions.

\n"}, {"fullname": "uisrnn.contrib.contrib_template.example_function", "modulename": "uisrnn.contrib.contrib_template", "qualname": "example_function", "kind": "function", "doc": "

This is an example function.

\n", "signature": "():", "funcdef": "def"}, {"fullname": "uisrnn.contrib.range_search_crp_alpha", "modulename": "uisrnn.contrib.range_search_crp_alpha", "kind": "module", "doc": "

This module implements method to search for best crp_alpha within a range for\na given data set.\n For example

\n\n

  train_cluster_id = np.array(\n    ['0_0', '0_0', '0_1', '0_1', '0_1', '0_0', '0_0', '1_0', '1_0', '1_0',\n    '1_1', '1_1', '1_1', '1_0', '1_0','1_0', '1_2', '1_2', '1_2'])\n  print(estimate_crp_alpha(train_cluster_id))\n  0.5\n

\n\n

Function for user:\n estimate_crp_alpha: see docstring for details.\n Internal functions:\n _get_cdf: see docstring for details.\n _get_cdf_single: see docstring for details.\n _get_k_t: see docstring for details.\n _get_n_kt: see docstring for details.\n _get_cluster_id_single: see docstring for details.\n _get_normalized_id: see docstring for details.

\n"}, {"fullname": "uisrnn.contrib.range_search_crp_alpha.estimate_crp_alpha", "modulename": "uisrnn.contrib.range_search_crp_alpha", "qualname": "estimate_crp_alpha", "kind": "function", "doc": "

Iterate through a range of alpha, return alpha with maximum cdf P{Y|Z}.

\n\n

Args:\n train_cluster_id: same as train_cluster_id in demo.py. See demo.py for\n details.\n search_range: the range to search for crp_alpha.\n search_step: the step to search for crp_alpha.\nReturns:\n cur_alpha: a float variable.

\n", "signature": "(train_cluster_id, search_range=1, search_step=0.01):", "funcdef": "def"}, {"fullname": "uisrnn.evals", "modulename": "uisrnn.evals", "kind": "module", "doc": "

Utils for model evaluation.

\n"}, {"fullname": "uisrnn.evals.get_list_inverse_index", "modulename": "uisrnn.evals", "qualname": "get_list_inverse_index", "kind": "function", "doc": "

Get value to position index from a list of unique ids.

\n\n

Args:\n unique_ids: A list of unique integers of strings.

\n\n

Returns:\n result: a dict from value to position

\n\n

Raises:\n TypeError: If unique_ids is not a list.

\n", "signature": "(unique_ids):", "funcdef": "def"}, {"fullname": "uisrnn.evals.compute_sequence_match_accuracy", "modulename": "uisrnn.evals", "qualname": "compute_sequence_match_accuracy", "kind": "function", "doc": "

Compute the accuracy between two sequences by finding optimal matching.

\n\n

Args:\n sequence1: A list of integers or strings.\n sequence2: A list of integers or strings.

\n\n

Returns:\n accuracy: sequence matching accuracy as a number in [0.0, 1.0]

\n\n

Raises:\n TypeError: If sequence1 or sequence2 is not list.\n ValueError: If sequence1 and sequence2 are not same size.

\n", "signature": "(sequence1, sequence2):", "funcdef": "def"}, {"fullname": "uisrnn.loss_func", "modulename": "uisrnn.loss_func", "kind": "module", "doc": "

Loss functions for training.

\n"}, {"fullname": "uisrnn.loss_func.weighted_mse_loss", "modulename": "uisrnn.loss_func", "qualname": "weighted_mse_loss", "kind": "function", "doc": "

Compute weighted MSE loss.

\n\n

Note that we are doing weighted loss that only sum up over non-zero entries.

\n\n

Args:\n input_tensor: input tensor\n target_tensor: target tensor\n weight: weight tensor, in this case 1/sigma^2

\n\n

Returns:\n the weighted MSE loss

\n", "signature": "(input_tensor, target_tensor, weight=1):", "funcdef": "def"}, {"fullname": "uisrnn.loss_func.sigma2_prior_loss", "modulename": "uisrnn.loss_func", "qualname": "sigma2_prior_loss", "kind": "function", "doc": "

Compute sigma2 prior loss.

\n\n

Args:\n num_non_zero: since rnn_truth is a collection of different length sequences\n padded with zeros to fit them into a tensor, we count the sum of\n 'real lengths' of all sequences\n sigma_alpha: inverse gamma shape\n sigma_beta: inverse gamma scale\n sigma2: sigma squared

\n\n

Returns:\n the sigma2 prior loss

\n", "signature": "(num_non_zero, sigma_alpha, sigma_beta, sigma2):", "funcdef": "def"}, {"fullname": "uisrnn.loss_func.regularization_loss", "modulename": "uisrnn.loss_func", "qualname": "regularization_loss", "kind": "function", "doc": "

Compute regularization loss.

\n\n

Args:\n params: iterable of all parameters\n weight: weight for the regularization term

\n\n

Returns:\n the regularization loss

\n", "signature": "(params, weight):", "funcdef": "def"}, {"fullname": "uisrnn.uisrnn", "modulename": "uisrnn.uisrnn", "kind": "module", "doc": "

The UIS-RNN model.

\n"}, {"fullname": "uisrnn.uisrnn.CoreRNN", "modulename": "uisrnn.uisrnn", "qualname": "CoreRNN", "kind": "class", "doc": "

The core Recurent Neural Network used by UIS-RNN.

\n", "bases": "torch.nn.modules.module.Module"}, {"fullname": "uisrnn.uisrnn.CoreRNN.__init__", "modulename": "uisrnn.uisrnn", "qualname": "CoreRNN.__init__", "kind": "function", "doc": "

Initialize internal Module state, shared by both nn.Module and ScriptModule.

\n", "signature": "(input_dim, hidden_size, depth, observation_dim, dropout=0)"}, {"fullname": "uisrnn.uisrnn.CoreRNN.hidden_size", "modulename": "uisrnn.uisrnn", "qualname": "CoreRNN.hidden_size", "kind": "variable", "doc": "

\n"}, {"fullname": "uisrnn.uisrnn.CoreRNN.linear_mean1", "modulename": "uisrnn.uisrnn", "qualname": "CoreRNN.linear_mean1", "kind": "variable", "doc": "

\n"}, {"fullname": "uisrnn.uisrnn.CoreRNN.linear_mean2", "modulename": "uisrnn.uisrnn", "qualname": "CoreRNN.linear_mean2", "kind": "variable", "doc": "

\n"}, {"fullname": "uisrnn.uisrnn.CoreRNN.forward", "modulename": "uisrnn.uisrnn", "qualname": "CoreRNN.forward", "kind": "function", "doc": "

The forward function of the module.

\n", "signature": "(self, input_seq, hidden=None):", "funcdef": "def"}, {"fullname": "uisrnn.uisrnn.BeamState", "modulename": "uisrnn.uisrnn", "qualname": "BeamState", "kind": "class", "doc": "

Structure that contains necessary states for beam search.

\n"}, {"fullname": "uisrnn.uisrnn.BeamState.__init__", "modulename": "uisrnn.uisrnn", "qualname": "BeamState.__init__", "kind": "function", "doc": "

\n", "signature": "(source=None)"}, {"fullname": "uisrnn.uisrnn.BeamState.append", "modulename": "uisrnn.uisrnn", "qualname": "BeamState.append", "kind": "function", "doc": "

Append new item to the BeamState.

\n", "signature": "(self, mean, hidden, cluster):", "funcdef": "def"}, {"fullname": "uisrnn.uisrnn.UISRNN", "modulename": "uisrnn.uisrnn", "qualname": "UISRNN", "kind": "class", "doc": "

Unbounded Interleaved-State Recurrent Neural Networks.

\n"}, {"fullname": "uisrnn.uisrnn.UISRNN.__init__", "modulename": "uisrnn.uisrnn", "qualname": "UISRNN.__init__", "kind": "function", "doc": "

Construct the UISRNN object.

\n\n

Args:\n args: Model configurations. See arguments.py for details.

\n", "signature": "(args)"}, {"fullname": "uisrnn.uisrnn.UISRNN.observation_dim", "modulename": "uisrnn.uisrnn", "qualname": "UISRNN.observation_dim", "kind": "variable", "doc": "

\n"}, {"fullname": "uisrnn.uisrnn.UISRNN.device", "modulename": "uisrnn.uisrnn", "qualname": "UISRNN.device", "kind": "variable", "doc": "

\n"}, {"fullname": "uisrnn.uisrnn.UISRNN.rnn_model", "modulename": "uisrnn.uisrnn", "qualname": "UISRNN.rnn_model", "kind": "variable", "doc": "

\n"}, {"fullname": "uisrnn.uisrnn.UISRNN.rnn_init_hidden", "modulename": "uisrnn.uisrnn", "qualname": "UISRNN.rnn_init_hidden", "kind": "variable", "doc": "

\n"}, {"fullname": "uisrnn.uisrnn.UISRNN.estimate_sigma2", "modulename": "uisrnn.uisrnn", "qualname": "UISRNN.estimate_sigma2", "kind": "variable", "doc": "

\n"}, {"fullname": "uisrnn.uisrnn.UISRNN.estimate_transition_bias", "modulename": "uisrnn.uisrnn", "qualname": "UISRNN.estimate_transition_bias", "kind": "variable", "doc": "

\n"}, {"fullname": "uisrnn.uisrnn.UISRNN.sigma2", "modulename": "uisrnn.uisrnn", "qualname": "UISRNN.sigma2", "kind": "variable", "doc": "

\n"}, {"fullname": "uisrnn.uisrnn.UISRNN.transition_bias", "modulename": "uisrnn.uisrnn", "qualname": "UISRNN.transition_bias", "kind": "variable", "doc": "

\n"}, {"fullname": "uisrnn.uisrnn.UISRNN.transition_bias_denominator", "modulename": "uisrnn.uisrnn", "qualname": "UISRNN.transition_bias_denominator", "kind": "variable", "doc": "

\n"}, {"fullname": "uisrnn.uisrnn.UISRNN.crp_alpha", "modulename": "uisrnn.uisrnn", "qualname": "UISRNN.crp_alpha", "kind": "variable", "doc": "

\n"}, {"fullname": "uisrnn.uisrnn.UISRNN.logger", "modulename": "uisrnn.uisrnn", "qualname": "UISRNN.logger", "kind": "variable", "doc": "

\n"}, {"fullname": "uisrnn.uisrnn.UISRNN.save", "modulename": "uisrnn.uisrnn", "qualname": "UISRNN.save", "kind": "function", "doc": "

Save the model to a file.

\n\n

Args:\n filepath: the path of the file.

\n", "signature": "(self, filepath):", "funcdef": "def"}, {"fullname": "uisrnn.uisrnn.UISRNN.load", "modulename": "uisrnn.uisrnn", "qualname": "UISRNN.load", "kind": "function", "doc": "

Load the model from a file.

\n\n

Args:\n filepath: the path of the file.

\n", "signature": "(self, filepath):", "funcdef": "def"}, {"fullname": "uisrnn.uisrnn.UISRNN.fit_concatenated", "modulename": "uisrnn.uisrnn", "qualname": "UISRNN.fit_concatenated", "kind": "function", "doc": "

Fit UISRNN model to concatenated sequence and cluster_id.

\n\n

Args:\n train_sequence: the training observation sequence, which is a\n 2-dim numpy array of real numbers, of size N * D.

\n\n
- `N`: summation of lengths of all utterances.\n- `D`: observation dimension.\n\nFor example,\n
\n\n

train_sequence =\n[[1.2 3.0 -4.1 6.0]    --> an entry of speaker #0 from utterance 'iaaa'\n [0.8 -1.1 0.4 0.5]    --> an entry of speaker #1 from utterance 'iaaa'\n [-0.2 1.0 3.8 5.7]    --> an entry of speaker #0 from utterance 'iaaa'\n [3.8 -0.1 1.5 2.3]    --> an entry of speaker #0 from utterance 'ibbb'\n [1.2 1.4 3.6 -2.7]]   --> an entry of speaker #0 from utterance 'ibbb'\n

\n\n
Here `N=5`, `D=4`.\n\nWe concatenate all training utterances into this single sequence.\n
\n\n

train_cluster_id: the speaker id sequence, which is 1-dim list or\n numpy array of strings, of size N.\n For example,

\n\n

train_cluster_id =\n  ['iaaa_0', 'iaaa_1', 'iaaa_0', 'ibbb_0', 'ibbb_0']\n

\n\n
'iaaa_0' means the entry belongs to speaker #0 in utterance 'iaaa'.\n\nNote that the order of entries within an utterance are preserved,\nand all utterances are simply concatenated together.\n
\n\n

args: Training configurations. See arguments.py for details.

\n\n

Raises:\n TypeError: If train_sequence or train_cluster_id is of wrong type.\n ValueError: If train_sequence or train_cluster_id has wrong dimension.

\n", "signature": "(self, train_sequence, train_cluster_id, args):", "funcdef": "def"}, {"fullname": "uisrnn.uisrnn.UISRNN.fit", "modulename": "uisrnn.uisrnn", "qualname": "UISRNN.fit", "kind": "function", "doc": "

Fit UISRNN model.

\n\n

Args:\n train_sequences: Either a list of training sequences, or a single\n concatenated training sequence:

\n\n
1. train_sequences is list, and each element is a 2-dim numpy array\n   of real numbers, of size: `length * D`.\n   The length varies among different sequences, but the D is the same.\n   In speaker diarization, each sequence is the sequence of speaker\n   embeddings of one utterance.\n2. train_sequences is a single concatenated sequence, which is a\n   2-dim numpy array of real numbers. See `fit_concatenated()`\n   for more details.\n
\n\n

train_cluster_ids: Ground truth labels for train_sequences:

\n\n
1. if train_sequences is a list, this must also be a list of the same\n   size, each element being a 1-dim list or numpy array of strings.\n2. if train_sequences is a single concatenated sequence, this\n   must also be the concatenated 1-dim list or numpy array of strings\n
\n\n

args: Training configurations. See arguments.py for details.

\n\n

Raises:\n TypeError: If train_sequences or train_cluster_ids is of wrong type.

\n", "signature": "(self, train_sequences, train_cluster_ids, args):", "funcdef": "def"}, {"fullname": "uisrnn.uisrnn.UISRNN.predict_single", "modulename": "uisrnn.uisrnn", "qualname": "UISRNN.predict_single", "kind": "function", "doc": "

Predict labels for a single test sequence using UISRNN model.

\n\n

Args:\n test_sequence: the test observation sequence, which is 2-dim numpy array\n of real numbers, of size N * D.

\n\n
- `N`: length of one test utterance.\n- `D` : observation dimension.\n\nFor example:\n
\n\n

test_sequence =\n[[2.2 -1.0 3.0 5.6]    --> 1st entry of utterance 'iccc'\n [0.5 1.8 -3.2 0.4]    --> 2nd entry of utterance 'iccc'\n [-2.2 5.0 1.8 3.7]    --> 3rd entry of utterance 'iccc'\n [-3.8 0.1 1.4 3.3]    --> 4th entry of utterance 'iccc'\n [0.1 2.7 3.5 -1.7]]   --> 5th entry of utterance 'iccc'\n

\n\n
Here `N=5`, `D=4`.\n
\n\n

args: Inference configurations. See arguments.py for details.

\n\n

Returns:\n predicted_cluster_id: predicted speaker id sequence, which is\n an array of integers, of size N.\n For example, predicted_cluster_id = [0, 1, 0, 0, 1]

\n\n

Raises:\n TypeError: If test_sequence is of wrong type.\n ValueError: If test_sequence has wrong dimension.

\n", "signature": "(self, test_sequence, args):", "funcdef": "def"}, {"fullname": "uisrnn.uisrnn.UISRNN.predict", "modulename": "uisrnn.uisrnn", "qualname": "UISRNN.predict", "kind": "function", "doc": "

Predict labels for a single or many test sequences using UISRNN model.

\n\n

Args:\n test_sequences: Either a list of test sequences, or a single test\n sequence. Each test sequence is a 2-dim numpy array\n of real numbers. See predict_single() for details.\n args: Inference configurations. See arguments.py for details.

\n\n

Returns:\n predicted_cluster_ids: Predicted labels for test_sequences.

\n\n
1. if test_sequences is a list, predicted_cluster_ids will be a list\n   of the same size, where each element being a 1-dim list of strings.\n2. if test_sequences is a single sequence, predicted_cluster_ids will\n   be a 1-dim list of strings\n
\n\n

Raises:\n TypeError: If test_sequences is of wrong type.

\n", "signature": "(self, test_sequences, args):", "funcdef": "def"}, {"fullname": "uisrnn.uisrnn.parallel_predict", "modulename": "uisrnn.uisrnn", "qualname": "parallel_predict", "kind": "function", "doc": "

Run prediction in parallel using torch.multiprocessing.

\n\n

This is a beta feature. It makes prediction slower on CPU. But it's reported\nthat it makes prediction faster on GPU.

\n\n

Args:\n model: instance of UISRNN model\n test_sequences: a list of test sequences, or a single test\n sequence. Each test sequence is a 2-dim numpy array\n of real numbers. See predict_single() for details.\n args: Inference configurations. See arguments.py for details.\n num_processes: number of parallel processes.

\n\n

Returns:\n a list of the same size as test_sequences, where each element\n being a 1-dim list of strings.

\n\n

Raises:\n TypeError: If test_sequences is of wrong type.

\n", "signature": "(model, test_sequences, args, num_processes=4):", "funcdef": "def"}, {"fullname": "uisrnn.utils", "modulename": "uisrnn.utils", "kind": "module", "doc": "

Utils for UIS-RNN.

\n"}, {"fullname": "uisrnn.utils.generate_random_string", "modulename": "uisrnn.utils", "qualname": "generate_random_string", "kind": "function", "doc": "

Generate a random string of upper case letters and digits.

\n\n

Args:\n length: length of the generated string

\n\n

Returns:\n the generated string

\n", "signature": "(length=6):", "funcdef": "def"}, {"fullname": "uisrnn.utils.enforce_cluster_id_uniqueness", "modulename": "uisrnn.utils", "qualname": "enforce_cluster_id_uniqueness", "kind": "function", "doc": "

Enforce uniqueness of cluster id across sequences.

\n\n

Args:\n cluster_ids: a list of 1-dim list/numpy.ndarray of strings

\n\n

Returns:\n a new list with same length of cluster_ids

\n\n

Raises:\n TypeError: if cluster_ids or its element has wrong type

\n", "signature": "(cluster_ids):", "funcdef": "def"}, {"fullname": "uisrnn.utils.concatenate_training_data", "modulename": "uisrnn.utils", "qualname": "concatenate_training_data", "kind": "function", "doc": "

Concatenate training data.

\n\n

Args:\n train_sequences: a list of 2-dim numpy arrays to be concatenated\n train_cluster_ids: a list of 1-dim list/numpy.ndarray of strings\n enforce_uniqueness: a boolean indicated whether we should enfore uniqueness\n to train_cluster_ids\n shuffle: whether to randomly shuffle input order

\n\n

Returns:\n concatenated_train_sequence: a 2-dim numpy array\n concatenated_train_cluster_id: a list of strings

\n\n

Raises:\n TypeError: if input has wrong type\n ValueError: if sizes/dimensions of input or their elements are incorrect

\n", "signature": "(\ttrain_sequences,\ttrain_cluster_ids,\tenforce_uniqueness=True,\tshuffle=True):", "funcdef": "def"}, {"fullname": "uisrnn.utils.sample_permuted_segments", "modulename": "uisrnn.utils", "qualname": "sample_permuted_segments", "kind": "function", "doc": "

Sample sequences with permuted blocks.

\n\n

Args:\n index_sequence: (integer array, size: L)\n - subsequence index\n For example, index_sequence = [1,2,6,10,11,12].\n number_samples: (integer)\n - number of subsampled block-preserving permuted sequences.\n For example, number_samples = 5

\n\n

Returns:\n sampled_index_sequences: (a list of numpy arrays) - a list of subsampled\n block-preserving permuted sequences. For example,

\n\n

sampled_index_sequences =\n[[10,11,12,1,2,6],\n [6,1,2,10,11,12],\n [1,2,10,11,12,6],\n [6,1,2,10,11,12],\n [1,2,6,10,11,12]]\n

\n\n
The length of \"sampled_index_sequences\" is \"number_samples\".\n
\n", "signature": "(index_sequence, number_samples):", "funcdef": "def"}, {"fullname": "uisrnn.utils.resize_sequence", "modulename": "uisrnn.utils", "qualname": "resize_sequence", "kind": "function", "doc": "

Resize sequences for packing and batching.

\n\n

Args:\n sequence: (real numpy matrix, size: seq_len*obs_size) - observed sequence\n cluster_id: (numpy vector, size: seq_len) - cluster indicator sequence\n num_permutations: int - Number of permutations per utterance sampled.

\n\n

Returns:\n sub_sequences: A list of numpy array, with obsevation vector from the same\n cluster in the same list.\n seq_lengths: The length of each cluster (+1).

\n", "signature": "(sequence, cluster_id, num_permutations=None):", "funcdef": "def"}, {"fullname": "uisrnn.utils.pack_sequence", "modulename": "uisrnn.utils", "qualname": "pack_sequence", "kind": "function", "doc": "

Pack sequences for training.

\n\n

Args:\n sub_sequences: A list of numpy array, with obsevation vector from the same\n cluster in the same list.\n seq_lengths: The length of each cluster (+1).\n batch_size: int or None - Run batch learning if batch_size is None. Else,\n run online learning with specified batch size.\n observation_dim: int - dimension for observation vectors\n device: str - Your device. E.g., cuda:0 or cpu.

\n\n

Returns:\n packed_rnn_input: (PackedSequence object) packed rnn input\n rnn_truth: ground truth

\n", "signature": "(sub_sequences, seq_lengths, batch_size, observation_dim, device):", "funcdef": "def"}, {"fullname": "uisrnn.utils.output_result", "modulename": "uisrnn.utils", "qualname": "output_result", "kind": "function", "doc": "

Produce a string to summarize the experiment.

\n", "signature": "(model_args, training_args, test_record):", "funcdef": "def"}, {"fullname": "uisrnn.utils.estimate_transition_bias", "modulename": "uisrnn.utils", "qualname": "estimate_transition_bias", "kind": "function", "doc": "

Estimate the transition bias.

\n\n

Args:\n cluster_id: Either a list of cluster indicator sequences, or a single\n concatenated sequence. The former is strongly preferred, since the\n transition_bias estimated from the latter will be inaccurate.\n smooth: int or float - Smoothing coefficient, avoids -inf value in np.log\n in the case of a sequence with a single speaker and division by 0 in the\n case of empty sequences. Using a small value for smooth decreases the\n bias in the calculation of transition_bias but can also lead to underflow\n in some remote cases, larger values are safer but less accurate.

\n\n

Returns:\n bias: Flipping coin head probability.\n bias_denominator: The denominator of the bias, used for multiple calls to\n fit().

\n", "signature": "(cluster_ids, smooth=1):", "funcdef": "def"}]; // mirrored in build-search-index.js (part 1) // Also split on html tags. this is a cheap heuristic, but good enough. diff --git a/docs/uisrnn.html b/docs/uisrnn.html index ff7f5db..9b922a4 100644 --- a/docs/uisrnn.html +++ b/docs/uisrnn.html @@ -3,14 +3,14 @@ - + uisrnn API documentation - - + +