Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Mar 27, 2024
1 parent b4a9223 commit 79760db
Show file tree
Hide file tree
Showing 11 changed files with 345 additions and 127 deletions.
146 changes: 78 additions & 68 deletions docs/attacks/blackbox_attacks.html → docs/attacks/all_attacks.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1" />
<meta name="generator" content="pdoc 0.10.0" />
<title>mimir.attacks.blackbox_attacks API documentation</title>
<title>mimir.attacks.all_attacks API documentation</title>
<meta name="description" content="Enum class for attacks. Also contains the base attack class." />
<link rel="preload stylesheet" as="style" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/11.0.1/sanitize.min.css" integrity="sha256-PK9q560IAAa6WVRRh76LtCaI8pjTJ2z11v0miyNNjrs=" crossorigin>
<link rel="preload stylesheet" as="style" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/11.0.1/typography.min.css" integrity="sha256-7l/o7C8jubJiy74VsKTidCy1yBkRtiUGbVkYBylBqUg=" crossorigin>
Expand All @@ -19,7 +19,7 @@
<main>
<article id="content">
<header>
<h1 class="title">Module <code>mimir.attacks.blackbox_attacks</code></h1>
<h1 class="title">Module <code>mimir.attacks.all_attacks</code></h1>
</header>
<section id="section-intro">
<p>Enum class for attacks. Also contains the base attack class.</p>
Expand All @@ -36,22 +36,24 @@ <h1 class="title">Module <code>mimir.attacks.blackbox_attacks</code></h1>


# Attack definitions
class BlackBoxAttacks(str, Enum):
class AllAttacks(str, Enum):
LOSS = &#34;loss&#34; # Done
REFERENCE_BASED = &#34;ref&#34; # Done
ZLIB = &#34;zlib&#34; # Done
MIN_K = &#34;min_k&#34; # Done
NEIGHBOR = &#34;ne&#34; # Done
GRADNORM = &#34;gradnorm&#34; # Done
# QUANTILE = &#34;quantile&#34; # Uncomment when tested implementation is available


# Base attack class
class Attack:
def __init__(self, config, target_model: Model, ref_model: Model = None):
def __init__(self, config, target_model: Model, ref_model: Model = None, is_blackbox: bool = True):
self.config = config
self.target_model = target_model
self.ref_model = ref_model
self.is_loaded = False
self.is_blackbox = is_blackbox

def load(self):
&#34;&#34;&#34;
Expand Down Expand Up @@ -105,9 +107,61 @@ <h1 class="title">Module <code>mimir.attacks.blackbox_attacks</code></h1>
<section>
<h2 class="section-title" id="header-classes">Classes</h2>
<dl>
<dt id="mimir.attacks.blackbox_attacks.Attack"><code class="flex name class">
<dt id="mimir.attacks.all_attacks.AllAttacks"><code class="flex name class">
<span>class <span class="ident">AllAttacks</span></span>
<span>(</span><span>value, names=None, *, module=None, qualname=None, type=None, start=1)</span>
</code></dt>
<dd>
<div class="desc"><p>An enumeration.</p></div>
<details class="source">
<summary>
<span>Expand source code</span>
</summary>
<pre><code class="python">class AllAttacks(str, Enum):
LOSS = &#34;loss&#34; # Done
REFERENCE_BASED = &#34;ref&#34; # Done
ZLIB = &#34;zlib&#34; # Done
MIN_K = &#34;min_k&#34; # Done
NEIGHBOR = &#34;ne&#34; # Done
GRADNORM = &#34;gradnorm&#34; # Done
# QUANTILE = &#34;quantile&#34; # Uncomment when tested implementation is available</code></pre>
</details>
<h3>Ancestors</h3>
<ul class="hlist">
<li>builtins.str</li>
<li>enum.Enum</li>
</ul>
<h3>Class variables</h3>
<dl>
<dt id="mimir.attacks.all_attacks.AllAttacks.GRADNORM"><code class="name">var <span class="ident">GRADNORM</span></code></dt>
<dd>
<div class="desc"></div>
</dd>
<dt id="mimir.attacks.all_attacks.AllAttacks.LOSS"><code class="name">var <span class="ident">LOSS</span></code></dt>
<dd>
<div class="desc"></div>
</dd>
<dt id="mimir.attacks.all_attacks.AllAttacks.MIN_K"><code class="name">var <span class="ident">MIN_K</span></code></dt>
<dd>
<div class="desc"></div>
</dd>
<dt id="mimir.attacks.all_attacks.AllAttacks.NEIGHBOR"><code class="name">var <span class="ident">NEIGHBOR</span></code></dt>
<dd>
<div class="desc"></div>
</dd>
<dt id="mimir.attacks.all_attacks.AllAttacks.REFERENCE_BASED"><code class="name">var <span class="ident">REFERENCE_BASED</span></code></dt>
<dd>
<div class="desc"></div>
</dd>
<dt id="mimir.attacks.all_attacks.AllAttacks.ZLIB"><code class="name">var <span class="ident">ZLIB</span></code></dt>
<dd>
<div class="desc"></div>
</dd>
</dl>
</dd>
<dt id="mimir.attacks.all_attacks.Attack"><code class="flex name class">
<span>class <span class="ident">Attack</span></span>
<span>(</span><span>config, target_model: <a title="mimir.models.Model" href="../models.html#mimir.models.Model">Model</a>, ref_model: <a title="mimir.models.Model" href="../models.html#mimir.models.Model">Model</a> = None)</span>
<span>(</span><span>config, target_model: <a title="mimir.models.Model" href="../models.html#mimir.models.Model">Model</a>, ref_model: <a title="mimir.models.Model" href="../models.html#mimir.models.Model">Model</a> = None, is_blackbox: bool = True)</span>
</code></dt>
<dd>
<div class="desc"></div>
Expand All @@ -116,11 +170,12 @@ <h2 class="section-title" id="header-classes">Classes</h2>
<span>Expand source code</span>
</summary>
<pre><code class="python">class Attack:
def __init__(self, config, target_model: Model, ref_model: Model = None):
def __init__(self, config, target_model: Model, ref_model: Model = None, is_blackbox: bool = True):
self.config = config
self.target_model = target_model
self.ref_model = ref_model
self.is_loaded = False
self.is_blackbox = is_blackbox

def load(self):
&#34;&#34;&#34;
Expand Down Expand Up @@ -166,6 +221,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
</details>
<h3>Subclasses</h3>
<ul class="hlist">
<li><a title="mimir.attacks.gradnorm.GradNormAttack" href="gradnorm.html#mimir.attacks.gradnorm.GradNormAttack">GradNormAttack</a></li>
<li><a title="mimir.attacks.loss.LOSSAttack" href="loss.html#mimir.attacks.loss.LOSSAttack">LOSSAttack</a></li>
<li><a title="mimir.attacks.min_k.MinKProbAttack" href="min_k.html#mimir.attacks.min_k.MinKProbAttack">MinKProbAttack</a></li>
<li><a title="mimir.attacks.neighborhood.NeighborhoodAttack" href="neighborhood.html#mimir.attacks.neighborhood.NeighborhoodAttack">NeighborhoodAttack</a></li>
Expand All @@ -175,7 +231,7 @@ <h3>Subclasses</h3>
</ul>
<h3>Methods</h3>
<dl>
<dt id="mimir.attacks.blackbox_attacks.Attack.attack"><code class="name flex">
<dt id="mimir.attacks.all_attacks.Attack.attack"><code class="name flex">
<span>def <span class="ident">attack</span></span>(<span>self, document, probs, **kwargs)</span>
</code></dt>
<dd>
Expand Down Expand Up @@ -208,7 +264,7 @@ <h3>Methods</h3>
return score</code></pre>
</details>
</dd>
<dt id="mimir.attacks.blackbox_attacks.Attack.load"><code class="name flex">
<dt id="mimir.attacks.all_attacks.Attack.load"><code class="name flex">
<span>def <span class="ident">load</span></span>(<span>self)</span>
</code></dt>
<dd>
Expand All @@ -226,7 +282,7 @@ <h3>Methods</h3>
self.is_loaded = True</code></pre>
</details>
</dd>
<dt id="mimir.attacks.blackbox_attacks.Attack.unload"><code class="name flex">
<dt id="mimir.attacks.all_attacks.Attack.unload"><code class="name flex">
<span>def <span class="ident">unload</span></span>(<span>self)</span>
</code></dt>
<dd>
Expand All @@ -243,53 +299,6 @@ <h3>Methods</h3>
</dd>
</dl>
</dd>
<dt id="mimir.attacks.blackbox_attacks.BlackBoxAttacks"><code class="flex name class">
<span>class <span class="ident">BlackBoxAttacks</span></span>
<span>(</span><span>value, names=None, *, module=None, qualname=None, type=None, start=1)</span>
</code></dt>
<dd>
<div class="desc"><p>An enumeration.</p></div>
<details class="source">
<summary>
<span>Expand source code</span>
</summary>
<pre><code class="python">class BlackBoxAttacks(str, Enum):
LOSS = &#34;loss&#34; # Done
REFERENCE_BASED = &#34;ref&#34; # Done
ZLIB = &#34;zlib&#34; # Done
MIN_K = &#34;min_k&#34; # Done
NEIGHBOR = &#34;ne&#34; # Done
# QUANTILE = &#34;quantile&#34; # Uncomment when tested implementation is available</code></pre>
</details>
<h3>Ancestors</h3>
<ul class="hlist">
<li>builtins.str</li>
<li>enum.Enum</li>
</ul>
<h3>Class variables</h3>
<dl>
<dt id="mimir.attacks.blackbox_attacks.BlackBoxAttacks.LOSS"><code class="name">var <span class="ident">LOSS</span></code></dt>
<dd>
<div class="desc"></div>
</dd>
<dt id="mimir.attacks.blackbox_attacks.BlackBoxAttacks.MIN_K"><code class="name">var <span class="ident">MIN_K</span></code></dt>
<dd>
<div class="desc"></div>
</dd>
<dt id="mimir.attacks.blackbox_attacks.BlackBoxAttacks.NEIGHBOR"><code class="name">var <span class="ident">NEIGHBOR</span></code></dt>
<dd>
<div class="desc"></div>
</dd>
<dt id="mimir.attacks.blackbox_attacks.BlackBoxAttacks.REFERENCE_BASED"><code class="name">var <span class="ident">REFERENCE_BASED</span></code></dt>
<dd>
<div class="desc"></div>
</dd>
<dt id="mimir.attacks.blackbox_attacks.BlackBoxAttacks.ZLIB"><code class="name">var <span class="ident">ZLIB</span></code></dt>
<dd>
<div class="desc"></div>
</dd>
</dl>
</dd>
</dl>
</section>
</article>
Expand All @@ -312,21 +321,22 @@ <h1>Index</h1>
<li><h3><a href="#header-classes">Classes</a></h3>
<ul>
<li>
<h4><code><a title="mimir.attacks.blackbox_attacks.Attack" href="#mimir.attacks.blackbox_attacks.Attack">Attack</a></code></h4>
<ul class="">
<li><code><a title="mimir.attacks.blackbox_attacks.Attack.attack" href="#mimir.attacks.blackbox_attacks.Attack.attack">attack</a></code></li>
<li><code><a title="mimir.attacks.blackbox_attacks.Attack.load" href="#mimir.attacks.blackbox_attacks.Attack.load">load</a></code></li>
<li><code><a title="mimir.attacks.blackbox_attacks.Attack.unload" href="#mimir.attacks.blackbox_attacks.Attack.unload">unload</a></code></li>
<h4><code><a title="mimir.attacks.all_attacks.AllAttacks" href="#mimir.attacks.all_attacks.AllAttacks">AllAttacks</a></code></h4>
<ul class="two-column">
<li><code><a title="mimir.attacks.all_attacks.AllAttacks.GRADNORM" href="#mimir.attacks.all_attacks.AllAttacks.GRADNORM">GRADNORM</a></code></li>
<li><code><a title="mimir.attacks.all_attacks.AllAttacks.LOSS" href="#mimir.attacks.all_attacks.AllAttacks.LOSS">LOSS</a></code></li>
<li><code><a title="mimir.attacks.all_attacks.AllAttacks.MIN_K" href="#mimir.attacks.all_attacks.AllAttacks.MIN_K">MIN_K</a></code></li>
<li><code><a title="mimir.attacks.all_attacks.AllAttacks.NEIGHBOR" href="#mimir.attacks.all_attacks.AllAttacks.NEIGHBOR">NEIGHBOR</a></code></li>
<li><code><a title="mimir.attacks.all_attacks.AllAttacks.REFERENCE_BASED" href="#mimir.attacks.all_attacks.AllAttacks.REFERENCE_BASED">REFERENCE_BASED</a></code></li>
<li><code><a title="mimir.attacks.all_attacks.AllAttacks.ZLIB" href="#mimir.attacks.all_attacks.AllAttacks.ZLIB">ZLIB</a></code></li>
</ul>
</li>
<li>
<h4><code><a title="mimir.attacks.blackbox_attacks.BlackBoxAttacks" href="#mimir.attacks.blackbox_attacks.BlackBoxAttacks">BlackBoxAttacks</a></code></h4>
<h4><code><a title="mimir.attacks.all_attacks.Attack" href="#mimir.attacks.all_attacks.Attack">Attack</a></code></h4>
<ul class="">
<li><code><a title="mimir.attacks.blackbox_attacks.BlackBoxAttacks.LOSS" href="#mimir.attacks.blackbox_attacks.BlackBoxAttacks.LOSS">LOSS</a></code></li>
<li><code><a title="mimir.attacks.blackbox_attacks.BlackBoxAttacks.MIN_K" href="#mimir.attacks.blackbox_attacks.BlackBoxAttacks.MIN_K">MIN_K</a></code></li>
<li><code><a title="mimir.attacks.blackbox_attacks.BlackBoxAttacks.NEIGHBOR" href="#mimir.attacks.blackbox_attacks.BlackBoxAttacks.NEIGHBOR">NEIGHBOR</a></code></li>
<li><code><a title="mimir.attacks.blackbox_attacks.BlackBoxAttacks.REFERENCE_BASED" href="#mimir.attacks.blackbox_attacks.BlackBoxAttacks.REFERENCE_BASED">REFERENCE_BASED</a></code></li>
<li><code><a title="mimir.attacks.blackbox_attacks.BlackBoxAttacks.ZLIB" href="#mimir.attacks.blackbox_attacks.BlackBoxAttacks.ZLIB">ZLIB</a></code></li>
<li><code><a title="mimir.attacks.all_attacks.Attack.attack" href="#mimir.attacks.all_attacks.Attack.attack">attack</a></code></li>
<li><code><a title="mimir.attacks.all_attacks.Attack.load" href="#mimir.attacks.all_attacks.Attack.load">load</a></code></li>
<li><code><a title="mimir.attacks.all_attacks.Attack.unload" href="#mimir.attacks.all_attacks.Attack.unload">unload</a></code></li>
</ul>
</li>
</ul>
Expand Down
Loading

0 comments on commit 79760db

Please sign in to comment.