UNPKG

qminer

Version:

A C++ based data analytics platform for processing large-scale real-time streams containing structured and unstructured data

1,314 lines 61.3 kB
<!doctype html>
<html>

<head>
  <meta name="generator" content="JSDoc 3">
  <meta charset="utf-8">
  <title>Class: FeatureSpace</title>
  <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Karla:400,400i,700,700i" type="text/css">
  <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Noto+Serif:400,400i,700,700i" type="text/css">
  <link rel="stylesheet" href="https://brick.a.ssl.fastly.net/Inconsolata:500" type="text/css">
  <link href="css/baseline.css" rel="stylesheet">
</head>

<body onload="prettyPrint()">
  <nav id="jsdoc-navbar" role="navigation" class="jsdoc-navbar">
    <div id="jsdoc-navbar-container">
      <div id="jsdoc-navbar-content">
        <a href="index.html" class="jsdoc-navbar-package-name">QMiner JavaScript API v9.4.0</a>
      </div>
    </div>
  </nav>
  <div id="jsdoc-body-container">
    <div id="jsdoc-content">
      <div id="jsdoc-content-container">
        <div id="jsdoc-main" role="main">
          <header class="page-header">
            <div class="symbol-detail-labels"><span class="label label-kind">class</span>&nbsp;<span class="label label-static">static</span></div>
            <h1><small><a href="module-qm.html">qm</a>.<wbr></small><span class="symbol-name">FeatureSpace</span></h1>
            <p class="source-link">Source: <a href="qminerdoc.js.html#source-line-2944">qminerdoc.<wbr>js:2944</a></p>
            <div class="symbol-classdesc">
              <p>Represents the feature space. It contains any of the <a href="module-qm.html#~FeatureExtractor">module:qm~FeatureExtractor</a> objects.</p>
            </div>
            <dl class="dl-compact">
            </dl>
          </header>
          <section id="summary">
            <div class="summary-callout">
              <h2 class="summary-callout-heading">Properties</h2>
              <div class="summary-content">
                <div class="summary-column">
                  <dl class="dl-summary-callout">
                    <dt><a href="module-qm.FeatureSpace.html#dim">dim</a></dt>
                    <dd>
                    </dd>
                  </dl>
                </div>
                <div class="summary-column">
                  <dl class="dl-summary-callout">
                    <dt><a href="module-qm.FeatureSpace.html#dims">dims</a></dt>
                    <dd>
                    </dd>
                  </dl>
                </div>
                <div class="summary-column">
                </div>
              </div>
            </div>
            <div class="summary-callout">
              <h2 class="summary-callout-heading">Methods</h2>
              <div class="summary-content">
                <div class="summary-column">
                  <dl class="dl-summary-callout">
                    <dt><a href="module-qm.FeatureSpace.html#addFeatureExtractor">addFeatureExtractor(ftExt)</a></dt>
                    <dd>
                    </dd>
                    <dt><a href="module-qm.FeatureSpace.html#clear">clear()</a></dt>
                    <dd>
                    </dd>
                    <dt><a href="module-qm.FeatureSpace.html#extractMatrix">extractMatrix(rs[, idx])</a></dt>
                    <dd>
                    </dd>
                    <dt><a href="module-qm.FeatureSpace.html#extractSparseMatrix">extractSparseMatrix(rs[, idx])</a></dt>
                    <dd>
                    </dd>
                    <dt><a href="module-qm.FeatureSpace.html#extractSparseVector">extractSparseVector(rec[, idx])</a></dt>
                    <dd>
                    </dd>
                  </dl>
                </div>
                <div class="summary-column">
                  <dl class="dl-summary-callout">
                    <dt><a href="module-qm.FeatureSpace.html#extractVector">extractVector(rec[, idx])</a></dt>
                    <dd>
                    </dd>
                    <dt><a href="module-qm.FeatureSpace.html#filter">filter(vec, idx[, keepOffset])</a></dt>
                    <dd>
                    </dd>
                    <dt><a href="module-qm.FeatureSpace.html#getFeature">getFeature(idx)</a></dt>
                    <dd>
                    </dd>
                    <dt><a href="module-qm.FeatureSpace.html#getFeatureExtractor">getFeatureExtractor(idx)</a></dt>
                    <dd>
                    </dd>
                    <dt><a href="module-qm.FeatureSpace.html#invertFeature">invertFeature(idx, val)</a></dt>
                    <dd>
                    </dd>
                  </dl>
                </div>
                <div class="summary-column">
                  <dl class="dl-summary-callout">
                    <dt><a href="module-qm.FeatureSpace.html#invertFeatureVector">invertFeatureVector(ftr)</a></dt>
                    <dd>
                    </dd>
                    <dt><a href="module-qm.FeatureSpace.html#save">save(fout)</a></dt>
                    <dd>
                    </dd>
                    <dt><a href="module-qm.FeatureSpace.html#updateRecord">updateRecord(rec)</a></dt>
                    <dd>
                    </dd>
                    <dt><a href="module-qm.FeatureSpace.html#updateRecords">updateRecords(rs)</a></dt>
                    <dd>
                    </dd>
                  </dl>
                </div>
              </div>
            </div>
          </section>
          <section>
            <h2 id="FeatureSpace">new&nbsp;<span class="symbol-name">FeatureSpace</span><span class="signature"><span class="signature-params">(base, arg)</span></span></h2>
            <p>Feature Space</p>
            <section>
              <h3>
                Example
              </h3>
              <div>
                <pre class="prettyprint"><code>// import qm module
var qm &#x3D; require(&#x27;qminer&#x27;);
// construct a base with the store
var base &#x3D; new qm.Base({
  mode: &quot;createClean&quot;,
  schema: {
    name: &quot;FtrSpace&quot;,
    fields: [
      { name: &quot;Value&quot;, type: &quot;float&quot; },
      { name: &quot;Category&quot;, type: &quot;string&quot; },
      { name: &quot;Categories&quot;, type: &quot;string_v&quot; },
    ],
    joins: [],
    keys: []
  }
});
// populate the store
Store &#x3D; base.store(&quot;FtrSpace&quot;);
Store.push({ Value: 1.0, Category: &quot;a&quot;, Categories: [&quot;a&quot;, &quot;q&quot;] });
Store.push({ Value: 1.1, Category: &quot;b&quot;, Categories: [&quot;b&quot;, &quot;w&quot;] });
Store.push({ Value: 1.2, Category: &quot;c&quot;, Categories: [&quot;c&quot;, &quot;e&quot;] });
Store.push({ Value: 1.3, Category: &quot;a&quot;, Categories: [&quot;a&quot;, &quot;q&quot;] });
// create a feature space
var ftr &#x3D; new qm.FeatureSpace(base, { type: &quot;numeric&quot;, source: &quot;FtrSpace&quot;, field: &quot;Value&quot; });
base.close();</code></pre>
              </div>
            </section>
            <section>
              <h3>Parameters</h3>
              <table class="jsdoc-details-table">
                <thead>
                  <tr>
                    <th>Name</th>
                    <th>Type</th>
                    <th>Optional</th>
                    <th>Description</th>
                  </tr>
                </thead>
                <tbody>
                  <tr>
                    <td>
                      <p>base</p>
                    </td>
                    <td>
                      <p><a href="module-qm.Base.html">module:qm.Base</a></p>
                    </td>
                    <td>
                      <p>&nbsp;</p>
                    </td>
                    <td>
                      <p>The base where the features are extracted from.</p>
                    </td>
                  </tr>
                  <tr>
                    <td>
                      <p>arg</p>
                    </td>
                    <td>
                      <p>(Array of <a href="module-qm.html#~FeatureExtractor">module:qm~FeatureExtractor</a> or <a href="module-fs.FIn.html">module:fs.FIn</a>)</p>
                    </td>
                    <td>
                      <p>&nbsp;</p>
                    </td>
                    <td>
                      <p>Constructor arguments. There are two ways of constructing:
                        <br>1. Using an array of <a href="module-qm.html#~FeatureExtractor">module:qm~FeatureExtractor</a> objects,
                        <br>2. using a file input stream <a href="module-fs.FIn.html">module:fs.FIn</a>.
                      </p>
                    </td>
                  </tr>
                </tbody>
              </table>
            </section>
            <dl class="dl-compact">
            </dl>
          </section>
          <section>
            <h2>Properties</h2>
            <section>
              <h3 id="dim"><span class="symbol-name">dim</span></h3>
              <p>Returns the dimension of the feature space. Type <code>number</code>.</p>
              <dl class="dl-compact">
              </dl>
              <h3 id="dims"><span class="symbol-name">dims</span></h3>
              <p>Returns an array of the dimensions of each feature extractor in the feature space. Type <code>Array of numbers</code>.</p>
              <dl class="dl-compact">
              </dl>
            </section>
            <h2>Methods</h2>
            <section>
              <h3 id="addFeatureExtractor"><span class="symbol-name">addFeatureExtractor</span><span class="signature"><span class="signature-params">(ftExt)</span>&nbsp;&rarr; <span class="signature-returns"> <a href="module-qm.FeatureSpace.html">module:qm.FeatureSpace</a></span></span></h3>
              <p>Adds a new feature extractor to the feature space.</p>
              <section>
                <h4>
                  Example
                </h4>
                <div>
                  <pre class="prettyprint"><code>// import qm module
var qm &#x3D; require(&#x27;qminer&#x27;);
// create a new base containing one store
var base &#x3D; new qm.Base({
   mode: &quot;createClean&quot;,
   schema: [{
       name: &quot;WeatherForcast&quot;,
       fields: [
           { name: &quot;Weather&quot;, type: &quot;string&quot; },
           { name: &quot;Date&quot;, type: &quot;datetime&quot; },
           { name: &quot;TemperatureDegrees&quot;, type: &quot;int&quot; }
       ]
   }]
});
// put some records in the &quot;WeatherForecast&quot; store
base.store(&quot;WeatherForcast&quot;).push({ Weather: &quot;Partly Cloudy&quot;, Date: &quot;2015-05-27T11:00:00&quot;, TemperatureDegrees: 19 });
base.store(&quot;WeatherForcast&quot;).push({ Weather: &quot;Partly Cloudy&quot;, Date: &quot;2015-05-28T11:00:00&quot;, TemperatureDegrees: 22 });
base.store(&quot;WeatherForcast&quot;).push({ Weather: &quot;Mostly Cloudy&quot;, Date: &quot;2015-05-29T11:00:00&quot;, TemperatureDegrees: 25 });
base.store(&quot;WeatherForcast&quot;).push({ Weather: &quot;Mostly Cloudy&quot;, Date: &quot;2015-05-30T11:00:00&quot;, TemperatureDegrees: 25 });
base.store(&quot;WeatherForcast&quot;).push({ Weather: &quot;Scattered Showers&quot;, Date: &quot;2015-05-31T11:00:00&quot;, TemperatureDegrees: 24 });
base.store(&quot;WeatherForcast&quot;).push({ Weather: &quot;Mostly Cloudy&quot;, Date: &quot;2015-06-01T11:00:00&quot;, TemperatureDegrees: 27 });
// create a feature space
var ftr &#x3D; new qm.FeatureSpace(base, { type: &quot;numeric&quot;, source: &quot;WeatherForcast&quot;, field: &quot;TemperatureDegrees&quot; });
// add a new feature extractor to the feature space
// it adds the new feature extractor to the pre-existing feature extractors in the feature space
ftr.addFeatureExtractor({ type: &quot;text&quot;, source: &quot;WeatherForcast&quot;, field: &quot;Weather&quot;, normalize: true, weight: &quot;tfidf&quot; });
base.close();</code></pre>
                </div>
              </section>
              <section>
                <h4>Parameter</h4>
                <table class="jsdoc-details-table">
                  <thead>
                    <tr>
                      <th>Name</th>
                      <th>Type</th>
                      <th>Optional</th>
                      <th>Description</th>
                    </tr>
                  </thead>
                  <tbody>
                    <tr>
                      <td>
                        <p>ftExt</p>
                      </td>
                      <td>
                        <p><a href="module-qm.html#~FeatureExtractor">module:qm~FeatureExtractor</a></p>
                      </td>
                      <td>
                        <p>&nbsp;</p>
                      </td>
                      <td>
                        <p>The added feature extractor.</p>
                      </td>
                    </tr>
                  </tbody>
                </table>
              </section>
              <dl class="dl-compact">
                <dt>Returns</dt>
                <dd>
                  <p><code><a href="module-qm.FeatureSpace.html">module:qm.FeatureSpace</a></code>B Self.</p>
                </dd>
              </dl>
              <h3 id="clear"><span class="symbol-name">clear</span><span class="signature"><span class="signature-params">()</span>&nbsp;&rarr; <span class="signature-returns"> <a href="module-qm.FeatureSpace.html">module:qm.FeatureSpace</a></span></span></h3>
              <p>Clears the feature space.</p>
              <section>
                <h4>
                  Example
                </h4>
                <div>
                  <pre class="prettyprint"><code>// import qm module
var qm &#x3D; require(&#x27;qminer&#x27;);
// create a new base containing one store
var base &#x3D; new qm.Base({
   mode: &quot;createClean&quot;,
   schema: [{
       name: &quot;Runners&quot;,
       fields: [
           { name: &quot;ID&quot;, type: &quot;int&quot;, primary: true },
           { name: &quot;Name&quot;, type: &quot;string&quot; },
           { name: &quot;BestTime&quot;, type: &quot;float&quot; }
       ]
   }]
});
// put some records in the &quot;Runners&quot; store
base.store(&quot;Runners&quot;).push({ ID: 110020, Name: &quot;Eric Ericsson&quot;, BestTime: 134.33 });
base.store(&quot;Runners&quot;).push({ ID: 123307, Name: &quot;Fred Friedrich&quot;, BestTime: 101.11 });
base.store(&quot;Runners&quot;).push({ ID: 767201, Name: &quot;Appel Banana&quot;, BestTime: 1034.56 });
// create a feature space
var ftr &#x3D; new qm.FeatureSpace(base, { type: &quot;numeric&quot;, source: &quot;Runners&quot;, field: &quot;BestTime&quot; });
// update the feature space
ftr.updateRecords(base.store(&quot;Runners&quot;).allRecords);
// clear the feature space (return the feature space to it&#x27;s default values)
ftr.clear();
base.close();</code></pre>
                </div>
              </section>
              <dl class="dl-compact">
                <dt>Returns</dt>
                <dd>
                  <p><code><a href="module-qm.FeatureSpace.html">module:qm.FeatureSpace</a></code>B Self. Features space has been cleared.</p>
                </dd>
              </dl>
              <h3 id="extractMatrix"><span class="symbol-name">extractMatrix</span><span class="signature"><span class="signature-params">(rs[, idx])</span>&nbsp;&rarr; <span class="signature-returns"> <a href="module-la.Matrix.html">module:la.Matrix</a></span></span></h3>
              <p>Extracts the feature vectors from the recordset and returns them as columns of a dense matrix.</p>
              <section>
                <h4>
                  Example
                </h4>
                <div>
                  <pre class="prettyprint"><code>// import qm module
var qm &#x3D; require(&quot;qminer&quot;);
// create a base containing the store Class. Let the Name field be the primary field.
var base &#x3D; new qm.Base({
   mode: &quot;createClean&quot;,
   schema: [{
       name: &quot;Class&quot;,
       fields: [
           { name: &quot;Name&quot;, type: &quot;string&quot;, primary: true },
           { name: &quot;StudyGroups&quot;, type: &quot;string_v&quot; }
       ]
   }]
});
// add some records to the store
base.store(&quot;Class&quot;).push({ Name: &quot;Dean&quot;, StudyGroups: [&quot;A&quot;, &quot;D&quot;] });
base.store(&quot;Class&quot;).push({ Name: &quot;Chang&quot;, StudyGroups: [&quot;B&quot;, &quot;D&quot;] });
base.store(&quot;Class&quot;).push({ Name: &quot;Magnitude&quot;, StudyGroups: [&quot;B&quot;, &quot;C&quot;] });
base.store(&quot;Class&quot;).push({ Name: &quot;Leonard&quot;, StudyGroups: [&quot;A&quot;, &quot;B&quot;] });
// create a feature space containing the multinomial feature extractor
var ftr &#x3D; new qm.FeatureSpace(base, { type: &quot;multinomial&quot;, source: &quot;Class&quot;, field: &quot;StudyGroups&quot;, values: [&quot;A&quot;, &quot;B&quot;, &quot;C&quot;, &quot;D&quot;] });
// create a feature matrix out of the records of the store by using the feature space
// returns a sparse matrix equal to
// 1  0  0  1
// 0  1  1  1
// 0  0  1  0
// 1  1  0  0
var matrix &#x3D; ftr.extractMatrix(base.store(&quot;Class&quot;).allRecords);
base.close();</code></pre>
                </div>
              </section>
              <section>
                <h4>Parameters</h4>
                <table class="jsdoc-details-table">
                  <thead>
                    <tr>
                      <th>Name</th>
                      <th>Type</th>
                      <th>Optional</th>
                      <th>Description</th>
                    </tr>
                  </thead>
                  <tbody>
                    <tr>
                      <td>
                        <p>rs</p>
                      </td>
                      <td>
                        <p><a href="module-qm.RecordSet.html">module:qm.RecordSet</a></p>
                      </td>
                      <td>
                        <p>&nbsp;</p>
                      </td>
                      <td>
                        <p>The given record set.</p>
                      </td>
                    </tr>
                    <tr>
                      <td>
                        <p>idx</p>
                      </td>
                      <td>
                        <p>number</p>
                      </td>
                      <td>
                        <p>Yes</p>
                      </td>
                      <td>
                        <p>when given, only use specified feature extractor.</p>
                      </td>
                    </tr>
                  </tbody>
                </table>
              </section>
              <dl class="dl-compact">
                <dt>Returns</dt>
                <dd>
                  <p><code><a href="module-la.Matrix.html">module:la.Matrix</a></code>B The dense matrix, where the i-th column is the feature vector of the i-th record in <code>rs</code>.</p>
                </dd>
              </dl>
              <h3 id="extractSparseMatrix"><span class="symbol-name">extractSparseMatrix</span><span class="signature"><span class="signature-params">(rs[, idx])</span>&nbsp;&rarr; <span class="signature-returns"> <a href="module-la.SparseMatrix.html">module:la.SparseMatrix</a></span></span></h3>
              <p>Extracts the sparse feature vectors from the record set and returns them as columns of the sparse matrix.</p>
              <section>
                <h4>
                  Example
                </h4>
                <div>
                  <pre class="prettyprint"><code>// import qm module
var qm &#x3D; require(&quot;qminer&quot;);
// create a base containing the store Class. Let the Name field be the primary field.
var base &#x3D; new qm.Base({
   mode: &quot;createClean&quot;,
   schema: [{
       name: &quot;Class&quot;,
       fields: [
           { name: &quot;Name&quot;, type: &quot;string&quot;, primary: true },
           { name: &quot;StudyGroups&quot;, type: &quot;string_v&quot; }
       ]
   }]
});
// add some records to the store
base.store(&quot;Class&quot;).push({ Name: &quot;Dean&quot;, StudyGroups: [&quot;A&quot;, &quot;D&quot;] });
base.store(&quot;Class&quot;).push({ Name: &quot;Chang&quot;, StudyGroups: [&quot;B&quot;, &quot;D&quot;] });
base.store(&quot;Class&quot;).push({ Name: &quot;Magnitude&quot;, StudyGroups: [&quot;B&quot;, &quot;C&quot;] });
base.store(&quot;Class&quot;).push({ Name: &quot;Leonard&quot;, StudyGroups: [&quot;A&quot;, &quot;B&quot;] });
// create a feature space containing the multinomial feature extractor
var ftr &#x3D; new qm.FeatureSpace(base, { type: &quot;multinomial&quot;, source: &quot;Class&quot;, field: &quot;StudyGroups&quot;, values: [&quot;A&quot;, &quot;B&quot;, &quot;C&quot;, &quot;D&quot;] });
// create a sparse feature matrix out of the records of the store by using the feature space
// returns a sparse matrix equal to
// [[(0, 1), (3, 1)], [(1, 1), (3, 1)], [(1, 1), (2, 1)], [(0, 1), (1, 1)]]
var sparseMatrix &#x3D; ftr.extractSparseMatrix(base.store(&quot;Class&quot;).allRecords);
base.close();</code></pre>
                </div>
              </section>
              <section>
                <h4>Parameters</h4>
                <table class="jsdoc-details-table">
                  <thead>
                    <tr>
                      <th>Name</th>
                      <th>Type</th>
                      <th>Optional</th>
                      <th>Description</th>
                    </tr>
                  </thead>
                  <tbody>
                    <tr>
                      <td>
                        <p>rs</p>
                      </td>
                      <td>
                        <p><a href="module-qm.RecordSet.html">module:qm.RecordSet</a></p>
                      </td>
                      <td>
                        <p>&nbsp;</p>
                      </td>
                      <td>
                        <p>The given record set.</p>
                      </td>
                    </tr>
                    <tr>
                      <td>
                        <p>idx</p>
                      </td>
                      <td>
                        <p>number</p>
                      </td>
                      <td>
                        <p>Yes</p>
                      </td>
                      <td>
                        <p>When given, only use specified feature extractor.</p>
                      </td>
                    </tr>
                  </tbody>
                </table>
              </section>
              <dl class="dl-compact">
                <dt>Returns</dt>
                <dd>
                  <p><code><a href="module-la.SparseMatrix.html">module:la.SparseMatrix</a></code>B The sparse matrix, where the i-th column is the sparse feature vector of the i-th record in <code>rs</code>.</p>
                </dd>
              </dl>
              <h3 id="extractSparseVector"><span class="symbol-name">extractSparseVector</span><span class="signature"><span class="signature-params">(rec[, idx])</span>&nbsp;&rarr; <span class="signature-returns"> <a href="module-la.SparseVector.html">module:la.SparseVector</a></span></span></h3>
              <p>Creates a sparse feature vector from the given record.</p>
              <section>
                <h4>
                  Example
                </h4>
                <div>
                  <pre class="prettyprint"><code>// import qm module
var qm &#x3D; require(&#x27;qminer&#x27;);
// create a base containing the store Class. Let the Name field be the primary field.
var base &#x3D; new qm.Base({
   mode: &quot;createClean&quot;,
   schema: [{
       name: &quot;Class&quot;,
       fields: [
           { name: &quot;Name&quot;, type: &quot;string&quot;, primary: true },
           { name: &quot;StudyGroup&quot;, type: &quot;string&quot; }
       ]
   }]
});
// add some records to the store
base.store(&quot;Class&quot;).push({ Name: &quot;Dean&quot;, StudyGroup: &quot;A&quot; });
base.store(&quot;Class&quot;).push({ Name: &quot;Chang&quot;, StudyGroup: &quot;D&quot; });
base.store(&quot;Class&quot;).push({ Name: &quot;Magnitude&quot;, StudyGroup: &quot;C&quot; });
base.store(&quot;Class&quot;).push({ Name: &quot;Leonard&quot;, StudyGroup: &quot;B&quot; });
// create a new feature space
// the feature space is of dimensions [0, 4]; 4 is the dimension of the categorical feature extractor
// and 0 is the dimension of text feature extractor (the text feature extractor doesn&#x27;t have any words,
// need to be updated for use).
var ftr &#x3D; new qm.FeatureSpace(base, [
   { type: &quot;text&quot;, source: &quot;Class&quot;, field: &quot;Name&quot;, normalize: false },
   { type: &quot;categorical&quot;, source: &quot;Class&quot;, field: &quot;StudyGroup&quot;, values: [&quot;A&quot;, &quot;B&quot;, &quot;C&quot;, &quot;D&quot;] }
]);
// get the sparse extractor vector for the first record in store
// the sparse vector will be [(0, 1)] - uses only the categorical feature extractor. There are no
// features in the text feature extractor.
var vec &#x3D; ftr.extractSparseVector(base.store(&quot;Class&quot;)[0]);
base.close();</code></pre>
                </div>
              </section>
              <section>
                <h4>Parameters</h4>
                <table class="jsdoc-details-table">
                  <thead>
                    <tr>
                      <th>Name</th>
                      <th>Type</th>
                      <th>Optional</th>
                      <th>Description</th>
                    </tr>
                  </thead>
                  <tbody>
                    <tr>
                      <td>
                        <p>rec</p>
                      </td>
                      <td>
                        <p><a href="module-qm.Record.html">module:qm.Record</a></p>
                      </td>
                      <td>
                        <p>&nbsp;</p>
                      </td>
                      <td>
                        <p>The given record.</p>
                      </td>
                    </tr>
                    <tr>
                      <td>
                        <p>idx</p>
                      </td>
                      <td>
                        <p>number</p>
                      </td>
                      <td>
                        <p>Yes</p>
                      </td>
                      <td>
                        <p>When given, only use specified feature extractor.</p>
                      </td>
                    </tr>
                  </tbody>
                </table>
              </section>
              <dl class="dl-compact">
                <dt>Returns</dt>
                <dd>
                  <p><code><a href="module-la.SparseVector.html">module:la.SparseVector</a></code>B The sparse feature vector gained from <code>rec</code> and <code>idx</code>.</p>
                </dd>
              </dl>
              <h3 id="extractVector"><span class="symbol-name">extractVector</span><span class="signature"><span class="signature-params">(rec[, idx])</span>&nbsp;&rarr; <span class="signature-returns"> <a href="module-la.Vector.html">module:la.Vector</a></span></span></h3>
              <p>Creates a feature vector from the given record.</p>
              <section>
                <h4>
                  Example
                </h4>
                <div>
                  <pre class="prettyprint"><code>// import qm module
var qm &#x3D; require(&#x27;qminer&#x27;);
// create a base containing the store Class. Let the Name field be the primary field.
var base &#x3D; new qm.Base({
   mode: &quot;createClean&quot;,
   schema: [{
       name: &quot;Class&quot;,
       fields: [
           { name: &quot;Name&quot;, type: &quot;string&quot;, primary: true },
           { name: &quot;StudyGroup&quot;, type: &quot;string&quot; }
       ]
   }]
});
// add some records to the store
base.store(&quot;Class&quot;).push({ Name: &quot;Jeff&quot;, StudyGroup: &quot;A&quot; });
base.store(&quot;Class&quot;).push({ Name: &quot;Britta&quot;, StudyGroup: &quot;D&quot; });
base.store(&quot;Class&quot;).push({ Name: &quot;Abed&quot;, StudyGroup: &quot;C&quot; });
base.store(&quot;Class&quot;).push({ Name: &quot;Annie&quot;, StudyGroup: &quot;B&quot; });
// create a new feature space
// the feature space is of dimensions [0, 4]; 4 is the dimension of the categorical feature extractor
// and 0 is the dimension of text feature extractor (the text feature extractor doesn&#x27;t have any words,
// need to be updated for use).
var ftr &#x3D; new qm.FeatureSpace(base, [
   { type: &quot;text&quot;, source: &quot;Class&quot;, field: &quot;Name&quot;, normalize: false },
   { type: &quot;categorical&quot;, source: &quot;Class&quot;, field: &quot;StudyGroup&quot;, values: [&quot;A&quot;, &quot;B&quot;, &quot;C&quot;, &quot;D&quot;] }
]);
// get the extractor vector for the first record in store
// the sparse vector will be [1, 0, 0, 0] - uses only the categorical feature extractor. There are no
// features in the text feature extractor.
var vec &#x3D; ftr.extractVector(base.store(&quot;Class&quot;)[0]);
base.close();</code></pre>
                </div>
              </section>
              <section>
                <h4>Parameters</h4>
                <table class="jsdoc-details-table">
                  <thead>
                    <tr>
                      <th>Name</th>
                      <th>Type</th>
                      <th>Optional</th>
                      <th>Description</th>
                    </tr>
                  </thead>
                  <tbody>
                    <tr>
                      <td>
                        <p>rec</p>
                      </td>
                      <td>
                        <p><a href="module-qm.Record.html">module:qm.Record</a></p>
                      </td>
                      <td>
                        <p>&nbsp;</p>
                      </td>
                      <td>
                        <p>The given record.</p>
                      </td>
                    </tr>
                    <tr>
                      <td>
                        <p>idx</p>
                      </td>
                      <td>
                        <p>number</p>
                      </td>
                      <td>
                        <p>Yes</p>
                      </td>
                      <td>
                        <p>when given, only use specified feature extractor.</p>
                      </td>
                    </tr>
                  </tbody>
                </table>
              </section>
              <dl class="dl-compact">
                <dt>Returns</dt>
                <dd>
                  <p><code><a href="module-la.Vector.html">module:la.Vector</a></code>B The feature vector gained from <code>rec</code> and <code>idx</code>.</p>
                </dd>
              </dl>
              <h3 id="filter"><span class="symbol-name">filter</span><span class="signature"><span class="signature-params">(vec, idx[, keepOffset])</span>&nbsp;&rarr; <span class="signature-returns"> (<a href="module-la.Vector.html">module:la.Vector</a> or <a href="module-la.SparseVector.html">module:la.SparseVector</a>)</span></span></h3>
              <p>Filters the vector to keep only the elements from the feature extractor.</p>
              <section>
                <h4>
                  Example
                </h4>
                <div>
                  <pre class="prettyprint"><code>// import qm module
var qm &#x3D; require(&#x27;qminer&#x27;);
// create a new base with one store
var base &#x3D; new qm.Base({
   mode: &quot;createClean&quot;,
   schema: [{
       name: &quot;Academics&quot;,
       fields: [
           { name: &quot;Name&quot;, type: &quot;string&quot; },
           { name: &quot;Age&quot;, type: &quot;int&quot; },
           { name: &quot;Gendre&quot;, type: &quot;string&quot; },
           { name: &quot;Skills&quot;, type: &quot;string_v&quot; }
       ]
   }]
});
// create a new feature space
var ftr &#x3D; new qm.FeatureSpace(base, [
    { type: &quot;numeric&quot;, source: &quot;Academics&quot;, field: &quot;Age&quot; },
    { type: &quot;categorical&quot;, source: &quot;Academics&quot;, field: &quot;Gendre&quot;, values: [&quot;Male&quot;, &quot;Female&quot;] },
    { type: &quot;multinomial&quot;, source: &quot;Academics&quot;, field: &quot;Skills&quot;, values: [&quot;Mathematics&quot;, &quot;Programming&quot;, &quot;Philosophy&quot;, &quot;Languages&quot;, &quot;Politics&quot;, &quot;Cooking&quot;] }
    ]);
// create a new dense vector
var vec &#x3D; new qm.la.Vector([40, 0, 1, 0, 1, 1, 1, 0, 0]);
// filter the elements from the second feature extractor
var vec2 &#x3D; ftr.filter(vec, 1); // returns vector [0, 0, 1, 0, 0, 0, 0, 0, 0]
// filter the elements from the second feature extractor, without keeping the offset
var vec3 &#x3D; ftr.filter(vec, 1, false); // returns vector [0, 1]
// create a new sparse vector
var spVec &#x3D; new qm.la.SparseVector([[0, 40], [2, 1], [4, 1], [5, 1], [6, 1]]);
// filter the elements from the second feature extractor
var spVec2 &#x3D; ftr.filter(spVec, 1); // returns sparse vector [[2, 1]]
// filter the elements from the second feature extractor, without keeping the offset
var spVec3 &#x3D; ftr.filter(spVec, 1, false); // returns sparse vector [[1, 1]]
base.close();</code></pre>
                </div>
              </section>
              <section>
                <h4>Parameters</h4>
                <table class="jsdoc-details-table">
                  <thead>
                    <tr>
                      <th>Name</th>
                      <th>Type</th>
                      <th>Optional</th>
                      <th>Description</th>
                    </tr>
                  </thead>
                  <tbody>
                    <tr>
                      <td>
                        <p>vec</p>
                      </td>
                      <td>
                        <p>(<a href="module-la.Vector.html">module:la.Vector</a> or <a href="module-la.SparseVector.html">module:la.SparseVector</a>)</p>
                      </td>
                      <td>
                        <p>&nbsp;</p>
                      </td>
                      <td>
                        <p>The vector from where the function filters the elements.</p>
                      </td>
                    </tr>
                    <tr>
                      <td>
                        <p>idx</p>
                      </td>
                      <td>
                        <p>number</p>
                      </td>
                      <td>
                        <p>&nbsp;</p>
                      </td>
                      <td>
                        <p>The index of the feature extractor.</p>
                      </td>
                    </tr>
                    <tr>
                      <td>
                        <p>keepOffset</p>
                      </td>
                      <td>
                        <p>boolean</p>
                      </td>
                      <td>
                        <p>Yes</p>
                      </td>
                      <td>
                        <p>For keeping the original indexing in the new vector.</p>
                        <p>Defaults to <code>'true'</code>.</p>
                      </td>
                    </tr>
                  </tbody>
                </table>
              </section>
              <dl class="dl-compact">
                <dt>Returns</dt>
                <dd>
                  <p><code>(<a href="module-la.Vector.html">module:la.Vector</a> or <a href="module-la.SparseVector.html">module:la.SparseVector</a>)</code>B <br>1. <a href="module-la.Vector.html">module:la.Vector</a>, if <code>vec</code> is <a href="module-la.Vector.html">module:la.Vector</a>.
                    <br>2. <a href="module-la.SparseVector.html">module:la.SparseVector</a>, if <code>vec</code> is <a href="module-la.SparseVector.html">module:la.SparseVector</a>.
                  </p>
                </dd>
              </dl>
              <h3 id="getFeature"><span class="symbol-name">getFeature</span><span class="signature"><span class="signature-params">(idx)</span>&nbsp;&rarr; <span class="signature-returns"> String</span></span></h3>
              <p>Gives the name of the feature at the given position.</p>
              <section>
                <h4>
                  Example
                </h4>
                <div>
                  <pre class="prettyprint"><code>// import qm module
var qm &#x3D; require(&quot;qminer&quot;);
// create a base containing the store Class. Let the Name field be the primary field.
var base &#x3D; new qm.Base({
   mode: &quot;createClean&quot;,
   schema: [{
       name: &quot;Class&quot;,
       fields: [
           { name: &quot;Name&quot;, type: &quot;string&quot;, primary: true },
           { name: &quot;StudyGroups&quot;, type: &quot;string_v&quot; }
       ]
   }]
});
// add some records to the store
base.store(&quot;Class&quot;).push({ Name: &quot;Dean&quot;, StudyGroups: [&quot;A&quot;, &quot;D&quot;] });
base.store(&quot;Class&quot;).push({ Name: &quot;Chang&quot;, StudyGroups: [&quot;B&quot;, &quot;D&quot;] });
base.store(&quot;Class&quot;).push({ Name: &quot;Magnitude&quot;, StudyGroups: [&quot;B&quot;, &quot;C&quot;] });
base.store(&quot;Class&quot;).push({ Name: &quot;Leonard&quot;, StudyGroups: [&quot;A&quot;, &quot;B&quot;] });
// create a feature space containing the multinomial feature extractor
var ftr &#x3D; new qm.FeatureSpace(base, [
{ type: &quot;text&quot;, source: &quot;Class&quot;, field: &quot;Name&quot; },
{ type: &quot;multinomial&quot;, source: &quot;Class&quot;, field: &quot;StudyGroups&quot;, values: [&quot;A&quot;, &quot;B&quot;, &quot;C&quot;, &quot;D&quot;] }
]);
// get the feature at position 2
var feature &#x3D; ftr.getFeature(2); // returns &quot;C&quot;, because the text extractor has no features at the moment
// update the feature space with the records of the store; see the method updateRecords
ftr.updateRecords(base.store(&quot;Class&quot;).allRecords);
// get the feature at position 2
var feature2 &#x3D; ftr.getFeature(2); // returns &quot;magnitude&quot;
base.close();</code></pre>
                </div>
              </section>
              <section>
                <h4>Parameter</h4>
                <table class="jsdoc-details-table">
                  <thead>
                    <tr>
                      <th>Name</th>
                      <th>Type</th>
                      <th>Optional</th>
                      <th>Description</th>
                    </tr>
                  </thead>
                  <tbody>
                    <tr>
                      <td>
                        <p>idx</p>
                      </td>
                      <td>
                        <p>number</p>
                      </td>
                      <td>
                        <p>&nbsp;</p>
                      </td>
                      <td>
                        <p>The index of the feature in feature space (zero based).</p>
                      </td>
                    </tr>
                  </tbody>
                </table>
              </section>
              <dl class="dl-compact">
                <dt>Returns</dt>
                <dd>
                  <p><code>String</code>B The name of the feature at the position <code>idx</code>.</p>
                </dd>
              </dl>
              <h3 id="getFeatureExtractor"><span class="symbol-name">getFeatureExtractor</span><span class="signature"><span class="signature-params">(idx)</span>&nbsp;&rarr; <span class="signature-returns"> String</span></span></h3>
              <p>Gives the name of feature extractor at given position.</p>
              <section>
                <h4>
                  Example
                </h4>
                <div>
                  <pre class="prettyprint"><code>// import qm module
var qm &#x3D; require(&quot;qminer&quot;);
// create a new base containing one store
var base &#x3D; new qm.Base({
   mode: &quot;createClean&quot;,
   schema: [{
       name: &quot;People&quot;,
       fields: [
           { name: &quot;Name&quot;, type: &quot;string&quot; },
           { name: &quot;Gendre&quot;, type: &quot;string&quot; },
           { name: &quot;Age&quot;, type: &quot;int&quot; }
       ]
   }]
});
// create a feature space containing a categorical and numeric feature extractor
var ftr &#x3D; new qm.FeatureSpace(base, [
   { type: &quot;numeric&quot;, source: &quot;People&quot;, field: &quot;Age&quot; },
   { type: &quot;categorical&quot;, source: &quot;People&quot;, field: &quot;Gendre&quot;, values: [&quot;Male&quot;, &quot;Female&quot;] }
]);
// get the name of the feature extractor with index 1
var extractorName &#x3D; ftr.getFeatureExtractor(1); // returns &quot;Categorical[Gendre]&quot;
base.close();</code></pre>
                </div>
              </section>
              <section>
                <h4>Parameter</h4>
                <table class="jsdoc-details-table">
                  <thead>
                    <tr>
                      <th>Name</th>
                      <th>Type</th>
                      <th>Optional</th>
                      <th>Description</th>
                    </tr>
                  </thead>
                  <tbody>
                    <tr>
                      <td>
                        <p>idx</p>
                      </td>
                      <td>
                        <p>number</p>
                      </td>
                      <td>
                        <p>&nbsp;</p>
                      </td>
                      <td>
                        <p>The index of the feature extractor in feature space (zero based).</p>
                      </td>
                    </tr>
                  </tbody>
                </table>
              </section>
              <dl class="dl-compact">
                <dt>Returns</dt>
                <dd>
                  <p><code>String</code>B The name of the feature extractor at position <code>idx</code>.</p>
                </dd>
              </dl>
              <h3 id="invertFeature"><span class="symbol-name">invertFeature</span><span class="signature"><span class="signature-params">(idx, val)</span>&nbsp;&rarr; <span class="signature-returns"> Object</span></span></h3>
              <p>Calculates the inverse of a single feature using a specific feature extractor.</p>
              <section>
                <h4>
                  Example
                </h4>
                <div>
                  <pre class="prettyprint"><code>// import qm module
var qm &#x3D; require(&#x27;qminer&#x27;);
// create a new base containing one store
var base &#x3D; new qm.Base({
   mode: &quot;createClean&quot;,
   schema: [{
       name: &quot;TheWitcherSaga&quot;,
       fields: [
           { name: &quot;Title&quot;, type: &quot;string&quot; },
           { name: &quot;YearOfRelease&quot;, type: &quot;int&quot; },
           { name: &quot;EnglishEdition&quot;, type: &quot;bool&quot; }
       ]
   }]
});
// put some records in the store
base.store(&quot;TheWitcherSaga&quot;).push({ Title: &quot;Blood of Elves&quot;, YearOfRelease: 1994, EnglishEdition: true });
base.store(&quot;TheWitcherSaga&quot;).push({ Title: &quot;Time of Contempt&quot;, YearOfRelease: 1995, EnglishEdition: true });
base.store(&quot;TheWitcherSaga&quot;).push({ Title: &quot;Baptism of Fire&quot;, YearOfRelease: 1996, EnglishEdition: true });
base.store(&quot;TheWitcherSaga&quot;).push({ Title: &quot;The Swallow&#x27;s Tower&quot;, YearOfRelease: 1997, EnglishEdition: false });
base.store(&quot;TheWitcherSaga&quot;).push({ Title: &quot;Lady of the Lake&quot;, YearOfRelease: 1999, EnglishEdition: false });
base.store(&quot;TheWitcherSaga&quot;).push({ Title: &quot;Season of Storms&quot;, YearOfRelease: 2013, EnglishEdition: false });
// create a feature space with the numeric feature extractor and update the feature space with the records in store
// for update, look the method updateRecords in feature space
var ftr &#x3D; new qm.FeatureSpace(base, { type: &quot;numeric&quot;, source: &quot;TheWitcherSaga&quot;, field: &quot;YearOfRelease&quot;, normalize: true });
ftr.updateRecords(base.store(&quot;TheWitcherSaga&quot;).allRecords);
// because of the numeric feature extractor having normalize: true and of the records update of feature space,
// the values are not equal to those of the records
// invert the value 0 using the numeric feature extractor
var inverse &#x3D; ftr.invertFeature(0, 0); // returns the value 1994
base.close();</code></pre>
                </div>
              </section>
              <section>
                <h4>Parameters</h4>
                <table class="jsdoc-details-table">
                  <thead>
                    <tr>
                      <th>Name</th>
                      <th>Type</th>
                      <th>Optional</th>
                      <th>Description</th>
                    </tr>
                  </thead>
                  <tbody>
                    <tr>
                      <td>
                        <p>idx</p>
                      </td>
                      <td>
                        <p>number</p>
                      </td>
                      <td>
                        <p>&nbsp;</p>
                      </td>
                      <td>
                        <p>The index of the specific feature extractor.</p>
                      </td>
                    </tr>
                    <tr>
                      <td>
                        <p>val</p>
                      </td>
                      <td>
                        <p>Object</p>
                      </td>
                      <td>
                        <p>&nbsp;</p>
                      </td>
                      <td>
                        <p>The value to be inverted.</p>
                      </td>
                    </tr>
                  </tbody>
                </table>
              </section>
              <dl class="dl-compact">
                <dt>Returns</dt>
                <dd>
                  <p><code>Object</code>B The inverse of <code>val</code> using the feature extractor with index <code>idx</code>.</p>
                </dd>
              </dl>
              <h3 id="invertFeatureVector"><span class="symbol-name">invertFeatureVector</span><span class="signature"><span class="signature-params">(ftr)</span>&nbsp;&rarr; <span class="signature-returns"> Array of Object</span></span></h3>
              <p>Performs the inverse operation of <code>ftrVec</code>. Works only for numeric feature extractors.</p>
              <section>
                <h4>
                  Example
                </h4>
                <div>
                  <pre class="prettyprint"><code>// import qm module
var qm &#x3D; require(&#x27;qminer&#x27;);
// create a new base containing one store
var base &#x3D; new qm.Base({
   mode: &quot;createClean&quot;,
   schema: [{
       name: &quot;TheWitcherSaga&quot;,
       fields: [
           { name: &quot;Title&quot;, type: &quot;string&quot; },
           { name: &quot;YearOfRelease&quot;, type: &quot;int&quot; },
           { name: &quot;EnglishEdition&quot;, type: &quot;bool&quot; }
       ]
   }]
});
// put some records in the store
base.store(&quot;TheWitcherSaga&quot;).push({ Title: &quot;Blood of Elves&quot;, YearOfRelease: 1994, EnglishEdition: true });
base.store(&quot;TheWitcherSaga&quot;).push({ Title: &quot;Time of Contempt&quot;, YearOfRelease: 1995, EnglishEdition: true });
base.store(&quot;TheWitcherSaga&quot;).push({ Title: &quot;Baptism of Fire&quot;, YearOfRelease: 1996, EnglishEdition: true });
base.store(&quot;TheWitcherSaga&quot;).push({ Title: &quot;The Swallow&#x27;s Tower&quot;, YearOfRelease: 1997, EnglishEdition: false });
base.store(&quot;TheWitcherSaga&quot;).push({ Title: &quot;Lady of the Lake&quot;, YearOfRelease: 1999, EnglishEdition: false });
base.store(&quot;TheWitcherSaga&quot;).push({ Title: &quot;Season of Storms&quot;, YearOfRelease: 2013, EnglishEdition: false });
// create a feature space with the numeric feature extractor and update the feature space with the records in store
// for update, look the method updateRecords in feature space
var ftr &#x3D; new qm.FeatureSpace(base, { type: &quot;numeric&quot;, source: &quot;TheWitcherSaga&quot;, field: &quot;YearOfRelease&quot;, normalize: true });
ftr.updateRecords(base.store(&quot;TheWitcherSaga&quot;).allRecords);
// get a feature vector for the second record
// because of the numeric feature extractor having normalize: true and of the records update of feature space, the values
// are not equal to those of the records, i.e. the value 1995 is now 0.105263
var ftrVec &#x3D; ftr.extractVector(base.store(&quot;TheWitcherSaga&quot;)[1]);
// get the inverse of the feature vector
// the function returns the values to their first value, i.e. 0.105263 returns to 1995
var inverse &#x3D; ftr.invertFeatureVector(ftrVec); // returns a vector [1995]
base.close();</code></pre>
                </div>
              </section>
              <section>
                <h4>Parameter</h4>
                <table class="jsdoc-details-table">
                  <thead>
                    <tr>
                      <th>Name</th>
                      <th>Type</th>
                      <th>Optional</th>
                      <th>Description</th>
                    </tr>
                  </thead>
                  <tbody>
                    <tr>
                      <td>
                        <p>ftr</p>
                      </td>
                      <td>
                        <p>(<a href="module-la.Vector.html">module:la.Vector</a> or Array of Object)</p>
                      </td>
                      <td>
                        <p>&nbsp;</p>
                      </td>
                      <td>
                        <p>The feature vector or an array with feature values.</p>
                      </td>
                    </tr>
                  </tbody>
                </table>
              </section>
              <dl class="dl-compact">
                <dt>Returns</dt>
                <dd>
                  <p><code>Array of Object</code>B The inverse of <code>ftr</code> as an array.</p>
                </dd>
              </dl>
              <h3 id="save"><span class="symbol-name">save</span><span class="signature"><span class="signature-params">(fout)</span>&nbsp;&rarr; <span class="signature-returns"> <a href="module-fs.FOut.html">module:fs.FOut</a></span></span></h3>
              <p>Serialize the feature space to an output stream.</p>
              <section>
                <h4>Parameter</h4>
                <table class="jsdoc-details-table">
                  <thead>
                    <tr>
                      <th>Name</th>
                      <th>Type</th>
                      <th>Optional</th>
                      <th>Description</th>
                    </tr>
                  </thead>
                  <tbody>
                    <tr>
                      <td>
                        <p>fout</p>
                      </td>
                      <td>
                        <p><a href="module-fs.FOut.html">module:fs.FOut</a></p>
                      </td>
                      <td>
                        <p>&nbsp;</p>
                      </td>
                      <td>
                        <p>The output stream.</p>
                      </td>
                    </tr>
                  </tbody>
                </table>
              </section>
              <dl class="dl-compact">
                <dt>Returns</dt>
                <dd>
                  <p><code><a href="module-fs.FOut.html">module:fs.FOut</a></code>B The output stream <code>fout</code>.</p>
                </dd>
              </dl>
              <h3 id="updateRecord"><span class="symbol-name">updateRecord</span><span class="signature"><span class="signature-params">(rec)</span>&nbsp;&rarr; <span class="signature-returns"> <a href="module-qm.FeatureSpace.html">module:qm.FeatureSpace</a></span></span></h3>
              <p>Updates the feature space definitions and extractors by adding one record.
                <br> For text feature extractors, it can update it's vocabulary by taking into account the new text.
                <br> For numeric feature extractors, it can update the minimal and maximal values used to form the normalization.
                <br> For jsfunc feature extractors, it can update a parameter used in it's function.
                <br> For dateWindow feature extractor, it can update the start and the end of the window period to form the normalization.
              </p>
              <section>
                <h4>
                  Example
                </h4>
                <div>
                  <pre class="prettyprint"><code>// import qm module
var qm &#x3D; require(&#x27;qminer&#x27;);
// create a new base
var base &#x3D; new qm.Base({
  mode: &quot;createClean&quot;,
  schema: {
    name: &quot;FtrSpace&quot;,
    fields: [
      { name: &quot;Value&quot;, type: &quot;float&quot; },
      { name: &quot;Category&quot;, type: &quot;string&quot; },
      { name: &quot;Categories&quot;, type: &quot;string_v&quot; },
    ]
  }
});
// populate the store
Store &#x3D; base.store(&quot;FtrSpace&quot;);
Store.push({ Value: 1.0, Category: &quot;a&quot;, Categories: [&quot;a&quot;, &quot;q&quot;] });
Store.push({ Value: 1.1, Category: &quot;b&quot;, Categories: [&quot;b&quot;, &quot;w&quot;] });
Store.push({ Value: 1.2, Category: &quot;c&quot;, Categories: [&quot;c&quot;, &quot;e&quot;] });
Store.push({ Value: 1.3, Category: &quot;a&quot;, Categories: [&quot;a&quot;, &quot;q&quot;] });
// create a new feature space
var ftr &#x3D; new qm.FeatureSpace(base, [
  { type: &quot;numeric&quot;, source: &quot;FtrSpace&quot;, normalize: true, field: &quot;Value&quot; },
  { type: &quot;categorical&quot;, source: &quot;FtrSpace&quot;, field: &quot;Category&quot;, values: [&quot;a&quot;, &quot;b&quot;, &quot;c&quot;] },
  { type: &quot;multinomial&quot;, source: &quot;FtrSpace&quot;, field: &quot;Categories&quot;, normalize: true, values: [&quot;a&quot;, &quot;b&quot;, &quot;c&quot;, &quot;q&quot;, &quot;w&quot;, &quot;e&quot;] }
]);
// update the feature space with the first three record of the store
ftr.updateRecord(Store[0]);
ftr.updateRecord(Store[1]);
ftr.updateRecord(Store[2]);
// get the feature vectors of these records
ftr.extractVector(Store[0]); // returns the vector [0, 1, 0, 0, 1 / Math.sqrt(2), 0, 0, 1 / Math.sqrt(2), 0, 0]
ftr.extractVector(Store[1]); // returns the vector [1/2, 0, 1, 0, 0, 1 / Math.sqrt(2), 0, 0, 1 / Math.sqrt(2), 0]
ftr.extractVector(Store[2]); // returns the vector [1, 0, 0, 1, 0, 0, 1 / Math.sqrt(2), 0, 0, 1 / Math.sqrt(2)]
base.close();</code></pre>
                </div>
              </section>
              <section>
                <h4>Parameter</h4>
                <table class="jsdoc-details-table">
                  <thead>
                    <tr>
                      <th>Name</th>
                      <th>Type</th>
                      <th>Optional</th>
                      <th>Description</th>
                    </tr>
                  </thead>
                  <tbody>
                    <tr>
                      <td>
                        <p>rec</p>
                      </td>
                      <td>
                        <p><a href="module-qm.Record.html">module:qm.Record</a></p>
                      </td>
                      <td>
                        <p>&nbsp;</p>
                      </td>
                      <td>
                        <p>The record, which updates the feature space.</p>
                      </td>
                    </tr>
                  </tbody>
                </table>
              </section>
              <dl class="dl-compact">
                <dt>Returns</dt>
                <dd>
                  <p><code><a href="module-qm.FeatureSpace.html">module:qm.FeatureSpace</a></code>B Self. The feature space has been updated.</p>
                </dd>
              </dl>
              <h3 id="updateRecords"><span class="symbol-name">updateRecords</span><span class="signature"><span class="signature-params">(rs)</span>&nbsp;&rarr; <span class="signature-returns"> <a href="module-qm.FeatureSpace.html">module:qm.FeatureSpace</a></span></span></h3>
              <p>Updates the feature space definitions and extractors by adding all the records of a record set.
                <br> For text feature extractors, it can update it's vocabulary by taking into account the new text.
                <br> For numeric feature extractors, it can update the minimal and maximal values used to form the normalization.
                <br> For jsfunc feature extractors, it can update a parameter used in it's function.
                <br> For dateWindow feature extractor, it can update the start and the end of the window period to form the normalization.
              </p>
              <section>
                <h4>
                  Example
                </h4>
                <div>
                  <pre class="prettyprint"><code>// import qm module
var qm &#x3D; require(&#x27;qminer&#x27;);
// create a new base
var base &#x3D; new qm.Base({
  mode: &quot;createClean&quot;,
  schema: {
    name: &quot;FtrSpace&quot;,
    fields: [
      { name: &quot;Value&quot;, type: &quot;float&quot; },
      { name: &quot;Category&quot;, type: &quot;string&quot; },
      { name: &quot;Categories&quot;, type: &quot;string_v&quot; },
    ]
  }
});
// populate the store
Store &#x3D; base.store(&quot;FtrSpace&quot;);
Store.push({ Value: 1.0, Category: &quot;a&quot;, Categories: [&quot;a&quot;, &quot;q&quot;] });
Store.push({ Value: 1.1, Category: &quot;b&quot;, Categories: [&quot;b&quot;, &quot;w&quot;] });
Store.push({ Value: 1.2, Category: &quot;c&quot;, Categories: [&quot;c&quot;, &quot;e&quot;] });
Store.push({ Value: 1.3, Category: &quot;a&quot;, Categories: [&quot;a&quot;, &quot;q&quot;] });
// create a new feature space
var ftr &#x3D; new qm.FeatureSpace(base, [
    { type: &quot;numeric&quot;, source: &quot;FtrSpace&quot;, normalize: true, field: &quot;Value&quot; },
    { type: &quot;categorical&quot;, source: &quot;FtrSpace&quot;, field: &quot;Category&quot;, values: [&quot;a&quot;, &quot;b&quot;, &quot;c&quot;] },
    { type: &quot;multinomial&quot;, source: &quot;FtrSpace&quot;, field: &quot;Categories&quot;, normalize: true, values: [&quot;a&quot;, &quot;b&quot;, &quot;c&quot;, &quot;q&quot;, &quot;w&quot;, &quot;e&quot;] }
]);
// update the feature space with the record set
ftr.updateRecords(Store.allRecords);
// get the feature vectors of these records
ftr.extractVector(Store[0]); // returns the vector [0, 1, 0, 0, 1 / Math.sqrt(2), 0, 0, 1 / Math.sqrt(2), 0, 0]
ftr.extractVector(Store[1]); // returns the vector [1/3, 0, 1, 0, 0, 1 / Math.sqrt(2), 0, 0, 1 / Math.sqrt(2), 0]
ftr.extractVector(Store[2]); // returns the vector [2/3, 0, 0, 1, 0, 0, 1 / Math.sqrt(2), 0, 0, 1 / Math.sqrt(2)]
ftr.extractVector(Store[3]); // returns the vector [1, 1, 0, 0, 1 / Math.sqrt(2), 0, 0, 1 / Math.sqrt(2), 0, 0]
base.close();</code></pre>
                </div>
              </section>
              <section>
                <h4>Parameter</h4>
                <table class="jsdoc-details-table">
                  <thead>
                    <tr>
                      <th>Name</th>
                      <th>Type</th>
                      <th>Optional</th>
                      <th>Description</th>
                    </tr>
                  </thead>
                  <tbody>
                    <tr>
                      <td>
                        <p>rs</p>
                      </td>
                      <td>
                        <p><a href="module-qm.RecordSet.html">module:qm.RecordSet</a></p>
                      </td>
                      <td>
                        <p>&nbsp;</p>
                      </td>
                      <td>
                        <p>The record set, which updates the feature space.</p>
                      </td>
                    </tr>
                  </tbody>
                </table>
              </section>
              <dl class="dl-compact">
                <dt>Returns</dt>
                <dd>
                  <p><code><a href="module-qm.FeatureSpace.html">module:qm.FeatureSpace</a></code>B Self. The feature space has been updated.</p>
                </dd>
              </dl>
            </section>
          </section>
        </div>
      </div>
      <nav id="jsdoc-toc-nav" role="navigation"></nav>
    </div>
  </div>
  <footer id="jsdoc-footer" class="jsdoc-footer">
    <div id="jsdoc-footer-container">
      <p>
        
      </p>
    </div>
  </footer>
  <script src="scripts/jquery.min.js"></script>
  <script src="scripts/tree.jquery.js"></script>
  <script src="scripts/prettify.js"></script>
  <script src="scripts/jsdoc-toc.js"></script>
  <script src="scripts/linenumber.js"></script>
  <script src="scripts/scrollanchor.js"></script>
</body>

</html>