Metrics
Stay organized with collections
Save and categorize content based on your preferences.
Helper class with built-in metrics functions.
Inherited Methods
From class
java.lang.Object
boolean
|
equals(Object arg0)
|
final
Class<?>
|
getClass()
|
int
|
hashCode()
|
final
void
|
notify()
|
final
void
|
notifyAll()
|
String
|
toString()
|
final
void
|
wait(long arg0, int arg1)
|
final
void
|
wait(long arg0)
|
final
void
|
wait()
|
Constants
public
static
final
float
L2_NORM_EPSILON
Public Methods
public
static
Operand<T>
topKCategoricalAccuracy
(Ops tf, Operand<? extends TNumber> labels, Operand<T> predictions, long k)
Computes how often targets are in the top K predictions.
Standalone usage:
Operand<TInt32> labels = tf.constant(new int[][]
{ {0, 0, 1}, {0, 1, 0} });
Operand<TFloat32> predictions = tf.constant(new float[][]
{ {0.1f, 0.9f, 0.8f}, {0.05f, 0.95f, 0f} });
Operand<TFloat32> m = Metrics.topKCategoricalAccuracy(
labels, predictions, 3)
//m.shape().toString == "[2]"
Parameters
tf |
the TensorFlow Ops. |
labels |
the ground truth values. |
predictions |
The prediction values. |
k |
Number of top elements to look at for computing accuracy. |
Returns
- the Operand for the Top K categorical accuracy value.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2021-11-29 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2021-11-29 UTC."],[],[],null,["# Metrics\n\npublic class **Metrics** \nHelper class with built-in metrics functions. \n\n### Constants\n\n|-------|------------------------------------------------------------------------------------------------|---|\n| float | [L2_NORM_EPSILON](/jvm/api_docs/java/org/tensorflow/framework/metrics/Metrics#L2_NORM_EPSILON) | |\n\n### Public Constructors\n\n|---|------------------------------------------------------------------------------------|\n| | [Metrics](/jvm/api_docs/java/org/tensorflow/framework/metrics/Metrics#Metrics())() |\n\n### Public Methods\n\n|--------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| static \\\u003cT extends [TNumber](/jvm/api_docs/java/org/tensorflow/types/family/TNumber)\\\u003e [Operand](/jvm/api_docs/java/org/tensorflow/Operand)\\\u003cT\\\u003e | [topKCategoricalAccuracy](/jvm/api_docs/java/org/tensorflow/framework/metrics/Metrics#topKCategoricalAccuracy(Ops, org.tensorflow.Operand\u003c? extends org.tensorflow.types.family.TNumber\u003e, org.tensorflow.Operand\u003cT\u003e, long))(Ops tf, [Operand](/jvm/api_docs/java/org/tensorflow/Operand)\\\u003c? extends [TNumber](/jvm/api_docs/java/org/tensorflow/types/family/TNumber)\\\u003e labels, [Operand](/jvm/api_docs/java/org/tensorflow/Operand)\\\u003cT\\\u003e predictions, long k) Computes how often targets are in the top K predictions. |\n\n### Inherited Methods\n\nFrom class java.lang.Object \n\n|------------------|---------------------------|\n| boolean | equals(Object arg0) |\n| final Class\\\u003c?\\\u003e | getClass() |\n| int | hashCode() |\n| final void | notify() |\n| final void | notifyAll() |\n| String | toString() |\n| final void | wait(long arg0, int arg1) |\n| final void | wait(long arg0) |\n| final void | wait() |\n\nConstants\n---------\n\n#### public static final float\n**L2_NORM_EPSILON**\n\n\u003cbr /\u003e\n\nConstant Value: 1.0E-12\n\nPublic Constructors\n-------------------\n\n#### public\n**Metrics**\n()\n\n\u003cbr /\u003e\n\nPublic Methods\n--------------\n\n#### public static [Operand](/jvm/api_docs/java/org/tensorflow/Operand)\\\u003cT\\\u003e\n**topKCategoricalAccuracy**\n(Ops tf, [Operand](/jvm/api_docs/java/org/tensorflow/Operand)\\\u003c? extends [TNumber](/jvm/api_docs/java/org/tensorflow/types/family/TNumber)\\\u003e labels, [Operand](/jvm/api_docs/java/org/tensorflow/Operand)\\\u003cT\\\u003e predictions, long k)\n\nComputes how often targets are in the top K predictions.\n\nStandalone usage:\n\n```\n Operand\u003cTInt32\u003e labels = tf.constant(new int[][]\n { {0, 0, 1}, {0, 1, 0} });\n Operand\u003cTFloat32\u003e predictions = tf.constant(new float[][]\n { {0.1f, 0.9f, 0.8f}, {0.05f, 0.95f, 0f} });\n Operand\u003cTFloat32\u003e m = Metrics.topKCategoricalAccuracy(\n labels, predictions, 3)\n //m.shape().toString == \"[2]\"\n \n```\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n##### Parameters\n\n| tf | the TensorFlow Ops. |\n| labels | the ground truth values. |\n| predictions | The prediction values. |\n| k | Number of top elements to look at for computing accuracy. |\n|-------------|-----------------------------------------------------------|\n\n##### Returns\n\n- the Operand for the Top K categorical accuracy value."]]