Probability distributions - torch.distributions¶
The distributions
package contains parameterizable probability distributions
and sampling functions. This allows the construction of stochastic computation
graphs and stochastic gradient estimators for optimization. This package
generally follows the design of the TensorFlow Distributions package.
It is not possible to directly backpropagate through random samples. However, there are two main methods for creating surrogate functions that can be backpropagated through. These are the score function estimator/likelihood ratio estimator/REINFORCE and the pathwise derivative estimator. REINFORCE is commonly seen as the basis for policy gradient methods in reinforcement learning, and the pathwise derivative estimator is commonly seen in the reparameterization trick in variational autoencoders. Whilst the score function only requires the value of samples \(f(x)\), the pathwise derivative requires the derivative \(f'(x)\). The next sections discuss these two in a reinforcement learning example. For more details see Gradient Estimation Using Stochastic Computation Graphs .
Score function¶
When the probability density function is differentiable with respect to its
parameters, we only need sample()
and
log_prob()
to implement REINFORCE:
where \(\theta\) are the parameters, \(\alpha\) is the learning rate, \(r\) is the reward and \(p(a|\pi^\theta(s))\) is the probability of taking action \(a\) in state \(s\) given policy \(\pi^\theta\).
In practice we would sample an action from the output of a network, apply this
action in an environment, and then use log_prob
to construct an equivalent
loss function. Note that we use a negative because optimizers use gradient
descent, whilst the rule above assumes gradient ascent. With a categorical
policy, the code for implementing REINFORCE would be as follows:
probs = policy_network(state)
# Note that this is equivalent to what used to be called multinomial
m = Categorical(probs)
action = m.sample()
next_state, reward = env.step(action)
loss = -m.log_prob(action) * reward
loss.backward()
Pathwise derivative¶
The other way to implement these stochastic/policy gradients would be to use the
reparameterization trick from the
rsample()
method, where the
parameterized random variable can be constructed via a parameterized
deterministic function of a parameter-free random variable. The reparameterized
sample therefore becomes differentiable. The code for implementing the pathwise
derivative would be as follows:
params = policy_network(state)
m = Normal(*params)
# Any distribution with .has_rsample == True could work based on the application
action = m.rsample()
next_state, reward = env.step(action) # Assuming that reward is differentiable
loss = -reward
loss.backward()
Distribution¶
-
class
torch.distributions.distribution.
Distribution
(batch_shape=torch.Size([]), event_shape=torch.Size([]), validate_args=None)[source]¶ Bases:
object
Distribution is the abstract base class for probability distributions.
-
arg_constraints
¶ Returns a dictionary from argument names to
Constraint
objects that should be satisfied by each argument of this distribution. Args that are not tensors need not appear in this dict.
-
batch_shape
¶ Returns the shape over which parameters are batched.
-
cdf
(value)[source]¶ Returns the cumulative density/mass function evaluated at value.
Parameters: value (Tensor) –
-
entropy
()[source]¶ Returns entropy of distribution, batched over batch_shape.
Returns: Tensor of shape batch_shape.
-
enumerate_support
()[source]¶ Returns tensor containing all values supported by a discrete distribution. The result will enumerate over dimension 0, so the shape of the result will be (cardinality,) + batch_shape + event_shape (where event_shape = () for univariate distributions).
Note that this enumerates over all batched tensors in lock-step [[0, 0], [1, 1], …]. To iterate over the full Cartesian product use itertools.product(m.enumerate_support()).
Returns: Tensor iterating over dimension 0.
-
event_shape
¶ Returns the shape of a single sample (without batching).
-
icdf
(value)[source]¶ Returns the inverse cumulative density/mass function evaluated at value.
Parameters: value (Tensor) –
-
log_prob
(value)[source]¶ Returns the log of the probability density/mass function evaluated at value.
Parameters: value (Tensor) –
-
mean
¶ Returns the mean of the distribution.
-
perplexity
()[source]¶ Returns perplexity of distribution, batched over batch_shape.
Returns: Tensor of shape batch_shape.
-
rsample
(sample_shape=torch.Size([]))[source]¶ Generates a sample_shape shaped reparameterized sample or sample_shape shaped batch of reparameterized samples if the distribution parameters are batched.
-
sample
(sample_shape=torch.Size([]))[source]¶ Generates a sample_shape shaped sample or sample_shape shaped batch of samples if the distribution parameters are batched.
-
sample_n
(n)[source]¶ Generates n samples or n batches of samples if the distribution parameters are batched.
-
stddev
¶ Returns the standard deviation of the distribution.
-
support
¶ Returns a
Constraint
object representing this distribution’s support.
-
variance
¶ Returns the variance of the distribution.
-
ExponentialFamily¶
-
class
torch.distributions.exp_family.
ExponentialFamily
(batch_shape=torch.Size([]), event_shape=torch.Size([]), validate_args=None)[source]¶ Bases:
torch.distributions.distribution.Distribution
ExponentialFamily is the abstract base class for probability distributions belonging to an exponential family, whose probability mass/density function has the form is defined below
\[p_{F}(x; \theta) = \exp(\langle t(x), \theta\rangle) - F(\theta) + k(x))\]where \(\theta\) denotes the natural parameters, \(t(x)\) denotes the sufficient statistic, \(F(\theta)\) is the log normalizer function for a given family and \(k(x)\) is the carrier measure.
Note
This class is an intermediary between the Distribution class and distributions which belong to an exponential family mainly to check the correctness of the .entropy() and analytic KL divergence methods. We use this class to compute the entropy and KL divergence using the AD frame- work and Bregman divergences (courtesy of: Frank Nielsen and Richard Nock, Entropies and Cross-entropies of Exponential Families).
Bernoulli¶
-
class
torch.distributions.bernoulli.
Bernoulli
(probs=None, logits=None, validate_args=None)[source]¶ Bases:
torch.distributions.exp_family.ExponentialFamily
Creates a Bernoulli distribution parameterized by probs or logits.
Samples are binary (0 or 1). They take the value 1 with probability p and 0 with probability 1 - p.
Example:
>>> m = Bernoulli(torch.tensor([0.3])) >>> m.sample() # 30% chance 1; 70% chance 0 tensor([ 0.])
Parameters: -
arg_constraints
= {'probs': <torch.distributions.constraints._Interval object at 0x7f65512f4898>}¶
-
has_enumerate_support
= True¶
-
mean
¶
-
param_shape
¶
-
support
= <torch.distributions.constraints._Boolean object>¶
-
variance
¶
-
Beta¶
-
class
torch.distributions.beta.
Beta
(concentration1, concentration0, validate_args=None)[source]¶ Bases:
torch.distributions.exp_family.ExponentialFamily
Beta distribution parameterized by concentration1 and concentration0.
Example:
>>> m = Beta(torch.tensor([0.5]), torch.tensor([0.5])) >>> m.sample() # Beta distributed with concentration concentration1 and concentration0 tensor([ 0.1046])
Parameters: -
arg_constraints
= {'concentration0': <torch.distributions.constraints._GreaterThan object at 0x7f65512f4860>, 'concentration1': <torch.distributions.constraints._GreaterThan object at 0x7f65512f4860>}¶
-
concentration0
¶
-
concentration1
¶
-
has_rsample
= True¶
-
mean
¶
-
support
= <torch.distributions.constraints._Interval object>¶
-
variance
¶
-
Binomial¶
-
class
torch.distributions.binomial.
Binomial
(total_count=1, probs=None, logits=None, validate_args=None)[source]¶ Bases:
torch.distributions.distribution.Distribution
Creates a Binomial distribution parameterized by total_count and either probs or logits (but not both). total_count must be broadcastable with probs/logits.
Example:
>>> m = Binomial(100, torch.tensor([0 , .2, .8, 1])) >>> x = m.sample() tensor([ 0., 22., 71., 100.]) >>> m = Binomial(torch.tensor([[5.], [10.]]), torch.tensor([0.5, 0.8])) >>> x = m.sample() tensor([[ 4., 5.], [ 7., 6.]])
Parameters: -
arg_constraints
= {'probs': <torch.distributions.constraints._Interval object at 0x7f65512f4898>, 'total_count': <torch.distributions.constraints._IntegerGreaterThan object at 0x7f65512f4780>}¶
-
has_enumerate_support
= True¶
-
mean
¶
-
param_shape
¶
-
support
¶
-
variance
¶
-
Categorical¶
-
class
torch.distributions.categorical.
Categorical
(probs=None, logits=None, validate_args=None)[source]¶ Bases:
torch.distributions.distribution.Distribution
Creates a categorical distribution parameterized by either
probs
orlogits
(but not both).Note
It is equivalent to the distribution that
torch.multinomial()
samples from.Samples are integers from 0 … K-1 where K is probs.size(-1).
If
probs
is 1D with length-K, each element is the relative probability of sampling the class at that index.If
probs
is 2D, it is treated as a batch of relative probability vectors.Note
probs
must be non-negative, finite and have a non-zero sum, and it will be normalized to sum to 1.See also:
torch.multinomial()
Example:
>>> m = Categorical(torch.tensor([ 0.25, 0.25, 0.25, 0.25 ])) >>> m.sample() # equal probability of 0, 1, 2, 3 tensor(3)
Parameters: -
arg_constraints
= {'probs': <torch.distributions.constraints._Simplex object at 0x7f65512f48d0>}¶
-
has_enumerate_support
= True¶
-
mean
¶
-
param_shape
¶
-
support
¶
-
variance
¶
-
Cauchy¶
-
class
torch.distributions.cauchy.
Cauchy
(loc, scale, validate_args=None)[source]¶ Bases:
torch.distributions.distribution.Distribution
Samples from a Cauchy (Lorentz) distribution. The distribution of the ratio of independent normally distributed random variables with means 0 follows a Cauchy distribution.
Example:
>>> m = Cauchy(torch.tensor([0.0]), torch.tensor([1.0])) >>> m.sample() # sample from a Cauchy distribution with loc=0 and scale=1 tensor([ 2.3214])
Parameters: -
arg_constraints
= {'loc': <torch.distributions.constraints._Real object at 0x7f65512f47f0>, 'scale': <torch.distributions.constraints._GreaterThan object at 0x7f65512f4860>}¶
-
has_rsample
= True¶
-
mean
¶
-
support
= <torch.distributions.constraints._Real object>¶
-
variance
¶
-
Chi2¶
-
class
torch.distributions.chi2.
Chi2
(df, validate_args=None)[source]¶ Bases:
torch.distributions.gamma.Gamma
Creates a Chi2 distribution parameterized by shape parameter df. This is exactly equivalent to Gamma(alpha=0.5*df, beta=0.5)
Example:
>>> m = Chi2(torch.tensor([1.0])) >>> m.sample() # Chi2 distributed with shape df=1 tensor([ 0.1046])
Parameters: df (float or Tensor) – shape parameter of the distribution -
arg_constraints
= {'df': <torch.distributions.constraints._GreaterThan object at 0x7f65512f4860>}¶
-
df
¶
-
Dirichlet¶
-
class
torch.distributions.dirichlet.
Dirichlet
(concentration, validate_args=None)[source]¶ Bases:
torch.distributions.exp_family.ExponentialFamily
Creates a Dirichlet distribution parameterized by concentration concentration.
Example:
>>> m = Dirichlet(torch.tensor([0.5, 0.5])) >>> m.sample() # Dirichlet distributed with concentrarion concentration tensor([ 0.1046, 0.8954])
Parameters: concentration (Tensor) – concentration parameter of the distribution (often referred to as alpha) -
arg_constraints
= {'concentration': <torch.distributions.constraints._GreaterThan object at 0x7f65512f4860>}¶
-
has_rsample
= True¶
-
mean
¶
-
support
= <torch.distributions.constraints._Simplex object>¶
-
variance
¶
-
Exponential¶
-
class
torch.distributions.exponential.
Exponential
(rate, validate_args=None)[source]¶ Bases:
torch.distributions.exp_family.ExponentialFamily
Creates a Exponential distribution parameterized by rate.
Example:
>>> m = Exponential(torch.tensor([1.0])) >>> m.sample() # Exponential distributed with rate=1 tensor([ 0.1046])
Parameters: rate (float or Tensor) – rate = 1 / scale of the distribution -
arg_constraints
= {'rate': <torch.distributions.constraints._GreaterThan object at 0x7f65512f4860>}¶
-
has_rsample
= True¶
-
mean
¶
-
stddev
¶
-
support
= <torch.distributions.constraints._GreaterThan object>¶
-
variance
¶
-
FisherSnedecor¶
-
class
torch.distributions.fishersnedecor.
FisherSnedecor
(df1, df2, validate_args=None)[source]¶ Bases:
torch.distributions.distribution.Distribution
Creates a Fisher-Snedecor distribution parameterized by df1 and df2.
Example:
>>> m = FisherSnedecor(torch.tensor([1.0]), torch.tensor([2.0])) >>> m.sample() # Fisher-Snedecor-distributed with df1=1 and df2=2 tensor([ 0.2453])
Parameters: -
arg_constraints
= {'df1': <torch.distributions.constraints._GreaterThan object at 0x7f65512f4860>, 'df2': <torch.distributions.constraints._GreaterThan object at 0x7f65512f4860>}¶
-
has_rsample
= True¶
-
mean
¶
-
support
= <torch.distributions.constraints._GreaterThan object>¶
-
variance
¶
-
Gamma¶
-
class
torch.distributions.gamma.
Gamma
(concentration, rate, validate_args=None)[source]¶ Bases:
torch.distributions.exp_family.ExponentialFamily
Creates a Gamma distribution parameterized by shape concentration and rate.
Example:
>>> m = Gamma(torch.tensor([1.0]), torch.tensor([1.0])) >>> m.sample() # Gamma distributed with concentration=1 and rate=1 tensor([ 0.1046])
Parameters: -
arg_constraints
= {'concentration': <torch.distributions.constraints._GreaterThan object at 0x7f65512f4860>, 'rate': <torch.distributions.constraints._GreaterThan object at 0x7f65512f4860>}¶
-
has_rsample
= True¶
-
mean
¶
-
support
= <torch.distributions.constraints._GreaterThan object>¶
-
variance
¶
-
Geometric¶
-
class
torch.distributions.geometric.
Geometric
(probs=None, logits=None, validate_args=None)[source]¶ Bases:
torch.distributions.distribution.Distribution
Creates a Geometric distribution parameterized by probs, where probs is the probability of success of Bernoulli trials. It represents the probability that in k + 1 Bernoulli trials, the first k trials failed, before seeing a success.
Samples are non-negative integers [0, inf).
Example:
>>> m = Geometric(torch.tensor([0.3])) >>> m.sample() # underlying Bernoulli has 30% chance 1; 70% chance 0 tensor([ 2.])
Parameters: -
arg_constraints
= {'probs': <torch.distributions.constraints._Interval object at 0x7f65512f4898>}¶
-
mean
¶
-
support
= <torch.distributions.constraints._IntegerGreaterThan object>¶
-
variance
¶
-
Gumbel¶
-
class
torch.distributions.gumbel.
Gumbel
(loc, scale, validate_args=None)[source]¶ Bases:
torch.distributions.transformed_distribution.TransformedDistribution
Samples from a Gumbel Distribution.
Examples:
>>> m = Gumbel(torch.tensor([1.0]), torch.tensor([2.0])) >>> m.sample() # sample from Gumbel distribution with loc=1, scale=2 tensor([ 1.0124])
Parameters: -
arg_constraints
= {'loc': <torch.distributions.constraints._Real object at 0x7f65512f47f0>, 'scale': <torch.distributions.constraints._GreaterThan object at 0x7f65512f4860>}¶
-
mean
¶
-
stddev
¶
-
support
= <torch.distributions.constraints._Real object>¶
-
variance
¶
-
HalfCauchy¶
-
class
torch.distributions.half_cauchy.
HalfCauchy
(scale, validate_args=None)[source]¶ Bases:
torch.distributions.transformed_distribution.TransformedDistribution
Creates a half-normal distribution parameterized by scale where:
X ~ Cauchy(0, scale) Y = |X| ~ HalfCauchy(scale)
Example:
>>> m = HalfCauchy(torch.tensor([1.0])) >>> m.sample() # half-cauchy distributed with scale=1 tensor([ 2.3214])
Parameters: scale (float or Tensor) – scale of the full Cauchy distribution -
arg_constraints
= {'scale': <torch.distributions.constraints._GreaterThan object at 0x7f65512f4860>}¶
-
has_rsample
= True¶
-
mean
¶
-
scale
¶
-
support
= <torch.distributions.constraints._GreaterThan object>¶
-
variance
¶
-
HalfNormal¶
-
class
torch.distributions.half_normal.
HalfNormal
(scale, validate_args=None)[source]¶ Bases:
torch.distributions.transformed_distribution.TransformedDistribution
Creates a half-normal distribution parameterized by scale where:
X ~ Normal(0, scale) Y = |X| ~ HalfNormal(scale)
Example:
>>> m = HalfNormal(torch.tensor([1.0])) >>> m.sample() # half-normal distributed with scale=1 tensor([ 0.1046])
Parameters: scale (float or Tensor) – scale of the full Normal distribution -
arg_constraints
= {'scale': <torch.distributions.constraints._GreaterThan object at 0x7f65512f4860>}¶
-
has_rsample
= True¶
-
mean
¶
-
scale
¶
-
support
= <torch.distributions.constraints._GreaterThan object>¶
-
variance
¶
-
Independent¶
-
class
torch.distributions.independent.
Independent
(base_distribution, reinterpreted_batch_ndims, validate_args=None)[source]¶ Bases:
torch.distributions.distribution.Distribution
Reinterprets some of the batch dims of a distribution as event dims.
This is mainly useful for changing the shape of the result of
log_prob()
. For example to create a diagonal Normal distribution with the same shape as a Multivariate Normal distribution (so they are interchangeable), you can:>>> loc = torch.zeros(3) >>> scale = torch.ones(3) >>> mvn = MultivariateNormal(loc, scale_tril=torch.diag(scale)) >>> [mvn.batch_shape, mvn.event_shape] [torch.Size(()), torch.Size((3,))] >>> normal = Normal(loc, scale) >>> [normal.batch_shape, normal.event_shape] [torch.Size((3,)), torch.Size(())] >>> diagn = Independent(normal, 1) >>> [diagn.batch_shape, diagn.event_shape] [torch.Size(()), torch.Size((3,))]
Parameters: - base_distribution (torch.distributions.distribution.Distribution) – a base distribution
- reinterpreted_batch_ndims (int) – the number of batch dims to reinterpret as event dims
-
arg_constraints
= {}¶
-
has_enumerate_support
¶
-
has_rsample
¶
-
mean
¶
-
support
¶
-
variance
¶
Laplace¶
-
class
torch.distributions.laplace.
Laplace
(loc, scale, validate_args=None)[source]¶ Bases:
torch.distributions.distribution.Distribution
Creates a Laplace distribution parameterized by loc and ‘scale’.
Example:
>>> m = Laplace(torch.tensor([0.0]), torch.tensor([1.0])) >>> m.sample() # Laplace distributed with loc=0, scale=1 tensor([ 0.1046])
Parameters: -
arg_constraints
= {'loc': <torch.distributions.constraints._Real object at 0x7f65512f47f0>, 'scale': <torch.distributions.constraints._GreaterThan object at 0x7f65512f4860>}¶
-
has_rsample
= True¶
-
mean
¶
-
stddev
¶
-
support
= <torch.distributions.constraints._Real object>¶
-
variance
¶
-
LogNormal¶
-
class
torch.distributions.log_normal.
LogNormal
(loc, scale, validate_args=None)[source]¶ Bases:
torch.distributions.transformed_distribution.TransformedDistribution
Creates a log-normal distribution parameterized by loc and scale where:
X ~ Normal(loc, scale) Y = exp(X) ~ LogNormal(loc, scale)
Example:
>>> m = LogNormal(torch.tensor([0.0]), torch.tensor([1.0])) >>> m.sample() # log-normal distributed with mean=0 and stddev=1 tensor([ 0.1046])
Parameters: -
arg_constraints
= {'loc': <torch.distributions.constraints._Real object at 0x7f65512f47f0>, 'scale': <torch.distributions.constraints._GreaterThan object at 0x7f65512f4860>}¶
-
has_rsample
= True¶
-
loc
¶
-
mean
¶
-
scale
¶
-
support
= <torch.distributions.constraints._GreaterThan object>¶
-
variance
¶
-
Multinomial¶
-
class
torch.distributions.multinomial.
Multinomial
(total_count=1, probs=None, logits=None, validate_args=None)[source]¶ Bases:
torch.distributions.distribution.Distribution
Creates a Multinomial distribution parameterized by total_count and either probs or logits (but not both). The innermost dimension of probs indexes over categories. All other dimensions index over batches.
Note that total_count need not be specified if only
log_prob()
is called (see example below)Note
probs
must be non-negative, finite and have a non-zero sum, and it will be normalized to sum to 1.sample()
requires a single shared total_count for all parameters and samples.log_prob()
allows different total_count for each parameter and sample.
Example:
>>> m = Multinomial(100, torch.tensor([ 1., 1., 1., 1.])) >>> x = m.sample() # equal probability of 0, 1, 2, 3 tensor([ 21., 24., 30., 25.]) >>> Multinomial(probs=torch.tensor([1., 1., 1., 1.])).log_prob(x) tensor([-4.1338])
Parameters: -
arg_constraints
= {'logits': <torch.distributions.constraints._Real object at 0x7f65512f47f0>}¶
-
logits
¶
-
mean
¶
-
param_shape
¶
-
probs
¶
-
support
¶
-
variance
¶
MultivariateNormal¶
-
class
torch.distributions.multivariate_normal.
MultivariateNormal
(loc, covariance_matrix=None, precision_matrix=None, scale_tril=None, validate_args=None)[source]¶ Bases:
torch.distributions.distribution.Distribution
Creates a multivariate normal (also called Gaussian) distribution parameterized by a mean vector and a covariance matrix.
The multivariate normal distribution can be parameterized either in terms of a positive definite covariance matrix \(\mathbf{\Sigma}\) or a positive definite precision matrix \(\mathbf{\Sigma}^{-1}\) or a lower-triangular matrix \(\mathbf{L}\) with positive-valued diagonal entries, such that \(\mathbf{\Sigma} = \mathbf{L}\mathbf{L}^\top\). This triangular matrix can be obtained via e.g. Cholesky decomposition of the covariance.
Example
>>> m = MultivariateNormal(torch.zeros(2), torch.eye(2)) >>> m.sample() # normally distributed with mean=`[0,0]` and covariance_matrix=`I` tensor([-0.2102, -0.5429])
Parameters: Note
Only one of
covariance_matrix
orprecision_matrix
orscale_tril
can be specified.Using
scale_tril
will be more efficient: all computations internally are based onscale_tril
. Ifcovariance_matrix
orprecision_matrix
is passed instead, it is only used to compute the corresponding lower triangular matrices using a Cholesky decomposition.-
arg_constraints
= {'covariance_matrix': <torch.distributions.constraints._PositiveDefinite object at 0x7f65512f4978>, 'loc': <torch.distributions.constraints._RealVector object at 0x7f65512f4828>, 'precision_matrix': <torch.distributions.constraints._PositiveDefinite object at 0x7f65512f4978>, 'scale_tril': <torch.distributions.constraints._LowerCholesky object at 0x7f65512f4940>}¶
-
has_rsample
= True¶
-
mean
¶
-
support
= <torch.distributions.constraints._Real object>¶
-
variance
¶
-
Normal¶
-
class
torch.distributions.normal.
Normal
(loc, scale, validate_args=None)[source]¶ Bases:
torch.distributions.exp_family.ExponentialFamily
Creates a normal (also called Gaussian) distribution parameterized by loc and scale.
Example:
>>> m = Normal(torch.tensor([0.0]), torch.tensor([1.0])) >>> m.sample() # normally distributed with loc=0 and scale=1 tensor([ 0.1046])
Parameters: -
arg_constraints
= {'loc': <torch.distributions.constraints._Real object at 0x7f65512f47f0>, 'scale': <torch.distributions.constraints._GreaterThan object at 0x7f65512f4860>}¶
-
has_rsample
= True¶
-
mean
¶
-
stddev
¶
-
support
= <torch.distributions.constraints._Real object>¶
-
variance
¶
-
OneHotCategorical¶
-
class
torch.distributions.one_hot_categorical.
OneHotCategorical
(probs=None, logits=None, validate_args=None)[source]¶ Bases:
torch.distributions.distribution.Distribution
Creates a one-hot categorical distribution parameterized by
probs
orlogits
.Samples are one-hot coded vectors of size
probs.size(-1)
.Note
probs
must be non-negative, finite and have a non-zero sum, and it will be normalized to sum to 1.See also:
torch.distributions.Categorical()
for specifications ofprobs
andlogits
.Example:
>>> m = OneHotCategorical(torch.tensor([ 0.25, 0.25, 0.25, 0.25 ])) >>> m.sample() # equal probability of 0, 1, 2, 3 tensor([ 0., 0., 0., 1.])
Parameters: -
arg_constraints
= {'probs': <torch.distributions.constraints._Simplex object at 0x7f65512f48d0>}¶
-
has_enumerate_support
= True¶
-
logits
¶
-
mean
¶
-
param_shape
¶
-
probs
¶
-
support
= <torch.distributions.constraints._Simplex object>¶
-
variance
¶
-
Pareto¶
-
class
torch.distributions.pareto.
Pareto
(scale, alpha, validate_args=None)[source]¶ Bases:
torch.distributions.transformed_distribution.TransformedDistribution
Samples from a Pareto Type 1 distribution.
Example:
>>> m = Pareto(torch.tensor([1.0]), torch.tensor([1.0])) >>> m.sample() # sample from a Pareto distribution with scale=1 and alpha=1 tensor([ 1.5623])
Parameters: -
arg_constraints
= {'alpha': <torch.distributions.constraints._GreaterThan object at 0x7f65512f4860>, 'scale': <torch.distributions.constraints._GreaterThan object at 0x7f65512f4860>}¶
-
mean
¶
-
support
¶
-
variance
¶
-
Poisson¶
-
class
torch.distributions.poisson.
Poisson
(rate, validate_args=None)[source]¶ Bases:
torch.distributions.exp_family.ExponentialFamily
Creates a Poisson distribution parameterized by rate, the rate parameter.
Samples are nonnegative integers, with a pmf given by
\[\mathrm{rate}^k \frac{e^{-\mathrm{rate}}}{k!}\]Example:
>>> m = Poisson(torch.tensor([4])) >>> m.sample() tensor([ 3.])
Parameters: rate (Number, Tensor) – the rate parameter -
arg_constraints
= {'rate': <torch.distributions.constraints._GreaterThan object at 0x7f65512f4860>}¶
-
mean
¶
-
support
= <torch.distributions.constraints._IntegerGreaterThan object>¶
-
variance
¶
-
RelaxedBernoulli¶
-
class
torch.distributions.relaxed_bernoulli.
RelaxedBernoulli
(temperature, probs=None, logits=None, validate_args=None)[source]¶ Bases:
torch.distributions.transformed_distribution.TransformedDistribution
Creates a RelaxedBernoulli distribution, parametrized by temperature, and either probs or logits. This is a relaxed version of the Bernoulli distribution, so the values are in (0, 1), and has reparametrizable samples.
Example:
>>> m = RelaxedBernoulli(torch.tensor([2.2]), torch.tensor([0.1, 0.2, 0.3, 0.99])) >>> m.sample() tensor([ 0.2951, 0.3442, 0.8918, 0.9021])
Parameters: -
arg_constraints
= {'probs': <torch.distributions.constraints._Interval object at 0x7f65512f4898>}¶
-
has_rsample
= True¶
-
logits
¶
-
probs
¶
-
support
= <torch.distributions.constraints._Interval object>¶
-
temperature
¶
-
RelaxedOneHotCategorical¶
-
class
torch.distributions.relaxed_categorical.
RelaxedOneHotCategorical
(temperature, probs=None, logits=None, validate_args=None)[source]¶ Bases:
torch.distributions.transformed_distribution.TransformedDistribution
Creates a RelaxedOneHotCategorical distribution parametrized by
temperature
, and eitherprobs
orlogits
. This is a relaxed version of theOneHotCategorical
distribution, so its samples are on simplex, and are reparametrizable.Example:
>>> m = RelaxedOneHotCategorical(torch.tensor([2.2]), torch.tensor([0.1, 0.2, 0.3, 0.4])) >>> m.sample() tensor([ 0.1294, 0.2324, 0.3859, 0.2523])
Parameters: -
arg_constraints
= {'probs': <torch.distributions.constraints._Simplex object at 0x7f65512f48d0>}¶
-
has_rsample
= True¶
-
logits
¶
-
probs
¶
-
support
= <torch.distributions.constraints._Simplex object>¶
-
temperature
¶
-
StudentT¶
-
class
torch.distributions.studentT.
StudentT
(df, loc=0.0, scale=1.0, validate_args=None)[source]¶ Bases:
torch.distributions.distribution.Distribution
Creates a Student’s t-distribution parameterized by df.
Example:
>>> m = StudentT(torch.tensor([2.0])) >>> m.sample() # Student's t-distributed with degrees of freedom=2 tensor([ 0.1046])
Parameters: df (float or Tensor) – degrees of freedom -
arg_constraints
= {'df': <torch.distributions.constraints._GreaterThan object at 0x7f65512f4860>, 'loc': <torch.distributions.constraints._Real object at 0x7f65512f47f0>, 'scale': <torch.distributions.constraints._GreaterThan object at 0x7f65512f4860>}¶
-
has_rsample
= True¶
-
mean
¶
-
support
= <torch.distributions.constraints._Real object>¶
-
variance
¶
-
TransformedDistribution¶
-
class
torch.distributions.transformed_distribution.
TransformedDistribution
(base_distribution, transforms, validate_args=None)[source]¶ Bases:
torch.distributions.distribution.Distribution
Extension of the Distribution class, which applies a sequence of Transforms to a base distribution. Let f be the composition of transforms applied:
X ~ BaseDistribution Y = f(X) ~ TransformedDistribution(BaseDistribution, f) log p(Y) = log p(X) + log |det (dX/dY)|
Note that the
.event_shape
of aTransformedDistribution
is the maximum shape of its base distribution and its transforms, since transforms can introduce correlations among events.An example for the usage of
TransformedDistribution
would be:# Building a Logistic Distribution # X ~ Uniform(0, 1) # f = a + b * logit(X) # Y ~ f(X) ~ Logistic(a, b) base_distribution = Uniform(0, 1) transforms = [SigmoidTransform().inv, AffineTransform(loc=a, scale=b)] logistic = TransformedDistribution(base_distribution, transforms)
For more examples, please look at the implementations of
Gumbel
,HalfCauchy
,HalfNormal
,LogNormal
,Pareto
,RelaxedBernoulli
andRelaxedOneHotCategorical
-
arg_constraints
= {}¶
-
cdf
(value)[source]¶ Computes the cumulative distribution function by inverting the transform(s) and computing the score of the base distribution.
-
has_rsample
¶
-
icdf
(value)[source]¶ Computes the inverse cumulative distribution function using transform(s) and computing the score of the base distribution.
-
log_prob
(value)[source]¶ Scores the sample by inverting the transform(s) and computing the score using the score of the base distribution and the log abs det jacobian.
-
rsample
(sample_shape=torch.Size([]))[source]¶ Generates a sample_shape shaped reparameterized sample or sample_shape shaped batch of reparameterized samples if the distribution parameters are batched. Samples first from base distribution and applies transform() for every transform in the list.
-
sample
(sample_shape=torch.Size([]))[source]¶ Generates a sample_shape shaped sample or sample_shape shaped batch of samples if the distribution parameters are batched. Samples first from base distribution and applies transform() for every transform in the list.
-
support
¶
-
Uniform¶
-
class
torch.distributions.uniform.
Uniform
(low, high, validate_args=None)[source]¶ Bases:
torch.distributions.distribution.Distribution
Generates uniformly distributed random samples from the half-open interval [low, high).
Example:
>>> m = Uniform(torch.tensor([0.0]), torch.tensor([5.0])) >>> m.sample() # uniformly distributed in the range [0.0, 5.0) tensor([ 2.3418])
Parameters: -
arg_constraints
= {'high': <torch.distributions.constraints._Dependent object at 0x7f65512f46d8>, 'low': <torch.distributions.constraints._Dependent object at 0x7f65512f46d8>}¶
-
has_rsample
= True¶
-
mean
¶
-
stddev
¶
-
support
¶
-
variance
¶
-
KL Divergence¶
-
torch.distributions.kl.
kl_divergence
(p, q)[source]¶ Compute Kullback-Leibler divergence \(KL(p \| q)\) between two distributions.
\[KL(p \| q) = \int p(x) \log\frac {p(x)} {q(x)} \,dx\]Parameters: - p (Distribution) – A
Distribution
object. - q (Distribution) – A
Distribution
object.
Returns: A batch of KL divergences of shape batch_shape.
Return type: Raises: NotImplementedError
– If the distribution types have not been registered viaregister_kl()
.- p (Distribution) – A
-
torch.distributions.kl.
register_kl
(type_p, type_q)[source]¶ Decorator to register a pairwise function with
kl_divergence()
. Usage:@register_kl(Normal, Normal) def kl_normal_normal(p, q): # insert implementation here
Lookup returns the most specific (type,type) match ordered by subclass. If the match is ambiguous, a RuntimeWarning is raised. For example to resolve the ambiguous situation:
@register_kl(BaseP, DerivedQ) def kl_version1(p, q): ... @register_kl(DerivedP, BaseQ) def kl_version2(p, q): ...
you should register a third most-specific implementation, e.g.:
register_kl(DerivedP, DerivedQ)(kl_version1) # Break the tie.
Parameters:
Transforms¶
-
class
torch.distributions.transforms.
Transform
(cache_size=0)[source]¶ Abstract class for invertable transformations with computable log det jacobians. They are primarily used in
torch.distributions.TransformedDistribution
.Caching is useful for tranforms whose inverses are either expensive or numerically unstable. Note that care must be taken with memoized values since the autograd graph may be reversed. For example while the following works with or without caching:
y = t(x) t.log_abs_det_jacobian(x, y).backward() # x will receive gradients.
However the following will error when caching due to dependency reversal:
y = t(x) z = t.inv(y) grad(z.sum(), [y]) # error because z is x
Derived classes should implement one or both of
_call()
or_inverse()
. Derived classes that set bijective=True should also implementlog_abs_det_jacobian()
.Parameters: cache_size (int) – Size of cache. If zero, no caching is done. If one, the latest single value is cached. Only 0 and 1 are supported.
Variables: - domain (
Constraint
) – The constraint representing valid inputs to this transform. - codomain (
Constraint
) – The constraint representing valid outputs to this transform which are inputs to the inverse transform. - bijective (bool) – Whether this transform is bijective. A transform
t
is bijective ifft.inv(t(x)) == x
andt(t.inv(y)) == y
for everyx
in the domain andy
in the codomain. Transforms that are not bijective should at least maintain the weaker pseudoinverse propertiest(t.inv(t(x)) == t(x)
andt.inv(t(t.inv(y))) == t.inv(y)
. - sign (int or Tensor) – For bijective univariate transforms, this should be +1 or -1 depending on whether transform is monotone increasing or decreasing.
- event_dim (int) – Number of dimensions that are correlated together in
the transform
event_shape
. This should be 0 for pointwise transforms, 1 for transforms that act jointly on vectors, 2 for transforms that act jointly on matrices, etc.
-
sign
¶ Returns the sign of the determinant of the Jacobian, if applicable. In general this only makes sense for bijective transforms.
- domain (
-
class
torch.distributions.transforms.
ComposeTransform
(parts)[source]¶ Composes multiple transforms in a chain. The transforms being composed are responsible for caching.
Parameters: parts (list of Transform
) – A list of transforms to compose.
-
class
torch.distributions.transforms.
ExpTransform
(cache_size=0)[source]¶ Transform via the mapping \(y = \exp(x)\).
-
class
torch.distributions.transforms.
PowerTransform
(exponent, cache_size=0)[source]¶ Transform via the mapping \(y = x^{\text{exponent}}\).
-
class
torch.distributions.transforms.
SigmoidTransform
(cache_size=0)[source]¶ Transform via the mapping \(y = \frac{1}{1 + \exp(-x)}\) and \(x = \text{logit}(y)\).
-
class
torch.distributions.transforms.
AbsTransform
(cache_size=0)[source]¶ Transform via the mapping \(y = |x|\).
-
class
torch.distributions.transforms.
AffineTransform
(loc, scale, event_dim=0, cache_size=0)[source]¶ Transform via the pointwise affine mapping \(y = \text{loc} + \text{scale} \times x\).
Parameters:
-
class
torch.distributions.transforms.
SoftmaxTransform
(cache_size=0)[source]¶ Transform from unconstrained space to the simplex via \(y = \exp(x)\) then normalizing.
This is not bijective and cannot be used for HMC. However this acts mostly coordinate-wise (except for the final normalization), and thus is appropriate for coordinate-wise optimization algorithms.
-
class
torch.distributions.transforms.
StickBreakingTransform
(cache_size=0)[source]¶ Transform from unconstrained space to the simplex of one additional dimension via a stick-breaking process.
This transform arises as an iterated sigmoid transform in a stick-breaking construction of the Dirichlet distribution: the first logit is transformed via sigmoid to the first probability and the probability of everything else, and then the process recurses.
This is bijective and appropriate for use in HMC; however it mixes coordinates together and is less appropriate for optimization.
Constraints¶
The following constraints are implemented:
constraints.boolean
constraints.dependent
constraints.greater_than(lower_bound)
constraints.integer_interval(lower_bound, upper_bound)
constraints.interval(lower_bound, upper_bound)
constraints.lower_cholesky
constraints.lower_triangular
constraints.nonnegative_integer
constraints.positive
constraints.positive_definite
constraints.positive_integer
constraints.real
constraints.real_vector
constraints.simplex
constraints.unit_interval
-
class
torch.distributions.constraints.
Constraint
[source]¶ Abstract base class for constraints.
A constraint object represents a region over which a variable is valid, e.g. within which a variable can be optimized.
-
torch.distributions.constraints.
dependent_property
¶ alias of
torch.distributions.constraints._DependentProperty
-
torch.distributions.constraints.
integer_interval
¶ alias of
torch.distributions.constraints._IntegerInterval
-
torch.distributions.constraints.
greater_than
¶ alias of
torch.distributions.constraints._GreaterThan
-
torch.distributions.constraints.
less_than
¶ alias of
torch.distributions.constraints._LessThan
-
torch.distributions.constraints.
interval
¶ alias of
torch.distributions.constraints._Interval
Constraint Registry¶
PyTorch provides two global ConstraintRegistry
objects that link
Constraint
objects to
Transform
objects. These objects both
input constraints and return transforms, but they have different guarantees on
bijectivity.
biject_to(constraint)
looks up a bijectiveTransform
fromconstraints.real
to the givenconstraint
. The returned transform is guaranteed to have.bijective = True
and should implement.log_abs_det_jacobian()
.transform_to(constraint)
looks up a not-necessarily bijectiveTransform
fromconstraints.real
to the givenconstraint
. The returned transform is not guaranteed to implement.log_abs_det_jacobian()
.
The transform_to()
registry is useful for performing unconstrained
optimization on constrained parameters of probability distributions, which are
indicated by each distribution’s .arg_constraints
dict. These transforms often
overparameterize a space in order to avoid rotation; they are thus more
suitable for coordinate-wise optimization algorithms like Adam:
loc = torch.zeros(100, requires_grad=True)
unconstrained = torch.zeros(100, requires_grad=True)
scale = transform_to(Normal.arg_constraints['scale'])(unconstrained)
loss = -Normal(loc, scale).log_prob(data).sum()
The biject_to()
registry is useful for Hamiltonian Monte Carlo, where
samples from a probability distribution with constrained .support
are
propagated in an unconstrained space, and algorithms are typically rotation
invariant.:
dist = Exponential(rate)
unconstrained = torch.zeros(100, requires_grad=True)
sample = biject_to(dist.support)(unconstrained)
potential_energy = -dist.log_prob(sample).sum()
Note
An example where transform_to
and biject_to
differ is
constraints.simplex
: transform_to(constraints.simplex)
returns a
SoftmaxTransform
that simply
exponentiates and normalizes its inputs; this is a cheap and mostly
coordinate-wise operation appropriate for algorithms like SVI. In
contrast, biject_to(constraints.simplex)
returns a
StickBreakingTransform
that
bijects its input down to a one-fewer-dimensional space; this a more
expensive less numerically stable transform but is needed for algorithms
like HMC.
The biject_to
and transform_to
objects can be extended by user-defined
constraints and transforms using their .register()
method either as a
function on singleton constraints:
transform_to.register(my_constraint, my_transform)
or as a decorator on parameterized constraints:
@transform_to.register(MyConstraintClass)
def my_factory(constraint):
assert isinstance(constraint, MyConstraintClass)
return MyTransform(constraint.param1, constraint.param2)
You can create your own registry by creating a new ConstraintRegistry
object.
-
class
torch.distributions.constraint_registry.
ConstraintRegistry
[source]¶ Registry to link constraints to transforms.
-
register
(constraint, factory=None)[source]¶ Registers a
Constraint
subclass in this registry. Usage:@my_registry.register(MyConstraintClass) def construct_transform(constraint): assert isinstance(constraint, MyConstraint) return MyTransform(constraint.arg_constraints)
Parameters: - constraint (subclass of
Constraint
) – A subclass ofConstraint
, or a singleton object of the desired class. - factory (callable) – A callable that inputs a constraint object and returns
a
Transform
object.
- constraint (subclass of
-


The TkWiCe software package is distributed under the terms of the so called "2-clause" BSD license (its summary: "do what you want, but don't accuse the author"):
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.


Did you know that Camels can travel at up to 40 miles per hour – the same as a racehorse!
Please enable JavaScript to continue using this application.


New ‘The Walking Dead’ easter egg links Beta and Beth
Spoilers for season 10 of 'The Walking Dead' below.
Episode 5 of the current tenth season of The Walking Dead aired at the weekend (November 3), and contains a very meta easter egg.
The episode, entitled What It Always Is, sees Magna listening to music on a gramophone during a scene with herself and Yumiko.
Eagle-eyed (or eared) fans have spotted that the song playing in the scene is ‘The Turtle and the Monkey’, which is written and sung by former Walking Dead star Emily Kinney, who played Beth Greene on the show. Kinney has since confirmed in a tweet that the song playing is indeed hers.
With the meta connections not stopping there, the version of ‘The Turtle and the Monkey’ playing in the show is actually sung by a male voice, and fans believe that it’s that of Beta, the Walking Dead character who’s a major part of The Whisperers.
Fans believe that Beta had a celebrity past before he became the masked villain, and actor Ryan Hurst recently responded to the speculation, saying: “I can’t say too much. All I can say at this point is maybe Beta was a large personality in the world before the apocalypse, and that sort of letting go of that might have been tragic to his psyche. I can’t say much more than that.”
In a recap of the new Walking Dead episode in question, NME‘s Sam Moore speculates that Negan may have returned to his previous bad ways.


http://www.speakers-podium.com/susangranger.
Susan Granger's Preview of Upcoming SHOWTIME TV movie: "Total Recall 2070"
On Sunday night, March 7, at 8 p.m. SHOWTIME launches its stylish new sci-fi thriller series, "Total Recall 2070," with a two-hour premiere movie, entitled "Machine Dreams." Michael Easton ("Ally McBeal") is moody and intense as police detective David Hume with Karl Pruner as his benign android partner, Ian Farve. As members of the Citizens Protection Bureau, their mission is to defend innocent people from corporate domination while exploring the android/human dynamic. Think "Alien Nation." Michael Anthony Rawlins ("NYPD Blue") plays Hume's boss with Cynthia Preston as Hume's wife, Judith Krant as a forensics expert who's heavily into gadgets, Matthew Bennett as the head of a special internal affairs unit, and Nick Mancuso as the villainous Richard Collector. The concept is inspired by the work of writer Philip K. Dick, whose original short stories were the basis for the films "Total Recall" and "Blade Runner." Indeed, the best part of this new series is its futuristic "Blade Runner" setting, a dreary cityscape which encompasses a cacophony of cultures. Plus there's the machine that can create temporal vacations, induced dreams that are indistinguishable from the real things. The weakness, however, lies in the flimsy characters who are not fully developed before the seemingly obligatory sex scenes and confusing plot kick in. Like "Strange Days," the characters seem subordinate to the bizarre special effects and the rapid MTV editing adds to the confusion and emotional detachment. A staggering $1.7 million was spent on each episode, obviously on the post-apocalyptic atmosphere rather than actors or writers, and SHOWTIME has committed to run 20 additional one-hour episodes.
The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews


{% include /structure/css.html %} {% seo %}
{% include /structure/navigation.html %}
κεραμεικος
κεραμεικος
{{ page.title }}
{{ content }}
Get Involved
Get Data
Another Heading
What to place here?
{% include /structure/footer.html %}


imageaffine
(PHP 5 >= 5.5.0, PHP 7)
imageaffine — 返回经过仿射变换后的图像，剪切区域可选
说明
resource imageaffine ( resource $image , array $affine [, array $clip ] )
Warning
本函数还未编写文档，仅有参数列表。
参数
image
由图象创建函数(例如imagecreatetruecolor())返回的图象资源。
affine
数组，其中键为 0 至 5 的数字。
clip
数组，其中键为 "x"，"y"，"width" 和 "height"。
返回值
成功则返回仿射变换后的图像，或者在失败时返回 FALSE.
User Contributed Notes 3 notes
===============================================================================
AFFINE is a geometric transformation operation involving MATRICES, covering
both, 2D and 3D environment.
Transformations are often used in linear algebra and computer graphics.
In geometric transformations of images, the pixel coordinate is mapped.
This means that, each pixel is localized by two coordinates, in the rectangular
domain of the image.
Without going into more details about pixel mapping, let's get to what really
matters: the AFFINE transformations.
There are several classes of pixel mapping, one is called "affine".
Affine transformations include: scaling, rotation, shearing and translation.
PHP 5.5.0+, like "libart", uses ARRAYS of six floating-point elements to do the
job.
The AFFINE ARRAY, is defined like,
$affine = [ a0, a1, b0, b1, a2, b2 ];
where,
a0, a1, b0, b1, a2, b2 are floating-point values.
represented by equations,
x' = a0x + a1y + a2
y' = b0x + b1y + b2
a ) IDENTITY, no change made in the path of points,
$affine = [ 1, 0, 0, 1, 0, 0 ];
equations remapping,
x' = 1x + 0y + 0 = x
y' = 0x + 1y = 0 = y
b ) TRANSLATION,
$affine = [ 1, 0, 0, 1, H, V ];
equations remapping,
x' = 1x + 0y + H = x + H
y' = 0x + 1y = V = y + V
Each point is moved H units horizontaly and V units verticaly.
c ) SCALE,
$affine = [ i, 0, j, 1, 0, 0 ];
equations remapping,
x' = Mx + 0y + 0 = Mx
y' = 0x + Ny = 0 = Ny
Each point will stretch or compress its path, horizontally or
vertically, according M and N; negative or positive values.
d ) SHEARING, parallel to x axis,
$affine = [ 1, K, 0, 1, 0, 0 ];
equations remapping,
x' = 1x + Ky + 0 = x + Ky
y' = 0x + 1y = 0 = y
SHEARING, parallel to y axis,
$affine = [ K, 0, 0, 1, 0, 0 ];
equations remapping,
x' = 1x + 0y + 0 = x
y' = Kx + 1y = 0 = y + Kx
e ) ROTATION, clockwise,
$affine = [ cos Ø, sin Ø, -sin Ø, cos Ø, 0, 0 ];
equations remapping,
x' = x cos Ø + y sin Ø + 0 = x cos Ø + y sin Ø
y' = -x sin Ø + y cos Ø = 0 = y cos Ø - x sin Ø
ROTATION, conterclockwise,
$affine = [ cos Ø, -sin Ø, sin Ø, cos Ø, 0, 0 ];
equations remapping,
x' = x cos Ø - y sin Ø + 0 = x cos Ø - y sin Ø
y' = x sin Ø + y cos Ø = 0 = y sin Ø - x cos Ø
===============================================================================
Here is an example, which performs a specific processing, every time it is
executed:
0, 'y' => 0, 'width' => $w, 'height' => $h ];
$fillcolor = imagecolorallocate($RSR_base, 0, 0, 0);
imagefill($RSR_base, 10,10, $fillcolor);
imagepng($RSR_base, $base_img);
$drawcolor = imagecolorallocate($RSR_base, 255, 0, 0);
$triangle = [ 50, 50, 50, 150, 200, 150 ];
$points = 3;
imageantialias($RSR_base, 1);
$drawtriangle = imagefilledpolygon($RSR_base, $triangle, $points, $drawcolor);
imagepng($RSR_base, $tgt_img1);
$select = mt_rand(0, 7);
$RSRaff2 = imageaffine($RSR_base, $arr_affine[$select], $arr_clip);
imagepng($RSRaff2, $tgt_img2, 9);
?>
SUPPORT IMAGE
BASE IMAGE
RESULT IMAGE
===============================================================================
correcting:
c ) SCALE,
$affine = [ M, 0, N, 1, 0, 0 ];
equations remapping,
x' = Mx + 0y + 0 = Mx
y' = 0x + Ny = 0 = Ny
Each point will stretch or compress its path, horizontally or
vertically, according M and N; negative or positive values.


Having a problem remembering passwords?, You can now have multiple accounts on a website without having to worry about username, email and password combinations. This app stores all your passwords inside your device to be accessed anytime you want it, the app works offline.
by Phirmware


Social media marketing is a powerful way for businesses of all sizes to reach prospects and customers. Your customers are already interacting with brands through social media, and if you're not speaking directly to your audience through social platforms like Facebook, Twitter, Instagram, and Pinterest, you're missing out!
Great marketing on social media can bring remarkable success to your business, creating devoted brand advocates and even driving leads and sales.
How Social Media Marketing Can Help You Meet Your Marketing Goals?
Chances are your audience is active on one or more of the major social networks where billions of people spend time daily. Brands that understand the power of social media marketing and commit resources to it can boost awareness, drive traffic, interact with customers, drive sales, build loyalty, and win advocates.
Consider first the top social channels in terms of active users: Facebook, Instagram, Twitter, LinkedIn, and Pinterest. Determine where your audience spends their time. Research the demographics and behavioral patterns of the users and consider the type of content you’ll share.
Your brand is now in the hands of your audience. You can’t “control” what’s said about it. But you can join the conversations, show you care about your customers, and add value.
No. Granted, you don’t want to give rise to a social media free-for-all that could confuse your audience. However, you should consider expanding your team with an employee advocacy program designed to empower employees to contribute to the conversation and amplify your brand’s voice.


Markdown to Medium
Easily import Markdown posts into Medium
Introductory post
Post title
Choose post title
Post Markdown
Provide post contents in markdown
Medium API key (
how to get
)
Provide your Medium API key: 65 characters containing numbers 0-9 and letters a-f
CORS proxy
Need to use a CORS proxy: you can use https://cors.root.workers.dev/ if you don't have one
Convert
Show log


ANTZ (1998) Rated PG for mild language and some intense violence.
Starring the vocal talents of: Woody Allen, Sharon Stone, Sylvester Stallone, Gene Hackman, Christopher Walkin, Dan Aykroyd, Jane Curtin, Anne Bancroft, and Danny Glover.
Out of 4 stars: **** (4 Stars)
Most people fit into two different categories: you either love Woody Allen, or you hate his guts. My family, for the most part, hates him and his movies. I think he's very funny, but his shtick has gotten forced and contrived over the years. So maybe taking his body away was the best decision any producer could have thought of. Unrestrained by physical boundaries, Allen's humor comes shining through. Those who had problems with his physical appearance will be able to join the rest of us in laughing at Allen's intelligent observations of life. Those who had problems with his verbal comedy may want to skip this one.
In 1995, a film was introduced to audiences which sparked their imaginations and showed them something they'd never seen before. TOY STORY used state-of-the-art computer technology and presented a world of toys who would come alive when no humans were present. Many critics will call that a better film, but I believe they only say that because it was a completely original motion picture. ANTZ, however, has upped the ante considerably. Disney's A BUG'S LIFE isn't due out for another two months, and DreamWorks seems to have received the better end of the deal. By beating Disney out, they have satisfied the audience's thirst for computer-animated films. But don't let that fool you: Disney is definitely not scared.
In the past two years, competitions have broken out between studios. In 1997, it was the volcano duel. In my opinion, DANTE'S PEAK came out way ahead of its predecessor, both in time and in quality. VOLCANO had an original premise, but destroyed that with some very ridiculous situations. In 1998, there are twice as many competing films. First was the comet competition, and ARMAGEDDON blew away it's cheesily dramatic competitor DEEP IMPACT. But now, it's even more interesting, as one beloved studio (Disney) goes up against the newcomer (DreamWorks). Who will prevail? Time will tell, but I'm sure that Mr. Mouse has nothing to fear.
This may sound like I didn't like ANTZ; on the contrary, I'd put it up there with TOY STORY. But due to it's PG rating, many parents may be put off by some of the dialogue which shouldn't appear in Disney's version. Some of the dialogue in ANTZ pushes the envelope for a family-oriented film. Sexual innuendoes and profanity pop up occasionally, which makes DreamWorks' animated feature geared more for an adult crowd. The humor is also written especially for adults, though many kids were laughing in the theater I attended. This is the type of film that should be made for families more often: entertaining for kids AND entertaining for parents.
ANTZ begins with a hilarious monologue which seems a meld between Woody Allen's shtick and Franz Kafka's METAMORPHOSIS, the short story of a man who wakes up to discover himself as a bug. Z (Allen) is a troubled ant, believing he was not made to be a worker. "When you're the middle child in a family of five million..." he comments about his neglected childhood.  In walks Princess Bala (Sharon Stone), whom no one recognizes without a crown. Bala asks Z is he would like to dance, and they engage in a PULP FICTION-esque dance while everyone else is following the leader. After discovering that she is the princess, Z falls in love, but there's a problem: Bala is getting married to General Mandible (Gene Hackman), a ruthless leader who merely wants to control a better and stronger colony. In order to do that, he must eliminate not only the Queen (Anne Bancroft), but the weakest of the colony, namely the worker ants. But to get rid of the Queen, he needs to get rid of the loyal army ants who would be willing to die for her.
He and Colonel Cutter (Christopher Walkin) come up with a plan to send the loyal ants off to battle, where they will surely be killed. The Queen is reluctant at first, but decides it is best for the colony. Meanwhile, Z wants to meet Bala again, and he asks Weaver, an army ant, to switch places with him. So Z gets sent off to battle, but he manages to survive the slaughter by the termites. The battle sequence is absolutely stunning, though you may have flashbacks to STARSHIP TROOPERS, which contained a very similar sequence. However, ANTZ and that 1997 film were both in production around the same time, so the similarities are merely coincidence.
The second half of the film revolves around Z's kidnapping of Bala, and their search for a mythical place called Insectopia. There, an ant can be his own boss and have all the food he wants. The adventures Z and Bala get into are surprisingly high in tension, especially one involving a magnifying glass. Looming over the targets like the spaceships from INDEPENDENCE DAY (in fact, I'm just going to assume that the producers referenced ID4 intentionally). The ants look up in awe, and then a beam of fire blasts into the ground. Visually, it's an exciting rush of adrenaline. But don't be fooled... little kids shouldn't see this, as they may just try and copy it. After seeing ANTZ, I vowed never to intentionally step on an ant again. Hopefully, children will learn that killing ants is rather cruel.
As an animated film, ANTZ is probably the best you will find to date. Visually, it's as stunning as WHAT DREAMS MAY COME. The best aspect of animation is the fact that the characters aren't limited by gravity. They can take ridiculous situations and make them seem plausible. One great moment involves a mass of worker ants bunching up to form a wrecking ball. The animation is so perfect that you can virtually see every single ant on the ball. However, the most exhilarating scene involves Bala getting stuck to the bottom of a young boy's shoe. It's truly a great example of film making at its finest. With computer technology, the animators have carefully made the ants' faces look similar to the actors providing the voices. The best example would have to be Barbatus (Danny Glover). At one point, you can even see the pores on his face (although, I doubt ants have pores... do they?). Barbatus also has a touching but rather gruesome scene as he has his final words with Z without a body. Young kids may be disturbed by the site of a dismembered head, but a good deal of humor is derived (more appropriate for adults, of course). Disney's A BUG'S LIFE looks good, but I don't know if they will be able to best DreamWorks' newest animated feature in terms of animation. If not, then DreamWorks will have done something no other studio could do: go head to head with the big Mouse, and knock him down (yes, Anastasia was good, but not nearly as good as even the worst of Disney).
Vocal talent is always essential to an animated feature, and ANTZ has one of the best line-ups seen since TOY STORY. In fact, it far exceeds that one. Woody Allen has always been funny, but here he transcends most of what he's done in the past few years. Without a body, his comic timing is the most noticeable thing. In fact, I'm pretty sure that the writers let him improvise a lot of his lines. Sharon Stone as Bala shows off some of her comic ability, though for the most part, Stone works best as a dramatic actress. Sylvester Stallone (teamed up with Stone once again) is beginning to solidify his statement that he wants to be an actor, not a typecast action star. After a snub at the Oscars last year, Stallone is proving himself as the serious (or comedic, as illustrated here) actor that he is. Gene Hackman is superb as the gruff-talking General, almost doing another take on his CRIMSON TIDE persona. Christopher Walkin is probably more noticed by his voice, and so many people will remember him from such hits as BATMAN RETURNS. Anne Bancroft has a minimal role, but she's effective nonetheless. Danny Glover has a small role, but he does a very, very good job. Dan Aykroyd and Jane Curtin also lend their voices as two lovesick, Euro-trash bees--both are very unrecognizable, especially Aykroyd. Jennifer Lopez plays a worker ant who falls in love with Weaver, although most people won't recognize her voice either. Many people will recognize Grant Shaud's voice as the foreman. He played Miles on the TV show MURPHY BROWN. This is definitely a huge cast with some high-profile names, and it will definitely help it's grosses. Of course, you can probably tell where a lot of the $60 million budget went to, also.
Directors Eric Darnell and Lawrence Guterman are relative newcomers (though Guterman did direct a 1994 feature, HEADLESS!). But both show an incredible talent for this type of a picture. Tense at times, and very funny throughout, the two hold this film together like professionals. The screenplay by Todd Alcott and Chris Weitz is quite simple in plot, but it contains a lot of subtlety that makes the film more suitable for adults. Kids will delight in the animation, while parents can laugh heartily at the humor. Most of it will go over young children's heads. Does that mean you shouldn't take kids to see it? Not at all. They will have a lot of fun watching this one. What is great is the themes that are given to us. Part social commentary, part romance story, and part moral drama, ANTZ gives everyone something to talk about, whether it be the animation, or the discussions of individualism and community. Thankfully, it's not subtle in either aspects.
ANTZ is rated PG for mild language and some intense action. Sometimes the language can be pushing the limits for a family movie, but the violence is what should keep kids at home. The battle scene has ants melting in acid, and bugs being speared to death. And the magnifying scene shows an ant disintegrate in the beam of sunlight. But other than that (and some sexual innuendos), it's a perfect choice for some wholesome fun at the theaters. I doubt many children will understand the sexual innuendos unless they are old enough, but it's still advisable to leave really young children at home. Have I confused you enough? If you do take your kids, I recommend seeing the film with them, because more than likely, you'll enjoy it the most.
-- Respect's Movie Reviews http://www.aros.net/~respect/movies.html ------------------- Baraka's Mortal Kombat 4 Page http://www.aros.net/~respect/mk4/mk4.html -------------------<EMAIL_ADDRESS>The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews


| About Dailyrotten |
|
Feedback
If you like this page, hate it, or would like to suggest changes,
<EMAIL_ADDRESS>is listening. This page
is experimental and somewhat different from what we usually offer, so please
do send your feedback.
Adding Stories
If you are a rotten newshound and you would like to suggest a story,
visit our submit page to
send us the URL. Stories that are accepted will have your name credited.
Viewership
On the first full day this page went live, 100,000 people visited this Rotten
News page. Of course that was the day after the WTC attacks, so that number is
somewhat distorted. Right now this page gets between 50,000 and 75,000 people
every day.
Linking
We encourage everyone to link to this page; if you like it, others probably
will as well.
Other Rotten
Rotten
Gaping Maw
Celebrity Morgue
Mugshots
Rotten Store
Shockumentary
Rate My Poo
Rate My Kitten
Rate My Finger
Penny Postcards
Phallic
Dr. Sputnik
Boners
Dead Pool
NNDB
Home
Make Dailyrotten your start page
|
|
|
November 19, 2003
Army officer confesses torturing prisoner
CNN | Submitted by: Mikey Mike
"An Army officer fought back tears Wednesday as he acknowledged threatening to shoot an Iraqi detainee to extract information about a planned attack... In addition to firing his pistol near Hamoodi, West also is accused of punching him during the August 20 interrogation... West, 42, of Atlanta, testified he had received information that Hamoodi, an Iraqi policeman, was allegedly involved in a plot to attack him and his troops... West said he decided to question the prisoner himself, bringing a number of soldiers with him to the place where Hamoodi was being questioned. The soldiers punched the detainee to force him to talk... 'I know that the method that I used was not the right method,' West said, adding he was ready to face the consequences of his action." [Just give the guy his richly-deserved dishonorable discharge and let's move on.]
|
|
Read article...
|
|
Japanese kill, eat new whale species
CNN | Submitted by: Mikey Mike
"Japanese scientists say they have identified a new species of whale - a remarkable discovery if confirmed... While new species of smaller creatures such as insects, birds and amphibians are discovered every year, it is very unusual for scientists to identify a new mammal, particularly one so large... In 1986, the International Whaling Commission imposed a moratorium on commercial whaling. Japan, however, takes hundreds of whales a year under a scientific exemption, usually selling them for food and other products after they are studied." [Tonight's special: research whale nigiri.]
|
|
Read article...
|
|
Teen rapist sentenced to 15 years
WCPO-TV 9 Cincinatti | Submitted by: I Choose The Matrix
"Terrell Wilkins, 17, pleaded no contest last month to charges of beating and raping his 57 year old tutor earlier this year in the basement of the YWCA... Wilkins said he attacked the woman because he was angry she ended their tutoring session early. The victim said she didn't know the teen had a long criminal history including dozens of misdemeanors and one felony."
|
|
Read article...
|
|
Severe weight lifting accident
Sydney Morning Herald | Submitted by: Mr Satan
"Hossein Barkhah of Iran dislocates his elbow while attempting to snatch 157.5kg in the men's 77 kilogram class at the World Weightlifting Championship in Vancouver, British Columbia." With photo.
|
|
Read article...
|
|
Dad allegedly kills 4-year-old as austerity measure
World Net Daily | Submitted by: optional
"Cameron John Brown says his 4-year-old daughter accidentally tripped and fell 130 feet to her death three years ago, but law enforcement officials now say the father pushed little Lauren off a cliff on California's Palos Verdes Peninsula to escape paying $1,000-a-month child-support payments... Deputy District Attorney Craig Hum told the Times, 'Our position is that at least one of his motives [for the alleged murder] was to get rid of child support.'"
|
|
Read article...
|
|
America refines nuke strategy over Hiroshima anniversary
BBC | Submitted by: Snitter the Rat
"A conference to plan the future of the American nuclear arsenal, including the development of so-called mini-nukes, is being held this week at StratCom, the headquarters of US Strategic Command in Nebraska. The Bush administration appears determined to build a new generation of small nuclear weapons, especially 'earth penetrators,' designed to attack nuclear, chemical or biological materials buried deep underground... Robert Musil, executive director of Physicians for Social Responsibility, said: 'Why in the world would we move towards manufacturing small nuclear weapons and then expect that no one will ever try to steal, beg or borrow one and use it against us?'"
|
|
Read article...
|
|
Darwin Award winner loved his hat
canada.com | Submitted by: monica
"A man was crushed to death Tuesday when he dived under a slow-moving semi-trailer to retrieve his baseball cap... 'The truck was rolling forward and he dove under to grab the hat. He tried to grab it and wiggle out quickly,' said witness Josh Emard... Derek Keenan, 44, of Lethbridge died at the scene after the truck's rear wheels rolled over his upper body. The truck came to a stop with Keenan underneath the flatbed trailer loaded with precast concrete drainage pipe."
|
|
Read article...
|
|
Flash! Russian dies of alcohol poisoning
Yahoo! UK | Submitted by: maitre ka-fu
"A vodka-drinking competition in a southern Russian town ended in tragedy... 'The competition lasted 30, perhaps 40 minutes and the winner downed three half-litre bottles. He was taken home by taxi but died within 20 minutes,' said Roman Popov, a prosecutor pursuing the case in the town of Volgodonsk. 'Five contestants ended up in intensive care.  The Justice Department, in a statement, said it wants to deport Jakiw Palij 'based on his participation in the persecution of Jewish civilians.' ... Eli M. Rosenbaum, head of a special investigation unit for the Justice Department, alleged Palij 'and his fellow "Trawniki men" played instrumental roles in carrying out Adolf Hitler's genocidal ambitions by rounding up, guarding and helping to murder Jews throughout Nazi-occupied Poland.'"
|
|
Read article...
|
|
Fisherman catches grenade
newstrib.com | Submitted by: Gutter Juice
"A man fishing the '30-foot' area near the Route 71 bridge found a pineapple grenade submerged in water. The fisherman took the grenade to the owner of the property who in turn wrapped it in a blanket and transported it in the trunk of his car to the police department... Since the grenade had been submerged for what appeared to be quite a while, police could not determine if the fuse was active. As a precaution in case it detonated, the grenade was placed on the ground and covered with sandbags."
|
|
Read article...
|
|
Malaysia forms toilet patrol
Malaysia Star | Submitted by: Reid Fleming
"Sarawak has declared war on dirty and smelly public toilets. 'If public toilets are dirty, poorly lit and with poor ventilation, it is a health hazard to users,' he said at a ceremony to mark World Toilet Day here yesterday. Malaysia is among 17 countries which founded the World Toilet Day in 2001. They would gather at the World Toilet Summit in Beijing next year."
|
|
Read article...
|
|
Coke executive murdered in Philippines
Philippine Daily Inquirer | Submitted by: Pinoyz
"The body of Betti Sy, 32, a Coca-Cola executive, was found wrapped in a blanket and stuffed in a black plastic trash bag near the seafront in Parañaque City. She was shot twice in her right leg and apparently bled to death, said Philippine National Police Director General Hermogenes Ebdane... She bore four puncture wounds on her right thigh aside from the injuries on her left hand, according to the police." [Just another casualty of the cola wars.]
|
|
Read article...
|
|
Just another casualty of the drug war
ABC TV affiliates | Submitted by: When you pry it from my dead, cold hand.
"Officers had no idea Nickolas Sandoval, 24, of Ponder, had drugs when they spotted him on Interstate 35E in Corinth, about 45 miles northeast of Fort Worth. 'Officers went from "Oh, hey, here is someone with a flat tire" to "Hey, this guy is choking,"' [Cpl. Frank Lott] told the Fort Worth Star-Telegram... Officers noticed a plastic bag lodged in the man's throat, but it was too far down for them to extract. They kept trying to dislodge it until an ambulance arrived, and medical personnel were able to remove it, Lott said. Sandoval was pronounced dead at Denton Regional Medical Center... The cause of death has been ruled as 'asphyxiation due to aspiration of plastic bag.'"
|
|
Read article...
|
|
Puppies cooked on heating pad
New York Daily News | Submitted by: Me'lao
"John Marchisotto took his 12 squirming, adorable boxer puppies to the veterinarian Monday to have their tails bobbed. Ninety minutes later, one of the precious pups was dead. Two more would die before the night was out - scorched by a heating pad on the maximum setting. Marchisotto blames staff at the Animal Hospital of Staten Island for turning up the heating pad and letting his 3-day-old puppies burn to death."
|
|
Read article...
|
|
More on that quad-quark particle
BBC | Submitted by: Reid Fleming
"Scientists have found a sub-atomic particle they cannot explain using current theories of energy and matter... Classified as X(3872), the particle was seen fleetingly in an atom smasher and has been dubbed the 'mystery meson.' ... X(3872) is peculiar in that it does not fit easily into any known particle scheme and, as a result, has attracted a considerable amount of attention from the world's physics community... X(3872) does not match theoretical expectations for any conceivable quark-antiquark arrangement."
|
|
Read article...
|
|
|
|
|


Arithme-Pix
Introduction
Background
Discovery
Formation
Color
Adjustments
Brightness
Contrast
Tone Curve
Extension
References
Feedback Form
Please feel free to share your feedback, thoughts and comments on this project. Any ideas for future extension or improvement are much appreciated!
Name
Email
Comments
How did you find this project?
Submit
Thank you very much.


RECIPE
Savoury Saturday Sundowners
For the cocktail lover with a more savoury palette.
by Citizen reporterRoku Negroni cocktail | Image: Supplied
With spring coming up, we thought what better way than to sip on a G&T, or better yet – one of several cocktails than with these savoury versions courtesy of Roku Gin.
If you’re looking for a savoury cocktail to enjoy, indulge in either the Roku Negroni with flavours of Umeshu, Campari and orange or the Roku Sour that combines Matcha and Yuzu.
1 – Refreshing Roku Tonic
Roku 30m
Tonic 120ml
Ginger sticks +
Add all ingredients and build. Serve over cubed ice in a highball glass. Garnish with ginger slices.
For a more refreshing option, delight in their Roku Sonic – a twist on the classic with the addition of soda water. The most refreshing of them all is their signature serve, the Roku Tonic, a Japanese spin on the classic G&T with the garnishing of ginger.
2 – Roku Negroni
Roku 30m
Umeshu 15ml
Campari 15ml
Orange twist +
Add all ingredients and build. Serve over a large cube of ice in an Old Fashioned glass. Garnish with orange zest.


W3Schools is a web developers site, with tutorials and references on web development languages such as HTML, CSS, JavaScript, PHP, SQL, Python, jQuery, W3.CSS, and Bootstrap, covering most aspects of web programming.
The site derives its name from the World Wide Web (W3), but is not affiliated with the W3C.
W3Schools was originally created in 1998 by Refsnes Data, a Norwegian software development and consulting company.
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Corporis quos illo exercitationem et? Illum maiores laborum ipsum unde, alias porro libero est. Commodi aliquam totam eaque dicta vitae autem dignissimos.


| Interface | Description |
|---|---|
| NDArrayCallback |
An ndarray listener
|
| NDArrayHolder |
A simple interface for retrieving an
ndarray
|
| Class | Description |
|---|---|
| AeronConnectionInformation |
Aeron connection information
pojo.
|
| AeronNDArrayPublisher |
NDArray publisher
for aeron
|
| AeronNDArraySerde |
NDArray Serialization and
de serialization class for
aeron.
|
| AeronNDArraySubscriber |
Subscriber for ndarrays.
|
| AeronUtil |
Utility functions for samples
|
| LowLatencyMediaDriver |
Created by agibsonccc on 9/22/16.
|
| NDArrayFragmentHandler |
NDArray fragment handler
for listening to an aeron queue
|
| NDArrayMessage |
A message sent over the wire for ndarrays
includ ing the timestamp sent (in nanoseconds),
index (for tensor along dimension view based updates)
and dimensions.
|
| Enum | Description |
|---|---|
| NDArrayMessage.MessageType | |
| NDArrayMessage.MessageValidity |
Copyright © 2020. All rights reserved.


Unlike our previous example where we were rotating to a vector, we can also manually provide rotations for each instance. In this example we'll provide a unique rotation that's constantly increasing for each axis. You can, of course, only manipulate one axis, but this example looks at how you might change each.
Opening the network you should see an example that looks familiar. What we should find different here is that we have a noise CHOP that produces unique rotation speeds for each axis - these are labeled 'rotx', 'roty', and 'rotz'. These channes are shuffled, passed to a speed to so they increment over time, then reshuffled to be packed into channels that are correctly constructed for instancing.
Like in previous examples each instance is represented by a sample in our CHOP network. Notice as well that in this example we use a noise TOP to produce the colors for our instances, which is then converted to CHOPs. The rotation and color data is merged with our location information with a merge CHOP before being used by our geometry COMP.
In the geometry COMP notice that we follow the same rules as previous examples and on the Instance page of our operator point to the CHOP channels to be used for rotation. The parameters "Rotate X", "Rotate Y", and "Rotate Z" are targeted with our new rotation information.
If you'd like to better see how the speed CHOP is being used in this example, locate the pulse reset parameter on the Speed CHOP and click to reset the rotation of each instance. This style of technique can often be useful for systems that need to return to a default or home state periodically.


Similarity measures are used to determine how many features two entities have in common.
See Resource Allocation Index. The Adamic-Adar Index analytic calculates the fraction of a "resource" that a node can send to another through their common neighbours. It is a variation of the Resource Allocation Index in that it is calculated by summing 1 divided by the log of the degree of each common neighbour node. The Soundarajan-Hopcroft Community Adamic-Adar Index parameter will only score pairs of nodes that are both selected (that is, sharing resources within the same community).


O (2001) Mekhi Phifer, Josh Hartnett, Julia Stiles, Andrew Keegan, Martin Sheen, Elden Henson, Rain Phoenix, John Heard. Screenplay by Brad Kaaya, based on the play "Othello" by: William Shakespeare. Directed by Tim Blake Nelson. 94 minutes. Rated R, 3 stars (out of five stars)
Review by Ed Johnson-Ott, NUVO Newsweekly www.nuvo.net Archive reviews at http://reviews.imdb.com/ReviewsBy?Edward+Johnson-Ott To receive reviews by e-mail at no charge, send subscription requests to<EMAIL_ADDRESS>or e-mail<EMAIL_ADDRESS>with the word "subscribe" in the subject line.
Talk about bad timing - "O," which transplants Shakespeare's "Othello" to a modern US high school, was scheduled for release two years ago.  Suddenly, a movie with a key scene depicting armed students attacking one another didn't seem like such a great idea.
For awhile, it looked like "O" would never be screened. Then a smaller studio took the troubled film, releasing it not in early summer but in late August – just in time for the new school year. Hmmm.
In this version of the classic tragedy, Othello becomes Odin Jones (Mekhi Phifer), star basketball player (and the sole black student) at a private Southern school.
Ah, but trouble is brewing. Coach Goulding's son Hugo (Josh Hartnett) is jealous because dad likes O more than him. So the boy hatches a plan. He will use insecure, horny Roger (Elden Hensen), naïve Emily (Rain Phoenix), O's best friend Michael Cassio (Andrew Keegan) and his own poison tongue to ruin his rival.
The melodrama works because high school is quite possibly the most melodramatic place on Earth. When O takes in Hugo's lies, you understand, because love makes a high school student susceptible to the most outlandish ideas. As the Shakespeare play heads toward the horrific ending we know so well, it seems plausible, given the emotional fragility of the participants.
Still, this is a bumpy ride. The script makes liberal use of the word "nigga" and tosses a few "faggots" in as well. I don't know about you, but I could go a lifetime without ever hearing any variation of those words again. And don't waste my time arguing about oppressed groups reclaiming hate words for their own benign use – when one of those words is voiced, regardless of the circumstances, some dim-bulb will assume that means it's okay for them to use it as well.
The acting is spotty. Josh Hartnett, sporting that godawful bed-head hairdo he favored before "Pearl Harbor," gives a performance consisting almost solely of wincing and whining, while Julia Stiles seems overly confined playing a character forced by the script to act illogically at the worst times. Mekhi Phifer struggles a bit during the more grandiose parts of his meltdown, but is credible overall.
Sadly, "O" is most convincing during its darkest moments – partially because of the filmmakers effective use of the mossy Southern settings, but mostly because it has now become far too easy to equate horror and high school.
© 2001 Ed Johnson-Ott
========== X-RAMR-ID: 29365 X-Language: en X-RT-ReviewID: 247014 X-RT-TitleID: 1108976 X-RT-SourceID: 591 X-RT-AuthorID: 1099 X-RT-RatingText: 3/5
The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews


{% extends "base.html" %} {% block content %}
This site provides research rankings for faculty and universities in the United States, focusing on the field of Natural Language Processing (NLP). Inspired by CSRankings which gives university rankings in diverse areas, this site conducts a more thorough survey in NLP. The academic research achievement is represented by publications archived on the ACL Anthology, an open source website hosted by the Association for Computational Linguistics.
When you click the university name, you will see the following information:
| Author ({{ dict(v['authors'])|length }}) | Score | Latest | Count |
|---|---|---|---|
| {{ author }} | {{ value[0] }} | {{ value[2] }} | {{ value[1] }} |


• Air India, the Country's proud flag carrier, also has the `biggest' MRO set up in India that can serve as a One-Stop-Shop for all Engineering requirements. • Air India Engineering Services Limited (AIESL), a wholly owned subsidiary company of Air India Limited was formed on 11th March 2004. • Presently, AIESL is approved by the DGCA under the purview of CAR-145 which carries with it nomination and acceptance by the DGCA of additional Managers (Base Maintenance, Line Maintenance and Workshops) who are competent and experienced in the area of their work. • AIESL policy is to be self-reliant in areas of Aircraft Maintenance (Line and Base Maintenance), Preventive Maintenance, Alterations or required Inspections, overhaul of aero engines and components and accessories and specialized services NDT etc. • AIESL comprises of huge infrastructure to cater to Line Maintenance, Base Maintenance, Engine Overhaul, Accessories Overhaul and Component Overhaul activities as per capability at main bases and line stations. • AIESL provides Base Maintenance facilities at Mumbai, Delhi, Kolkata, Hyderabad, Thiruvananthapuram and Nagpur Airports. These locations also have specialized overhaul shops and are equipped with the necessary hangars, workshops, storage rooms and office buildings, in accordance with national and international regulations and requirements. • AIESL also provides Line Maintenance Facilities at various Indian as well as International Stations. • AIESL offers exclusive maintenance services to Third Party Customers.
○ AIESL offers exclusive maintenance services to Third Party Customers. ○ Highly skilled and trained manpower ○ Extensive use of specialized tools & equipments ○ As an Airline owned MRO, understandingMRO requirements of customers is far better and hence can offer Customized solution for every Customer need. ○ Extensive back shops capabilities to supportfrontline maintenance. ○ Low turnaround time. ○ Elaborate In-Coming Parts inspection to ensure use of authentic Spares.


The LinkML Ecosystem
LinkML is part of a growing ecosystem of tools:
Tools that build off LinkML
Data Harmonizer
DataHarmonizer is a ontology-based curation tool that is being adapter to LinkML
Bootstrapping Models
linkml-model-enrichment bootstraps schemas from existing structured and semi-structured sources
Templated OWL generation
linkml-owl enables generation of complex OWL axioms from datamodels


EntityDB¶
EntityDB is a framework for storing and querying data in a SQL database.
It provides a SQL implementation of an EAV Data Model . It uses SqlAlchemy to provide python classes and utilities for creating and querying entity records
Why EntityDB?¶
MissionControl includes EntityDB for several reasons:
- Jobs and Flows often need to store and query intermediate data in a variety of schemas. EntityDB provides a way to accomodate a wide range of schemas .
- Jobs and Flows often query data from pre-existing libraries of inputs. EntityDB can be used to quickly setup input libraries for testing.
- It is often useful to decouple data parsing from data ingestion. EntityDB provides a system for defining abstract ingestion ‘actions’, so that job parsers can run without needing database connections.
Schema¶
The key to understanding how EntityDB works is to understand its schema. That is, the way it organizes data.
Ent¶
The central component of EntityDB’s schema is the mc.db.models.Ent
class. An Ent represents a ‘thing’.
However, when we think about data, we usually think in more specific terms. We think about things specific using terms specific to our field. For example, if we’re thinking about chemistry, we think in terms of ‘molecules’, ‘conformers’, ‘electronic structure’, and other chemistry-specific terms.
So how do we go from a general ‘thing’ to a field-specific term? We use Ent’s
mc.db.models.Ent.ent_type
attribute to indicate that our entity has a
particular type. For example, we could create an Ent that represents a molecule.
In the example below we create a Houston instance with an in-memory db,
and create an entity that represents a molecule:
# Setup a Houston instance for easy db access.
from mc.houston import Houston
houston = Houston(cfg={'MC_DB_URI': 'sqlite://'})
houston.db.ensure_tables()
my_molecule = houston.db.models.Ent(ent_type='molecule')
houston.db.session.add(my_molecule)
houston.db.session.commit()
print(my_molecule)
<Ent|ID:...|KEY:ent:molecule:...>
Props¶
Usually things in our field have different properties. For example, a molecule can have atoms, or a charge.
We use Ent’s mc.db.models.Ent.props
attribute to store properties
related to our entity. For example:
my_molecule.props['atoms'] = [
{'element': 'C', 'x': 0, 'y': 0, 'z': 0},
{'element': 'O', 'x': 1, 'y': 0, 'z': 0},
# ...
]
my_molecule.props['charge'] = 3
houston.db.session.add(my_molecule)
houston.db.session.commit()
import json
print(json.dumps(dict(my_molecule.props), indent=2, sort_keys=True))
{
"atoms": [
{
"element": "C",
"x": 0,
"y": 0,
"z": 0
},
{
"element": "O",
"x": 1,
"y": 0,
"z": 0
}
],
"charge": 3
}
In general you can store anything in props that can be serialized into JSON. This gives you great flexibility!
Warning
If you try to store something in props that can’t be serialized you will get an error when you try to save your ent.
Example:
class NonSerializable: pass
ent_w_bad_props = houston.db.models.Ent(
props={'this_wont_work': NonSerializable()}
)
houston.db.session.add(ent_w_bad_props)
try:
houston.db.session.commit()
except Exception as exc:
print(exc)
(builtins.TypeError) Object of type 'NonSerializable' is not JSON serializable ...
Filtering by Props¶
You can also filter ents by prop values.
Note that we filter on an Ent’s :attr:mc.db.models.Ent.props_set attribute, rather than :attr:mc.db.models.Ent.props.
Here’s an example of filter ents that have a property with a specific value.
# Setup a Houston instance with a db.
from mc.houston import Houston
houston = Houston(cfg={'MC_DB_URI': 'sqlite://'})
houston.db.ensure_tables()
# shortcut, to save some typing :p
Ent = houston.db.models.Ent
# Create some molecule ents.
molecules = []
for i in range(1, 4):
molecule = Ent(
ent_type='molecule',
props={'num_atoms': i}
)
molecules.append(molecule)
houston.db.session.add_all(molecules)
houston.db.session.commit()
# Setup a base query to filter for molecule ents.
base_molecule_query = (
houston.db.session.query(Ent)
.filter(Ent.ent_type == 'molecule')
)
# Filter for molecules with one atom.
molecules_w_one_atom = (
base_molecule_query
.filter(Ent.props_set.any(key='num_atoms', value=1))
.all()
)
for molecule in molecules_w_one_atom:
print('num_atoms:', molecule.props['num_atoms'])
num_atoms: 1
Here’s a more advanced example that filters for a property matching a numerical comparison. Notice how we ‘join’ to Ent.Prop.
# Filter for molecules with greater than one atom.
molecules_w_multiple_atoms = (
base_molecule_query
.join(Ent.Prop, aliased=True, from_joinpoint=True)
.filter(Ent.Prop.key == 'num_atoms')
.filter(Ent.Prop.value > 1)
.order_by(Ent.Prop.value)
.reset_joinpoint()
.all()
)
for molecule in molecules_w_multiple_atoms:
print('num_atoms:', molecule.props['num_atoms'])
num_atoms: 2
num_atoms: 3
Because EntityDB uses SqlAlchemy, you have great flexibility in the queries you can build.
See http://docs.sqlalchemy.org/en/latest/orm/query.html#sqlalchemy.orm.query.Query.join to understand the ‘join’ line.
Tags¶
Often we want a way to group ents into collections, or to quickly find specific ents. EntityDB provides a tagging mechanism to help us do these things.
Here’s an example:
# Setup a Houston instance with a db.
from mc.houston import Houston
houston = Houston(cfg={'MC_DB_URI': 'sqlite://'})
houston.db.ensure_tables()
# shortcut, to save some typing :p
Ent = houston.db.models.Ent
# Create a molecule ent with some tags.
# We define tags as python set().
molecule = Ent(
ent_type='molecule',
tags={'some_tag', 'some_other_tag'}
)
houston.db.session.add(molecule)
houston.db.session.commit()
print(sorted(molecule.tags))
['some_other_tag', 'some_tag']
# We can add tags without worrying about duplicates.
molecule.tags.add('a new tag')
molecule.tags.add('some_tag')
houston.db.session.add(molecule)
houston.db.session.commit()
print(sorted(molecule.tags))
['a new tag', 'some_other_tag', 'some_tag']
Filtering by Tags¶
We can filter ents by tags.
Note that we filter on an Ent’s :attr:mc.db.models.Ent.tags_set attribute, rather than :attr:mc.db.models.Ent.tagas.
Here’s an example of filtering for ents that have a specific tag.
# Setup a Houston instance with a db.
from mc.houston import Houston
houston = Houston(cfg={'MC_DB_URI': 'sqlite://'})
houston.db.ensure_tables()
# shortcut, to save some typing :p
Ent = houston.db.models.Ent
# Create ents with combinations of 2 tags.
tags = ['tag_%s' % i for i in range(1, 4)]
molecules = []
import itertools
pairs = list(itertools.combinations(tags, 2))
trios = list(itertools.combinations(tags, 3))
for tag_combo in [*pairs, *trios]:
molecule = Ent(
ent_type='molecule',
tags=set(tag_combo)
)
molecules.append(molecule)
houston.db.session.add_all(molecules)
houston.db.session.commit()
# Filter for ents that have tag_1.
ents_w_tag_1 = (
houston.db.session.query(Ent)
.filter(Ent.tags_set.any(name=tags[0]))
.all()
)
def generate_key_for_tags(tags):
return '|'.join(sorted(tags))
tag_set_keys = [generate_key_for_tags(ent.tags) for ent in ents_w_tag_1]
print(sorted(tag_set_keys))
['tag_1|tag_2', 'tag_1|tag_2|tag_3', 'tag_1|tag_3']
In the following example we filter for ents that have a set of tags.
ents_w_tags_1_and_2 = (
houston.db.session.query(Ent)
.filter(
Ent.tags_set.any(name=tags[0])
& Ent.tags_set.any(name=tags[1])
)
.all()
)
def generate_key_for_tags(tags):
return '|'.join(sorted(tags))
tag_set_keys = [generate_key_for_tags(ent.tags) for ent in ents_w_tags_1_and_2]
print(sorted(tag_set_keys))
['tag_1|tag_2', 'tag_1|tag_2|tag_3']
In the following example we filter for ents that lack a tag.
ents_sans_tag_1 = (
houston.db.session.query(Ent)
.filter(~(Ent.tags_set.any(name=tags[0])))
.all()
)
def generate_key_for_tags(tags):
return '|'.join(sorted(tags))
tag_set_keys = [generate_key_for_tags(ent.tags) for ent in ents_sans_tag_1]
print(sorted(tag_set_keys))
['tag_2|tag_3']
Lineage¶
You can organize ents in relationship hierarchies using the attributes
mc.db.models.Ent.parents
mc.db.models.Ent.children
mc.db.models.Ent.ancestors
mc.db.models.Ent.descendants
Let’s see an example.
# Setup a Houston instance with a db.
from mc.houston import Houston
houston = Houston(cfg={'MC_DB_URI': 'sqlite://'})
houston.db.ensure_tables()
# shortcut, to save some typing :p
Ent = houston.db.models.Ent
# Setup helper methods
def create_families(num_families=2):
families = {}
for i in range(1, 1 + num_families):
family_key = ('family_%s' % i)
families[family_key] = create_family(family_key=family_key)
return families
def create_family(family_key=None):
common_props = {'family_key': family_key}
grandparents = [
Ent(
key=('%s:grandparent_%s' % (family_key, i)),
props={**common_props, 'generation': 'grandparents'}
)
for i in range(4)
]
grandparent_pairs = [
[grandparents[0], grandparents[1]],
[grandparents[2], grandparents[3]]
]
parents = []
for i, grandparent_pair in enumerate(grandparent_pairs):
parents.append(
Ent(
key=('%s:parent_%s' % (family_key, i)),
props={**common_props, 'generation': 'parents'},
parents=grandparent_pair,
ancestors=grandparent_pair
)
)
children = [
Ent(
key=('%s:child_%s' % (family_key, i)),
props={**common_props, 'generation': 'children'},
parents=parents,
ancestors=(grandparents + parents)
)
for i in range(3)
]
houston.db.session.add_all(grandparents + parents + children)
houston.db.session.commit()
family = {
'grandparents': grandparents,
'grandparent_pairs': grandparent_pairs,
'parents': parents,
'children': children
}
return family
def keys_for_ents(ents): return sorted(set([ent.key for ent in ents]))
families = create_families(2)
family_1 = families['family_1']
individuals = {
'grandparent': family_1['grandparents'][0],
'parent': family_1['parents'][0],
'child': family_1['children'][0]
}
for generation, individual in individuals.items():
for attr in ['parents', 'children', 'ancestors', 'descendants']:
label = '{generation}.{attr}: '.format(
generation=generation, attr=attr)
key_set = keys_for_ents(getattr(individual, attr))
print(label, key_set)
grandparent.parents: []
grandparent.children: ['family_1:parent_0']
grandparent.ancestors: []
grandparent.descendants: ['family_1:child_0', 'family_1:child_1', 'family_1:child_2', 'family_1:parent_0']
parent.parents: ['family_1:grandparent_0', 'family_1:grandparent_1']
parent.children: ['family_1:child_0', 'family_1:child_1', 'family_1:child_2']
parent.ancestors: ['family_1:grandparent_0', 'family_1:grandparent_1']
parent.descendants: ['family_1:child_0', 'family_1:child_1', 'family_1:child_2']
child.parents: ['family_1:parent_0', 'family_1:parent_1']
child.children: []
child.ancestors: ['family_1:grandparent_0', 'family_1:grandparent_1', 'family_1:grandparent_2', 'family_1:grandparent_3', 'family_1:parent_0', 'family_1:parent_1']
child.descendants: []
Filtering by Lineage¶
We can filter ents by their lineage.
Note that unlike props or tags, we filter on the direct lineage attributes. The reason for this is technical: props and tags are SqlAlchemy association_proxies, whereas lineage attributes are SqlAlchemy relationships.
Here are some examples.
Querying by parents:
grandparent_pair_0 = family_1['grandparent_pairs'][0]
children_of_grandparent_pair_0 = (
houston.db.session.query(Ent)
.join(Ent.parents, aliased=True, from_joinpoint=True)
.filter(
Ent.key.in_([
grandparent.key
for grandparent in grandparent_pair_0
])
)
.reset_joinpoint()
.all()
)
print("\n".join(keys_for_ents(children_of_grandparent_pair_0)))
family_1:parent_0
Querying by ancestors:
descendants = (
houston.db.session.query(Ent)
.filter(
Ent.props_set.any(key='generation', value='children')
)
.join(Ent.ancestors, aliased=True, from_joinpoint=True)
.filter(
Ent.props_set.any(key='family_key', value='family_1')
)
.reset_joinpoint()
.all()
)
print("\n".join(keys_for_ents(descendants)))
family_1:child_0
family_1:child_1
family_1:child_2
Updating an EntityDB via Actions¶
EntityDB allows you to describe updates to a db as a list of dicts. We call these dicts ‘actions’.
An action is a dict with keys for ‘type’ and ‘params’.
Actions are useful because they allow a program to generate a set of updates without needing a DB connection. This is allows us to do things like:
- Define parsers for job artifacts that can run without a DB connection.
- Test parse results by in terms of expected actions, rather than expected DB state.
- Batch together DB writes into chunks, for more efficient write performance.
Upsert Actions¶
Currently the only valid type is ‘upsert’.
The general idea of an upsert action is to get or create an ent, and then run a series of updates to that ent.
See mc.db.Db.upsert()
for how
the parameters that an upsert action can take.
raise NotImplementedError('link upsert action example')
Recommended Practices for Using EntityDB¶
- Think carefully about your schema before you start creating large numbers of
entities.
- Can you design queries that get the correct answers for your questions?
- What kind of lineage relationships do you need to track?
- What kind of properties do you expect to store? Will you need to filter on these properties?


Harkilgamed:
You must be Kamael...
What brings you to this blasted place? Did you really lay your hands on the Star of Destiny?
Say yes.


@@include('./head.html')
@@include('./header.html')You will find below a library of reports, surveys and strategic documents, as well as press and media pieces relating to numerous aspects of Grandton Police Service’s operation, which have been used throughout this website. Click on each link to access each material in full.