• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..16-Feb-2021-

BUILD.gnH A D16-Feb-20211 KiB4137

README.mdH A D16-Feb-20213 KiB6049

builtin_worker.ccH A D16-Feb-20213.8 KiB11282

builtin_worker.hH A D16-Feb-20211.4 KiB4627

download_worker.ccH A D16-Feb-20214.9 KiB130105

download_worker.hH A D16-Feb-20212.3 KiB6536

metrics.ccH A D16-Feb-20211.1 KiB3724

metrics.hH A D16-Feb-20211.7 KiB7150

ml_agent.ccH A D16-Feb-202112.2 KiB349266

ml_agent.hH A D16-Feb-20212.6 KiB7840

ml_agent_unittest.ccH A D16-Feb-202111.7 KiB298206

ml_agent_util.ccH A D16-Feb-20213.1 KiB9070

ml_agent_util.hH A D16-Feb-20211 KiB3018

ml_agent_util_unittest.ccH A D16-Feb-20212.7 KiB7862

ml_service_client.ccH A D16-Feb-20217.2 KiB196145

ml_service_client.hH A D16-Feb-20211.7 KiB5024

smart_dim_worker.ccH A D16-Feb-20211 KiB4730

smart_dim_worker.hH A D16-Feb-20212.8 KiB7639

README.md

1# Smart Dim Model
2
3The Smart Dim Model is an experimental model used to predict whether an upcoming
4screen-dim should go ahead or be deferred. The prediction is based on whether
5the user is likely to remain inactive or reactivate following a screen-dim. If
6the user is likely to reactivate, the model would predict the dim should be
7deferred, otherwise, the model would predict the dim should go ahead.
8
9## Model prediction
10
11The input to the model is a list of features that would help predict user
12activity after the screen is dimmed. Example features are user related features
13(e.g. activity count) and environment features (e.g. time of day). The model
14takes in these features and calculates an inactivity-score: the higher the
15score, the more likely the user will remain inactive. If this inactivity-score
16is higher than or equal to a dim-threshold (set by an experiment), the model
17will predict the dim should go ahead; otherwise it will predict the dim should
18be deferred.
19
20The features used by the model are those metrics logged to UKM by
21`UserActivityUkmLoggerImpl`. These metrics and features do not contain any user
22personal data. They are aggregated when training the model.
23
24Using these metrics, we trained a
25[DNN](https://en.wikipedia.org/wiki/Deep_learning#Deep_neural_networks) model.
26The inferencing code in `tf_native_inference.cc` consists of the model weights
27generated by [TensorFlow](https://www.tensorflow.org/) and basic operations to
28execute the model over an example.
29
30## Example preprocessing
31
32The `tf_native_inference.cc` generated from a TensorFlow model expects input
33features to be represented as a vector of floats. This conversion is handled by
34AssistRanker based on the configuration
35provided in `example_preprocessor_config.pb`. The feature-to-float conversion
36depends on the type of the feature. For example, a numerical feature will be
37converted to a corresponding float (possibly normalized). Categorical features
38(e.g. enums or bucketized numerical features) will be converted via
39[One-hot encoding](https://en.wikipedia.org/wiki/One-hot). Missing features can
40also be handled, with configurations specified in the
41`example_preprocessor_config.pb`. The configuration can be examined with the
42`print_example_preprocessor_config.py` utility:
43
44```shell
45./components/assist_ranker/print_example_preprocessor_config.py \
46  out/Release \
47  chrome/browser/chromeos/power/ml/smart_dim/example_preprocessor_config.pb
48```
49
50## Smart dim model interface
51
52Example processing and inactivity-score calculation are all internal details of
53the model. The public interface of the model is `SmartDimModel::ShouldDim()`.
54`SmartDimModelImpl::ShouldDim()` provides the actual implementation. It takes
55prediction features (`UserActivityEvent::Features`) as input and returns
56`UserActivityEvent::ModelPrediction`. The returned prediction contains both
57model response (dim, no-dim or model-error) and quantized values of
58inactivity-score and dim-threshold. These two values are quantized in the
59returned result so that they can be logged when necessary.
60