Skip to content

Commit

Permalink
Proposes API for thresholded metrics
Browse files Browse the repository at this point in the history
A more complete proposal of the behavior/contract can be found here: https://docs.google.com/document/d/1xT8Fq2fc2j3ZkrNamFEK9I2OQg5988X4xV8fQFXBUH0/edit?resourcekey=0-9uxb8KFe_JCOesZo4Z317Q#heading=h.da395nbulm5q

(Ideally contractual information belongs in the proto, but AutoTFX-specific details don't seem appropriate here so I think the above will have to be translated into some kind of AutoTFX g3doc instead?)

PiperOrigin-RevId: 407688935
  • Loading branch information
tf-metadata-team authored and tfx-copybara committed Nov 4, 2021
1 parent f5bc9e9 commit c28a163
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 8 deletions.
3 changes: 3 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

## Bug Fixes and Other Changes

* A `threshold_config` is added to MetaOptimizationTarget to allow for
expressing thresholded optimization goals.

## Breaking Changes

## Deprecations
Expand Down
46 changes: 38 additions & 8 deletions tensorflow_metadata/proto/v0/problem_statement.proto
Original file line number Diff line number Diff line change
Expand Up @@ -277,23 +277,53 @@ message Task {
// proxy function to optimize model weights. Target definitions include tasks,
// metrics, and any weighted combination of them.
message MetaOptimizationTarget {
reserved 2;
// The name of a task in this problem statement producing the
// prediction or classification for the metric.
string task_name = 1;

// The type of the meta-objective.
// If this is not specified, use the type of the task.
Type type = 2;

// The performance metric to be evaluated.
// The prediction or classification is based upon the task.
// The label is from the type of the task, or from the override_task.
PerformanceMetric performance_metric = 3;

// If a model spec has multiple meta optimization targets, the weight
// of each can be specified. If not specified, value is 1.
// If multi_objective is specified, then the weights are ignored.
double weight = 4;
// Configuration for thresholded meta-optimization targets.
message ThresholdConfig {
// If specified, indicates a threshold that the user wishes the metric to
// stay under (for MINIMIZE type), or above (for MAXIMIZE type). The
// optimization process need not prefer models that are higher (or lower)
// on the thresholded metric so long as the threshold is respected.
// E.g., if `threshold` for a MAXIMIZE type metric X is .9, the optimization
// process will prefer a solution with X = .92 over a solution with X = .88,
// but may not prefer a solution with X = .95 over a solution with X = .92.
// Unless otherwise specified by the PerformanceMetric, threshold is
// best effort. It does not provide a hard guarantee about the properties of
// the final model, but rather serves as a "target" to guide the
// optimization process. The user is responsible for validating that final
// model metrics are in an acceptable range for the application.
// A problem statement may, however, be rejected if the specified target
// is impossible to achieve. Keep this in mind if running the optimization
// on a recurring basis, as shifts in the data could push a previously
// achievable target to being unachievable (and thus yield no solution).
// The units and range for the threshold will be the same as the
// valid output range of the associated performance_metric.
double threshold = 1;
}

// Describes how to combine with other objectives.
oneof objective_combination {
// If a model spec has multiple meta optimization targets, the weight
// of each can be specified. The final objective is then a weighted
// combination of the multiple objectives. If not specified, value is 1.
// If multi_objective is specified, then the weights are ignored.
double weight = 4;

// Secondary meta optimization targets can be thresholded, meaning that the
// optimization process prefers solutions above (or below) the threshold,
// but need not prefer solutions higher (or lower) on the metric if the
// threshold is met.
ThresholdConfig threshold_config = 5;
}
}

message ProblemStatement {
Expand Down

0 comments on commit c28a163

Please sign in to comment.