Files
PINE/docs/build/html/autoapi/pine/pipelines/NER_API/index.html
Laura Glendenning d9cdcf1721 Updates from internal development branch.
This includes two main features:

1. Add/fix status/train/predict endpoints for pipelines.
2. Add OpenAPI specification for backend API.
2021-08-04 11:38:21 -04:00

232 lines
20 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>pine.pipelines.NER_API &#8212; pine documentation</title>
<link rel="stylesheet" href="../../../../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../../../../_static/bizstyle.css" type="text/css" />
<link rel="stylesheet" type="text/css" href="../../../../_static/graphviz.css" />
<script id="documentation_options" data-url_root="../../../../" src="../../../../_static/documentation_options.js"></script>
<script src="../../../../_static/jquery.js"></script>
<script src="../../../../_static/underscore.js"></script>
<script src="../../../../_static/doctools.js"></script>
<script src="../../../../_static/bizstyle.js"></script>
<link rel="index" title="Index" href="../../../../genindex.html" />
<link rel="search" title="Search" href="../../../../search.html" />
<link rel="next" title="pine.pipelines.RankingFunctions" href="../RankingFunctions/index.html" />
<link rel="prev" title="pine.pipelines.NERWrapper" href="../NERWrapper/index.html" />
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
<!--[if lt IE 9]>
<script src="_static/css3-mediaqueries.js"></script>
<![endif]-->
</head><body>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../../../../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="../../../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="../RankingFunctions/index.html" title="pine.pipelines.RankingFunctions"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="../NERWrapper/index.html" title="pine.pipelines.NERWrapper"
accesskey="P">previous</a> |</li>
<li class="nav-item nav-item-0"><a href="../../../../index.html">pine documentation</a> &#187;</li>
<li class="nav-item nav-item-1"><a href="../../../index.html" >API Reference</a> &#187;</li>
<li class="nav-item nav-item-2"><a href="../../index.html" ><code class="xref py py-mod docutils literal notranslate"><span class="pre">pine</span></code></a> &#187;</li>
<li class="nav-item nav-item-3"><a href="../index.html" accesskey="U"><code class="xref py py-mod docutils literal notranslate"><span class="pre">pine.pipelines</span></code></a> &#187;</li>
<li class="nav-item nav-item-this"><a href=""><code class="xref py py-mod docutils literal notranslate"><span class="pre">pine.pipelines.NER_API</span></code></a></li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="module-pine.pipelines.NER_API">
<span id="pine-pipelines-ner-api"></span><h1><a class="reference internal" href="#module-pine.pipelines.NER_API" title="pine.pipelines.NER_API"><code class="xref py py-mod docutils literal notranslate"><span class="pre">pine.pipelines.NER_API</span></code></a><a class="headerlink" href="#module-pine.pipelines.NER_API" title="Permalink to this headline"></a></h1>
<div class="section" id="module-contents">
<h2>Module Contents<a class="headerlink" href="#module-contents" title="Permalink to this headline"></a></h2>
<div class="section" id="classes">
<h3>Classes<a class="headerlink" href="#classes" title="Permalink to this headline"></a></h3>
<table class="longtable docutils align-default">
<colgroup>
<col style="width: 10%" />
<col style="width: 90%" />
</colgroup>
<tbody>
<tr class="row-odd"><td><p><a class="reference internal" href="#pine.pipelines.NER_API.ner_api" title="pine.pipelines.NER_API.ner_api"><code class="xref py py-obj docutils literal notranslate"><span class="pre">ner_api</span></code></a></p></td>
<td><p></p></td>
</tr>
</tbody>
</table>
<dl class="py data">
<dt id="pine.pipelines.NER_API.logger">
<code class="sig-prename descclassname"><span class="pre">pine.pipelines.NER_API.</span></code><code class="sig-name descname"><span class="pre">logger</span></code><a class="headerlink" href="#pine.pipelines.NER_API.logger" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="py data">
<dt id="pine.pipelines.NER_API.config">
<code class="sig-prename descclassname"><span class="pre">pine.pipelines.NER_API.</span></code><code class="sig-name descname"><span class="pre">config</span></code><a class="headerlink" href="#pine.pipelines.NER_API.config" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="py class">
<dt id="pine.pipelines.NER_API.ner_api">
<em class="property"><span class="pre">class</span> </em><code class="sig-prename descclassname"><span class="pre">pine.pipelines.NER_API.</span></code><code class="sig-name descname"><span class="pre">ner_api</span></code><a class="headerlink" href="#pine.pipelines.NER_API.ner_api" title="Permalink to this definition"></a></dt>
<dd><p>Bases: <a class="reference external" href="https://docs.python.org/3/library/functions.html#object" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></a></p>
<dl class="py method">
<dt id="pine.pipelines.NER_API.ner_api.status">
<code class="sig-name descname"><span class="pre">status</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">classifier_id</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">pipeline_name</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em><span class="sig-paren">)</span> &#x2192; <a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#dict" title="(in Python v3.9)"><span class="pre">dict</span></a><a class="headerlink" href="#pine.pipelines.NER_API.ner_api.status" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="py method">
<dt id="pine.pipelines.NER_API.ner_api.perform_fold">
<code class="sig-name descname"><span class="pre">perform_fold</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">model</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference internal" href="../pmap_ner/index.html#pine.pipelines.pmap_ner.NER" title="pine.pipelines.pmap_ner.NER"><span class="pre">pine.pipelines.pmap_ner.NER</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">train_data</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">test_data</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">pipeline_parameters</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pine.pipelines.NER_API.ner_api.perform_fold" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="py method">
<dt id="pine.pipelines.NER_API.ner_api.perform_five_fold">
<code class="sig-name descname"><span class="pre">perform_five_fold</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">model</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference internal" href="../pmap_ner/index.html#pine.pipelines.pmap_ner.NER" title="pine.pipelines.pmap_ner.NER"><span class="pre">pine.pipelines.pmap_ner.NER</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">documents</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">annotations</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">doc_ids</span></span></em>, <em class="sig-param"><span class="o"><span class="pre">**</span></span><span class="n"><span class="pre">pipeline_parameters</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pine.pipelines.NER_API.ner_api.perform_five_fold" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="py method">
<dt id="pine.pipelines.NER_API.ner_api.get_document_ranking">
<code class="sig-name descname"><span class="pre">get_document_ranking</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">model</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference internal" href="../pmap_ner/index.html#pine.pipelines.pmap_ner.NER" title="pine.pipelines.pmap_ner.NER"><span class="pre">pine.pipelines.pmap_ner.NER</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">doc_map</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">Dict</span><span class="p"><span class="pre">[</span></span><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a><span class="p"><span class="pre">,</span> </span><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a><span class="p"><span class="pre">]</span></span></span></em>, <em class="sig-param"><span class="n"><span class="pre">doc_ids</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">List</span><span class="p"><span class="pre">[</span></span><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a><span class="p"><span class="pre">]</span></span></span></em><span class="sig-paren">)</span> &#x2192; <span class="pre">List</span><span class="p"><span class="pre">[</span></span><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a><span class="p"><span class="pre">]</span></span><a class="headerlink" href="#pine.pipelines.NER_API.ner_api.get_document_ranking" title="Permalink to this definition"></a></dt>
<dd><p>Calculates document rankings and returns document IDs sorted by ranking.</p>
<p>The ranking should be which documents should be evaluated first. This probably
corresponds in some ways to the documents which the model is least confident about.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>model</strong> NER model</p></li>
<li><p><strong>doc_map</strong> dict: mapping of document IDs to document text where overlap is 0</p></li>
<li><p><strong>doc_ids</strong> list: IDs of documents where ???</p></li>
</ul>
</dd>
<dt class="field-even">Returns</dt>
<dd class="field-even"><p>sorted document IDs</p>
</dd>
<dt class="field-odd">Return type</dt>
<dd class="field-odd"><p><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(in Python v3.9)">list</a></p>
</dd>
</dl>
</dd></dl>
<dl class="py method">
<dt id="pine.pipelines.NER_API.ner_api.get_classifier_pipeline_metrics_objs">
<code class="sig-name descname"><span class="pre">get_classifier_pipeline_metrics_objs</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">classifier_id</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pine.pipelines.NER_API.ner_api.get_classifier_pipeline_metrics_objs" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="py method">
<dt id="pine.pipelines.NER_API.ner_api.train_model">
<code class="sig-name descname"><span class="pre">train_model</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">custom_filename</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">classifier_id</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">pipeline_name</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pine.pipelines.NER_API.ner_api.train_model" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
<dl class="py method">
<dt id="pine.pipelines.NER_API.ner_api.predict">
<code class="sig-name descname"><span class="pre">predict</span></code><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">classifier_id</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">pipeline_name</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a></span></em>, <em class="sig-param"><span class="n"><span class="pre">document_ids</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">List</span><span class="p"><span class="pre">[</span></span><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a><span class="p"><span class="pre">]</span></span></span></em>, <em class="sig-param"><span class="n"><span class="pre">texts</span></span><span class="p"><span class="pre">:</span></span> <span class="n"><span class="pre">List</span><span class="p"><span class="pre">[</span></span><a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.9)"><span class="pre">str</span></a><span class="p"><span class="pre">]</span></span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#pine.pipelines.NER_API.ner_api.predict" title="Permalink to this definition"></a></dt>
<dd></dd></dl>
</dd></dl>
</div>
</div>
</div>
<div class="clearer"></div>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h3><a href="../../../../index.html">Table of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#"><code class="xref py py-mod docutils literal notranslate"><span class="pre">pine.pipelines.NER_API</span></code></a><ul>
<li><a class="reference internal" href="#module-contents">Module Contents</a><ul>
<li><a class="reference internal" href="#classes">Classes</a><ul>
<li><a class="reference internal" href="#pine.pipelines.NER_API.logger">logger</a></li>
<li><a class="reference internal" href="#pine.pipelines.NER_API.config">config</a></li>
<li><a class="reference internal" href="#pine.pipelines.NER_API.ner_api">ner_api</a><ul>
<li><a class="reference internal" href="#pine.pipelines.NER_API.ner_api.status">status</a></li>
<li><a class="reference internal" href="#pine.pipelines.NER_API.ner_api.perform_fold">perform_fold</a></li>
<li><a class="reference internal" href="#pine.pipelines.NER_API.ner_api.perform_five_fold">perform_five_fold</a></li>
<li><a class="reference internal" href="#pine.pipelines.NER_API.ner_api.get_document_ranking">get_document_ranking</a></li>
<li><a class="reference internal" href="#pine.pipelines.NER_API.ner_api.get_classifier_pipeline_metrics_objs">get_classifier_pipeline_metrics_objs</a></li>
<li><a class="reference internal" href="#pine.pipelines.NER_API.ner_api.train_model">train_model</a></li>
<li><a class="reference internal" href="#pine.pipelines.NER_API.ner_api.predict">predict</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="../NERWrapper/index.html"
title="previous chapter"><code class="xref py py-mod docutils literal notranslate"><span class="pre">pine.pipelines.NERWrapper</span></code></a></p>
<h4>Next topic</h4>
<p class="topless"><a href="../RankingFunctions/index.html"
title="next chapter"><code class="xref py py-mod docutils literal notranslate"><span class="pre">pine.pipelines.RankingFunctions</span></code></a></p>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../../../../_sources/autoapi/pine/pipelines/NER_API/index.rst.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="../../../../search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" />
<input type="submit" value="Go" />
</form>
</div>
</div>
<script>$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../../../../genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="../../../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="../RankingFunctions/index.html" title="pine.pipelines.RankingFunctions"
>next</a> |</li>
<li class="right" >
<a href="../NERWrapper/index.html" title="pine.pipelines.NERWrapper"
>previous</a> |</li>
<li class="nav-item nav-item-0"><a href="../../../../index.html">pine documentation</a> &#187;</li>
<li class="nav-item nav-item-1"><a href="../../../index.html" >API Reference</a> &#187;</li>
<li class="nav-item nav-item-2"><a href="../../index.html" ><code class="xref py py-mod docutils literal notranslate"><span class="pre">pine</span></code></a> &#187;</li>
<li class="nav-item nav-item-3"><a href="../index.html" ><code class="xref py py-mod docutils literal notranslate"><span class="pre">pine.pipelines</span></code></a> &#187;</li>
<li class="nav-item nav-item-this"><a href=""><code class="xref py py-mod docutils literal notranslate"><span class="pre">pine.pipelines.NER_API</span></code></a></li>
</ul>
</div>
<div class="footer" role="contentinfo">
&#169; Copyright (C) 2019 The Johns Hopkins University Applied Physics Laboratory LLC..
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 3.5.3.
</div>
</body>
</html>