-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Power ML] UserActivityManager calls SmartDimModel for prediction.
Once an idle event is received, UserActivityManager will call a smart dim model to predict whether the upcoming dim should be deferred. The smart dim model currently does nothing. It will be implemented to make prediction in a later cl. The purpose of this cl is to set up the structure, specifically how various classes work together. This cl also contains the following changes: 1. All data that are used in prediction and logging now live in UserActivityEvent. - This makes prediction and logging simpler as all data are now in one place. 2. Add additional metrics to log (i). Model prediction data. (ii). Previous positive and negative actions count. - They were derived data from other logged data. They are used as prediction features, and we log them directly now to avoid training-serving skew. 3. Stop logging several tab-related metrics logged, this will significantly reduce data logged. - Also only log one active tab in the focused/topmost browser that's visible. 4. Add a flag to disable/enable prediction. - It's disabled by default but will be set in experiments later. Bug: 862461 Change-Id: I7770efdfb5f15679fc4b49f8bf892292e7a347fc Reviewed-on: https://chromium-review.googlesource.com/1132828 Reviewed-by: Dan Erat <[email protected]> Reviewed-by: Steven Holte <[email protected]> Commit-Queue: Jia Meng <[email protected]> Cr-Original-Commit-Position: refs/heads/master@{#576808}(cherry picked from commit 7332829) Reviewed-on: https://chromium-review.googlesource.com/1147620 Reviewed-by: Jia Meng <[email protected]> Cr-Commit-Position: refs/branch-heads/3497@{#31} Cr-Branched-From: 271eaf5-refs/heads/master@{#576753}
- Loading branch information
Showing
17 changed files
with
858 additions
and
336 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Copyright 2018 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#ifndef CHROME_BROWSER_CHROMEOS_POWER_ML_SMART_DIM_MODEL_H_ | ||
#define CHROME_BROWSER_CHROMEOS_POWER_ML_SMART_DIM_MODEL_H_ | ||
|
||
#include "chrome/browser/chromeos/power/ml/user_activity_event.pb.h" | ||
|
||
namespace chromeos { | ||
namespace power { | ||
namespace ml { | ||
|
||
// Interface to indicate whether an upcoming screen dim should go ahead based on | ||
// whether user will remain inactive if screen is dimmed now. | ||
class SmartDimModel { | ||
public: | ||
virtual ~SmartDimModel() = default; | ||
|
||
// Returns whether an upcoming dim should go ahead based on input |features|. | ||
// If |inactive_probability_out| and |threshold_out| are non-null, also | ||
// returns model confidence (probability that user will remain inactive if | ||
// screen is dimmed now) and threshold: if probability >= threshold then model | ||
// will return true for this function. Both |inactive_probability_out| and | ||
// |threshold_out| are expected to be in the range of [0, 1.0] so that they | ||
// can be logged as model results. | ||
virtual bool ShouldDim(const UserActivityEvent::Features& features, | ||
float* inactive_probability_out, | ||
float* threshold_out) = 0; | ||
}; | ||
|
||
} // namespace ml | ||
} // namespace power | ||
} // namespace chromeos | ||
|
||
#endif // CHROME_BROWSER_CHROMEOS_POWER_ML_SMART_DIM_MODEL_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Copyright 2018 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "chrome/browser/chromeos/power/ml/smart_dim_model_impl.h" | ||
|
||
namespace chromeos { | ||
namespace power { | ||
namespace ml { | ||
|
||
SmartDimModelImpl::SmartDimModelImpl() = default; | ||
|
||
SmartDimModelImpl::~SmartDimModelImpl() = default; | ||
|
||
// TODO(jiameng): add impl. | ||
bool SmartDimModelImpl::ShouldDim(const UserActivityEvent::Features& features, | ||
float* inactive_probability_out, | ||
float* threshold_out) { | ||
// Let dim go ahead before we have a model implementation in place. | ||
if (inactive_probability_out) { | ||
*inactive_probability_out = 1.0; | ||
} | ||
if (threshold_out) { | ||
*threshold_out = 0.0; | ||
} | ||
return true; | ||
} | ||
|
||
} // namespace ml | ||
} // namespace power | ||
} // namespace chromeos |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Copyright 2018 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#ifndef CHROME_BROWSER_CHROMEOS_POWER_ML_SMART_DIM_MODEL_IMPL_H_ | ||
#define CHROME_BROWSER_CHROMEOS_POWER_ML_SMART_DIM_MODEL_IMPL_H_ | ||
|
||
#include "base/macros.h" | ||
#include "chrome/browser/chromeos/power/ml/smart_dim_model.h" | ||
|
||
namespace chromeos { | ||
namespace power { | ||
namespace ml { | ||
|
||
// Real implementation of SmartDimModel that predicts whether an upcoming screen | ||
// dim should go ahead based on user activity/inactivity following dim. | ||
class SmartDimModelImpl : public SmartDimModel { | ||
public: | ||
SmartDimModelImpl(); | ||
~SmartDimModelImpl() override; | ||
|
||
// chromeos::power::ml::SmartDimModel overrides: | ||
bool ShouldDim(const UserActivityEvent::Features& features, | ||
float* inactive_probability_out, | ||
float* threshold_out) override; | ||
|
||
private: | ||
DISALLOW_COPY_AND_ASSIGN(SmartDimModelImpl); | ||
}; | ||
|
||
} // namespace ml | ||
} // namespace power | ||
} // namespace chromeos | ||
|
||
#endif // CHROME_BROWSER_CHROMEOS_POWER_ML_SMART_DIM_MODEL_IMPL_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.