text:
<?xml version="1.0" encoding="UTF-8"?>
<billStatus>
  <bill>
    <cosponsors>
      <item>
        <identifiers>
          <bioguideId>M001137</bioguideId>
          <lisID>1506</lisID>
          <gpoId>8067</gpoId>
        </identifiers>
        <party>D</party>
        <middleName>W.</middleName>
        <district>5</district>
        <firstName>GREGORY</firstName>
        <bioguideId>M001137</bioguideId>
        <lastName>MEEKS</lastName>
        <sponsorshipDate>2017-04-26</sponsorshipDate>
        <state>NY</state>
        <sponsorshipWithdrawnDate />
        <fullName>Rep. Meeks, Gregory W. [D-NY-5]</fullName>
        <isOriginalCosponsor>False</isOriginalCosponsor>
      </item>
      <item>
        <identifiers>
          <bioguideId>M001160</bioguideId>
          <lisID>1811</lisID>
          <gpoId>8217</gpoId>
        </identifiers>
        <party>D</party>
        <middleName />
        <district>4</district>
        <firstName>Gwen</firstName>
        <bioguideId>M001160</bioguideId>
        <lastName>Moore</lastName>
        <sponsorshipDate>2017-04-26</sponsorshipDate>
        <state>WI</state>
        <sponsorshipWithdrawnDate />
        <fullName>Rep. Moore, Gwen [D-WI-4]</fullName>
        <isOriginalCosponsor>False</isOriginalCosponsor>
      </item>
      <item>
        <identifiers>
          <lisID>2354</lisID>
          <gpoId />
          <bioguideId>J000298</bioguideId>
        </identifiers>
        <party>D</party>
        <middleName />
        <district>7</district>
        <firstName>Pramila</firstName>
        <bioguideId>J000298</bioguideId>
        <lastName>Jayapal</lastName>
        <sponsorshipDate>2017-04-26</sponsorshipDate>
        <state>WA</state>
        <sponsorshipWithdrawnDate />
        <fullName>Rep. Jayapal, Pramila [D-WA-7]</fullName>
        <isOriginalCosponsor>False</isOriginalCosponsor>
      </item>
      <item>
        <identifiers>
          <gpoId />
          <bioguideId>S001200</bioguideId>
          <lisID>2319</lisID>
        </identifiers>
        <party>D</party>
        <middleName />
        <district>9</district>
        <firstName>Darren</firstName>
        <bioguideId>S001200</bioguideId>
        <lastName>Soto</lastName>
        <sponsorshipDate>2017-05-23</sponsorshipDate>
        <state>FL</state>
        <sponsorshipWithdrawnDate />
        <fullName>Rep. Soto, Darren [D-FL-9]</fullName>
        <isOriginalCosponsor>False</isOriginalCosponsor>
      </item>
      <item>
        <identifiers>
          <bioguideId>W000822</bioguideId>
          <lisID>2259</lisID>
          <gpoId />
        </identifiers>
        <party>D</party>
        <middleName />
        <district>12</district>
        <firstName>Bonnie</firstName>
        <bioguideId>W000822</bioguideId>
        <lastName>Watson Coleman</lastName>
        <sponsorshipDate>2017-06-07</sponsorshipDate>
        <state>NJ</state>
        <sponsorshipWithdrawnDate />
        <fullName>Rep. Watson Coleman, Bonnie [D-NJ-12]</fullName>
        <isOriginalCosponsor>False</isOriginalCosponsor>
      </item>
      <item>
        <identifiers>
          <lisID>868</lisID>
          <gpoId>7871</gpoId>
          <bioguideId>N000147</bioguideId>
        </identifiers>
        <party>D</party>
        <middleName>HOLMES</middleName>
        <district>0</district>
        <firstName>ELEANOR</firstName>
        <bioguideId>N000147</bioguideId>
        <lastName>NORTON</lastName>
        <sponsorshipDate>2017-06-07</sponsorshipDate>
        <state>DC</state>
        <sponsorshipWithdrawnDate />
        <fullName>Rep. Norton, Eleanor Holmes [D-DC-At Large]</fullName>
        <isOriginalCosponsor>False</isOriginalCosponsor>
      </item>
      <item>
        <identifiers>
          <lisID>2298</lisID>
          <gpoId />
          <bioguideId>E000296</bioguideId>
        </identifiers>
        <party>D</party>
        <middleName />
        <district>2</district>
        <firstName>Dwight</firstName>
        <bioguideId>E000296</bioguideId>
        <lastName>Evans</lastName>
        <sponsorshipDate>2017-06-07</sponsorshipDate>
        <state>PA</state>
        <sponsorshipWithdrawnDate />
        <fullName>Rep. Evans, Dwight [D-PA-2]</fullName>
        <isOriginalCosponsor>False</isOriginalCosponsor>
      </item>
      <item>
        <identifiers>
          <bioguideId>C001067</bioguideId>
          <gpoId>8072</gpoId>
          <lisID>1864</lisID>
        </identifiers>
        <party>D</party>
        <middleName>D.</middleName>
        <district>9</district>
        <firstName>Yvette</firstName>
        <bioguideId>C001067</bioguideId>
        <lastName>Clarke</lastName>
        <sponsorshipDate>2017-06-07</sponsorshipDate>
        <state>NY</state>
        <sponsorshipWithdrawnDate />
        <fullName>Rep. Clarke, Yvette D. [D-NY-9]</fullName>
        <isOriginalCosponsor>False</isOriginalCosponsor>
      </item>
      <item>
        <identifiers>
          <bioguideId>P000604</bioguideId>
          <lisID>2097</lisID>
          <gpoId>8373</gpoId>
        </identifiers>
        <party>D</party>
        <middleName>M.</middleName>
        <district>10</district>
        <firstName>Donald</firstName>
        <bioguideId>P000604</bioguideId>
        <lastName>Payne</lastName>
        <sponsorshipDate>2017-07-11</sponsorshipDate>
        <state>NJ</state>
        <sponsorshipWithdrawnDate />
        <fullName>Rep. Payne, Donald M., Jr. [D-NJ-10]</fullName>
        <isOriginalCosponsor>False</isOriginalCosponsor>
      </item>
    </cosponsors>
    <cboCostEstimates />
    <title>Kalief's Law</title>
    <calendarNumbers />
    <titles>
      <item>
        <title>Kalief Browder Reentry Success Act of 2017</title>
        <parentTitleType />
        <chamberCode />
        <titleType>(Extracted from GPO) Short Titles as Introduced</titleType>
        <chamberName />
      </item>
      <item>
        <title>Kalief's Law</title>
        <parentTitleType />
        <chamberCode />
        <titleType>Short Titles as Introduced</titleType>
        <chamberName />
      </item>
      <item>
        <title>Kalief Browder Reentry Success Act of 2017</title>
        <parentTitleType />
        <chamberCode />
        <titleType>Short Titles as Introduced</titleType>
        <chamberName />
      </item>
      <item>
        <title>To authorize the Attorney General, in consultation with the Director of the National Institute of Mental Health, to carry out a pilot program in correctional facilities in order to provide mental health services and other social services to eligible individuals, and for other purposes.</title>
        <parentTitleType />
        <chamberCode />
        <titleType>Official Title as Introduced</titleType>
        <chamberName />
      </item>
      <item>
        <title>Kalief's Law</title>
        <parentTitleType />
        <chamberCode />
        <titleType>Display Title</titleType>
        <chamberName />
      </item>
    </titles>
    <summaries>
      <billSummaries>
        <item>
          <lastSummaryUpdateDate>2017-07-26T21:03:52Z</lastSummaryUpdateDate>
          <text><![CDATA[
Kalief Browder Reentry Success Act of 2017 or Kalief's Law

This bill directs the Department of Justice to establish a pilot program to provide pre-release mental health screenings and post-release mental heath and social services to individuals who are incarcerated or detained at federal and state or local correctional facilities.
]]></text>
          <name>Introduced in House</name>
          <actionDesc>Introduced in House</actionDesc>
          <updateDate>2017-04-03T04:00:00Z</updateDate>
          <actionDate>2017-04-03</actionDate>
          <versionCode>00</versionCode>
        </item>
      </billSummaries>
    </summaries>
    <billNumber>1853</billNumber>
    <recordedVotes />
    <policyArea>
      <name>Crime and Law Enforcement</name>
    </policyArea>
    <relatedBills />
    <committeeReports />
    <subjects>
      <billSubjects>
        <legislativeSubjects>
          <item>
            <name>Correctional facilities and imprisonment</name>
          </item>
          <item>
            <name>Health information and medical records</name>
          </item>
          <item>
            <name>Medical tests and diagnostic methods</name>
          </item>
          <item>
            <name>Mental health</name>
          </item>
        </legislativeSubjects>
        <policyArea>
          <name>Crime and Law Enforcement</name>
        </policyArea>
      </billSubjects>
    </subjects>
    <constitutionalAuthorityStatementText><![CDATA[
From the Congressional Record Online through the Government Publishing Office [www.gpo.gov]By Mr. CROWLEY:H.R. 1853.Congress has the power to enact this legislation pursuantto the following:Article I, Section 8[Page H2629]
]]></constitutionalAuthorityStatementText>
    <billType>HR</billType>
    <originChamber>House</originChamber>
    <notes />
    <sponsors>
      <item>
        <bioguideId>C001038</bioguideId>
        <firstName>JOSEPH</firstName>
        <district>14</district>
        <fullName>Rep. Crowley, Joseph [D-NY-14]</fullName>
        <identifiers>
          <gpoId>8068</gpoId>
          <lisID>1604</lisID>
          <bioguideId>C001038</bioguideId>
        </identifiers>
        <lastName>CROWLEY</lastName>
        <middleName />
        <party>D</party>
        <byRequestType />
        <state>NY</state>
      </item>
    </sponsors>
    <congress>115</congress>
    <introducedDate>2017-04-03</introducedDate>
    <laws />
    <version>1.0.0</version>
    <amendments />
    <latestAction>
      <text>Referred to the Subcommittee on Crime, Terrorism, Homeland Security, and Investigations.</text>
      <links />
      <actionDate>2017-04-24</actionDate>
    </latestAction>
    <committees>
      <billCommittees>
        <item>
          <chamber>House</chamber>
          <activities>
            <item>
              <date>2017-04-03T16:01:40Z</date>
              <name>Referred to</name>
            </item>
          </activities>
          <subcommittees>
            <item>
              <systemCode>hsju08</systemCode>
              <activities>
                <item>
                  <date>2017-04-24T15:41:40Z</date>
                  <name>Referred to</name>
                </item>
              </activities>
              <name>Crime, Terrorism, Homeland Security, and Investigations Subcommittee</name>
            </item>
          </subcommittees>
          <type>Standing</type>
          <systemCode>hsju00</systemCode>
          <name>Judiciary Committee</name>
        </item>
      </billCommittees>
    </committees>
    <updateDate>2017-07-26T21:15:14Z</updateDate>
    <createDate>2017-04-04T03:11:53Z</createDate>
    <actions>
      <item>
        <actionDate>2017-04-24</actionDate>
        <committee>
          <systemCode>hsju08</systemCode>
          <name>Crime, Terrorism, Homeland Security, and Investigations Subcommittee</name>
        </committee>
        <links />
        <sourceSystem>
          1
          <name>House committee actions</name>
        </sourceSystem>
        <text>Referred to the Subcommittee on Crime, Terrorism, Homeland Security, and Investigations.</text>
        <type>Committee</type>
      </item>
      <item>
        <text>Referred to the House Committee on the Judiciary.</text>
        <committee>
          <systemCode>hsju00</systemCode>
          <name>Judiciary Committee</name>
        </committee>
        <sourceSystem>
          2
          <name>House floor actions</name>
        </sourceSystem>
        <links />
        <actionCode>H11100</actionCode>
        <type>IntroReferral</type>
        <actionDate>2017-04-03</actionDate>
      </item>
      <item>
        <text>Introduced in House</text>
        <committee />
        <sourceSystem>
          9
          <name>Library of Congress</name>
        </sourceSystem>
        <links />
        <actionCode>Intro-H</actionCode>
        <type>IntroReferral</type>
        <actionDate>2017-04-03</actionDate>
      </item>
      <item>
        <text>Introduced in House</text>
        <committee />
        <sourceSystem>
          9
          <name>Library of Congress</name>
        </sourceSystem>
        <links />
        <actionCode>1000</actionCode>
        <type>IntroReferral</type>
        <actionDate>2017-04-03</actionDate>
      </item>
      <actionTypeCounts>
        <placeholderTextForH>1</placeholderTextForH>
        <introducedInHouse>1</introducedInHouse>
        <billReferrals>1</billReferrals>
        <introducedInTheHouse>1</introducedInTheHouse>
      </actionTypeCounts>
      <actionByCounts>
        <houseOfRepresentatives>4</houseOfRepresentatives>
      </actionByCounts>
    </actions>
  </bill>
  <dublinCore xmlns:dc="http://purl.org/dc/elements/1.1/">
    <dc:format>text/xml</dc:format>
    <dc:language>EN</dc:language>
    <dc:rights>Pursuant to Title 17 Section 105 of the United States Code, this file is not subject to copyright protection and is in the public domain.</dc:rights>
    <dc:contributor>Congressional Research Service, Library of Congress</dc:contributor>
    <dc:description>This file contains bill summaries and statuses for federal legislation. A bill summary describes the most significant provisions of a piece of legislation and details the effects the legislative text may have on current law and federal programs. Bill summaries are authored by the Congressional Research Service (CRS) of the Library of Congress. As stated in Public Law 91-510 (2 USC 166 (d)(6)), one of the duties of CRS is "to prepare summaries and digests of bills and resolutions of a public general nature introduced in the Senate or House of Representatives". For more information, refer to the User Guide that accompanies this file.</dc:description>
  </dublinCore>
</billStatus>


text:
set -e
set -v
set -x

# http://superuser.com/questions/196848/how-do-i-create-an-administrator-user-on-ubuntu
# http://unix.stackexchange.com/questions/1416/redirecting-stdout-to-a-file-you-dont-have-write-permission-on
# This line assumes the user you created in the preseed directory is vagrant
echo "%admin  ALL=NOPASSWD: ALL" | sudo tee -a /etc/sudoers.d/init-users
sudo groupadd admin
sudo usermod -a -G admin vagrant

# Installing vagrant keys
wget --no-check-certificate 'https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub'
sudo mkdir -p /home/vagrant/.ssh
sudo chown -R vagrant:vagrant /home/vagrant/.ssh
cat ./vagrant.pub >> /home/vagrant/.ssh/authorized_keys
sudo chown -R vagrant:vagrant /home/vagrant/.ssh/authorized_keys
echo "All Done!"

#http://www.fail2ban.org/wiki/index.php/MANUAL_0_8#Jails
sudo sed -i "s/bantime = 600/bantime = -1/g" /etc/fail2ban/jail.conf
sudo systemctl enable fail2ban
sudo service fail2ban restart

##################################################
# Add User customizations below here
##################################################

git config --global user.email "hajek@iit.edu"
git config --global user.name "Jeremy R Hajek"

sudo apt-get update -y
wget -P /tmp https://releases.hashicorp.com/consul/1.0.2/consul_1.0.2_linux_amd64.zip
unzip /tmp/consul_1.0.2_linux_amd64.zip -d /usr/local/bin

redpajama_set_name: RedPajamaGithub


text: var isona={};"object"==typeof module?module.exports=isona:"function"==typeof define&&define.amd?define(function(){return isona}):window.isona=isona,function(a){a.version="0.1.0"}(isona);


text:
package org.onosproject.store.primitives.impl;

import org.onosproject.store.Timestamp;

import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;

import static com.google.common.base.Preconditions.checkNotNull;

/**
 * Representation of a value in EventuallyConsistentMap.
 *
 * @param <V> value type
 */
public class MapValue<V> implements Comparable<MapValue<V>> {
    private final Timestamp timestamp;
    private final V value;
    private long creationTime;

    /**
     * Creates a tombstone value with the specified timestamp.
     *
     * @param timestamp timestamp for tombstone
     * @return tombstone MapValue
     *
     * @param <U> value type
     */
    public static <U> MapValue<U> tombstone(Timestamp timestamp) {
        return new MapValue<>(null, timestamp, System.currentTimeMillis());
    }

    /**
     * Constructor automatically to create the system time of construction.
     *
     * @param value value
     * @param timestamp value timestamp
     */
    public MapValue(V value, Timestamp timestamp) {
        this(value, timestamp, System.currentTimeMillis());
    }

    /**
     * Creates a map value using value, timestamp, and creation time.
     *
     * @param value value
     * @param timestamp value timestamp.
     * @param creationTime the system time (on local instance) of construction
     */
    public MapValue(V value, Timestamp timestamp, long creationTime) {
        this.value = value;
        this.timestamp = checkNotNull(timestamp, "Timestamp cannot be null");
        this.creationTime = creationTime;
    }

    /**
     * Creates a copy of MapValue.
     * <p>
     * The copy will have an updated creation time corresponding to when the copy was constructed.
     *
     * @return MapValue copy
     */
    public MapValue<V> copy() {
        return new MapValue<>(this.value, this.timestamp, System.currentTimeMillis());
    }

    /**
     * Tests if this value is tombstone value with the specified timestamp.
     *
     * @return true if this value is null, otherwise false
     */
    public boolean isTombstone() {
        return value == null;
    }

    /**
     * Tests if this value is alive.
     *
     * @return true if this value is not null, otherwise false
     */
    public boolean isAlive() {
        return value != null;
    }

    /**
     * Returns the timestamp of this value.
     *
     * @return timestamp
     */
    public Timestamp timestamp() {
        return timestamp;
    }

    /**
     * Returns this value.
     *
     * @return value
     */
    public V get() {
        return value;
    }

    /**
     * Returns the creation time of this value.
     *
     * @return creationTime
     */
    public long creationTime() {
        return creationTime;
    }

    /**
     * Tests if this value is newer than the specified MapValue.
     *
     * @param other the value to be compared
     * @return true if this value is newer than other
     */
    public boolean isNewerThan(MapValue<V> other) {
        if (other == null) {
            return true;
        }
        return this.timestamp.isNewerThan(other.timestamp);
    }

    /**
     * Tests if this timestamp is newer than the specified timestamp.
     *
     * @param timestamp timestamp to be compared
     * @return true if this instance is newer
     */
    public boolean isNewerThan(Timestamp timestamp) {
        return this.timestamp.isNewerThan(timestamp);
    }

    /**
     * Returns summary of a MapValue for use during Anti-Entropy exchanges.
     *
     * @return Digest with timestamp and whether this value is null or not
     */
    public Digest digest() {
        return new Digest(timestamp, isTombstone());
    }

    @Override
    public int compareTo(MapValue<V> o) {
        return this.timestamp.compareTo(o.timestamp);
    }

    @Override
    public int hashCode() {
        return Objects.hashCode(timestamp, value);
    }

    @SuppressWarnings("unchecked")
    @Override
    public boolean equals(Object other) {
        if (other instanceof MapValue) {
            MapValue<V> that = (MapValue<V>) other;
            return Objects.equal(this.timestamp, that.timestamp) &&
                    Objects.equal(this.value, that.value);
        }
        return false;
    }

    @Override
    public String toString() {
        return MoreObjects.toStringHelper(getClass())
                .add("timestamp", timestamp)
                .add("value", value)
                .toString();
    }

    @SuppressWarnings("unused")
    private MapValue() {
        this.timestamp = null;
        this.value = null;
    }

    /**
     * Digest or summary of a MapValue for use during Anti-Entropy exchanges.
     */
    public static class Digest {
        private final Timestamp timestamp;
        private final boolean isTombstone;

        public Digest(Timestamp timestamp, boolean isTombstone) {
            this.timestamp = timestamp;
            this.isTombstone = isTombstone;
        }

        public Timestamp timestamp() {
            return timestamp;
        }

        public boolean isTombstone() {
            return isTombstone;
        }

        public boolean isNewerThan(Digest other) {
            return timestamp.isNewerThan(other.timestamp);
        }

        @Override
        public int hashCode() {
            return Objects.hashCode(timestamp, isTombstone);
        }

        @Override
        public boolean equals(Object other) {
            if (other instanceof Digest) {
                Digest that = (Digest) other;
                return Objects.equal(this.timestamp, that.timestamp) &&
                        Objects.equal(this.isTombstone, that.isTombstone);
            }
            return false;
        }

        @Override
        public String toString() {
            return MoreObjects.toStringHelper(getClass())
                    .add("timestamp", timestamp)
                    .add("isTombstone", isTombstone)
                    .toString();
        }
    }
}


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Evo C++ Library v0.5.1: Member List</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

<link href="doxygen.css" rel="stylesheet" type="text/css" />

Evo C++ Library v0.5.1

evo

SysMutex

SysMutex Member List

This is the complete list of members for SysMutex, including all inherited members.

Handle typedef	SysMutex

handle	SysMutex

lock()	SysMutex	inline

SysMutex()	SysMutex	inline

trylock()	SysMutex	inline

trylock(ulong timeout_ms)	SysMutex	inline

unlock()	SysMutex	inline

~SysMutex()	SysMutex	inline

<address class="footer">
Generated on Tue May 7 2019 18:17:44 for Evo C++ Library v0.5.1 by

 1.8.13
</address>


text:
layout: post
title: "unsupervised variational homoencoders"
categories: blog
excerpt: "Extending variational homoencoders to an unsupervised regime"
tags: [machine learning, unsupervised learning]
---

# intro

Variational autoencoders (VAEs) are a type of generative model. Variational homoencoders were introduced in [this paper](https://arxiv.org/pdf/1807.08919.pdf) and extend the idea of VAEs by providing amortized class information.

# background

## vae

For background on the VAE see [this post](http://jalexvig.github.io/blog/associative-compression-networks/#vae).

> One problem with VAEs is that, with a sufficiently powerful decoder, they can learn to ignore the latent codes. The MDL says that if we can use the least number of bits then we have achieved the best hypothesis for the data. If the decoder learns to ignore $z$ and just learns $p(X)$ then $q(z\|x)$ can just learn $p(z)$. This can happen at the beginning of training when the approximate posterior ($q$) doesn't produce meaningful information on $x$. The optimization routine then just attempts to make $q$ equal to the prior ($p(z)$). As $H(X)$ is the optimal possible compression for $X$, meaningful latent codes will never be learned.

## vhe

One solution to this problem is to amortize the cost of sending class level information over many samples. From the paper:

$$
\begin{align}
C_{total} &=
\mathop{\mathbb{E}}_{\substack{x \in X \\ D \subset X_x}} \left[
\mathop{\mathbb{E}}_{\substack{q \left( c|D \right) \\ q \left( z|c, x \right)}} \left[
\log{ p \left( x | c, z \right) } + D_{KL} \left( q \left( z | c, x \right) || p \left( z|c \right) \right) + \frac{1}{|X_x|} D_{KL} \left( q \left( c | D \right) || p \left( c \right) \right)
\right]
\right]
\end{align}
$$

This amounts to the following training algorithm:

1. Pick a training example $x$.
2. Pick a subset $D$ that has the same label as $x$.
3. Encode $D$ to get $c$.
4. Encode $x$ conditioned on $c$ to get $z$.
5. Reconstruct $x$ from $c$ and $z$.

Ideally $c$ will encode information about the class whereas $z$ will encode information about how $x$ delivers from its class.

#### kl divergence derivation

See [this post](http://jalexvig.github.io/blog/associative-compression-networks/#kl-derivation).

# unsupervised VHEs

There is a comparitive dearth of supervised data so an important question becomes how to extend algorithms like this into the unsupervised regime. I posit that we can get pseudo-labels (or at least a meaningful measure of proximity) using the latent codes produced by $q \left( c \| D \right)$ and $q \left( z \| c, x \right)$. From here on I will refer to a code as the concatenation of the class code and individual example code.

By using a clustering algorithm on the codes we can get an idea of how similar two training examples are. At the beginning of training, the similarity will be dominated by the $z$ portion of the code since $D$ will be chosen basically at random. The function $q \left( z \| c, x \right)$ will effectively ignore $c$ and just encode $x$ like a typical VAE. As training progresses, however, the $D$s become more representative of the training example since examples with similar $z$ codes will be chosen. The $c$ parts of the codes then become more meaningful and $z$s start encoding differences.

The training algorithm looks the same as before with the following differences:

Initialization:
1. Pick codes from $N(0, 1)$ for every training example $x$.
2. Initialize a KMeans clustering algorithm with codes.

Before each epoch:
1. Associate each training example with labels based on the clustering.

Training:
6. Record the new values of $z$ and $c$ for this $x$.

# code

The full code is available [on GitHub](https://github.com/jalexvig/variational_homoencoders).

## vae

The following code implements the distributions required for equation 1.

```python
class VHE(nn.Module):

    def __init__(self, code_len):

        super().__init__()

        self.encode_c_u = nn.Sequential(
            nn.Linear(28 * 28, 512),
            nn.ReLU(True),
            nn.Linear(512, code_len),
        )

        self.encode_c_logstd = nn.Sequential(
            nn.Linear(28 * 28, 512),
            nn.ReLU(True),
            nn.Linear(512, code_len),
        )

        self.encode_z_u = nn.Sequential(
            nn.Linear(28 * 28 + code_len, 512),
            nn.ReLU(True),
            nn.Linear(512, code_len),
        )

        self.encode_z_logstd = nn.Sequential(
            nn.Linear(28 * 28 + code_len, 512),
            nn.ReLU(True),
            nn.Linear(512, code_len),
        )

        self.prior_z_mu = nn.Sequential(
            nn.Linear(code_len, 512),
            nn.ReLU(True),
            nn.Linear(512, code_len),
        )

        self.prior_z_logstd = nn.Sequential(
            nn.Linear(code_len, 512),
            nn.ReLU(True),
            nn.Linear(512, code_len),
        )

        self.decode_cz = nn.Sequential(
            nn.Linear(2 * code_len, 512),
            nn.ReLU(True),
            nn.Linear(512, 28 * 28),
            nn.Sigmoid(),
        )
```

And here is how those distributions are used:

```python
def forward(self,
            inputs: torch.Tensor,
            inputs_class: torch.Tensor):

    # mean to get from N x D x H * W to N x H * W
    u = self.encode_c_u(inputs_class)
    mean = u.mean(dim=0)
    logstd = self.encode_c_logstd(inputs_class).mean(dim=0)
    q_c = NormalParams(mean, logstd)
    c_sample = self.reparametrize(q_c.u, q_c.s)

    # condition the posterior of z on c
    inputs_augmented = torch.cat([inputs, c_sample], dim=-1)

    # N x H * W + CODE_LEN
    q_z = NormalParams(self.encode_z_u(inputs_augmented), self.encode_z_logstd(inputs_augmented))
    z_sample = self.reparametrize(q_z.u, q_z.s)

    p_c = NormalParams(torch.tensor(0, dtype=torch.float32), torch.tensor(0, dtype=torch.float32))
    p_z = NormalParams(self.prior_z_mu(c_sample), self.prior_z_logstd(c_sample))

    latent = torch.cat([z_sample, c_sample], dim=1)

    output = self.decode_cz(latent)

    return output, q_c, p_c, q_z, p_z
```

where NormalParams is just a wrapper for mean `u` and log standard deviation `s`:

```python
from collections import namedtuple

NormalParams = namedtuple('NormalParams', ['u', 's'])
```

```python
def calc_loss(x: torch.Tensor,
              recon: torch.Tensor,
              cardinality_class: torch.Tensor,
              params_q_c: NormalParams,
              params_p_c: NormalParams,
              params_q_z: NormalParams,
              params_p_z: NormalParams) -> torch.Tensor:
    # reconstruction
    xent = F.binary_cross_entropy(recon, x, size_average=False)

    # class coding cost
    dkl_c = dkl_2_gaussians(params_q_c, params_p_c, weights=1 / cardinality_class)

    # sample coding cost
    dkl_z = dkl_2_gaussians(params_q_z, params_p_z)

    return xent + dkl_c + dkl_z

def dkl_2_gaussians(q: NormalParams,
                    p: NormalParams,
                    weights: torch.Tensor = None) -> torch.Tensor:

    dkls = p.s - q.s - 0.5 + ((2 * q.s).exp() + (q.u - p.u).pow(2)) / (2 * (2 * p.s).exp())

    if weights is not None:
        dkls *= weights[:, None]

    dkl = torch.sum(dkls)

    return dkl
```

[comment]: # TODO:  <20-09-18, yourname> >

# results

The following results correspond to two layer simple feedforward (512 dimensional hidden layer) architectures for both the VAE and the unsupervised VHE. Note that the VHE actually has more parameters since it has two encoding networks.

### loss

The following shows the average loss (in nats) for each training epoch. We see that amortizing information transfer using a pseudo-class does result in fewer nats used.

{:refdef: style="text-align: center;"}
![Losses VAE VHE](/images/unsupervised_vhe/vae_vhe_loss.png){:height="80%" width="80%"}
{: refdef}

### z & c contributions

Given the class labels are initially chosen at random (since class codes are initially randomized) we would expect the contribution from the $c$ component of the latent code to be meaningless at the start of training. As the $z$ components of the latent codes begin to cluster then the membership of this cluster can be learned by the $c$ component of the code. This relationship is something that we notice when looking at the derivative of the loss with respect to each of the two components:

{:refdef: style="text-align: center;"}
![VHE Gradients z c](/images/unsupervised_vhe/vhe_z_c_gradient.png){:height="80%" width="80%"}
{: refdef}

{:refdef: style="text-align: center;"}
![VHE Gradient Ratio z:c](/images/unsupervised_vhe/vhe_z_c_gradient_ratio.png){:height="80%" width="80%"}
{: refdef}

# future work

Clearly using the l2 norm on the codes does not provide for an optimal balance between the $c$ and $z$ components. Importantly the $z$ component will eventually prevent some examples from the same class from being labeled as such. This occurs when the model does a good job at discriminating between classes but the $z$ distributions force them into separate clusters. Below are a few ideas of solutions:

* Anneal weights applied to $c$ and $z$ over the course of training. This is problematic because it is not a universal solution.
* Calculate weights applied to $c$ and $z$ as a function of their respective loss gradients. Again this does not seem necessarily easily generalizeable.
* Use estimates of the mutual information between latent codes and the input to determine these weights.

# additional resources

* [The original paper](https://arxiv.org/pdf/1807.08919.pdf)
* All the code used in this post can be found [on GitHub](https://github.com/jalexvig/variational_homoencoders).
* [Associative Compression Networks](http://jalexvig.github.io/blog/associative-compression-networks) (another solution to this problem)


text:
<?php
return [
    'view_manager'    => [
        'template_path_stack' => [
            'soliant-jira-issue-collector' => __DIR__ . '/../view',
        ],
    ],
    'service_manager' => [
        'factories' => [
            \Soliant\JiraIssueCollector\Options::class => \Soliant\JiraIssueCollector\Factory\OptionsFactory::class,
            \Soliant\JiraIssueCollector\Listener::class =>
                \Soliant\JiraIssueCollector\Factory\ListenerFactory::class
            ,
        ],
    ],
];


text:
angular.module('app.services').
value('lang', {
	SAVE :'Salvar',
	CLOSE :'Fechar',
	ITEMS :'Itens',
	NEW_CATEGORY :'Nova categoria',
	CATEGORY_CODE :'Código',
	CATEGORY_NAME : 'Nome',
	CATEGORY :'Categoria',
	CATEGORIES :'Categorias',
	CATEGORY_EXISTS :'Categoria já existe',
	CATEGORY_UPD_ERR :'Não foi possível atualizar a categoria.'

	//tipos
	, CATEGORY_NOT_DEFINED:'Indefinido'
	, CATEGORY_DOCUMENT:'Documentos'
	, CATEGORY_UNIT:'Unidades'
	, CATEGORY_INSTRUMENT:'Instrumentos'
	, CATEGORY_MAINTENANCE:'Manutenção'
	, CATEGORY_PROCESS:'Processos'
	, CATEGORY_STOCK:'Estoques'
	, CATEGORY_ORDER:'Ordens'
	, CATEGORY_PRODUCT:'Produtos'
	, CATEGORY_SERVICE:'Serviços'
	, CATEGORY_REQUEST:'Solicitações'
	, CATEGORY_PROJECT:'Projeto'
	, CATEGORY_PLANNING:'Planejamento'
	, CATEGORY_COMPETENCE:'Competências'
	, CATEGORY_INDICATOR:'Indicadores',
	_getLocalizationKeys: function() {
//		Returns an object that has as properties the same properties of this object.
//		The values of these properties is equal to the name of each properties.
		var keys = {};
		for (var k in this) {
			keys[k] = k;
		}
		return keys;
	}
});


text:
/**
 * @author sabidib http://github.com/sabidib
 */
/** @constructor */
/*global Flory*/
/*jslint white*/

'use strict';
Flory.generic_class_name_you_choose = function () {
    Flory.Environment.call(this);

};

//This will bring in all the methods from the parent
Flory.generic_class_name_you_choose.prototype = Object.create(Flory.Environment.prototype);

Flory.generic_class_name_you_choose.prototype.constructor = Flory.generic_class_name_you_choose;

Flory.generic_class_name_you_choose.prototype.update = function () {
    //Here is where you update the position of the
    //this.entities array.
    return this;
};

//......
//......
//......
//Other methods you override...
//......
//......
//......

Flory.generic_class_name_you_choose.a_static_variable = 100;


text:
import '#3p/polyfills';

import {register} from '#3p/3p';
import {draw3p, init} from '#3p/integration-lib';

import {videonow} from '#ads/vendors/videonow';

init(window);
register('videonow', videonow);

window.draw3p = draw3p;


text:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<!--
	수정일                 수정자                          수정내용
  =========     =======    =================================================
  2011.9.7   	정진오     	 	CommunityManageDAO.deleteCommunityUserInf과 CommunityManageDAO.deleteAllCommunityUserInf의 update 문에
  							MNGR_AT = 'N' 추가(커뮤니티 탈퇴 시 운영자 인 경우 강제로 비운영자로 변경 필요)
-->
<sqlMap namespace="CommunityManageDAO">

	<typeAlias  alias="egovMap" type="egovframework.rte.psl.dataaccess.util.EgovMap"/>
	<typeAlias  alias="Cmmnty" type="egovframework.com.cop.cmy.service.Community"/>
	<typeAlias  alias="CmmntyVO" type="egovframework.com.cop.cmy.service.CommunityVO"/>
	<typeAlias  alias="CmmntyUser" type="egovframework.com.cop.cmy.service.CommunityUser"/>
	<typeAlias  alias="CmmntyUserVO" type="egovframework.com.cop.cmy.service.CommunityUserVO"/>

	<resultMap id="CmmntyList" class="egovframework.com.cop.cmy.service.CommunityVO">
		<result property="cmmntyId" column="CMMNTY_ID" columnIndex="1"/>
		<result property="cmmntyNm" column="CMMNTY_NM" columnIndex="2"/>
		<result property="registSeCode" column="REGIST_SE_CODE" columnIndex="3"/>
		<result property="registSeCodeNm" column="REGIST_SE_CODE_NM" columnIndex="4"/>
		<result property="useAt" column="USE_AT" columnIndex="5"/>
		<result property="frstRegisterId" column="FRST_REGISTER_ID" columnIndex="6"/>
		<result property="frstRegisterNm" column="FRST_REGISTER_NM" columnIndex="7"/>
		<result property="frstRegisterPnttm" column="FRST_REGIST_PNTTM" columnIndex="8"/>
	</resultMap>

	<resultMap id="CmmntyDetail" class="egovframework.com.cop.cmy.service.CommunityVO">
		<result property="cmmntyId" column="CMMNTY_ID" columnIndex="1"/>
		<result property="cmmntyNm" column="CMMNTY_NM" columnIndex="2"/>
		<result property="cmmntyIntrcn" column="CMMNTY_INTRCN" columnIndex="3"/>
		<result property="useAt" column="USE_AT" columnIndex="4"/>
		<result property="tmplatId" column="TMPLAT_ID" columnIndex="5"/>
		<result property="tmplatNm" column="TMPLAT_NM" columnIndex="6"/>
		<result property="frstRegisterId" column="FRST_REGISTER_ID" columnIndex="7"/>
		<result property="frstRegisterNm" column="FRST_REGISTER_NM" columnIndex="8"/>
		<result property="frstRegisterPnttm" column="FRST_REGIST_PNTTM" columnIndex="9"/>
	</resultMap>

	<resultMap id="CmmntyBBSUseList" class="egovframework.com.cop.cmy.service.CommunityVO">
		<result property="bbsId" column="BBS_ID" columnIndex="1"/>
		<result property="bbsNm" column="BBS_NM" columnIndex="2"/>
	</resultMap>

	<resultMap id="CmmntyListPortlet" class="egovframework.com.cop.cmy.service.CommunityVO">
		<result property="cmmntyId" column="CMMNTY_ID" columnIndex="1"/>
		<result property="cmmntyNm" column="CMMNTY_NM" columnIndex="2"/>
		<result property="cmmntyIntrcn" column="CMMNTY_INTRCN" columnIndex="3"/>
		<result property="tmplatId" column="TMPLAT_ID" columnIndex="4"/>
	</resultMap>

	<resultMap id="CmmntyUserInf" class="egovframework.com.cop.cmy.service.CommunityUser">
	    <result property="mngrAt" column="MNGR_AT" columnIndex="1"/>
		<result property="useAt" column="USE_AT" columnIndex="2"/>
	</resultMap>

	<resultMap id="CmmntyManagerInf" class="egovframework.com.cop.cmy.service.CommunityUser">
	    <result property="emplyrId" column="EMPLYR_ID" columnIndex="1"/>
		<result property="emplyrNm" column="USER_NM" columnIndex="2"/>
	</resultMap>

	<insert id="CommunityManageDAO.insertCommunityInf" parameterClass="Cmmnty">
		<![CDATA[
			INSERT INTO COMTNCMMNTY
			(CMMNTY_ID, CMMNTY_NM, CMMNTY_INTRCN, REGIST_SE_CODE,
			 TMPLAT_ID, USE_AT, FRST_REGISTER_ID, FRST_REGIST_PNTTM)
			VALUES
			(#cmmntyId#, #cmmntyNm#, #cmmntyIntrcn#, #registSeCode#,
			 #tmplatId#, #useAt#, #frstRegisterId#, SYSDATE)
		]]>
	</insert>

	<insert id="CommunityManageDAO.insertCommunityUserInf" parameterClass="CmmntyUser">
		<![CDATA[
			INSERT INTO COMTNCMMNTYUSER
			(CMMNTY_ID, EMPLYR_ID, SBSCRB_DE, MNGR_AT,
			 USE_AT, FRST_REGISTER_ID, FRST_REGIST_PNTTM)
			VALUES
			(#cmmntyId#, #emplyrId#, SYSDATE, #mngrAt#,
			 #useAt#, #frstRegisterId#, SYSDATE)
		]]>
	</insert>

	<select id="CommunityManageDAO.selectCommunityInfs" parameterClass="CmmntyVO" resultMap="CmmntyList" >
		<![CDATA[
		SELECT * FROM ( SELECT rownum rn, TB.* FROM (
			SELECT
				a.CMMNTY_ID, a.CMMNTY_NM, a.USE_AT, a.REGIST_SE_CODE,
				c.CODE_NM as REGIST_SE_CODE_NM,
				a.FRST_REGIST_PNTTM, a.FRST_REGISTER_ID,
				b.USER_NM as FRST_REGISTER_NM
			FROM
				COMTNCMMNTY a
			LEFT OUTER JOIN COMVNUSERMASTER b
			ON a.FRST_REGISTER_ID = b.ESNTL_ID
			LEFT OUTER JOIN COMTCCMMNDETAILCODE c
			ON a.REGIST_SE_CODE = c.CODE
			WHERE c.CODE_ID = 'COM001'
		]]>
			<isEqual prepend="AND" property="searchCnd" compareValue="0">
				<![CDATA[	a.CMMNTY_NM LIKE '%' || #searchWrd# || '%' 		]]>
			</isEqual>
		<![CDATA[
			ORDER BY a.FRST_REGIST_PNTTM DESC
			) TB ) WHERE rn BETWEEN #firstIndex# + 1 AND #firstIndex# + #recordCountPerPage#
		]]>
	</select>

	<select id="CommunityManageDAO.selectCommunityInfsCnt" parameterClass="CmmntyVO" resultClass="java.lang.Integer" >
		<![CDATA[
			SELECT
				COUNT(a.CMMNTY_ID) as cnt
			FROM
				COMTNCMMNTY a
			LEFT OUTER JOIN COMVNUSERMASTER b
			ON a.FRST_REGISTER_ID = b.ESNTL_ID
			LEFT OUTER JOIN COMTCCMMNDETAILCODE c
			ON a.REGIST_SE_CODE = c.CODE
			WHERE c.CODE_ID = 'COM001'
		]]>
			<isEqual prepend="AND" property="searchCnd" compareValue="0">
				<![CDATA[	a.CMMNTY_NM LIKE '%' || #searchWrd# || '%' 		]]>
			</isEqual>
	</select>

	<select id="CommunityManageDAO.selectCommunityInf" parameterClass="CmmntyVO" resultMap="CmmntyDetail">
		<![CDATA[
			SELECT
				a.CMMNTY_ID, a.CMMNTY_NM, a.CMMNTY_INTRCN, a.USE_AT,
				c.TMPLAT_ID, c.TMPLAT_NM,
				a.FRST_REGIST_PNTTM, a.FRST_REGISTER_ID,
				b.USER_NM as FRST_REGISTER_NM, a.FRST_REGIST_PNTTM
			FROM
				COMTNCMMNTY a
			LEFT OUTER JOIN COMVNUSERMASTER b
			ON a.FRST_REGISTER_ID = b.ESNTL_ID
			LEFT OUTER JOIN COMTNTMPLATINFO c
			ON a.TMPLAT_ID = c.TMPLAT_ID
			WHERE
				a.CMMNTY_ID = #cmmntyId#
		]]>
	</select>

	<select id="CommunityManageDAO.selectCommunityBBSUseInf" parameterClass="CmmntyVO" resultMap="CmmntyBBSUseList">
		<![CDATA[
			SELECT
				a.BBS_ID, a.BBS_NM
			FROM
				COMTNBBSMASTER a
		    LEFT OUTER JOIN COMTNBBSUSE b
			ON a.BBS_ID = b.BBS_ID
			WHERE b.TRGET_ID = #cmmntyId#
			AND b.USE_AT = 'Y'
		]]>
	</select>

	<update id="CommunityManageDAO.updateCommunityInf"  parameterClass="Cmmnty">
		<![CDATA[
			UPDATE COMTNCMMNTY
			SET
				CMMNTY_NM = #cmmntyNm#,
				CMMNTY_INTRCN = #cmmntyIntrcn#,
				TMPLAT_ID = #tmplatId#,
				USE_AT = #useAt#,
				LAST_UPDUSR_ID = #lastUpdusrId#,
				LAST_UPDT_PNTTM = SYSDATE
			WHERE
				CMMNTY_ID = #cmmntyId#
		]]>
	</update>

	<update id="CommunityManageDAO.deleteCommunityInf"  parameterClass="Cmmnty">
		<![CDATA[
			UPDATE COMTNCMMNTY
			SET
				USE_AT = 'N',
				LAST_UPDUSR_ID = #lastUpdusrId#,
				LAST_UPDT_PNTTM = SYSDATE
			WHERE
				CMMNTY_ID = #cmmntyId#
		]]>
	</update>

	<update id="CommunityManageDAO.updateCommunityUserInf" parameterClass="CmmntyUser">
		<![CDATA[
			UPDATE COMTNCMMNTYUSER
			SET
				MNGR_AT = #mngrAt#,
				USE_AT = #useAt#,
				SECSN_DE = #secsnDe#,
				LAST_UPDUSR_ID = #lastUpdusrId#,
				LAST_UPDT_PNTTM = SYSDATE
			WHERE
				CMMNTY_ID = #cmmntyId#
			AND
				EMPLYR_ID = #emplyrId#
		]]>
	</update>

	<update id="CommunityManageDAO.deleteCommunityUserInf" parameterClass="CmmntyUser">
		<![CDATA[
			UPDATE COMTNCMMNTYUSER
			SET
				USE_AT = 'N',
				MNGR_AT = 'N',
				SECSN_DE = #secsnDe#,
				LAST_UPDUSR_ID = #lastUpdusrId#,
				LAST_UPDT_PNTTM = SYSDATE
			WHERE
				CMMNTY_ID = #cmmntyId#
			AND
				EMPLYR_ID = #emplyrId#
		]]>
	</update>

	<select id="CommunityManageDAO.selectCmmntyListPortlet"  parameterClass="CmmntyVO" resultMap="CmmntyListPortlet" >
		<![CDATA[
			SELECT
				CMMNTY_ID, CMMNTY_NM, CMMNTY_INTRCN, TMPLAT_ID
			FROM
				COMTNCMMNTY
			WHERE USE_AT = 'Y'
		]]>
	</select>
	<select id="CommunityManageDAO.selectCmmntyTmplat" parameterClass="CmmntyVO"  resultClass="java.lang.String" >
		<![CDATA[
			SELECT
				a.TMPLAT_COURS
			FROM
				COMTNTMPLATINFO a, COMTNCMMNTY b
			WHERE
				a. TMPLAT_ID = b.TMPLAT_ID
			AND
				b.CMMNTY_ID = #cmmntyId#
		]]>
	</select>

	<select id="CommunityManageDAO.checkExistUser" parameterClass="CmmntyUser" resultClass="java.lang.Integer">
		<![CDATA[
			SELECT COUNT(CMMNTY_ID) as cnt
				FROM
			COMTNCMMNTYUSER
				WHERE EMPLYR_ID = #emplyrId#
					AND CMMNTY_ID = #cmmntyId#
		]]>
	</select>

	<select id="CommunityManageDAO.selectAllCmmnty" resultMap="CmmntyList" >
		<![CDATA[
			SELECT
				a.CMMNTY_ID, a.CMMNTY_NM, a.USE_AT, a.REGIST_SE_CODE,
				c.CODE_NM as REGIST_SE_CODE_NM,
				a.FRST_REGIST_PNTTM, a.FRST_REGISTER_ID,
				b.USER_NM as FRST_REGISTER_NM
			FROM
				COMTNCMMNTY a
			LEFT OUTER JOIN COMVNUSERMASTER b
			ON a.FRST_REGISTER_ID = b.ESNTL_ID
			LEFT OUTER JOIN COMTCCMMNDETAILCODE c
			ON a.REGIST_SE_CODE = c.CODE
			WHERE c.CODE_ID = 'COM001'
			AND a.USE_AT = 'Y'
			ORDER BY CMMNTY_NM
		]]>
	</select>

	<update id="CommunityManageDAO.deleteAllCommunityUserInf" parameterClass="CmmntyUser">
		<![CDATA[
			UPDATE COMTNCMMNTYUSER
			SET
				USE_AT = 'N',
				MNGR_AT = 'N',
				SECSN_DE = #secsnDe#,
				LAST_UPDUSR_ID = #lastUpdusrId#,
				LAST_UPDT_PNTTM = SYSDATE
			WHERE
				CMMNTY_ID = #cmmntyId#
			AND
				USE_AT = 'Y'
		]]>
	</update>

	<select id="CommunityManageDAO.selectSingleCommunityUserInf" parameterClass="CmmntyUser"  resultMap="CmmntyUserInf" >
		<![CDATA[
			SELECT MNGR_AT, USE_AT FROM
			COMTNCMMNTYUSER
			WHERE EMPLYR_ID = #emplyrId#
				AND CMMNTY_ID =  #cmmntyId#
		]]>
	</select>

	<select id="CommunityManageDAO.selectCommunityManagerInf" parameterClass="CmmntyVO"  resultMap="CmmntyManagerInf" >
		<![CDATA[
			SELECT a.EMPLYR_ID, b.USER_NM as USER_NM
			FROM COMTNCMMNTYUSER a
			LEFT OUTER JOIN COMVNUSERMASTER b
			ON a.EMPLYR_ID = b.ESNTL_ID
			WHERE a.CMMNTY_ID =  #cmmntyId#
				AND a.USE_AT = 'Y' AND a.MNGR_AT = 'Y'
			ORDER BY a.FRST_REGIST_PNTTM ASC
		]]>
	</select>

</sqlMap>


text:
table {
  margin: auto;
  border-collapse: collapse;
  width: 100%;
}

th, td {
  text-align: center;
  padding: 8px;
}

tr:nth-child(even){background-color: black}

tr:hover {
  background-color: midnightblue;
}

tr > th {
  background-color: midnightblue;
}

.section {
  display: flex;
  align-content: center;
  align-items: center;
}

.shorted {
  margin: 0 10px;
}

.fixed {
  width: 100%;
  overflow: auto;
}


text:
' Copyright (c) Microsoft.  All Rights Reserved.  Licensed under the Apache License, Version 2.0.  See License.txt in the project root for license information.

Namespace Microsoft.VisualStudio.LanguageServices.VisualBasic.ProjectSystemShim.Interop
    Friend Enum VBCompilerOutputTypes
        ''' <summary>
        ''' This indicates that the compiler will not attempt to generate an output assembly. The
        ''' compiler can be used for UI features (e.g. Intellisense), but not for building an output
        ''' assembly. The compiler assumes Library output so it will not generate any errors for
        ''' missing Sub Main.
        ''' </summary>
        OUTPUT_None

        ''' <summary>
        ''' The current default. Produces an application that has a console window. The classes
        ''' defined inside of the EXE cannot be expose outside the EXE.
        ''' </summary>
        OUTPUT_ConsoleEXE

        ''' <summary>
        ''' Produces an application that does not have a console window. The classes defined inside
        ''' of the EXE cannot be exposed outside of the EXE.
        ''' </summary>
        OUTPUT_WindowsEXE

        ''' <summary>
        ''' Produces a DLL that may expose classes outside of itself.
        ''' </summary>
        OUTPUT_Library

        ''' <summary>
        ''' Produces a module that must be consumed by another assembly.
        ''' </summary>
        OUTPUT_Module

        ''' <summary>
        ''' Produces an app that runs in Appcontainer
        ''' </summary>
        OUTPUT_AppContainerEXE

        ''' <summary>
        ''' Produces the intermediary file that feeds into WinMDExp to produce a Windows
        ''' Runtime Metadata assembly
        ''' </summary>
        OUTPUT_WinMDObj
    End Enum
End Namespace


text:
package org.projectfloodlight.openflow.protocol;

import org.projectfloodlight.openflow.protocol.*;
import org.projectfloodlight.openflow.protocol.action.*;
import org.projectfloodlight.openflow.protocol.actionid.*;
import org.projectfloodlight.openflow.protocol.bsntlv.*;
import org.projectfloodlight.openflow.protocol.errormsg.*;
import org.projectfloodlight.openflow.protocol.meterband.*;
import org.projectfloodlight.openflow.protocol.instruction.*;
import org.projectfloodlight.openflow.protocol.instructionid.*;
import org.projectfloodlight.openflow.protocol.match.*;
import org.projectfloodlight.openflow.protocol.stat.*;
import org.projectfloodlight.openflow.protocol.oxm.*;
import org.projectfloodlight.openflow.protocol.oxs.*;
import org.projectfloodlight.openflow.protocol.queueprop.*;
import org.projectfloodlight.openflow.types.*;
import org.projectfloodlight.openflow.util.*;
import org.projectfloodlight.openflow.exceptions.*;
import java.util.Set;
import java.util.List;
import io.netty.buffer.ByteBuf;

public interface OFBsnGenericStatsRequest extends OFObject, OFBsnStatsRequest<OFBsnGenericStatsReply>, OFRequest<OFBsnGenericStatsReply> {
    OFVersion getVersion();
    OFType getType();
    long getXid();
    OFStatsType getStatsType();
    Set<OFStatsRequestFlags> getFlags();
    long getExperimenter();
    long getSubtype();
    String getName();
    List<OFBsnTlv> getTlvs();

    void writeTo(ByteBuf channelBuffer);

    Builder createBuilder();
    public interface Builder extends OFBsnStatsRequest.Builder<OFBsnGenericStatsReply> {
        OFBsnGenericStatsRequest build();
        OFVersion getVersion();
        OFType getType();
        long getXid();
        Builder setXid(long xid);
        OFStatsType getStatsType();
        Set<OFStatsRequestFlags> getFlags();
        Builder setFlags(Set<OFStatsRequestFlags> flags);
        long getExperimenter();
        long getSubtype();
        String getName();
        Builder setName(String name);
        List<OFBsnTlv> getTlvs();
        Builder setTlvs(List<OFBsnTlv> tlvs);
    }
}


text:
/*
 * @name Flocking
 * @description Demonstration of Craig Reynolds' "Flocking" behavior.

 * (Rules: Cohesion, Separation, Alignment.)

 * From natureofcode.com.
 */
let boids = [];

function setup() {
  createCanvas(720, 400);

  // Add an initial set of boids into the system
  for (let i = 0; i < 100; i++) {
    boids[i] = new Boid(random(width), random(height));
  }
}

function draw() {
  background(51);
  // Run all the boids
  for (let i = 0; i < boids.length; i++) {
    boids[i].run(boids);
  }
}

// Boid class
// Methods for Separation, Cohesion, Alignment added
class Boid {
  constructor(x, y) {
    this.acceleration = createVector(0, 0);
    this.velocity = p5.Vector.random2D();
    this.position = createVector(x, y);
    this.r = 3.0;
    this.maxspeed = 3;    // Maximum speed
    this.maxforce = 0.05; // Maximum steering force
  }

  run(boids) {
    this.flock(boids);
    this.update();
    this.borders();
    this.render();
  }

  // Forces go into acceleration
  applyForce(force) {
    this.acceleration.add(force);
  }

  // We accumulate a new acceleration each time based on three rules
  flock(boids) {
    let sep = this.separate(boids); // Separation
    let ali = this.align(boids);    // Alignment
    let coh = this.cohesion(boids); // Cohesion
    // Arbitrarily weight these forces
    sep.mult(2.5);
    ali.mult(1.0);
    coh.mult(1.0);
    // Add the force vectors to acceleration
    this.applyForce(sep);
    this.applyForce(ali);
    this.applyForce(coh);
  }

  // Method to update location
  update() {
    // Update velocity
    this.velocity.add(this.acceleration);
    // Limit speed
    this.velocity.limit(this.maxspeed);
    this.position.add(this.velocity);
    // Reset acceleration to 0 each cycle
    this.acceleration.mult(0);
  }

  // A method that calculates and applies a steering force towards a target
  // STEER = DESIRED MINUS VELOCITY
  seek(target) {
    let desired = p5.Vector.sub(target, this.position); // A vector pointing from the location to the target
    // Normalize desired and scale to maximum speed
    desired.normalize();
    desired.mult(this.maxspeed);
    // Steering = Desired minus Velocity
    let steer = p5.Vector.sub(desired, this.velocity);
    steer.limit(this.maxforce); // Limit to maximum steering force
    return steer;
  }

  // Draw boid as a circle
  render() {
    fill(127, 127);
    stroke(200);
    ellipse(this.position.x, this.position.y, 16, 16);
  }

  // Wraparound
  borders() {
    if (this.position.x < -this.r) this.position.x = width + this.r;
    if (this.position.y < -this.r) this.position.y = height + this.r;
    if (this.position.x > width + this.r) this.position.x = -this.r;
    if (this.position.y > height + this.r) this.position.y = -this.r;
  }

  // Separation
  // Method checks for nearby boids and steers away
  separate(boids) {
    let desiredseparation = 25.0;
    let steer = createVector(0, 0);
    let count = 0;
    // For every boid in the system, check if it's too close
    for (let i = 0; i < boids.length; i++) {
      let d = p5.Vector.dist(this.position, boids[i].position);
      // If the distance is greater than 0 and less than an arbitrary amount (0 when you are yourself)
      if ((d > 0) && (d < desiredseparation)) {
        // Calculate vector pointing away from neighbor
        let diff = p5.Vector.sub(this.position, boids[i].position);
        diff.normalize();
        diff.div(d); // Weight by distance
        steer.add(diff);
        count++; // Keep track of how many
      }
    }
    // Average -- divide by how many
    if (count > 0) {
      steer.div(count);
    }

    // As long as the vector is greater than 0
    if (steer.mag() > 0) {
      // Implement Reynolds: Steering = Desired - Velocity
      steer.normalize();
      steer.mult(this.maxspeed);
      steer.sub(this.velocity);
      steer.limit(this.maxforce);
    }
    return steer;
  }

  // Alignment
  // For every nearby boid in the system, calculate the average velocity
  align(boids) {
    let neighbordist = 50;
    let sum = createVector(0, 0);
    let count = 0;
    for (let i = 0; i < boids.length; i++) {
      let d = p5.Vector.dist(this.position, boids[i].position);
      if ((d > 0) && (d < neighbordist)) {
        sum.add(boids[i].velocity);
        count++;
      }
    }
    if (count > 0) {
      sum.div(count);
      sum.normalize();
      sum.mult(this.maxspeed);
      let steer = p5.Vector.sub(sum, this.velocity);
      steer.limit(this.maxforce);
      return steer;
    } else {
      return createVector(0, 0);
    }
  }

  // Cohesion
  // For the average location (i.e. center) of all nearby boids, calculate steering vector towards that location
  cohesion(boids) {
    let neighbordist = 50;
    let sum = createVector(0, 0); // Start with empty vector to accumulate all locations
    let count = 0;
    for (let i = 0; i < boids.length; i++) {
      let d = p5.Vector.dist(this.position, boids[i].position);
      if ((d > 0) && (d < neighbordist)) {
        sum.add(boids[i].position); // Add location
        count++;
      }
    }
    if (count > 0) {
      sum.div(count);
      return this.seek(sum); // Steer towards the location
    } else {
      return createVector(0, 0);
    }
  }
}


text:
package org.springframework.cloud.dataflow.composedtaskrunner;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import org.springframework.batch.core.StepContribution;
import org.springframework.batch.core.UnexpectedJobExecutionException;
import org.springframework.batch.core.scope.context.ChunkContext;
import org.springframework.batch.core.step.tasklet.Tasklet;
import org.springframework.batch.item.ExecutionContext;
import org.springframework.batch.repeat.RepeatStatus;
import org.springframework.cloud.common.security.core.support.OAuth2AccessTokenProvidingClientHttpRequestInterceptor;
import org.springframework.cloud.dataflow.composedtaskrunner.properties.ComposedTaskProperties;
import org.springframework.cloud.dataflow.composedtaskrunner.support.TaskExecutionTimeoutException;
import org.springframework.cloud.dataflow.rest.client.DataFlowOperations;
import org.springframework.cloud.dataflow.rest.client.DataFlowTemplate;
import org.springframework.cloud.dataflow.rest.client.TaskOperations;
import org.springframework.cloud.dataflow.rest.util.HttpClientConfigurer;
import org.springframework.cloud.task.configuration.TaskProperties;
import org.springframework.cloud.task.repository.TaskExecution;
import org.springframework.cloud.task.repository.TaskExplorer;
import org.springframework.security.oauth2.client.endpoint.OAuth2AccessTokenResponseClient;
import org.springframework.security.oauth2.client.endpoint.OAuth2ClientCredentialsGrantRequest;
import org.springframework.security.oauth2.client.registration.ClientRegistration;
import org.springframework.security.oauth2.client.registration.ClientRegistrationRepository;
import org.springframework.security.oauth2.core.endpoint.OAuth2AccessTokenResponse;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
import org.springframework.web.client.RestTemplate;

/**
 * Executes task launch request using Spring Cloud Data Flow's Restful API
 * then returns the execution id once the task launched.
 *
 * Note: This class is not thread-safe and as such should not be used as a singleton.
 *
 * @author Glenn Renfro
 */
public class TaskLauncherTasklet implements Tasklet {

	private ComposedTaskProperties composedTaskProperties;

	private TaskExplorer taskExplorer;

	private Map<String, String> properties;

	private List<String> arguments;

	private String taskName;

	private static final Log logger = LogFactory.getLog(org.springframework.cloud.dataflow.composedtaskrunner.TaskLauncherTasklet.class);

	private Long executionId;

	private long timeout;

	private ClientRegistrationRepository clientRegistrations;

	private OAuth2AccessTokenResponseClient<OAuth2ClientCredentialsGrantRequest> clientCredentialsTokenResponseClient;

	private TaskOperations taskOperations;

	TaskProperties taskProperties;

	public TaskLauncherTasklet(
			ClientRegistrationRepository clientRegistrations,
			OAuth2AccessTokenResponseClient<OAuth2ClientCredentialsGrantRequest> clientCredentialsTokenResponseClient,
			TaskExplorer taskExplorer,
			ComposedTaskProperties composedTaskProperties, String taskName,
			TaskProperties taskProperties) {
		Assert.hasText(taskName, "taskName must not be empty nor null.");
		Assert.notNull(taskExplorer, "taskExplorer must not be null.");
		Assert.notNull(composedTaskProperties,
				"composedTaskProperties must not be null");

		this.taskName = taskName;
		this.taskExplorer = taskExplorer;
		this.composedTaskProperties = composedTaskProperties;
		this.taskProperties = taskProperties;
		this.clientRegistrations = clientRegistrations;
		this.clientCredentialsTokenResponseClient = clientCredentialsTokenResponseClient;
	}

	public void setProperties(Map<String, String> properties) {
		if(properties != null) {
			this.properties = properties;
		}
		else {
			this.properties = new HashMap<>(0);
		}
	}

	public void setArguments(List<String> arguments) {
		if(arguments != null) {
			this.arguments = arguments;
		}
		else {
			this.arguments = new ArrayList<>(0);
		}
	}

	/**
	 * Executes the task as specified by the taskName with the associated
	 * properties and arguments.
	 *
	 * @param contribution mutable state to be passed back to update the current step execution
	 * @param chunkContext contains the task-execution-id used by the listener.
	 * @return Repeat status of FINISHED.
	 */
	@Override
	public RepeatStatus execute(StepContribution contribution,
			ChunkContext chunkContext) {
		TaskOperations taskOperations = taskOperations();
		if (this.executionId == null) {
			this.timeout = System.currentTimeMillis() +
					this.composedTaskProperties.getMaxWaitTime();
			logger.debug("Wait time for this task to complete is " +
					this.composedTaskProperties.getMaxWaitTime());
			logger.debug("Interval check time for this task to complete is " +
					this.composedTaskProperties.getIntervalTimeBetweenChecks());

			String tmpTaskName = this.taskName.substring(0,
					this.taskName.lastIndexOf('_'));

			List<String> args = this.arguments;

			ExecutionContext stepExecutionContext = chunkContext.getStepContext().getStepExecution().
					getExecutionContext();
			if (stepExecutionContext.containsKey("task-arguments")) {
				args = (List<String>) stepExecutionContext.get("task-arguments");
			}
			List<String> cleansedArgs = new ArrayList<>();
			if(args != null) {
				for(String argument : args) {
					if(!argument.startsWith("--spring.cloud.task.parent-execution-id=")) {
						cleansedArgs.add(argument);
					}
				}
				args = cleansedArgs;
			}
			if(this.taskProperties.getExecutionid() != null) {
				args.add("--spring.cloud.task.parent-execution-id=" + this.taskProperties.getExecutionid());
			}
			if(StringUtils.hasText(this.composedTaskProperties.getPlatformName())) {
				properties.put("spring.cloud.dataflow.task.platformName", this.composedTaskProperties.getPlatformName());
			}
			this.executionId = taskOperations.launch(tmpTaskName,
					this.properties, args);

			stepExecutionContext.put("task-execution-id", executionId);
			stepExecutionContext.put("task-arguments", args);
		}
		else {
			try {
				Thread.sleep(this.composedTaskProperties.getIntervalTimeBetweenChecks());
			}
			catch (InterruptedException e) {
				Thread.currentThread().interrupt();
				throw new IllegalStateException(e.getMessage(), e);
			}

			TaskExecution taskExecution =
					this.taskExplorer.getTaskExecution(this.executionId);
			if (taskExecution != null && taskExecution.getEndTime() != null) {
				if (taskExecution.getExitCode() == null) {
					throw new UnexpectedJobExecutionException("Task returned a null exit code.");
				}
				else if (taskExecution.getExitCode() != 0) {
					throw new UnexpectedJobExecutionException("Task returned a non zero exit code.");
				}
				else {
					return RepeatStatus.FINISHED;
				}
			}
			if (this.composedTaskProperties.getMaxWaitTime() > 0 &&
					System.currentTimeMillis() > timeout) {
				throw new TaskExecutionTimeoutException(String.format(
						"Timeout occurred while processing task with Execution Id %s",
						this.executionId));
			}
		}
		return RepeatStatus.CONTINUABLE;
	}

	public TaskOperations taskOperations() {
		if(this.taskOperations == null) {
			this.taskOperations = dataFlowOperations().taskOperations();
		}
		return this.taskOperations;
	}

	/**
	 * @return new instance of DataFlowOperations
	 */
	private DataFlowOperations dataFlowOperations() {

		final RestTemplate restTemplate = DataFlowTemplate.getDefaultDataflowRestTemplate();
		validateUsernamePassword(this.composedTaskProperties.getDataflowServerUsername(), this.composedTaskProperties.getDataflowServerPassword());
		HttpClientConfigurer clientHttpRequestFactoryBuilder = null;

		if (this.composedTaskProperties.getOauth2ClientCredentialsClientId() != null
				|| StringUtils.hasText(this.composedTaskProperties.getDataflowServerAccessToken())
				|| (StringUtils.hasText(this.composedTaskProperties.getDataflowServerUsername())
				&& StringUtils.hasText(this.composedTaskProperties.getDataflowServerPassword()))) {
			clientHttpRequestFactoryBuilder = HttpClientConfigurer.create(this.composedTaskProperties.getDataflowServerUri());
		}

		String accessTokenValue = null;

		if (this.composedTaskProperties.getOauth2ClientCredentialsClientId() != null) {
			final ClientRegistration clientRegistration = this.clientRegistrations.findByRegistrationId("default");
			final OAuth2ClientCredentialsGrantRequest grantRequest = new OAuth2ClientCredentialsGrantRequest(clientRegistration);
			final OAuth2AccessTokenResponse res = this.clientCredentialsTokenResponseClient.getTokenResponse(grantRequest);
			accessTokenValue = res.getAccessToken().getTokenValue();
			logger.debug("Configured OAuth2 Client Credentials for accessing the Data Flow Server");
		}
		else if (StringUtils.hasText(this.composedTaskProperties.getDataflowServerAccessToken())) {
			accessTokenValue = this.composedTaskProperties.getDataflowServerAccessToken();
			logger.debug("Configured OAuth2 Access Token for accessing the Data Flow Server");
		}
		else if (StringUtils.hasText(this.composedTaskProperties.getDataflowServerUsername())
				&& StringUtils.hasText(this.composedTaskProperties.getDataflowServerPassword())) {
			accessTokenValue = null;
			clientHttpRequestFactoryBuilder.basicAuthCredentials(composedTaskProperties.getDataflowServerUsername(), composedTaskProperties.getDataflowServerPassword());
			logger.debug("Configured basic security for accessing the Data Flow Server");
		}
		else {
			logger.debug("Not configuring basic security for accessing the Data Flow Server");
		}

		if (accessTokenValue != null) {
			restTemplate.getInterceptors().add(new OAuth2AccessTokenProvidingClientHttpRequestInterceptor(accessTokenValue));
		}

		if (clientHttpRequestFactoryBuilder != null) {
			restTemplate.setRequestFactory(clientHttpRequestFactoryBuilder.buildClientHttpRequestFactory());
		}

		return new DataFlowTemplate(this.composedTaskProperties.getDataflowServerUri(), restTemplate);
	}

	private void validateUsernamePassword(String userName, String password) {
		if (StringUtils.hasText(password) && !StringUtils.hasText(userName)) {
			throw new IllegalArgumentException("A password may be specified only together with a username");
		}
		if (!StringUtils.hasText(password) && StringUtils.hasText(userName)) {
			throw new IllegalArgumentException("A username may be specified only together with a password");
		}
	}
}


text:
FactoryGirl.define do
  factory :minimal_record, class: MediaObject do
    title 'Minimal test record'
    creator 'RSpec'
    date_issued '#{Time.now}'
    abstract 'A bare bones test record with only required fields completed'
  end

  factory :single_entry, class: MediaObject do
    title 'Single contributor'
    creator 'RSpec'
    date_issued '#{Time.now}'
    abstract 'A record with only a single contributor and publisher'

    contributor 'RSpec helper'
    publisher 'Ruby on Rails'
    subject 'Programming'
  end

  factory :multiple_entries, class: MediaObject do
    title 'Multiple contributors'
    creator 'RSpec'
    date_issued '#{Time.now}'
    abstract 'A record with multiple contributors, publishers, and search terms'

    contributor ['Chris Colvard', 'Nathan Rogers', 'Phuong Dinh']
    publisher ['Mark Notess', 'Jon Dunn', 'Stu Baker']
    subject ['Programming', 'Ruby on Rails']
  end
end


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Pluteolus leaianus Berk.

### Remarks
null


text:
<?php

/**
 * Class PilipayLogger
 * This class is used for customizing logging.
 *
 * For example:
 *
 *   // to record logs into a file:
 *   PilipayLogger::instance()->setHandler(function($level, $msg){
 *       file_put_contents('path/to/pilipay/log/file', sprintf('%s %s: %s'.PHP_EOL, date('Y-m-d H:i:s'), $level, $msg));
 *   });
 *
 */
class PilipayLogger
{
    /**
     * @param callable $handler function ($level, $msg)...
     */
    public function setHandler($handler){
        $this->handler = $handler;
    }

    /**
     * @param $level string error/info/debug...
     * @param $msg string
     */
    public function log($level, $msg){
        if (!is_null($this->handler)){
            call_user_func($this->handler, $level, $msg);
        }
    }

    /**
     * @return PilipayLogger
     */
    public static function instance(){
        if (!self::$instance){
            self::$instance = new PilipayLogger();
        }

        return self::$instance;
    }

    protected static $instance;
    private $handler = null;
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

    <meta content="atl.general" name="decorator" />
    <title>AUI Page</title>

    <link type="text/css" rel="stylesheet" href="../aui/css/basic.css" media="all">
    <link type="text/css" rel="stylesheet" href="../aui/css/firebug.css" media="all">
    <link type="text/css" rel="stylesheet" href="../aui/css/dialog.css" media="all">
    <link type="text/css" rel="stylesheet" href="../aui/css/dropdown.css" media="all">
    <link type="text/css" rel="stylesheet" href="../aui/css/forms.css" media="all">
    <link type="text/css" rel="stylesheet" href="../aui/css/icons.css" media="all">
    <link type="text/css" rel="stylesheet" href="../aui/css/inline-dialog.css" media="all">
    <link type="text/css" rel="stylesheet" href="../aui/css/messages.css" media="all">
    <link type="text/css" rel="stylesheet" href="../aui/css/tables.css" media="all">
    <link type="text/css" rel="stylesheet" href="../aui/css/tabs.css" media="all">
    <link type="text/css" rel="stylesheet" href="../aui/css/toolbar.css" media="all">

AuiDropDown

 Shows a standard dropdown

                    Links

JQuery Page

Item 1

Item 2

Item 3

Item 4

Item 5

AuiTabs

                Admin Tab

                User Tab

This is Admin Tab

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse porttitor volutpat posuere. Nunc non lacinia ligula. In convallis iaculis interdum. Sed quis risus gravida enim adipiscing semper. In magna tortor, scelerisque vel lobortis sed, tincidunt quis mauris. Sed libero neque, hendrerit ac sagittis eget, rhoncus vel augue. Proin eget blandit ligula. Praesent placerat, nisl a laoreet ultrices, mi sem suscipit nisl, non ornare neque massa nec augue. Integer consectetur elementum posuere. Integer feugiat aliquam rutrum. Praesent sapien lectus, pharetra quis pharetra vel, mattis ut orci. In vehicula nibh et enim lacinia interdum. Sed aliquam vehicula risus, vitae commodo sapien vulputate eu. Phasellus vulputate tempor aliquet.

This is User Tab

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse porttitor volutpat posuere. Nunc non lacinia ligula. In convallis iaculis interdum. Sed quis risus gravida enim adipiscing semper. In magna tortor, scelerisque vel lobortis sed, tincidunt quis mauris. Sed libero neque, hendrerit ac sagittis eget, rhoncus vel augue. Proin eget blandit ligula. Praesent placerat, nisl a laoreet ultrices, mi sem suscipit nisl, non ornare neque massa nec augue. Integer consectetur elementum posuere. Integer feugiat aliquam rutrum. Praesent sapien lectus, pharetra quis pharetra vel, mattis ut orci. In vehicula nibh et enim lacinia interdum. Sed aliquam vehicula risus, vitae commodo sapien vulputate eu. Phasellus vulputate tempor aliquet.

Inline Dialog

Click Link


text:
    X

        <search></search>


text:
//
//  @author raver119@gmail.com
//

#include <op_boilerplate.h>
#if NOT_EXCLUDED(OP_listdiff)

#include <ops/declarable/headers/parity_ops.h>
#include <ops/declarable/helpers/listdiff.h>

// this op will probably never become GPU-compatible
namespace nd4j {
    namespace ops {
        CUSTOM_OP_IMPL(listdiff, 2, 2, false, 0, 0) {
            auto values = INPUT_VARIABLE(0);
            auto keep = INPUT_VARIABLE(1);
            auto output1 = OUTPUT_VARIABLE(0);
            auto output2 = OUTPUT_VARIABLE(1);

            REQUIRE_TRUE(values->rankOf() == 1, 0, "ListDiff: rank of values should be 1D, but got %iD instead", values->rankOf());
            REQUIRE_TRUE(keep->rankOf() == 1, 0, "ListDiff: rank of keep should be 1D, but got %iD instead", keep->rankOf());
            REQUIRE_TRUE(keep->dataType() == values->dataType(), 0, "ListDiff: both inputs must have same data type");

            return helpers::listDiffFunctor(block.launchContext(), values, keep, output1, output2);
        };

        DECLARE_SHAPE_FN(listdiff) {
            auto values = INPUT_VARIABLE(0);
            auto keep = INPUT_VARIABLE(1);

            REQUIRE_TRUE(values->rankOf() == 1, 0, "ListDiff: rank of values should be 1D, but got %iD instead", values->rankOf());
            REQUIRE_TRUE(keep->rankOf() == 1, 0, "ListDiff: rank of keep should be 1D, but got %iD instead", keep->rankOf());
            auto v = values->dataType();
            auto k = keep->dataType();
            REQUIRE_TRUE(k == v, 0, "ListDiff: both inputs must have same data type");

            auto saved = helpers::listDiffCount(block.launchContext(), values, keep);

            REQUIRE_TRUE(saved > 0, 0, "ListDiff: no matches found");

            auto shapeX = ConstantShapeHelper::getInstance()->vectorShapeInfo(saved, values->dataType());
            auto shapeY = ConstantShapeHelper::getInstance()->vectorShapeInfo(saved, DataType::INT64);
            return SHAPELIST(shapeX, shapeY);
        }

        DECLARE_TYPES(listdiff) {
            getOpDescriptor()
                    ->setAllowedInputTypes({ALL_INTS, ALL_FLOATS})
                    ->setAllowedOutputTypes(0, DataType::INHERIT)
                    ->setAllowedOutputTypes(1, {ALL_INTS});
        }
    }
}

#endif


text:
1. Install node
1. Clone this project
1. `npm install`
1. `bower install`
1. If you don't have Grunt's CLI, install it: `npm install -g grunt-cli`
1. `grunt serve`

* Local webserver
* Live reloading
* Stylus parser and autoprefixer


text:
/* pfold style */

.uc-container {
	position: relative;
	width: 100px;
	height: 100px;
	top: 0;
	left: 0;
}

.uc-single,
.uc-back,
.uc-front,
.uc-final {
	background:url('../images/General/paper.png') repeat top left;
}

.uc-final,
.uc-initial,
.uc-final-wrapper {
	width: 100%;
	height: 100%;
	position: absolute;
	top: 0;
	left: 0;
}

.uc-initial-content,
.uc-final-content {
	width: 100%;
	height: 100%;
	position: relative;
}

.uc-final,
.uc-final-content {
	display: none;
}

.uc-initial-content {
	-webkit-backface-visibility: hidden;
	-moz-backface-visibility: hidden;
	-o-backface-visibility: hidden;
	-ms-backface-visibility: hidden;
	backface-visibility: hidden;
}

.uc-part {
	top: 0;
	left: 0;
	position: absolute;
	-webkit-transform-style: preserve-3d;
	-moz-transform-style: preserve-3d;
	-o-transform-style: preserve-3d;
	-ms-transform-style: preserve-3d;
	transform-style: preserve-3d;
}

.uc-part > div {
	display: block;
	position: absolute;
	width: 100%;
	height: 100%;
	-webkit-backface-visibility: hidden;
	-moz-backface-visibility: hidden;
	-o-backface-visibility: hidden;
	-ms-backface-visibility: hidden;
	backface-visibility: hidden;
}

.uc-part .uc-back {
	-webkit-transform: rotateY(-180deg);
	-moz-transform: rotateY(-180deg);
	-o-transform: rotateY(-180deg);
	-ms-transform: rotateY(-180deg);
	transform: rotateY(-180deg);
}

/* Transformation-origin classes */

.uc-unfold-left {
	-webkit-transform-origin: 0 50%;
	-moz-transform-origin: 0 50%;
	-o-transform-origin: 0 50%;
	-ms-transform-origin: 0 50%;
	transform-origin: 0 50%;
}

.uc-unfold-right {
	-webkit-transform-origin: 100% 50%;
	-moz-transform-origin: 100% 50%;
	-o-transform-origin: 100% 50%;
	-ms-transform-origin: 100% 50%;
	transform-origin: 100% 50%;
}

.uc-unfold-top {
	-webkit-transform-origin: 50% 0%;
	-moz-transform-origin: 50% 0%;
	-o-transform-origin: 50% 0%;
	-ms-transform-origin: 50% 0%;
	transform-origin: 50% 0%;
}

.uc-unfold-bottom {
	-webkit-transform-origin: 50% 100%;
	-moz-transform-origin: 50% 100%;
	-o-transform-origin: 50% 100%;
	-ms-transform-origin: 50% 100%;
	transform-origin: 50% 100%;
}

/* Unfolding classes */
.uc-unfold-left.uc-unfold {
	-webkit-transform: rotateY(-180deg);
	-moz-transform: rotateY(-180deg);
	-o-transform: rotateY(-180deg);
	-ms-transform: rotateY(-180deg);
	transform: rotateY(-180deg);
}

.uc-unfold-right.uc-unfold {
	-webkit-transform: rotateY(180deg);
	-moz-transform: rotateY(180deg);
	-o-transform: rotateY(180deg);
	-ms-transform: rotateY(180deg);
	transform: rotateY(180deg);
}

.uc-unfold-top.uc-unfold {
	-webkit-transform: rotateX(180deg);
	-moz-transform: rotateX(180deg);
	-o-transform: rotateX(180deg);
	-ms-transform: rotateX(180deg);
	transform: rotateX(180deg);
}

.uc-unfold-bottom.uc-unfold{
	-webkit-transform: rotateX(-180deg);
	-moz-transform: rotateX(-180deg);
	-o-transform: rotateX(-180deg);
	-ms-transform: rotateX(-180deg);
	transform: rotateX(-180deg);
}

.uc-overlay {
	width: 100%;
	height: 100%;
	position: absolute;
	top: 0;
	left: 0;
}

.uc-overlay,
.uc-flipoverlay {
	background-color: rgba(100, 100, 100, 0.7);
	position: absolute;
	top: 0px;
	left: 0px;
	width: 100%;
	height: 100%;
	opacity: 0;
	-webkit-backface-visibility: hidden;
	-moz-backface-visibility: hidden;
	-o-backface-visibility: hidden;
	-ms-backface-visibility: hidden;
	backface-visibility: hidden;
}

.uc-flipoverlay {
	background-color: rgba(100, 100, 100, 0.4);
}

.uc-inner {
	position: absolute;
	left: 0;
	top: 0;
	overflow: hidden;
	width: 100%;
	height: 100%;
}

.uc-inner-rotate {
	-webkit-transform: rotateY(180deg) rotateX(180deg);
	-moz-transform: rotateY(180deg) rotateX(180deg);
	-o-transform: rotateY(180deg) rotateX(180deg);
	-ms-transform: rotateY(180deg) rotateX(180deg);
	transform: rotateY(180deg) rotateX(180deg);
}

.uc-container.uc-current {
	z-index: 9999;
}