Usage in framework
All in tf.keras.metrics available metrics can be used in our framework. Just use the class name as configuration key and the arguments as as dict.
YAML Configuration
E.g. for tf.metrics.MeanAbsoluteError without no arguments
metrics:
MeanSquaredError:
or for tf.metrics.MeanIoU with arguments:
metrics:
MeanIoU:
num_classes: 7
Keras metrics
AUC class
tensorflow.keras.metrics.AUC(
num_thresholds=200,
curve="ROC",
summation_method="interpolation",
name=None,
dtype=None,
thresholds=None,
multi_label=False,
label_weights=None,
)
Computes the approximate AUC (Area under the curve) via a Riemann sum.
This metric creates four local variables, true_positives
, true_negatives
,
false_positives
and false_negatives
that are used to compute the AUC.
To discretize the AUC curve, a linearly spaced set of thresholds is used to
compute pairs of recall and precision values. The area under the ROC-curve is
therefore computed using the height of the recall values by the false positive
rate, while the area under the PR-curve is the computed using the height of
the precision values by the recall.
This value is ultimately returned as auc
, an idempotent operation that
computes the area under a discretized curve of precision versus recall values
(computed using the aforementioned variables). The num_thresholds
variable
controls the degree of discretization with larger numbers of thresholds more
closely approximating the true AUC. The quality of the approximation may vary
dramatically depending on num_thresholds
. The thresholds
parameter can be
used to manually specify thresholds which split the predictions more evenly.
For best results, predictions
should be distributed approximately uniformly
in the range [0, 1] and not peaked around 0 or 1. The quality of the AUC
approximation may be poor if this is not the case. Setting summation_method
to 'minoring' or 'majoring' can help quantify the error in the approximation
by providing lower or upper bound estimate of the AUC.
If sample_weight
is None
, weights default to 1.
Use sample_weight
of 0 to mask values.
Args:
num_thresholds: (Optional) Defaults to 200. The number of thresholds to
use when discretizing the roc curve. Values must be > 1.
curve: (Optional) Specifies the name of the curve to be computed, 'ROC'
[default] or 'PR' for the Precision-Recall-curve.
summation_method: (Optional) Specifies the Riemann summation method used.
'interpolation' (default) applies mid-point summation scheme for ROC
.
For PR-AUC, interpolates (true/false) positives but not the ratio that
is precision (see Davis & Goadrich 2006 for details);
'minoring' applies left summation
for increasing intervals and right summation for decreasing intervals;
'majoring' does the opposite.
name: (Optional) string name of the metric instance.
dtype: (Optional) data type of the metric result.
thresholds: (Optional) A list of floating point values to use as the
thresholds for discretizing the curve. If set, the num_thresholds
parameter is ignored. Values should be in [0, 1]. Endpoint thresholds
equal to {-epsilon, 1+epsilon} for a small positive epsilon value will
be automatically included with these to correctly handle predictions
equal to exactly 0 or 1.
multi_label: boolean indicating whether multilabel data should be
treated as such, wherein AUC is computed separately for each label and
then averaged across labels, or (when False) if the data should be
flattened into a single label before AUC computation. In the latter
case, when multilabel data is passed to AUC, each label-prediction pair
is treated as an individual data point. Should be set to False for
multi-class data.
label_weights: (optional) list, array, or tensor of non-negative weights
used to compute AUCs for multilabel data. When multi_label
is True,
the weights are applied to the individual label AUCs when they are
averaged to produce the multi-label AUC. When it's False, they are used
to weight the individual label predictions in computing the confusion
matrix on the flattened data. Note that this is unlike class_weights in
that class_weights weights the example depending on the value of its
label, whereas label_weights depends only on the index of that label
before flattening; therefore label_weights
should not be used for
multi-class data.
Standalone usage:
m = tf.keras.metrics.AUC(num_thresholds=3) m.update_state([0, 0, 1, 1], [0, 0.5, 0.3, 0.9])
threshold values are [0 - 1e-7, 0.5, 1 + 1e-7]
tp = [2, 1, 0], fp = [2, 0, 0], fn = [0, 1, 2], tn = [0, 2, 2]
recall = [1, 0.5, 0], fp_rate = [1, 0, 0]
auc = ((((1+0.5)/2)(1-0))+ (((0.5+0)/2)(0-0))) = 0.75
m.result().numpy() 0.75
m.reset_states() m.update_state([0, 0, 1, 1], [0, 0.5, 0.3, 0.9], ... sample_weight=[1, 0, 0, 1]) m.result().numpy() 1.0
Usage with compile()
API:
model.compile(optimizer='sgd', loss='mse', metrics=[tf.keras.metrics.AUC()])
Accuracy class
tensorflow.keras.metrics.Accuracy(name="accuracy", dtype=None)
Calculates how often predictions equal labels.
This metric creates two local variables, total
and count
that are used to
compute the frequency with which y_pred
matches y_true
. This frequency is
ultimately returned as binary accuracy
: an idempotent operation that simply
divides total
by count
.
If sample_weight
is None
, weights default to 1.
Use sample_weight
of 0 to mask values.
Args: name: (Optional) string name of the metric instance. dtype: (Optional) data type of the metric result.
Standalone usage:
m = tf.keras.metrics.Accuracy() m.update_state([[1], [2], [3], [4]], [[0], [2], [3], [4]]) m.result().numpy() 0.75
m.reset_states() m.update_state([[1], [2], [3], [4]], [[0], [2], [3], [4]], ... sample_weight=[1, 1, 0, 0]) m.result().numpy() 0.5
Usage with compile()
API:
model.compile(optimizer='sgd',
loss='mse',
metrics=[tf.keras.metrics.Accuracy()])
BinaryAccuracy class
tensorflow.keras.metrics.BinaryAccuracy(name="binary_accuracy", dtype=None, threshold=0.5)
Calculates how often predictions match binary labels.
This metric creates two local variables, total
and count
that are used to
compute the frequency with which y_pred
matches y_true
. This frequency is
ultimately returned as binary accuracy
: an idempotent operation that simply
divides total
by count
.
If sample_weight
is None
, weights default to 1.
Use sample_weight
of 0 to mask values.
Args: name: (Optional) string name of the metric instance. dtype: (Optional) data type of the metric result. threshold: (Optional) Float representing the threshold for deciding whether prediction values are 1 or 0.
Standalone usage:
m = tf.keras.metrics.BinaryAccuracy() m.update_state([[1], [1], [0], [0]], [[0.98], [1], [0], [0.6]]) m.result().numpy() 0.75
m.reset_states() m.update_state([[1], [1], [0], [0]], [[0.98], [1], [0], [0.6]], ... sample_weight=[1, 0, 0, 1]) m.result().numpy() 0.5
Usage with compile()
API:
model.compile(optimizer='sgd',
loss='mse',
metrics=[tf.keras.metrics.BinaryAccuracy()])
BinaryCrossentropy class
tensorflow.keras.metrics.BinaryCrossentropy(
name="binary_crossentropy", dtype=None, from_logits=False, label_smoothing=0
)
Computes the crossentropy metric between the labels and predictions.
This is the crossentropy metric class to be used when there are only two label classes (0 and 1).
Args:
name: (Optional) string name of the metric instance.
dtype: (Optional) data type of the metric result.
from_logits: (Optional )Whether output is expected to be a logits tensor.
By default, we consider that output encodes a probability distribution.
label_smoothing: (Optional) Float in [0, 1]. When > 0, label values are
smoothed, meaning the confidence on label values are relaxed.
e.g. label_smoothing=0.2
means that we will use a value of 0.1
for
label 0
and 0.9
for label 1
".
Standalone usage:
m = tf.keras.metrics.BinaryCrossentropy() m.update_state([[0, 1], [0, 0]], [[0.6, 0.4], [0.4, 0.6]]) m.result().numpy() 0.81492424
m.reset_states() m.update_state([[0, 1], [0, 0]], [[0.6, 0.4], [0.4, 0.6]], ... sample_weight=[1, 0]) m.result().numpy() 0.9162905
Usage with compile()
API:
model.compile(
optimizer='sgd',
loss='mse',
metrics=[tf.keras.metrics.BinaryCrossentropy()])
CategoricalAccuracy class
tensorflow.keras.metrics.CategoricalAccuracy(name="categorical_accuracy", dtype=None)
Calculates how often predictions matches one-hot labels.
You can provide logits of classes as y_pred
, since argmax of
logits and probabilities are same.
This metric creates two local variables, total
and count
that are used to
compute the frequency with which y_pred
matches y_true
. This frequency is
ultimately returned as categorical accuracy
: an idempotent operation that
simply divides total
by count
.
y_pred
and y_true
should be passed in as vectors of probabilities, rather
than as labels. If necessary, use tf.one_hot
to expand y_true
as a vector.
If sample_weight
is None
, weights default to 1.
Use sample_weight
of 0 to mask values.
Args: name: (Optional) string name of the metric instance. dtype: (Optional) data type of the metric result.
Standalone usage:
m = tf.keras.metrics.CategoricalAccuracy() m.update_state([[0, 0, 1], [0, 1, 0]], [[0.1, 0.9, 0.8], ... [0.05, 0.95, 0]]) m.result().numpy() 0.5
m.reset_states() m.update_state([[0, 0, 1], [0, 1, 0]], [[0.1, 0.9, 0.8], ... [0.05, 0.95, 0]], ... sample_weight=[0.7, 0.3]) m.result().numpy() 0.3
Usage with compile()
API:
model.compile(
optimizer='sgd',
loss='mse',
metrics=[tf.keras.metrics.CategoricalAccuracy()])
CategoricalCrossentropy class
tensorflow.keras.metrics.CategoricalCrossentropy(
name="categorical_crossentropy", dtype=None, from_logits=False, label_smoothing=0
)
Computes the crossentropy metric between the labels and predictions.
This is the crossentropy metric class to be used when there are multiple
label classes (2 or more). Here we assume that labels are given as a one_hot
representation. eg., When labels values are [2, 0, 1],
y_true
= [[0, 0, 1], [1, 0, 0], [0, 1, 0]].
Args:
name: (Optional) string name of the metric instance.
dtype: (Optional) data type of the metric result.
from_logits: (Optional) Whether output is expected to be a logits tensor.
By default, we consider that output encodes a probability distribution.
label_smoothing: (Optional) Float in [0, 1]. When > 0, label values are
smoothed, meaning the confidence on label values are relaxed. e.g.
label_smoothing=0.2
means that we will use a value of 0.1
for label
0
and 0.9
for label 1
"
Standalone usage:
EPSILON = 1e-7, y = y_true, y` = y_pred
y` = clip_ops.clip_by_value(output, EPSILON, 1. - EPSILON)
y` = [[0.05, 0.95, EPSILON], [0.1, 0.8, 0.1]]
xent = -sum(y * log(y'), axis = -1)
= -((log 0.95), (log 0.1))
= [0.051, 2.302]
Reduced xent = (0.051 + 2.302) / 2
m = tf.keras.metrics.CategoricalCrossentropy() m.update_state([[0, 1, 0], [0, 0, 1]], ... [[0.05, 0.95, 0], [0.1, 0.8, 0.1]]) m.result().numpy() 1.1769392
m.reset_states() m.update_state([[0, 1, 0], [0, 0, 1]], ... [[0.05, 0.95, 0], [0.1, 0.8, 0.1]], ... sample_weight=tf.constant([0.3, 0.7])) m.result().numpy() 1.6271976
Usage with compile()
API:
model.compile(
optimizer='sgd',
loss='mse',
metrics=[tf.keras.metrics.CategoricalCrossentropy()])
CategoricalHinge class
tensorflow.keras.metrics.CategoricalHinge(name="categorical_hinge", dtype=None)
Computes the categorical hinge metric between y_true
and y_pred
.
Args: name: (Optional) string name of the metric instance. dtype: (Optional) data type of the metric result.
Standalone usage:
m = tf.keras.metrics.CategoricalHinge() m.update_state([[0, 1], [0, 0]], [[0.6, 0.4], [0.4, 0.6]]) m.result().numpy() 1.4000001
m.reset_states() m.update_state([[0, 1], [0, 0]], [[0.6, 0.4], [0.4, 0.6]], ... sample_weight=[1, 0]) m.result().numpy() 1.2
Usage with compile()
API:
model.compile(
optimizer='sgd',
loss='mse',
metrics=[tf.keras.metrics.CategoricalHinge()])
CosineSimilarity class
tensorflow.keras.metrics.CosineSimilarity(name="cosine_similarity", dtype=None, axis=-1)
Computes the cosine similarity between the labels and predictions.
cosine similarity = (a . b) / ||a|| ||b||
See: Cosine Similarity.
This metric keeps the average cosine similarity between predictions
and
labels
over a stream of data.
Args: name: (Optional) string name of the metric instance. dtype: (Optional) data type of the metric result. axis: (Optional) Defaults to -1. The dimension along which the cosine similarity is computed.
Standalone usage:
l2_norm(y_true) = [[0., 1.], [1./1.414], 1./1.414]]]
l2_norm(y_pred) = [[1., 0.], [1./1.414], 1./1.414]]]
l2_norm(y_true) . l2_norm(y_pred) = [[0., 0.], [0.5, 0.5]]
result = mean(sum(l2_norm(y_true) . l2_norm(y_pred), axis=1))
= ((0. + 0.) + (0.5 + 0.5)) / 2
m = tf.keras.metrics.CosineSimilarity(axis=1) m.update_state([[0., 1.], [1., 1.]], [[1., 0.], [1., 1.]]) m.result().numpy() 0.49999997
m.reset_states() m.update_state([[0., 1.], [1., 1.]], [[1., 0.], [1., 1.]], ... sample_weight=[0.3, 0.7]) m.result().numpy() 0.6999999
Usage with compile()
API:
model.compile(
optimizer='sgd',
loss='mse',
metrics=[tf.keras.metrics.CosineSimilarity(axis=1)])
FalseNegatives class
tensorflow.keras.metrics.FalseNegatives(thresholds=None, name=None, dtype=None)
Calculates the number of false negatives.
If sample_weight
is given, calculates the sum of the weights of
false negatives. This metric creates one local variable, accumulator
that is used to keep track of the number of false negatives.
If sample_weight
is None
, weights default to 1.
Use sample_weight
of 0 to mask values.
Args:
thresholds: (Optional) Defaults to 0.5. A float value or a python
list/tuple of float threshold values in [0, 1]. A threshold is compared
with prediction values to determine the truth value of predictions
(i.e., above the threshold is true
, below is false
). One metric
value is generated for each threshold value.
name: (Optional) string name of the metric instance.
dtype: (Optional) data type of the metric result.
Standalone usage:
m = tf.keras.metrics.FalseNegatives() m.update_state([0, 1, 1, 1], [0, 1, 0, 0]) m.result().numpy() 2.0
m.reset_states() m.update_state([0, 1, 1, 1], [0, 1, 0, 0], sample_weight=[0, 0, 1, 0]) m.result().numpy() 1.0
Usage with compile()
API:
model.compile(optimizer='sgd',
loss='mse',
metrics=[tf.keras.metrics.FalseNegatives()])
FalsePositives class
tensorflow.keras.metrics.FalsePositives(thresholds=None, name=None, dtype=None)
Calculates the number of false positives.
If sample_weight
is given, calculates the sum of the weights of
false positives. This metric creates one local variable, accumulator
that is used to keep track of the number of false positives.
If sample_weight
is None
, weights default to 1.
Use sample_weight
of 0 to mask values.
Args:
thresholds: (Optional) Defaults to 0.5. A float value or a python
list/tuple of float threshold values in [0, 1]. A threshold is compared
with prediction values to determine the truth value of predictions
(i.e., above the threshold is true
, below is false
). One metric
value is generated for each threshold value.
name: (Optional) string name of the metric instance.
dtype: (Optional) data type of the metric result.
Standalone usage:
m = tf.keras.metrics.FalsePositives() m.update_state([0, 1, 0, 0], [0, 0, 1, 1]) m.result().numpy() 2.0
m.reset_states() m.update_state([0, 1, 0, 0], [0, 0, 1, 1], sample_weight=[0, 0, 1, 0]) m.result().numpy() 1.0
Usage with compile()
API:
model.compile(optimizer='sgd',
loss='mse',
metrics=[tf.keras.metrics.FalsePositives()])
Hinge class
tensorflow.keras.metrics.Hinge(name="hinge", dtype=None)
Computes the hinge metric between y_true
and y_pred
.
y_true
values are expected to be -1 or 1. If binary (0 or 1) labels are
provided we will convert them to -1 or 1.
Args: name: (Optional) string name of the metric instance. dtype: (Optional) data type of the metric result.
Standalone usage:
m = tf.keras.metrics.Hinge() m.update_state([[0, 1], [0, 0]], [[0.6, 0.4], [0.4, 0.6]]) m.result().numpy() 1.3
m.reset_states() m.update_state([[0, 1], [0, 0]], [[0.6, 0.4], [0.4, 0.6]], ... sample_weight=[1, 0]) m.result().numpy() 1.1
Usage with compile()
API:
model.compile(optimizer='sgd', loss='mse', metrics=[tf.keras.metrics.Hinge()])
kl_divergence function
tensorflow.keras.metrics.KLD(y_true, y_pred)
Computes Kullback-Leibler divergence loss between y_true
and y_pred
.
loss = y_true * log(y_true / y_pred)
See: https://en.wikipedia.org/wiki/Kullback%E2%80%93Leibler_divergence
Standalone usage:
y_true = np.random.randint(0, 2, size=(2, 3)).astype(np.float64) y_pred = np.random.random(size=(2, 3)) loss = tf.keras.losses.kullback_leibler_divergence(y_true, y_pred) assert loss.shape == (2,) y_true = tf.keras.backend.clip(y_true, 1e-7, 1) y_pred = tf.keras.backend.clip(y_pred, 1e-7, 1) assert np.array_equal( ... loss.numpy(), np.sum(y_true * np.log(y_true / y_pred), axis=-1))
Args: y_true: Tensor of true targets. y_pred: Tensor of predicted targets.
Returns:
A Tensor
with loss.
Raises:
TypeError: If y_true
cannot be cast to the y_pred.dtype
.
KLDivergence class
tensorflow.keras.metrics.KLDivergence(name="kullback_leibler_divergence", dtype=None)
Computes Kullback-Leibler divergence metric between y_true
and y_pred
.
metric = y_true * log(y_true / y_pred)
Args: name: (Optional) string name of the metric instance. dtype: (Optional) data type of the metric result.
Standalone usage:
m = tf.keras.metrics.KLDivergence() m.update_state([[0, 1], [0, 0]], [[0.6, 0.4], [0.4, 0.6]]) m.result().numpy() 0.45814306
m.reset_states() m.update_state([[0, 1], [0, 0]], [[0.6, 0.4], [0.4, 0.6]], ... sample_weight=[1, 0]) m.result().numpy() 0.9162892
Usage with compile()
API:
model.compile(optimizer='sgd',
loss='mse',
metrics=[tf.keras.metrics.KLDivergence()])
LogCoshError class
tensorflow.keras.metrics.LogCoshError(name="logcosh", dtype=None)
Computes the logarithm of the hyperbolic cosine of the prediction error.
logcosh = log((exp(x) + exp(-x))/2)
, where x is the error (y_pred - y_true)
Args: name: (Optional) string name of the metric instance. dtype: (Optional) data type of the metric result.
Standalone usage:
m = tf.keras.metrics.LogCoshError() m.update_state([[0, 1], [0, 0]], [[1, 1], [0, 0]]) m.result().numpy() 0.10844523
m.reset_states() m.update_state([[0, 1], [0, 0]], [[1, 1], [0, 0]], ... sample_weight=[1, 0]) m.result().numpy() 0.21689045
Usage with compile()
API:
model.compile(optimizer='sgd',
loss='mse',
metrics=[tf.keras.metrics.LogCoshError()])
mean_absolute_error function
tensorflow.keras.metrics.MAE(y_true, y_pred)
Computes the mean absolute error between labels and predictions.
loss = mean(abs(y_true - y_pred), axis=-1)
Standalone usage:
y_true = np.random.randint(0, 2, size=(2, 3)) y_pred = np.random.random(size=(2, 3)) loss = tf.keras.losses.mean_absolute_error(y_true, y_pred) assert loss.shape == (2,) assert np.array_equal( ... loss.numpy(), np.mean(np.abs(y_true - y_pred), axis=-1))
Args:
y_true: Ground truth values. shape = [batch_size, d0, .. dN]
.
y_pred: The predicted values. shape = [batch_size, d0, .. dN]
.
Returns:
Mean absolute error values. shape = [batch_size, d0, .. dN-1]
.
mean_absolute_percentage_error function
tensorflow.keras.metrics.MAPE(y_true, y_pred)
Computes the mean absolute percentage error between y_true
and y_pred
.
loss = 100 * mean(abs((y_true - y_pred) / y_true), axis=-1)
Standalone usage:
y_true = np.random.random(size=(2, 3)) y_true = np.maximum(y_true, 1e-7) # Prevent division by zero y_pred = np.random.random(size=(2, 3)) loss = tf.keras.losses.mean_absolute_percentage_error(y_true, y_pred) assert loss.shape == (2,) assert np.array_equal( ... loss.numpy(), ... 100. * np.mean(np.abs((y_true - y_pred) / y_true), axis=-1))
Args:
y_true: Ground truth values. shape = [batch_size, d0, .. dN]
.
y_pred: The predicted values. shape = [batch_size, d0, .. dN]
.
Returns:
Mean absolute percentage error values. shape = [batch_size, d0, .. dN-1]
.
mean_squared_error function
tensorflow.keras.metrics.MSE(y_true, y_pred)
Computes the mean squared error between labels and predictions.
After computing the squared distance between the inputs, the mean value over the last dimension is returned.
loss = mean(square(y_true - y_pred), axis=-1)
Standalone usage:
y_true = np.random.randint(0, 2, size=(2, 3)) y_pred = np.random.random(size=(2, 3)) loss = tf.keras.losses.mean_squared_error(y_true, y_pred) assert loss.shape == (2,) assert np.array_equal( ... loss.numpy(), np.mean(np.square(y_true - y_pred), axis=-1))
Args:
y_true: Ground truth values. shape = [batch_size, d0, .. dN]
.
y_pred: The predicted values. shape = [batch_size, d0, .. dN]
.
Returns:
Mean squared error values. shape = [batch_size, d0, .. dN-1]
.
mean_squared_logarithmic_error function
tensorflow.keras.metrics.MSLE(y_true, y_pred)
Computes the mean squared logarithmic error between y_true
and y_pred
.
loss = mean(square(log(y_true + 1) - log(y_pred + 1)), axis=-1)
Standalone usage:
y_true = np.random.randint(0, 2, size=(2, 3)) y_pred = np.random.random(size=(2, 3)) loss = tf.keras.losses.mean_squared_logarithmic_error(y_true, y_pred) assert loss.shape == (2,) y_true = np.maximum(y_true, 1e-7) y_pred = np.maximum(y_pred, 1e-7) assert np.allclose( ... loss.numpy(), ... np.mean( ... np.square(np.log(y_true + 1.) - np.log(y_pred + 1.)), axis=-1))
Args:
y_true: Ground truth values. shape = [batch_size, d0, .. dN]
.
y_pred: The predicted values. shape = [batch_size, d0, .. dN]
.
Returns:
Mean squared logarithmic error values. shape = [batch_size, d0, .. dN-1]
.
Mean class
tensorflow.keras.metrics.Mean(name="mean", dtype=None)
Computes the (weighted) mean of the given values.
For example, if values is [1, 3, 5, 7] then the mean is 4. If the weights were specified as [1, 1, 0, 0] then the mean would be 2.
This metric creates two variables, total
and count
that are used to
compute the average of values
. This average is ultimately returned as mean
which is an idempotent operation that simply divides total
by count
.
If sample_weight
is None
, weights default to 1.
Use sample_weight
of 0 to mask values.
Args: name: (Optional) string name of the metric instance. dtype: (Optional) data type of the metric result.
Standalone usage:
m = tf.keras.metrics.Mean() m.update_state([1, 3, 5, 7]) m.result().numpy() 4.0 m.reset_states() m.update_state([1, 3, 5, 7], sample_weight=[1, 1, 0, 0]) m.result().numpy() 2.0
Usage with compile()
API:
model.add_metric(tf.keras.metrics.Mean(name='mean_1')(outputs))
model.compile(optimizer='sgd', loss='mse')
MeanAbsoluteError class
tensorflow.keras.metrics.MeanAbsoluteError(name="mean_absolute_error", dtype=None)
Computes the mean absolute error between the labels and predictions.
Args: name: (Optional) string name of the metric instance. dtype: (Optional) data type of the metric result.
Standalone usage:
m = tf.keras.metrics.MeanAbsoluteError() m.update_state([[0, 1], [0, 0]], [[1, 1], [0, 0]]) m.result().numpy() 0.25
m.reset_states() m.update_state([[0, 1], [0, 0]], [[1, 1], [0, 0]], ... sample_weight=[1, 0]) m.result().numpy() 0.5
Usage with compile()
API:
model.compile(
optimizer='sgd',
loss='mse',
metrics=[tf.keras.metrics.MeanAbsoluteError()])
MeanAbsolutePercentageError class
tensorflow.keras.metrics.MeanAbsolutePercentageError(name="mean_absolute_percentage_error", dtype=None)
Computes the mean absolute percentage error between y_true
and y_pred
.
Args: name: (Optional) string name of the metric instance. dtype: (Optional) data type of the metric result.
Standalone usage:
m = tf.keras.metrics.MeanAbsolutePercentageError() m.update_state([[0, 1], [0, 0]], [[1, 1], [0, 0]]) m.result().numpy() 250000000.0
m.reset_states() m.update_state([[0, 1], [0, 0]], [[1, 1], [0, 0]], ... sample_weight=[1, 0]) m.result().numpy() 500000000.0
Usage with compile()
API:
model.compile(
optimizer='sgd',
loss='mse',
metrics=[tf.keras.metrics.MeanAbsolutePercentageError()])
MeanIoU class
tensorflow.keras.metrics.MeanIoU(num_classes, name=None, dtype=None)
Computes the mean Intersection-Over-Union metric.
Mean Intersection-Over-Union is a common evaluation metric for semantic image
segmentation, which first computes the IOU for each semantic class and then
computes the average over classes. IOU is defined as follows:
IOU = true_positive / (true_positive + false_positive + false_negative).
The predictions are accumulated in a confusion matrix, weighted by
sample_weight
and the metric is then calculated from it.
If sample_weight
is None
, weights default to 1.
Use sample_weight
of 0 to mask values.
Args: num_classes: The possible number of labels the prediction task can have. This value must be provided, since a confusion matrix of dimension = [num_classes, num_classes] will be allocated. name: (Optional) string name of the metric instance. dtype: (Optional) data type of the metric result.
Standalone usage:
cm = [[1, 1],
[1, 1]]
sum_row = [2, 2], sum_col = [2, 2], true_positives = [1, 1]
iou = true_positives / (sum_row + sum_col - true_positives))
result = (1 / (2 + 2 - 1) + 1 / (2 + 2 - 1)) / 2 = 0.33
m = tf.keras.metrics.MeanIoU(num_classes=2) m.update_state([0, 0, 1, 1], [0, 1, 0, 1]) m.result().numpy() 0.33333334
m.reset_states() m.update_state([0, 0, 1, 1], [0, 1, 0, 1], ... sample_weight=[0.3, 0.3, 0.3, 0.1]) m.result().numpy() 0.23809525
Usage with compile()
API:
model.compile(
optimizer='sgd',
loss='mse',
metrics=[tf.keras.metrics.MeanIoU(num_classes=2)])
MeanRelativeError class
tensorflow.keras.metrics.MeanRelativeError(normalizer, name=None, dtype=None)
Computes the mean relative error by normalizing with the given values.
This metric creates two local variables, total
and count
that are used to
compute the mean relative error. This is weighted by sample_weight
, and
it is ultimately returned as mean_relative_error
:
an idempotent operation that simply divides total
by count
.
If sample_weight
is None
, weights default to 1.
Use sample_weight
of 0 to mask values.
Args: normalizer: The normalizer values with same shape as predictions. name: (Optional) string name of the metric instance. dtype: (Optional) data type of the metric result.
Standalone usage:
m = tf.keras.metrics.MeanRelativeError(normalizer=[1, 3, 2, 3]) m.update_state([1, 3, 2, 3], [2, 4, 6, 8])
metric = mean(|y_pred - y_true| / normalizer)
= mean([1, 1, 4, 5] / [1, 3, 2, 3]) = mean([1, 1/3, 2, 5/3])
= 5/4 = 1.25
m.result().numpy() 1.25
Usage with compile()
API:
model.compile(
optimizer='sgd',
loss='mse',
metrics=[tf.keras.metrics.MeanRelativeError(normalizer=[1, 3])])
MeanSquaredError class
tensorflow.keras.metrics.MeanSquaredError(name="mean_squared_error", dtype=None)
Computes the mean squared error between y_true
and y_pred
.
Args: name: (Optional) string name of the metric instance. dtype: (Optional) data type of the metric result.
Standalone usage:
m = tf.keras.metrics.MeanSquaredError() m.update_state([[0, 1], [0, 0]], [[1, 1], [0, 0]]) m.result().numpy() 0.25
m.reset_states() m.update_state([[0, 1], [0, 0]], [[1, 1], [0, 0]], ... sample_weight=[1, 0]) m.result().numpy() 0.5
Usage with compile()
API:
model.compile(
optimizer='sgd',
loss='mse',
metrics=[tf.keras.metrics.MeanSquaredError()])
MeanSquaredLogarithmicError class
tensorflow.keras.metrics.MeanSquaredLogarithmicError(name="mean_squared_logarithmic_error", dtype=None)
Computes the mean squared logarithmic error between y_true
and y_pred
.
Args: name: (Optional) string name of the metric instance. dtype: (Optional) data type of the metric result.
Standalone usage:
m = tf.keras.metrics.MeanSquaredLogarithmicError() m.update_state([[0, 1], [0, 0]], [[1, 1], [0, 0]]) m.result().numpy() 0.12011322
m.reset_states() m.update_state([[0, 1], [0, 0]], [[1, 1], [0, 0]], ... sample_weight=[1, 0]) m.result().numpy() 0.24022643
Usage with compile()
API:
model.compile(
optimizer='sgd',
loss='mse',
metrics=[tf.keras.metrics.MeanSquaredLogarithmicError()])
MeanTensor class
tensorflow.keras.metrics.MeanTensor(name="mean_tensor", dtype=None)
Computes the element-wise (weighted) mean of the given tensors.
MeanTensor
returns a tensor with the same shape of the input tensors. The
mean value is updated by keeping local variables total
and count
. The
total
tracks the sum of the weighted values, and count
stores the sum of
the weighted counts.
Args: name: (Optional) string name of the metric instance. dtype: (Optional) data type of the metric result.
Standalone usage:
m = tf.keras.metrics.MeanTensor() m.update_state([0, 1, 2, 3]) m.update_state([4, 5, 6, 7]) m.result().numpy() array([2., 3., 4., 5.], dtype=float32)
m.update_state([12, 10, 8, 6], sample_weight= [0, 0.2, 0.5, 1]) m.result().numpy() array([2. , 3.6363635, 4.8 , 5.3333335], dtype=float32)
Metric class
tensorflow.keras.metrics.Metric(name=None, dtype=None, **kwargs)
Encapsulates metric logic and state.
Args: name: (Optional) string name of the metric instance. dtype: (Optional) data type of the metric result. **kwargs: Additional layer keywords arguments.
Standalone usage:
m = SomeMetric(...)
for input in ...:
m.update_state(input)
print('Final result: ', m.result().numpy())
Usage with compile()
API:
model = tf.keras.Sequential()
model.add(tf.keras.layers.Dense(64, activation='relu'))
model.add(tf.keras.layers.Dense(64, activation='relu'))
model.add(tf.keras.layers.Dense(10, activation='softmax'))
model.compile(optimizer=tf.keras.optimizers.RMSprop(0.01),
loss=tf.keras.losses.CategoricalCrossentropy(),
metrics=[tf.keras.metrics.CategoricalAccuracy()])
data = np.random.random((1000, 32))
labels = np.random.random((1000, 10))
dataset = tf.data.Dataset.from_tensor_slices((data, labels))
dataset = dataset.batch(32)
model.fit(dataset, epochs=10)
To be implemented by subclasses:
* __init__()
: All state variables should be created in this method by
calling self.add_weight()
like: self.var = self.add_weight(...)
* update_state()
: Has all updates to the state variables like:
self.var.assign_add(...).
* result()
: Computes and returns a value for the metric
from the state variables.
Example subclass implementation:
class BinaryTruePositives(tf.keras.metrics.Metric):
def __init__(self, name='binary_true_positives', **kwargs):
super(BinaryTruePositives, self).__init__(name=name, **kwargs)
self.true_positives = self.add_weight(name='tp', initializer='zeros')
def update_state(self, y_true, y_pred, sample_weight=None):
y_true = tf.cast(y_true, tf.bool)
y_pred = tf.cast(y_pred, tf.bool)
values = tf.logical_and(tf.equal(y_true, True), tf.equal(y_pred, True))
values = tf.cast(values, self.dtype)
if sample_weight is not None:
sample_weight = tf.cast(sample_weight, self.dtype)
sample_weight = tf.broadcast_to(sample_weight, values.shape)
values = tf.multiply(values, sample_weight)
self.true_positives.assign_add(tf.reduce_sum(values))
def result(self):
return self.true_positives
Poisson class
tensorflow.keras.metrics.Poisson(name="poisson", dtype=None)
Computes the Poisson metric between y_true
and y_pred
.
metric = y_pred - y_true * log(y_pred)
Args: name: (Optional) string name of the metric instance. dtype: (Optional) data type of the metric result.
Standalone usage:
m = tf.keras.metrics.Poisson() m.update_state([[0, 1], [0, 0]], [[1, 1], [0, 0]]) m.result().numpy() 0.49999997
m.reset_states() m.update_state([[0, 1], [0, 0]], [[1, 1], [0, 0]], ... sample_weight=[1, 0]) m.result().numpy() 0.99999994
Usage with compile()
API:
model.compile(optimizer='sgd',
loss='mse',
metrics=[tf.keras.metrics.Poisson()])
Precision class
tensorflow.keras.metrics.Precision(thresholds=None, top_k=None, class_id=None, name=None, dtype=None)
Computes the precision of the predictions with respect to the labels.
The metric creates two local variables, true_positives
and false_positives
that are used to compute the precision. This value is ultimately returned as
precision
, an idempotent operation that simply divides true_positives
by the sum of true_positives
and false_positives
.
If sample_weight
is None
, weights default to 1.
Use sample_weight
of 0 to mask values.
If top_k
is set, we'll calculate precision as how often on average a class
among the top-k classes with the highest predicted values of a batch entry is
correct and can be found in the label for that entry.
If class_id
is specified, we calculate precision by considering only the
entries in the batch for which class_id
is above the threshold and/or in the
top-k highest predictions, and computing the fraction of them for which
class_id
is indeed a correct label.
Args:
thresholds: (Optional) A float value or a python list/tuple of float
threshold values in [0, 1]. A threshold is compared with prediction
values to determine the truth value of predictions (i.e., above the
threshold is true
, below is false
). One metric value is generated
for each threshold value. If neither thresholds nor top_k are set, the
default is to calculate precision with thresholds=0.5
.
top_k: (Optional) Unset by default. An int value specifying the top-k
predictions to consider when calculating precision.
class_id: (Optional) Integer class ID for which we want binary metrics.
This must be in the half-open interval [0, num_classes)
, where
num_classes
is the last dimension of predictions.
name: (Optional) string name of the metric instance.
dtype: (Optional) data type of the metric result.
Standalone usage:
m = tf.keras.metrics.Precision() m.update_state([0, 1, 1, 1], [1, 0, 1, 1]) m.result().numpy() 0.6666667
m.reset_states() m.update_state([0, 1, 1, 1], [1, 0, 1, 1], sample_weight=[0, 0, 1, 0]) m.result().numpy() 1.0
With top_k=2, it will calculate precision over y_true[:2] and y_pred[:2]
m = tf.keras.metrics.Precision(top_k=2) m.update_state([0, 0, 1, 1], [1, 1, 1, 1]) m.result().numpy() 0.0
With top_k=4, it will calculate precision over y_true[:4] and y_pred[:4]
m = tf.keras.metrics.Precision(top_k=4) m.update_state([0, 0, 1, 1], [1, 1, 1, 1]) m.result().numpy() 0.5
Usage with compile()
API:
model.compile(optimizer='sgd',
loss='mse',
metrics=[tf.keras.metrics.Precision()])
PrecisionAtRecall class
tensorflow.keras.metrics.PrecisionAtRecall(recall, num_thresholds=200, name=None, dtype=None)
Computes best precision where recall is >= specified value.
This metric creates four local variables, true_positives
, true_negatives
,
false_positives
and false_negatives
that are used to compute the
precision at the given recall. The threshold for the given recall
value is computed and used to evaluate the corresponding precision.
If sample_weight
is None
, weights default to 1.
Use sample_weight
of 0 to mask values.
Args:
recall: A scalar value in range [0, 1]
.
num_thresholds: (Optional) Defaults to 200. The number of thresholds to
use for matching the given recall.
name: (Optional) string name of the metric instance.
dtype: (Optional) data type of the metric result.
Standalone usage:
m = tf.keras.metrics.PrecisionAtRecall(0.5) m.update_state([0, 0, 0, 1, 1], [0, 0.3, 0.8, 0.3, 0.8]) m.result().numpy() 0.5
m.reset_states() m.update_state([0, 0, 0, 1, 1], [0, 0.3, 0.8, 0.3, 0.8], ... sample_weight=[2, 2, 2, 1, 1]) m.result().numpy() 0.33333333
Usage with compile()
API:
model.compile(
optimizer='sgd',
loss='mse',
metrics=[tf.keras.metrics.PrecisionAtRecall(recall=0.8)])
Recall class
tensorflow.keras.metrics.Recall(thresholds=None, top_k=None, class_id=None, name=None, dtype=None)
Computes the recall of the predictions with respect to the labels.
This metric creates two local variables, true_positives
and
false_negatives
, that are used to compute the recall. This value is
ultimately returned as recall
, an idempotent operation that simply divides
true_positives
by the sum of true_positives
and false_negatives
.
If sample_weight
is None
, weights default to 1.
Use sample_weight
of 0 to mask values.
If top_k
is set, recall will be computed as how often on average a class
among the labels of a batch entry is in the top-k predictions.
If class_id
is specified, we calculate recall by considering only the
entries in the batch for which class_id
is in the label, and computing the
fraction of them for which class_id
is above the threshold and/or in the
top-k predictions.
Args:
thresholds: (Optional) A float value or a python list/tuple of float
threshold values in [0, 1]. A threshold is compared with prediction
values to determine the truth value of predictions (i.e., above the
threshold is true
, below is false
). One metric value is generated
for each threshold value. If neither thresholds nor top_k are set, the
default is to calculate recall with thresholds=0.5
.
top_k: (Optional) Unset by default. An int value specifying the top-k
predictions to consider when calculating recall.
class_id: (Optional) Integer class ID for which we want binary metrics.
This must be in the half-open interval [0, num_classes)
, where
num_classes
is the last dimension of predictions.
name: (Optional) string name of the metric instance.
dtype: (Optional) data type of the metric result.
Standalone usage:
m = tf.keras.metrics.Recall() m.update_state([0, 1, 1, 1], [1, 0, 1, 1]) m.result().numpy() 0.6666667
m.reset_states() m.update_state([0, 1, 1, 1], [1, 0, 1, 1], sample_weight=[0, 0, 1, 0]) m.result().numpy() 1.0
Usage with compile()
API:
model.compile(optimizer='sgd',
loss='mse',
metrics=[tf.keras.metrics.Recall()])
RecallAtPrecision class
tensorflow.keras.metrics.RecallAtPrecision(precision, num_thresholds=200, name=None, dtype=None)
Computes best recall where precision is >= specified value.
For a given score-label-distribution the required precision might not be achievable, in this case 0.0 is returned as recall.
This metric creates four local variables, true_positives
, true_negatives
,
false_positives
and false_negatives
that are used to compute the
recall at the given precision. The threshold for the given precision
value is computed and used to evaluate the corresponding recall.
If sample_weight
is None
, weights default to 1.
Use sample_weight
of 0 to mask values.
Args:
precision: A scalar value in range [0, 1]
.
num_thresholds: (Optional) Defaults to 200. The number of thresholds to
use for matching the given precision.
name: (Optional) string name of the metric instance.
dtype: (Optional) data type of the metric result.
Standalone usage:
m = tf.keras.metrics.RecallAtPrecision(0.8) m.update_state([0, 0, 1, 1], [0, 0.5, 0.3, 0.9]) m.result().numpy() 0.5
m.reset_states() m.update_state([0, 0, 1, 1], [0, 0.5, 0.3, 0.9], ... sample_weight=[1, 0, 0, 1]) m.result().numpy() 1.0
Usage with compile()
API:
model.compile(
optimizer='sgd',
loss='mse',
metrics=[tf.keras.metrics.RecallAtPrecision(precision=0.8)])
RootMeanSquaredError class
tensorflow.keras.metrics.RootMeanSquaredError(name="root_mean_squared_error", dtype=None)
Computes root mean squared error metric between y_true
and y_pred
.
Standalone usage:
m = tf.keras.metrics.RootMeanSquaredError() m.update_state([[0, 1], [0, 0]], [[1, 1], [0, 0]]) m.result().numpy() 0.5
m.reset_states() m.update_state([[0, 1], [0, 0]], [[1, 1], [0, 0]], ... sample_weight=[1, 0]) m.result().numpy() 0.70710677
Usage with compile()
API:
model.compile(
optimizer='sgd',
loss='mse',
metrics=[tf.keras.metrics.RootMeanSquaredError()])
SensitivityAtSpecificity class
tensorflow.keras.metrics.SensitivityAtSpecificity(specificity, num_thresholds=200, name=None, dtype=None)
Computes best sensitivity where specificity is >= specified value.
the sensitivity at a given specificity.
Sensitivity
measures the proportion of actual positives that are correctly
identified as such (tp / (tp + fn)).
Specificity
measures the proportion of actual negatives that are correctly
identified as such (tn / (tn + fp)).
This metric creates four local variables, true_positives
, true_negatives
,
false_positives
and false_negatives
that are used to compute the
sensitivity at the given specificity. The threshold for the given specificity
value is computed and used to evaluate the corresponding sensitivity.
If sample_weight
is None
, weights default to 1.
Use sample_weight
of 0 to mask values.
For additional information about specificity and sensitivity, see the following.
Args:
specificity: A scalar value in range [0, 1]
.
num_thresholds: (Optional) Defaults to 200. The number of thresholds to
use for matching the given specificity.
name: (Optional) string name of the metric instance.
dtype: (Optional) data type of the metric result.
Standalone usage:
m = tf.keras.metrics.SensitivityAtSpecificity(0.5) m.update_state([0, 0, 0, 1, 1], [0, 0.3, 0.8, 0.3, 0.8]) m.result().numpy() 0.5
m.reset_states() m.update_state([0, 0, 0, 1, 1], [0, 0.3, 0.8, 0.3, 0.8], ... sample_weight=[1, 1, 2, 2, 1]) m.result().numpy() 0.333333
Usage with compile()
API:
model.compile(
optimizer='sgd',
loss='mse',
metrics=[tf.keras.metrics.SensitivityAtSpecificity()])
SparseCategoricalAccuracy class
tensorflow.keras.metrics.SparseCategoricalAccuracy(name="sparse_categorical_accuracy", dtype=None)
Calculates how often predictions matches integer labels.
acc = np.dot(sample_weight, np.equal(y_true, np.argmax(y_pred, axis=1))
You can provide logits of classes as y_pred
, since argmax of
logits and probabilities are same.
This metric creates two local variables, total
and count
that are used to
compute the frequency with which y_pred
matches y_true
. This frequency is
ultimately returned as sparse categorical accuracy
: an idempotent operation
that simply divides total
by count
.
If sample_weight
is None
, weights default to 1.
Use sample_weight
of 0 to mask values.
Args: name: (Optional) string name of the metric instance. dtype: (Optional) data type of the metric result.
Standalone usage:
m = tf.keras.metrics.SparseCategoricalAccuracy() m.update_state([[2], [1]], [[0.1, 0.6, 0.3], [0.05, 0.95, 0]]) m.result().numpy() 0.5
m.reset_states() m.update_state([[2], [1]], [[0.1, 0.6, 0.3], [0.05, 0.95, 0]], ... sample_weight=[0.7, 0.3]) m.result().numpy() 0.3
Usage with compile()
API:
model.compile(
optimizer='sgd',
loss='mse',
metrics=[tf.keras.metrics.SparseCategoricalAccuracy()])
SparseCategoricalCrossentropy class
tensorflow.keras.metrics.SparseCategoricalCrossentropy(
name="sparse_categorical_crossentropy", dtype=None, from_logits=False, axis=-1
)
Computes the crossentropy metric between the labels and predictions.
Use this crossentropy metric when there are two or more label classes.
We expect labels to be provided as integers. If you want to provide labels
using one-hot
representation, please use CategoricalCrossentropy
metric.
There should be # classes
floating point values per feature for y_pred
and a single floating point value per feature for y_true
.
In the snippet below, there is a single floating point value per example for
y_true
and # classes
floating pointing values per example for y_pred
.
The shape of y_true
is [batch_size]
and the shape of y_pred
is
[batch_size, num_classes]
.
Args: name: (Optional) string name of the metric instance. dtype: (Optional) data type of the metric result. from_logits: (Optional) Whether output is expected to be a logits tensor. By default, we consider that output encodes a probability distribution. axis: (Optional) Defaults to -1. The dimension along which the metric is computed.
Standalone usage:
y_true = one_hot(y_true) = [[0, 1, 0], [0, 0, 1]]
logits = log(y_pred)
softmax = exp(logits) / sum(exp(logits), axis=-1)
softmax = [[0.05, 0.95, EPSILON], [0.1, 0.8, 0.1]]
xent = -sum(y * log(softmax), 1)
log(softmax) = [[-2.9957, -0.0513, -16.1181],
[-2.3026, -0.2231, -2.3026]]
y_true * log(softmax) = [[0, -0.0513, 0], [0, 0, -2.3026]]
xent = [0.0513, 2.3026]
Reduced xent = (0.0513 + 2.3026) / 2
m = tf.keras.metrics.SparseCategoricalCrossentropy() m.update_state([1, 2], ... [[0.05, 0.95, 0], [0.1, 0.8, 0.1]]) m.result().numpy() 1.1769392
m.reset_states() m.update_state([1, 2], ... [[0.05, 0.95, 0], [0.1, 0.8, 0.1]], ... sample_weight=tf.constant([0.3, 0.7])) m.result().numpy() 1.6271976
Usage with compile()
API:
model.compile(
optimizer='sgd',
loss='mse',
metrics=[tf.keras.metrics.SparseCategoricalCrossentropy()])
SparseTopKCategoricalAccuracy class
tensorflow.keras.metrics.SparseTopKCategoricalAccuracy(
k=5, name="sparse_top_k_categorical_accuracy", dtype=None
)
Computes how often integer targets are in the top K
predictions.
Args: k: (Optional) Number of top elements to look at for computing accuracy. Defaults to 5. name: (Optional) string name of the metric instance. dtype: (Optional) data type of the metric result.
Standalone usage:
m = tf.keras.metrics.SparseTopKCategoricalAccuracy(k=1) m.update_state([2, 1], [[0.1, 0.9, 0.8], [0.05, 0.95, 0]]) m.result().numpy() 0.5
m.reset_states() m.update_state([2, 1], [[0.1, 0.9, 0.8], [0.05, 0.95, 0]], ... sample_weight=[0.7, 0.3]) m.result().numpy() 0.3
Usage with compile()
API:
model.compile(
optimizer='sgd',
loss='mse',
metrics=[tf.keras.metrics.SparseTopKCategoricalAccuracy()])
SpecificityAtSensitivity class
tensorflow.keras.metrics.SpecificityAtSensitivity(sensitivity, num_thresholds=200, name=None, dtype=None)
Computes best specificity where sensitivity is >= specified value.
Sensitivity
measures the proportion of actual positives that are correctly
identified as such (tp / (tp + fn)).
Specificity
measures the proportion of actual negatives that are correctly
identified as such (tn / (tn + fp)).
This metric creates four local variables, true_positives
, true_negatives
,
false_positives
and false_negatives
that are used to compute the
specificity at the given sensitivity. The threshold for the given sensitivity
value is computed and used to evaluate the corresponding specificity.
If sample_weight
is None
, weights default to 1.
Use sample_weight
of 0 to mask values.
For additional information about specificity and sensitivity, see the following.
Args:
sensitivity: A scalar value in range [0, 1]
.
num_thresholds: (Optional) Defaults to 200. The number of thresholds to
use for matching the given sensitivity.
name: (Optional) string name of the metric instance.
dtype: (Optional) data type of the metric result.
Standalone usage:
m = tf.keras.metrics.SpecificityAtSensitivity(0.5) m.update_state([0, 0, 0, 1, 1], [0, 0.3, 0.8, 0.3, 0.8]) m.result().numpy() 0.66666667
m.reset_states() m.update_state([0, 0, 0, 1, 1], [0, 0.3, 0.8, 0.3, 0.8], ... sample_weight=[1, 1, 2, 2, 2]) m.result().numpy() 0.5
Usage with compile()
API:
model.compile(
optimizer='sgd',
loss='mse',
metrics=[tf.keras.metrics.SpecificityAtSensitivity()])
SquaredHinge class
tensorflow.keras.metrics.SquaredHinge(name="squared_hinge", dtype=None)
Computes the squared hinge metric between y_true
and y_pred
.
y_true
values are expected to be -1 or 1. If binary (0 or 1) labels are
provided we will convert them to -1 or 1.
Args: name: (Optional) string name of the metric instance. dtype: (Optional) data type of the metric result.
Standalone usage:
m = tf.keras.metrics.SquaredHinge() m.update_state([[0, 1], [0, 0]], [[0.6, 0.4], [0.4, 0.6]]) m.result().numpy() 1.86
m.reset_states() m.update_state([[0, 1], [0, 0]], [[0.6, 0.4], [0.4, 0.6]], ... sample_weight=[1, 0]) m.result().numpy() 1.46
Usage with compile()
API:
model.compile(
optimizer='sgd',
loss='mse',
metrics=[tf.keras.metrics.SquaredHinge()])
Sum class
tensorflow.keras.metrics.Sum(name="sum", dtype=None)
Computes the (weighted) sum of the given values.
For example, if values is [1, 3, 5, 7] then the sum is 16. If the weights were specified as [1, 1, 0, 0] then the sum would be 4.
This metric creates one variable, total
, that is used to compute the sum of
values
. This is ultimately returned as sum
.
If sample_weight
is None
, weights default to 1. Use sample_weight
of 0
to mask values.
Args: name: (Optional) string name of the metric instance. dtype: (Optional) data type of the metric result.
Standalone usage:
m = tf.keras.metrics.Sum() m.update_state([1, 3, 5, 7]) m.result().numpy() 16.0
Usage with compile()
API:
model.add_metric(tf.keras.metrics.Sum(name='sum_1')(outputs))
model.compile(optimizer='sgd', loss='mse')
TopKCategoricalAccuracy class
tensorflow.keras.metrics.TopKCategoricalAccuracy(k=5, name="top_k_categorical_accuracy", dtype=None)
Computes how often targets are in the top K
predictions.
Args: k: (Optional) Number of top elements to look at for computing accuracy. Defaults to 5. name: (Optional) string name of the metric instance. dtype: (Optional) data type of the metric result.
Standalone usage:
m = tf.keras.metrics.TopKCategoricalAccuracy(k=1) m.update_state([[0, 0, 1], [0, 1, 0]], ... [[0.1, 0.9, 0.8], [0.05, 0.95, 0]]) m.result().numpy() 0.5
m.reset_states() m.update_state([[0, 0, 1], [0, 1, 0]], ... [[0.1, 0.9, 0.8], [0.05, 0.95, 0]], ... sample_weight=[0.7, 0.3]) m.result().numpy() 0.3
Usage with compile()
API:
model.compile(optimizer='sgd',
loss='mse',
metrics=[tf.keras.metrics.TopKCategoricalAccuracy()])
TrueNegatives class
tensorflow.keras.metrics.TrueNegatives(thresholds=None, name=None, dtype=None)
Calculates the number of true negatives.
If sample_weight
is given, calculates the sum of the weights of
true negatives. This metric creates one local variable, accumulator
that is used to keep track of the number of true negatives.
If sample_weight
is None
, weights default to 1.
Use sample_weight
of 0 to mask values.
Args:
thresholds: (Optional) Defaults to 0.5. A float value or a python
list/tuple of float threshold values in [0, 1]. A threshold is compared
with prediction values to determine the truth value of predictions
(i.e., above the threshold is true
, below is false
). One metric
value is generated for each threshold value.
name: (Optional) string name of the metric instance.
dtype: (Optional) data type of the metric result.
Standalone usage:
m = tf.keras.metrics.TrueNegatives() m.update_state([0, 1, 0, 0], [1, 1, 0, 0]) m.result().numpy() 2.0
m.reset_states() m.update_state([0, 1, 0, 0], [1, 1, 0, 0], sample_weight=[0, 0, 1, 0]) m.result().numpy() 1.0
Usage with compile()
API:
model.compile(optimizer='sgd',
loss='mse',
metrics=[tf.keras.metrics.TrueNegatives()])
TruePositives class
tensorflow.keras.metrics.TruePositives(thresholds=None, name=None, dtype=None)
Calculates the number of true positives.
If sample_weight
is given, calculates the sum of the weights of
true positives. This metric creates one local variable, true_positives
that is used to keep track of the number of true positives.
If sample_weight
is None
, weights default to 1.
Use sample_weight
of 0 to mask values.
Args:
thresholds: (Optional) Defaults to 0.5. A float value or a python
list/tuple of float threshold values in [0, 1]. A threshold is compared
with prediction values to determine the truth value of predictions
(i.e., above the threshold is true
, below is false
). One metric
value is generated for each threshold value.
name: (Optional) string name of the metric instance.
dtype: (Optional) data type of the metric result.
Standalone usage:
m = tf.keras.metrics.TruePositives() m.update_state([0, 1, 1, 1], [1, 0, 1, 1]) m.result().numpy() 2.0
m.reset_states() m.update_state([0, 1, 1, 1], [1, 0, 1, 1], sample_weight=[0, 0, 1, 0]) m.result().numpy() 1.0
Usage with compile()
API:
model.compile(optimizer='sgd',
loss='mse',
metrics=[tf.keras.metrics.TruePositives()])
binary_accuracy function
tensorflow.keras.metrics.binary_accuracy(y_true, y_pred, threshold=0.5)
Calculates how often predictions matches binary labels.
Standalone usage:
y_true = [[1], [1], [0], [0]] y_pred = [[1], [1], [0], [0]] m = tf.keras.metrics.binary_accuracy(y_true, y_pred) assert m.shape == (4,) m.numpy() array([1., 1., 1., 1.], dtype=float32)
Args:
y_true: Ground truth values. shape = [batch_size, d0, .. dN]
.
y_pred: The predicted values. shape = [batch_size, d0, .. dN]
.
threshold: (Optional) Float representing the threshold for deciding whether
prediction values are 1 or 0.
Returns:
Binary accuracy values. shape = [batch_size, d0, .. dN-1]
binary_crossentropy function
tensorflow.keras.metrics.binary_crossentropy(y_true, y_pred, from_logits=False, label_smoothing=0)
Computes the binary crossentropy loss.
Standalone usage:
y_true = [[0, 1], [0, 0]] y_pred = [[0.6, 0.4], [0.4, 0.6]] loss = tf.keras.losses.binary_crossentropy(y_true, y_pred) assert loss.shape == (2,) loss.numpy() array([0.916 , 0.714], dtype=float32)
Args:
y_true: Ground truth values. shape = [batch_size, d0, .. dN]
.
y_pred: The predicted values. shape = [batch_size, d0, .. dN]
.
from_logits: Whether y_pred
is expected to be a logits tensor. By default,
we assume that y_pred
encodes a probability distribution.
label_smoothing: Float in [0, 1]. If > 0
then smooth the labels.
Returns:
Binary crossentropy loss value. shape = [batch_size, d0, .. dN-1]
.
categorical_accuracy function
tensorflow.keras.metrics.categorical_accuracy(y_true, y_pred)
Calculates how often predictions matches one-hot labels.
Standalone usage:
y_true = [[0, 0, 1], [0, 1, 0]] y_pred = [[0.1, 0.9, 0.8], [0.05, 0.95, 0]] m = tf.keras.metrics.categorical_accuracy(y_true, y_pred) assert m.shape == (2,) m.numpy() array([0., 1.], dtype=float32)
You can provide logits of classes as y_pred
, since argmax of
logits and probabilities are same.
Args: y_true: One-hot ground truth values. y_pred: The prediction values.
Returns: Categorical accuracy values.
categorical_crossentropy function
tensorflow.keras.metrics.categorical_crossentropy(y_true, y_pred, from_logits=False, label_smoothing=0)
Computes the categorical crossentropy loss.
Standalone usage:
y_true = [[0, 1, 0], [0, 0, 1]] y_pred = [[0.05, 0.95, 0], [0.1, 0.8, 0.1]] loss = tf.keras.losses.categorical_crossentropy(y_true, y_pred) assert loss.shape == (2,) loss.numpy() array([0.0513, 2.303], dtype=float32)
Args:
y_true: Tensor of one-hot true targets.
y_pred: Tensor of predicted targets.
from_logits: Whether y_pred
is expected to be a logits tensor. By default,
we assume that y_pred
encodes a probability distribution.
label_smoothing: Float in [0, 1]. If > 0
then smooth the labels.
Returns: Categorical crossentropy loss value.
deserialize function
tensorflow.keras.metrics.deserialize(config, custom_objects=None)
Deserializes a serialized metric class/function instance.
Arguments: config: Metric configuration. custom_objects: Optional dictionary mapping names (strings) to custom objects (classes and functions) to be considered during deserialization.
Returns:
A Keras Metric
instance or a metric function.
get function
tensorflow.keras.metrics.get(identifier)
Retrieves a Keras metric as a function
/Metric
class instance.
The identifier
may be the string name of a metric function or class.
metric = tf.keras.metrics.get("categorical_crossentropy") type(metric)
metric = tf.keras.metrics.get("CategoricalCrossentropy") type(metric)
You can also specify config
of the metric to this function by passing dict
containing class_name
and config
as an identifier. Also note that the
class_name
must map to a Metric
class
identifier = {"class_name": "CategoricalCrossentropy", ... "config": {"from_logits": True}} metric = tf.keras.metrics.get(identifier) type(metric)
Arguments: identifier: A metric identifier. One of None or string name of a metric function/class or metric configuration dictionary or a metric function or a metric class instance
Returns:
A Keras metric as a function
/ Metric
class instance.
Raises:
ValueError: If identifier
cannot be interpreted.
hinge function
tensorflow.keras.metrics.hinge(y_true, y_pred)
Computes the hinge loss between y_true
and y_pred
.
loss = mean(maximum(1 - y_true * y_pred, 0), axis=-1)
Standalone usage:
y_true = np.random.choice([-1, 1], size=(2, 3)) y_pred = np.random.random(size=(2, 3)) loss = tf.keras.losses.hinge(y_true, y_pred) assert loss.shape == (2,) assert np.array_equal( ... loss.numpy(), ... np.mean(np.maximum(1. - y_true * y_pred, 0.), axis=-1))
Args:
y_true: The ground truth values. y_true
values are expected to be -1 or 1.
If binary (0 or 1) labels are provided they will be converted to -1 or 1.
shape = [batch_size, d0, .. dN]
.
y_pred: The predicted values. shape = [batch_size, d0, .. dN]
.
Returns:
Hinge loss values. shape = [batch_size, d0, .. dN-1]
.
kl_divergence function
tensorflow.keras.metrics.kl_divergence(y_true, y_pred)
Computes Kullback-Leibler divergence loss between y_true
and y_pred
.
loss = y_true * log(y_true / y_pred)
See: https://en.wikipedia.org/wiki/Kullback%E2%80%93Leibler_divergence
Standalone usage:
y_true = np.random.randint(0, 2, size=(2, 3)).astype(np.float64) y_pred = np.random.random(size=(2, 3)) loss = tf.keras.losses.kullback_leibler_divergence(y_true, y_pred) assert loss.shape == (2,) y_true = tf.keras.backend.clip(y_true, 1e-7, 1) y_pred = tf.keras.backend.clip(y_pred, 1e-7, 1) assert np.array_equal( ... loss.numpy(), np.sum(y_true * np.log(y_true / y_pred), axis=-1))
Args: y_true: Tensor of true targets. y_pred: Tensor of predicted targets.
Returns:
A Tensor
with loss.
Raises:
TypeError: If y_true
cannot be cast to the y_pred.dtype
.
kl_divergence function
tensorflow.keras.metrics.kld(y_true, y_pred)
Computes Kullback-Leibler divergence loss between y_true
and y_pred
.
loss = y_true * log(y_true / y_pred)
See: https://en.wikipedia.org/wiki/Kullback%E2%80%93Leibler_divergence
Standalone usage:
y_true = np.random.randint(0, 2, size=(2, 3)).astype(np.float64) y_pred = np.random.random(size=(2, 3)) loss = tf.keras.losses.kullback_leibler_divergence(y_true, y_pred) assert loss.shape == (2,) y_true = tf.keras.backend.clip(y_true, 1e-7, 1) y_pred = tf.keras.backend.clip(y_pred, 1e-7, 1) assert np.array_equal( ... loss.numpy(), np.sum(y_true * np.log(y_true / y_pred), axis=-1))
Args: y_true: Tensor of true targets. y_pred: Tensor of predicted targets.
Returns:
A Tensor
with loss.
Raises:
TypeError: If y_true
cannot be cast to the y_pred.dtype
.
kl_divergence function
tensorflow.keras.metrics.kullback_leibler_divergence(y_true, y_pred)
Computes Kullback-Leibler divergence loss between y_true
and y_pred
.
loss = y_true * log(y_true / y_pred)
See: https://en.wikipedia.org/wiki/Kullback%E2%80%93Leibler_divergence
Standalone usage:
y_true = np.random.randint(0, 2, size=(2, 3)).astype(np.float64) y_pred = np.random.random(size=(2, 3)) loss = tf.keras.losses.kullback_leibler_divergence(y_true, y_pred) assert loss.shape == (2,) y_true = tf.keras.backend.clip(y_true, 1e-7, 1) y_pred = tf.keras.backend.clip(y_pred, 1e-7, 1) assert np.array_equal( ... loss.numpy(), np.sum(y_true * np.log(y_true / y_pred), axis=-1))
Args: y_true: Tensor of true targets. y_pred: Tensor of predicted targets.
Returns:
A Tensor
with loss.
Raises:
TypeError: If y_true
cannot be cast to the y_pred.dtype
.
log_cosh function
tensorflow.keras.metrics.log_cosh(y_true, y_pred)
Logarithm of the hyperbolic cosine of the prediction error.
log(cosh(x))
is approximately equal to (x ** 2) / 2
for small x
and
to abs(x) - log(2)
for large x
. This means that 'logcosh' works mostly
like the mean squared error, but will not be so strongly affected by the
occasional wildly incorrect prediction.
Standalone usage:
y_true = np.random.random(size=(2, 3)) y_pred = np.random.random(size=(2, 3)) loss = tf.keras.losses.logcosh(y_true, y_pred) assert loss.shape == (2,) x = y_pred - y_true assert np.allclose( ... loss.numpy(), ... np.mean(x + np.log(np.exp(-2. * x) + 1.) - math_ops.log(2.), axis=-1), ... atol=1e-5)
Args:
y_true: Ground truth values. shape = [batch_size, d0, .. dN]
.
y_pred: The predicted values. shape = [batch_size, d0, .. dN]
.
Returns:
Logcosh error values. shape = [batch_size, d0, .. dN-1]
.
log_cosh function
tensorflow.keras.metrics.logcosh(y_true, y_pred)
Logarithm of the hyperbolic cosine of the prediction error.
log(cosh(x))
is approximately equal to (x ** 2) / 2
for small x
and
to abs(x) - log(2)
for large x
. This means that 'logcosh' works mostly
like the mean squared error, but will not be so strongly affected by the
occasional wildly incorrect prediction.
Standalone usage:
y_true = np.random.random(size=(2, 3)) y_pred = np.random.random(size=(2, 3)) loss = tf.keras.losses.logcosh(y_true, y_pred) assert loss.shape == (2,) x = y_pred - y_true assert np.allclose( ... loss.numpy(), ... np.mean(x + np.log(np.exp(-2. * x) + 1.) - math_ops.log(2.), axis=-1), ... atol=1e-5)
Args:
y_true: Ground truth values. shape = [batch_size, d0, .. dN]
.
y_pred: The predicted values. shape = [batch_size, d0, .. dN]
.
Returns:
Logcosh error values. shape = [batch_size, d0, .. dN-1]
.
mean_absolute_error function
tensorflow.keras.metrics.mae(y_true, y_pred)
Computes the mean absolute error between labels and predictions.
loss = mean(abs(y_true - y_pred), axis=-1)
Standalone usage:
y_true = np.random.randint(0, 2, size=(2, 3)) y_pred = np.random.random(size=(2, 3)) loss = tf.keras.losses.mean_absolute_error(y_true, y_pred) assert loss.shape == (2,) assert np.array_equal( ... loss.numpy(), np.mean(np.abs(y_true - y_pred), axis=-1))
Args:
y_true: Ground truth values. shape = [batch_size, d0, .. dN]
.
y_pred: The predicted values. shape = [batch_size, d0, .. dN]
.
Returns:
Mean absolute error values. shape = [batch_size, d0, .. dN-1]
.
mean_absolute_percentage_error function
tensorflow.keras.metrics.mape(y_true, y_pred)
Computes the mean absolute percentage error between y_true
and y_pred
.
loss = 100 * mean(abs((y_true - y_pred) / y_true), axis=-1)
Standalone usage:
y_true = np.random.random(size=(2, 3)) y_true = np.maximum(y_true, 1e-7) # Prevent division by zero y_pred = np.random.random(size=(2, 3)) loss = tf.keras.losses.mean_absolute_percentage_error(y_true, y_pred) assert loss.shape == (2,) assert np.array_equal( ... loss.numpy(), ... 100. * np.mean(np.abs((y_true - y_pred) / y_true), axis=-1))
Args:
y_true: Ground truth values. shape = [batch_size, d0, .. dN]
.
y_pred: The predicted values. shape = [batch_size, d0, .. dN]
.
Returns:
Mean absolute percentage error values. shape = [batch_size, d0, .. dN-1]
.
mean_absolute_error function
tensorflow.keras.metrics.mean_absolute_error(y_true, y_pred)
Computes the mean absolute error between labels and predictions.
loss = mean(abs(y_true - y_pred), axis=-1)
Standalone usage:
y_true = np.random.randint(0, 2, size=(2, 3)) y_pred = np.random.random(size=(2, 3)) loss = tf.keras.losses.mean_absolute_error(y_true, y_pred) assert loss.shape == (2,) assert np.array_equal( ... loss.numpy(), np.mean(np.abs(y_true - y_pred), axis=-1))
Args:
y_true: Ground truth values. shape = [batch_size, d0, .. dN]
.
y_pred: The predicted values. shape = [batch_size, d0, .. dN]
.
Returns:
Mean absolute error values. shape = [batch_size, d0, .. dN-1]
.
mean_absolute_percentage_error function
tensorflow.keras.metrics.mean_absolute_percentage_error(y_true, y_pred)
Computes the mean absolute percentage error between y_true
and y_pred
.
loss = 100 * mean(abs((y_true - y_pred) / y_true), axis=-1)
Standalone usage:
y_true = np.random.random(size=(2, 3)) y_true = np.maximum(y_true, 1e-7) # Prevent division by zero y_pred = np.random.random(size=(2, 3)) loss = tf.keras.losses.mean_absolute_percentage_error(y_true, y_pred) assert loss.shape == (2,) assert np.array_equal( ... loss.numpy(), ... 100. * np.mean(np.abs((y_true - y_pred) / y_true), axis=-1))
Args:
y_true: Ground truth values. shape = [batch_size, d0, .. dN]
.
y_pred: The predicted values. shape = [batch_size, d0, .. dN]
.
Returns:
Mean absolute percentage error values. shape = [batch_size, d0, .. dN-1]
.
mean_squared_error function
tensorflow.keras.metrics.mean_squared_error(y_true, y_pred)
Computes the mean squared error between labels and predictions.
After computing the squared distance between the inputs, the mean value over the last dimension is returned.
loss = mean(square(y_true - y_pred), axis=-1)
Standalone usage:
y_true = np.random.randint(0, 2, size=(2, 3)) y_pred = np.random.random(size=(2, 3)) loss = tf.keras.losses.mean_squared_error(y_true, y_pred) assert loss.shape == (2,) assert np.array_equal( ... loss.numpy(), np.mean(np.square(y_true - y_pred), axis=-1))
Args:
y_true: Ground truth values. shape = [batch_size, d0, .. dN]
.
y_pred: The predicted values. shape = [batch_size, d0, .. dN]
.
Returns:
Mean squared error values. shape = [batch_size, d0, .. dN-1]
.
mean_squared_logarithmic_error function
tensorflow.keras.metrics.mean_squared_logarithmic_error(y_true, y_pred)
Computes the mean squared logarithmic error between y_true
and y_pred
.
loss = mean(square(log(y_true + 1) - log(y_pred + 1)), axis=-1)
Standalone usage:
y_true = np.random.randint(0, 2, size=(2, 3)) y_pred = np.random.random(size=(2, 3)) loss = tf.keras.losses.mean_squared_logarithmic_error(y_true, y_pred) assert loss.shape == (2,) y_true = np.maximum(y_true, 1e-7) y_pred = np.maximum(y_pred, 1e-7) assert np.allclose( ... loss.numpy(), ... np.mean( ... np.square(np.log(y_true + 1.) - np.log(y_pred + 1.)), axis=-1))
Args:
y_true: Ground truth values. shape = [batch_size, d0, .. dN]
.
y_pred: The predicted values. shape = [batch_size, d0, .. dN]
.
Returns:
Mean squared logarithmic error values. shape = [batch_size, d0, .. dN-1]
.
mean_squared_error function
tensorflow.keras.metrics.mse(y_true, y_pred)
Computes the mean squared error between labels and predictions.
After computing the squared distance between the inputs, the mean value over the last dimension is returned.
loss = mean(square(y_true - y_pred), axis=-1)
Standalone usage:
y_true = np.random.randint(0, 2, size=(2, 3)) y_pred = np.random.random(size=(2, 3)) loss = tf.keras.losses.mean_squared_error(y_true, y_pred) assert loss.shape == (2,) assert np.array_equal( ... loss.numpy(), np.mean(np.square(y_true - y_pred), axis=-1))
Args:
y_true: Ground truth values. shape = [batch_size, d0, .. dN]
.
y_pred: The predicted values. shape = [batch_size, d0, .. dN]
.
Returns:
Mean squared error values. shape = [batch_size, d0, .. dN-1]
.
mean_squared_logarithmic_error function
tensorflow.keras.metrics.msle(y_true, y_pred)
Computes the mean squared logarithmic error between y_true
and y_pred
.
loss = mean(square(log(y_true + 1) - log(y_pred + 1)), axis=-1)
Standalone usage:
y_true = np.random.randint(0, 2, size=(2, 3)) y_pred = np.random.random(size=(2, 3)) loss = tf.keras.losses.mean_squared_logarithmic_error(y_true, y_pred) assert loss.shape == (2,) y_true = np.maximum(y_true, 1e-7) y_pred = np.maximum(y_pred, 1e-7) assert np.allclose( ... loss.numpy(), ... np.mean( ... np.square(np.log(y_true + 1.) - np.log(y_pred + 1.)), axis=-1))
Args:
y_true: Ground truth values. shape = [batch_size, d0, .. dN]
.
y_pred: The predicted values. shape = [batch_size, d0, .. dN]
.
Returns:
Mean squared logarithmic error values. shape = [batch_size, d0, .. dN-1]
.
poisson function
tensorflow.keras.metrics.poisson(y_true, y_pred)
Computes the Poisson loss between y_true and y_pred.
The Poisson loss is the mean of the elements of the Tensor
y_pred - y_true * log(y_pred)
.
Standalone usage:
y_true = np.random.randint(0, 2, size=(2, 3)) y_pred = np.random.random(size=(2, 3)) loss = tf.keras.losses.poisson(y_true, y_pred) assert loss.shape == (2,) y_pred = y_pred + 1e-7 assert np.allclose( ... loss.numpy(), np.mean(y_pred - y_true * np.log(y_pred), axis=-1), ... atol=1e-5)
Args:
y_true: Ground truth values. shape = [batch_size, d0, .. dN]
.
y_pred: The predicted values. shape = [batch_size, d0, .. dN]
.
Returns:
Poisson loss value. shape = [batch_size, d0, .. dN-1]
.
Raises:
InvalidArgumentError: If y_true
and y_pred
have incompatible shapes.
serialize function
tensorflow.keras.metrics.serialize(metric)
Serializes metric function or Metric
instance.
Arguments:
metric: A Keras Metric
instance or a metric function.
Returns: Metric configuration dictionary.
sparse_categorical_accuracy function
tensorflow.keras.metrics.sparse_categorical_accuracy(y_true, y_pred)
Calculates how often predictions matches integer labels.
Standalone usage:
y_true = [2, 1] y_pred = [[0.1, 0.9, 0.8], [0.05, 0.95, 0]] m = tf.keras.metrics.sparse_categorical_accuracy(y_true, y_pred) assert m.shape == (2,) m.numpy() array([0., 1.], dtype=float32)
You can provide logits of classes as y_pred
, since argmax of
logits and probabilities are same.
Args: y_true: Integer ground truth values. y_pred: The prediction values.
Returns: Sparse categorical accuracy values.
sparse_categorical_crossentropy function
tensorflow.keras.metrics.sparse_categorical_crossentropy(y_true, y_pred, from_logits=False, axis=-1)
Computes the sparse categorical crossentropy loss.
Standalone usage:
y_true = [1, 2] y_pred = [[0.05, 0.95, 0], [0.1, 0.8, 0.1]] loss = tf.keras.losses.sparse_categorical_crossentropy(y_true, y_pred) assert loss.shape == (2,) loss.numpy() array([0.0513, 2.303], dtype=float32)
Args:
y_true: Ground truth values.
y_pred: The predicted values.
from_logits: Whether y_pred
is expected to be a logits tensor. By default,
we assume that y_pred
encodes a probability distribution.
axis: (Optional) Defaults to -1. The dimension along which the entropy is
computed.
Returns: Sparse categorical crossentropy loss value.
sparse_top_k_categorical_accuracy function
tensorflow.keras.metrics.sparse_top_k_categorical_accuracy(y_true, y_pred, k=5)
Computes how often integer targets are in the top K
predictions.
Standalone usage:
y_true = [2, 1] y_pred = [[0.1, 0.9, 0.8], [0.05, 0.95, 0]] m = tf.keras.metrics.sparse_top_k_categorical_accuracy( ... y_true, y_pred, k=3) assert m.shape == (2,) m.numpy() array([1., 1.], dtype=float32)
Args: y_true: tensor of true targets. y_pred: tensor of predicted targets. k: (Optional) Number of top elements to look at for computing accuracy. Defaults to 5.
Returns: Sparse top K categorical accuracy value.
squared_hinge function
tensorflow.keras.metrics.squared_hinge(y_true, y_pred)
Computes the squared hinge loss between y_true
and y_pred
.
loss = mean(square(maximum(1 - y_true * y_pred, 0)), axis=-1)
Standalone usage:
y_true = np.random.choice([-1, 1], size=(2, 3)) y_pred = np.random.random(size=(2, 3)) loss = tf.keras.losses.squared_hinge(y_true, y_pred) assert loss.shape == (2,) assert np.array_equal( ... loss.numpy(), ... np.mean(np.square(np.maximum(1. - y_true * y_pred, 0.)), axis=-1))
Args:
y_true: The ground truth values. y_true
values are expected to be -1 or 1.
If binary (0 or 1) labels are provided we will convert them to -1 or 1.
shape = [batch_size, d0, .. dN]
.
y_pred: The predicted values. shape = [batch_size, d0, .. dN]
.
Returns:
Squared hinge loss values. shape = [batch_size, d0, .. dN-1]
.
top_k_categorical_accuracy function
tensorflow.keras.metrics.top_k_categorical_accuracy(y_true, y_pred, k=5)
Computes how often targets are in the top K
predictions.
Standalone usage:
y_true = [[0, 0, 1], [0, 1, 0]] y_pred = [[0.1, 0.9, 0.8], [0.05, 0.95, 0]] m = tf.keras.metrics.top_k_categorical_accuracy(y_true, y_pred, k=3) assert m.shape == (2,) m.numpy() array([1., 1.], dtype=float32)
Args: y_true: The ground truth values. y_pred: The prediction values. k: (Optional) Number of top elements to look at for computing accuracy. Defaults to 5.
Returns: Top K categorical accuracy value.


Toggle navigation
START BOOTSTRAP
PORTFOLIO
ABOUT
CONTACT
START BOOTSTRAP
Web Developer - Graphic Artist - User Experience Designer


--- layout: post title: 'Finding difficult puzzles: \"The best' date: 2004-12-12 00:00:00 category: personal ---
Finding difficult puzzles: "The best such puzzles are easy to explain, yet difficult to solve. Historically, they have been devised by trial and error. But earlier this year, Jim Lewis, an inventor based in Midland Park, New Jersey, set out to find the hardest possible “simple” puzzle, using a computer-based search.".
We got onto this subject yesterday at the sushiFest, talking about Suicide Chess and Bastard Tetris: both games which take an established, understood game environment and turn it on its head by a simple change of the rules/behaviour.


Chapter 9 The Scatterplot
The scatterplot is the most powerful tool in statistics. The following comes as close to any rote procedure that I would recommend following:
Always plot your data using a scatterplot.
For some combinations of unordered, qualitative variables with a large number of categories, the scatterplot might not offer useful information. However, the plot itself will not mislead the researcher. Therefore, the scatterplot offers a safe, likely useful starting point for almost all data analysis.
9.1 geom_point()
To create scatterplots, we simply use geom_point()
as the geometry combined with our same approach to data and aesthetics.
Here’s a simple example with hypothetical data.
# create a fictional dataset with tribble()
df <- tribble(
~x, ~ y,
1, 1,
2, 2,
3, 6,
1, 3,
2.5, 5)
# quick look at this fictional data frame
glimpse(df)
Rows: 5
Columns: 2
$ x <dbl> 1.0, 2.0, 3.0, 1.0, 2.5
$ y <dbl> 1, 2, 6, 3, 5
9.2 Example: Gamson’s Law
Here’s a more realistic example.
Rows: 826
Columns: 2
$ seat_share <dbl> 0.02424242, 0.46060607, 0.51515150, 0.47204968, 0.527…
$ portfolio_share <dbl> 0.09090909, 0.36363637, 0.54545456, 0.45454547, 0.545…
Because the data are so dense, especially in the lower-left corner of the plot, we might use alpha transparency to make the density easier to see.
9.3 Example: Gapminder
For a dataset with more variables, we can represent a few other variables using aesthetics other than location in space.
For this example, we use country-level data from the gapminder package. We haven’t discussed this yet, but many R packages contain datasets that are useful as examples. In this case, we can load the gapminder
dataset from the gapminder package using data(gapminder, package = "gapminder")
. This is an alternative to downloading the dataset to your computer, uploading it to the project in RStudio Cloud, and reading it into R with, say, read_csv()
.
# load gapminder dataset from gapminder package
data(gapminder, package = "gapminder")
glimpse(gapminder)
Rows: 1,704
Columns: 6
$ country <fct> Afghanistan, Afghanistan, Afghanistan, Afghanistan, Afghani…
$ continent <fct> Asia, Asia, Asia, Asia, Asia, Asia, Asia, Asia, Asia, Asia,…
$ year <int> 1952, 1957, 1962, 1967, 1972, 1977, 1982, 1987, 1992, 1997,…
$ lifeExp <dbl> 28.801, 30.332, 31.997, 34.020, 36.088, 38.438, 39.854, 40.…
$ pop <int> 8425333, 9240934, 10267083, 11537966, 13079460, 14880372, 1…
$ gdpPercap <dbl> 779.4453, 820.8530, 853.1007, 836.1971, 739.9811, 786.1134,…
ggplot(gapminder, aes(x = gdpPercap,
y = lifeExp,
size = pop,
color = continent)) +
geom_point(alpha = 0.3)
Because GDP per capita is skewed so heavily to the right, we might transform the x-axis from a linear scale (the default) to a log (base-10) scale.
ggplot(gapminder, aes(x = gdpPercap,
y = lifeExp,
size = pop,
color = continent)) +
geom_point(alpha = 0.3) +
scale_x_log10()
percent_uninsured
(the percent of each state’s population without health insurance) along the horizontal axis and the variable percent_favorable_aca
(the percent of each state with a favorable attitude toward Obamacare) along the vertical axis. Interpret and speculate about any pattern. I encourage you to represent other variables with other aesthetics.
Exercise 9.2 Continuing the exercise above, label each point with the state’s two-letter abbreviation. Experiment with the following strategies.
geom_text()
instead ofgeom_point()
geom_label()
instead ofgeom_point()
geom_text_repel()
in the ggrepel package in addition togeom_point()
geom_label_repel()
in the ggrepel package in addition togeom_point()
?geom_text()
) and the contained examples to understand how to use each geom. The variable state_abbr
contains the two-letter abbreviation, so you’ll need to include the aesthetic label = state_abbr
in the aes()
function.


| Start with the motor. Put the shaft in the slot like in the picture. The wires need to be away from the motor mount. | |
| Turn the motor until the yellow plastic tab is in the slot in the end of the motor mount, and push the motor against this end wall. | |
| There is a small yellow circle on the side of the motor. This needs to be pushed into the matching hole on the motor mount. | |
| The motor should fit flat, like in this picture. | |
| Now put the switch through the hole in the top of the motor mount. | |
| The circuit board should snap into the motor mount and sit square. | |
| The hole is wide to let the switch in easily, but it needs to be pushed to the middle of the motor mount to work well. | |
| Now put the arm on the motor. | |
| You can test everything now by putting in batteries. Be careful not to pinch your fingers! | |
| If the arm doesn’t move, check that your terminal block connections are tight. If it moves the wrong way, you need to switch the motor wires. | |
| When everything is working, connect the top to the motor mount with one of the nuts from the switch. | |
| Test the switch again, then fit the top into the box. | |
| Now put the battery holder in the battery holder holder. | |
| Finally, put on the lid. | |
| Congratulations! |


Chat History
My notes needs to be setup
Might I suggest the following links:
Notes ID and Password Administration
Manage all of your Notes ID and password administrative needs
Reinitialize Notes
Reinitialize Notes by stripping the notes.ini file.
Temporary Notes Password Not Accepted
After a Notes password reset, the temporary password is not allowing you to log in to Notes.
My notes ARCHIVE needs to be setup
Might I suggest the following links:
Notes ID and Password Administration
Manage all of your Notes ID and password administrative needs
Reinitialize Notes
Reinitialize Notes by stripping the notes.ini file.
Temporary Notes Password Not Accepted
After a Notes password reset, the temporary password is not allowing you to log in to Notes.
Page
1
2
3
.
.
13
Next
Type something to see the output
Virtual Agent
I am having trouble connecting my wifi
Might I suggest the following links:
Connect to the IBM Wireless Network
Wirelessly Connecting Your Computer to the IBM Network
IBM Wireless LAN - Troubleshooting Tips
IBM Wi-Fi troubleshooting tips
Frequently Asked Questions about IBM Wireless LAN
FAQs for IBM Wireless LAN
Did this help solve your problem
Transferring to support desk...
Hi John! Give me a minute while go through your problem


2 writes to _hidden
System.Management.Automation (2)
engine\DataStoreAdapter.cs (2)
284
_hidden
= driveInfo._hidden;
483
_hidden
= value;
2 references to _hidden
System.Management.Automation (2)
engine\DataStoreAdapter.cs (2)
284
_hidden = driveInfo.
_hidden
;
478
return
_hidden
;


Headquarter, First Bank of Nigeria Plc. Lagos, Nigeria. Phone: 234-80-37142361. Alternative<EMAIL_ADDRESS>Sir, Compliment of the day and how is life general with you? Of course it is my humble wish to solicit and crave your indulgence to make this project request for a joint business transaction which I hope will not come to you as a surprise, hence I plead for your pardon. I am Mike Igbo, the manager of headquarter first bank of Nig. Plc. Lagos. I have an urgent and confidential business proposal for you. On June 6, 1997, an Australian oil consultant/contractor with via National Petroleum cooperation (NNPC) Mr. Peter Bush made a numbered time (fixed) deposit for twelve calenderer month valued at US$25,000, 000. 00(Twenty-Five Million US Dollars) in my branch. On maturity, I sent a routine notification to his forwarded address but got no reply after months we send a reminder and finally we discovered from his contract employee (Nigeria national petroleum Corporation) that Mr. Peter Bush died from an automobile accident. On further investigation, it was clear that he died without making a will. All attempts by the Australian to trace his next of kin were fruitless. I therefore made further investigation and discovered that Mr. Peter Bush did not declare any next of kin or relations in all his official documents including his deposit document in my bank. The total sum US$25,000,000.00 is still in my bank as dormant acct. No one will ever come forward to claim it. According to Nigerian banking law, after five years, the money will revert to the ownership of the Nigerian Government. If the account owner is certified death and nobody comes forward to claim it. This is the situation, and my proposal is that I am looking for a foreigner who will stand in as the beneficiary/next of kin. This is simple. All you have to do is to immediately send me the details of a bank account anywhere in the world for me to arrange the proper money transfer document. The money will then be transferred into the account for us to share in the ration of 60% for me 30% for you while the remaining 10% will be set aside for expenses incurred with here and there. There is no risk involved. I am using my position and connection in the bank here to do all the document work for the transaction. We shall employ the services of an attorney to draft the will and obtain all necessary documents and letter of administration in your favor for the transfer. This transaction is risk free guaranteed. If you are interested, please reply immediately confidentiality and be rest assured that this transaction could be most profitable for both of us. Please do not expose this deal if you are not interested because if you do, it will take me out of seat. I am awaiting your urgent reply. Best regards, Mike Igbo. __________________________________ Do you Yahoo!? New Yahoo! Photos - easier uploading and sharing. http://photos.yahoo.com/


Create Porsche ID Account
Please enter your registration details in the following fields. Mandatory fields are marked with an asterisk (*). Salutation *


360 HDR Photos
by Josh
All
SMU
Home
living
room
click here to view in 360 hi-res
green
room
click here to view in 360 hi-res
Hope
lobby
click here to view in 360 hi-res
Hope
courtyard
click here to view in 360 hi-res
Meadows
steps
click here to view in 360 hi-res
alley
entrance
click here to view in 360 hi-res
north
quad
click here to view in 360 hi-res
Whitney's
room
click here to view in 360 hi-res


Across: 7. Nasty herb stings and smarts (10) 9. India's politicians, devious fellows! (4) 10. Topside roast initially carved with great authority (8) 11. Rules for performing singer (6) 12,22dn. Mary lets loose with words we can all understand (3 5) 13. Steel used in autopsy chisels (5) 14. First lady taken by the masculine French 21 (5) 18. Leftward Peron take from all of country's leaders working together? (13) 19,21. As famous movie fish, Mudskipper's number one in the big pond (5 3) 20. Captive fish housing stank badly (5) 21. see 19 24. No change for 25 abused via internet (6) 26. Removing toxins from bloodstream advisable? Yes, rinse regularly! (8) 27. Stop and take back mouthful (4) 28. Not taking direct path due to explosive mine danger (10) Down: 1. Smile about Peron having access, deleting the odd complaints (10) 2. State making technology help humanist ends? (5) 3. Leader performing mass at ten (9) 4. Take over from principal leader after cutting short money lending (5) 5. Whisk simple admiral away with every other 'character' in 6 18 24 8 (9) 6. Frank work with English? (4) 8. Chambers issue perhaps: bench, losing edge, help each one out of policy backflip (13) 15. Heights of stormy violent sea (10) 16. Breaks in trees holding listener in clutches (9) 17. In this way, 21 is mad to recommend charges (9) 23. Type of scheme involving some 21s being built and some geography drowned (5) 25. Crooked line which runs through 2 (4)


Ex-South African leader files leave to appeal in graft case
by The Associated PressJOHANNESBURG (AP) — Former South African president Jacob Zuma has filed notice to appeal a court ruling that cleared the way for him to be prosecuted for corruption.
Zuma’s lawyers are arguing in Pietermaritzburg High Court on Friday to be granted leave to appeal.
The court had dismissed his application to have the corruption case against him permanently halted.
Zuma has alleged his case was prejudiced by lengthy delays in bringing the matter to trial. He also has alleged political interference.
He denies charges of corruption, money laundering and racketeering related to the country’s controversial 1999 arms deal.
Zuma is accused of receiving bribes from French arms manufacturer Thales through his former financial adviser Schabir Shaik, who was convicted of fraud and corruption in 2005.
The Associated Press


RT @pamelafox: One day I'm going to learn to stop coding apps that deal with timezones. Or I'll take over the world and abolish them, for c…
7/23/2013, 6:11:43 PM
Favs: 0
Retweets: 0
link--- layout: tweet ---
RT @pamelafox: One day I'm going to learn to stop coding apps that deal with timezones. Or I'll take over the world and abolish them, for c…
7/23/2013, 6:11:43 PM
Favs: 0
Retweets: 0
link


| Trees | Indices | Help |
|---|
|
|
bialang is a python wrapper to the imagej1 api. It tries to create a simpler api for imagej1 to allow writing more readable and re-usable bio-image analysis scripts.
Currently there are 4 ways to write image analysis workflows in ImageJ:
- as an imagej-macro
- as a script in one of the scripting languages (python, groovy, javascript, ...)
- as a plugin in java
- using operators and imglib2 from the sci-java framework
A nice feature is that actions can be recorded in different languages, using the macro-recorder.
However there are some problems with the above approaches:
- the code contains technical details and is not centered on the (bio-)image analysis
- the macro-language has little support for code-organization and re-use.
- execution depends on the global state in imagej (global settings like the "Black background option, ...)
- operations are applied to the active image or window
- parameters are passed as strings
- the sci-java remedies most of the problems, however a high level image analysis api is still missing.
Example:
Here is a simple pre-processing workflow in the ijm:
run("Duplicate...", " "); run("Find Edges"); run("8-bit"); run("Smooth"); setAutoThreshold(thresholdMethod); run("Analyze Particles...", "size="+minSize+"-"+maxSize+" circularity=0.00-1.00 show=Masks exclude in_situ"); run("Create Selection"); run("Enlarge...", "enlarge=" + numberOfDilates + " pixel"); roiManager("Add"); close(); roiManager("select", 0); run("Clear Outside");
In a scripting language it would look something like this:
imp2 = imp.duplicate(); IJ.run(imp, "Find Edges", ""); IJ.run(imp, "8-bit", ""); IJ.run(imp, "Smooth", ""); IJ.setAutoThreshold(imp, "Percentile dark"); IJ.run(imp, "Analyze Particles...", "size=350-20000 show=Masks exclude in_situ"); IJ.run(imp, "Create Selection", ""); IJ.run(imp, "Enlarge...", "enlarge=10"); rm.addRoi(imp.getRoi()); imp.close(); rm.select(0); IJ.setBackgroundColor(0, 0, 0); IJ.run(imp, "Clear Outside", "");
Here is how it looks like in bialang:
image = duplicate(inputImage) findEdges(image) to8Bit(image) smooth(image) toMask(image, percentileThreshold(image), Filter(minSize, maxSize, minCirc, maxCirc, exclude)) roi = createSelection(image) close(image) enlarge(roi, numberOfDilates, unit=units.pixel) clearOutside(inputImage, roi)
The operations like duplicate, findEdges, ... are objects which instead being immediatly run can also be created and configured first and then explicitly run.
For example:
Duplicate = Duplicate() Duplicate.selectChannels(1, 3) Duplicate.setZSices(1, 3, 5, 7) Duplicate.run(image)
written 2020 by Volker Baecker, Montpellier Ressources Imagerie, Biocampus Montpellier, UM, INSERM, CNRS
Have fun!
|
|||
|
ImageOperation Abstract super-class for image-operations. |
|||
|
FindEdges Apply an edge-filter to the image. |
|
|||
|
| Trees | Indices | Help |
|---|
| Generated by Epydoc 3.0.1 on Mon Mar 9 23:31:36 2020 | http://epydoc.sourceforge.net |


Ken Moini Fierce Software • Lead Solution Architect
THE ENTERPRISE DATA CLOUD COMPANY
<EMAIL_ADDRESS><EMAIL_ADDRESS>For more on our Training, Webinars, Workshops and more...


1D
1 D
1 W
1 Mo
1 Min
5 Min
30 Min
Chart
Chart Style
Candle
Bar
Colored Bar
Line
Hollow Candle
Mountain
Chart Scale
Log Scale
Studies
Accumulative Swing Index
Aroon
Aroon Oscillator
Average True Range
Bollinger Bands
Center Of Gravity
Chaikin Money Flow
Chaikin Volatility
Chande Forecast Oscillator
Chande Momentum Oscillator
Commodity Channel Index
Coppock Curve
Detrended Price Oscillator
Directional Movement System
Donchian Channel
Ease of Movement
Ehler Fisher Transform
Elder Force Index
Elder Ray
Fractal Chaos Bands
Fractal Chaos Oscillator
Gopalakrishnan Range Index
High Low Bands
High Minus Low
Highest High Value
Historical Volatility
Intraday Momentum Index
Keltner Channel
Klinger Volume Oscillator
Linear Reg Forecast
Linear Reg Intercept
Linear Reg R2
Linear Reg Slope
Lowest Low Value
MACD
Mass Index
Median Price
Momentum Oscillator
Money Flow Index
Moving Average
Moving Average Envelope
Negative Volume Index
On Balance Volume
Parabolic SAR
Performance Index
Positive Volume Index
Pretty Good Oscillator
Price Oscillator
Price Rate of Change
Price Volume Trend
Prime Number Bands
Prime Number Oscillator
QStick
Random Walk Index
RAVI
RSI
Schaff Trend Cycle
Standard Deviation
Stochastics
Stochastic Momentum Index
Stochastic Oscillator
Swing Index
Time Series Forecast
Trade Volume Index
TRIX
True Range
Twiggs Money Flow
Typical Price
Ultimate Oscillator
Vertical Horizontal Filter
Volume
Vol Underlay
Volume Oscillator
Volume Rate of Change
Weighted Close
Williams %R
Williams Accumulation Distribution
Timezone
Change Timezone
Default Themes
White
Black
Custom Themes
x
New Custom Theme
F
Select Tool
None
Crosshairs
Annotation
Fibonacci
Horizontal
Vertical
Line
Ray
Segment
Rectangle
Ellipse
Clear Drawings
Fill:
Line:
None
Axis Label:
O:
H:
V:
C:
L:
Create
Show Zones
OverBought
OverSold
Remove This Study
Choose Timezone
Close
To set your timezone use the location button below, or scroll through the following list...
Use My Current Location
(Scroll for more options)
Create a New Custom Theme
Close
Chart Style
Candle
/
Bar
/
Line
Wick
Candle Borders
Monotone
Bar
/
Line
Mountain Charts
Gradient
Background
Background
Grid Lines
Date Dividers
Axis Text
New Theme Name:
Save Theme


"MERCY "compassion for the miserable. Its object is misery. By the atoning sacrifice of Christ a way is open for the exercise of mercy towards the sons of men, in harmony with the demands of truth and righteousness(Genesis 19:19; Exodus 20:6; 34:6, 7; Psalm 85:10; 86:15, 16). In Christ mercy and truth meet together. Mercy is also a Christian grace (Matthew 5:7; 18:33-35).
"MERCY "compassion for the miserable. Its object is misery. By the atoning sacrifice of Christ a way is open for the exercise of mercy towards the sons of men, in harmony with the demands of truth and righteousness(Genesis 19:19; Exodus 20:6; 34:6, 7; Psalm 85:10; 86:15, 16). In Christ mercy and truth meet together. Mercy is also a Christian grace (Matthew 5:7; 18:33-35).


BY EDWIN JAHIEL
THE MYTH OF FINGERPRINTS (1997) ** Written & directed by Bart Freundlich. Photography, Stephen Kazmierski, Editing, Kate Williams, Ken J. Sackheim. Production design, Lucy W. Corrigan. Main cast (alphabetically): Arija Bareiikis, Blythe Danner, Hope Davis, Kelsey Gunn, Brian Kerwin, James LeGros, Julianne Moore, Roy Scheider, Michael Vartan, Noah Wyle. A Sony release. 90 min. Rated R (language, sex).
The title of this movie, cryptic and quite forced and precious, seems to mean that while a person's fingerprints are always the same, people's natures (psyches, characters) can change. The people in question are the now grown children of Lena (Danner) and Hal (Scheidel). For the first time in three years, the brood join their parents for Thanksgiving, in a rather luxurious farmhouse in Maine (the film was shot in Bethel and Andover).
Daughter Mia (Moore) brings along her male companion Elliot (Kerwin), a psychotherapist. Jake brings his girl Margaret (Davis). Warren (Wyle) comes alone, still brooding over the break, three years ago, with his great love Daphne (Bareikis). The youngest child, a girl, is Leigh (Holloman).
Mother Lena is sweet. Father Hal is a near-silent, sullen, often unpleasant patriarch. Mia and Elliot are not a good couple. Jake and Margaret are, and make love vigorously and noisily, often in odd locations. Later on Warren and Daphne are reunited. All the couples copulate.
The assembly is one of W.A.S.P.s who are often waspish, with the Pulitzer Prize for unpleasantness going to Mia. She's lavish with insults, snide remarks and complaints.
There is a general unease about this household, where spats and repartees are frequent, where there are times when you think that everyone hates everybody else. It's more complex than that, however. But the movie does a peculiarly confusing job of editing at the expense of giving us information about the characters, and at the detriment of dimensionality. This may be compounded for some viewers by the plethora of blonde women (all good-looking), awkward flashbacks, and minimalist dialogue scenes (sometimes ponderous). You might get the impression that all are deranged, save for the sensible and natural Leigh.
 Yet you've been out making your way in the world, feeling like an adult." Etc.etc. But that's not really shown in the movie.
Freundlich, about the age of the younger characters, seems to identify with them, while making them identify with him. This results in a film that has mature ambitions but an adolescent texture. Among several jejune matters are the inter-relations of just about all; the basic lack of interest, for us, of the characters, even though the performances are very good (for what they are); the humorlessness of the whole thing, in spite of a few funny lines and in spite of Freundlich's stating that the film is funny; odd reactions, such as the grown-up children being revolted at the idea that last night their parents made love; the peculiar affair (if there is one) between Mia and a fellow kindergartener who now calls himself Cezanne (!).
The new director is promising, but his first feature is more like a personal settling of family accounts. Been there, done that..
It is nice to get detailed pressbooks for new movies, but in this case, the fact that the writer-director takes almost 10 pages to explain his film, makes you wonder if he mistrusts the work speaking for itself. One the plus side, some bits of the film and the dialogue are OK, and the production values are most professional in the staging, framing and especially the excellent photography.
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


Magister Xenovia:
That's what I like! A plain speaker! Now put this powder into the medium jar along with the bones you have. I fear that the results may be other than what you expect...


Seeker
The summoned nebulas move quicker between enemies and burn them gravely.
+${value}% Elemental Damages
5 10 15 20 25 30 35 40 45 50 55 60 65 70
+${value}% Movement Speed
16 24 34 46 54 64 72 82 90 102 112 120 128 136
MaxLevel
10
UltimateLevel
14