Skip to content

Commit

Permalink
add test seed
Browse files Browse the repository at this point in the history
  • Loading branch information
goodov committed Jul 11, 2024
1 parent 4b3c6d1 commit 30b6486
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 2 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/generate-test-seed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ jobs:
env:
ACTION_RUN_URL: '${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}'
REMOTE_SEED_PATH: 'pull/${{ github.event.pull_request.number }}/seed'
SEED_VERSION: 'pull/${{ github.event.pull_request.number }}#${{ github.event.pull_request.head.ref }}'

steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
Expand Down Expand Up @@ -63,9 +64,9 @@ jobs:
- name: Generate seed
run: |
# Use only python implementation for now.
python seed/serialize.py seed/seed.json
python seed/serialize.py seed/seed.json --version "$SEED_VERSION"
# TODO: enable this when per-file studies will be synced with seed.json.
# npm run seed_tools -- create_seed studies seed.bin
# npm run seed_tools -- create_seed studies seed.bin --version "$SEED_VERSION"
- name: Upload seed
env:
Expand Down Expand Up @@ -97,6 +98,7 @@ jobs:
\`\`\`
#### Seed Details
- Version: \`${process.env.SEED_VERSION}\`
- Serial Number: \`${serialNumberContent}\`
- Uploaded: \`${new Date().toISOString()}\`
`
Expand Down
3 changes: 3 additions & 0 deletions seed/serialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ def main():
'seed_path', type=argparse.FileType('r'), nargs='?',
help='json seed file to process')
parser.add_argument('--mock_serial_number', help='mock serial number')
parser.add_argument('--version', help='version')
args = parser.parse_args()

print("Load", args.seed_path.name)
Expand All @@ -343,6 +344,8 @@ def main():
if args.mock_serial_number is not None:
seed_message.serial_number = args.mock_serial_number
update_serial_number(seed_message.serial_number)
if args.version is not None:
seed_message.version = args.version

# Serialize and save as seed file
with open(SEED_BIN_PATH, "wb") as seed_file:
Expand Down
63 changes: 63 additions & 0 deletions studies/BraveAds.CreativeAdModelBasedPredictorRecencyStudy.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
[
{
"name": "BraveAds.CreativeAdModelBasedPredictorRecencyStudy",
"experiment": [
{
"name": "NoRecency",
"probability_weight": 20,
"feature_association": {
"enable_feature": [
"CreativeNotificationAdModelBasedPredictor",
"CreativeNewTabPageAdModelBasedPredictor",
"CreativeInlineContentAdModelBasedPredictor"
]
},
"param": [
{
"name": "last_seen_ad_predictor_weight",
"value": "0.0"
},
{
"name": "last_seen_advertiser_predictor_weight",
"value": "0.0"
}
]
},
{
"name": "NoAdvertiserRecency",
"probability_weight": 20,
"feature_association": {
"enable_feature": [
"CreativeNotificationAdModelBasedPredictor",
"CreativeNewTabPageAdModelBasedPredictor",
"CreativeInlineContentAdModelBasedPredictor"
]
},
"param": [
{
"name": "last_seen_advertiser_predictor_weight",
"value": "0.0"
}
]
},
{
"name": "Control",
"probability_weight": 60
}
],
"filter": {
"channel": [
"NIGHTLY",
"BETA",
"RELEASE"
],
"platform": [
"PLATFORM_WINDOWS",
"PLATFORM_MAC",
"PLATFORM_LINUX",
"PLATFORM_ANDROID",
"PLATFORM_IOS"
]
}
}
]

0 comments on commit 30b6486

Please sign in to comment.