Comments (9)
You can add metrics you want to the canned Estimators using tf.estimator.add_metrics
from model-analysis.
Sorry, GitHub doesn't send notifications for edits, so I didn't realise you had made an update.
The predictions
argument is the same as the predictions
dictionary in the EstimatorSpec
returned by your model_fn
. It looks like it's a dictionary containing a single key named predictions
, so you probably want to do mean_absolute_error(labels, predictions['predictions'])
.
from model-analysis.
Do you have any info on this? Are we missing something or is it not supported yet?
from model-analysis.
Yes, all canned Estimators are supported. Did you run into problems trying to get a regression model to work?
from model-analysis.
We have access only to average_loss, label/mean, post_export_metrics/example_count, prediction/mean. Can we have access to regression tf.metrics like mae, mse, rmse, mcd ?
EDIT :
I found this in the DNNRegressor.evaluate() doc :
For canned estimators, the dict contains the loss (mean loss per mini-batch) and the average_loss (mean loss per sample). Canned classifiers also return the accuracy. Canned regressors also return the label/mean and the prediction/mean
I also learned that DNNRegressor use L2 loss function, so the average_loss on 1 example is a mse. Can you (or is it the tf.estimator team?) provide off-the-shelf mae, rmse? Thanks
from model-analysis.
It's exactly what I want, thanks! Sorry for the inconvenience.
EDIT : Well I can't seem to get it work.
I do :
def my_mae(labels, predictions): return {'mean_absolute_error': tf.metrics.mean_absolute_error(labels, predictions)}
estimator = tf.estimator.add_metrics(estimator, my_mae)
And I get the following error:
ERROR - Failed to convert object of type <type 'dict'> to Tensor. Contents: {'predictions': <tf.Tensor 'dnn/logits/BiasAdd:0' shape=(?, 1) dtype=float32>}. Consider casting elements to a supported type.
I tried predictions['logits'], predictions['activation'] (similarly to the predictions['logistics'] for a classifier in the doc) without success. Can you help me? Thanks!
from model-analysis.
Hello, any updates on my edit? I can't find any info on the internet. Thanks!
from model-analysis.
It works, thanks!
from model-analysis.
Closing the issue due to the lack of recent activity. Please feel free to add additional information and open the issue again. Thanks!
from model-analysis.
Related Issues (20)
- Unable to use custom Keras metrics with TFX evaluator component HOT 4
- AttributeError: partially initialized module error, test.py HOT 2
- Incorrect Documentation for MetricConfig
- Custom multilabel Keras metrics: dynamically initialize weight shape HOT 1
- Fairness indicator metrics do not show up HOT 5
- Validation bug when using feature values as slicing specs HOT 2
- No longer compatible with Dataflow runner v1 after v0.29
- Renaming Custom Layer breaks TFMA Evaluator HOT 6
- Error in merge_accumulators when using keras metrics on dataflow HOT 3
- TFMA analyze_raw_data function support with MultiClassConfusionMatrixPlot HOT 3
- Analytics HOT 1
- Breaking changes: tfma.metrics.MetricComputation `preprocessor` argument changed from accepting beam DoFn to `preprocessors` accepting a list of `Preprocessor` HOT 1
- Move to numpy >=1.20 because <1.20 is difficult to build on Apple Silicon HOT 4
- TFMA on Flink does not seems to be parallelizing work. HOT 5
- only integer values should be passed to num_instances metric. HOT 3
- Render_plot is failing HOT 2
- Feat: Have ability to return the HTML rather than creating the plots HOT 1
- CVE in Pyarrow dependency HOT 1
- CNN HOT 2
- pip install tensorflow-model-analysis fails on WSL2 on Windows 11 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from model-analysis.