Skip to content

Commit 60322c0

Browse files
kai687shortcutsFluf22
authored
fix(specs): a/b testing (#2981)
Co-authored-by: Clément Vannicatte <vannicattec@gmail.com> Co-authored-by: Thomas Raffray <Fluf22@users.noreply.github.com>
1 parent abb8913 commit 60322c0

File tree

10 files changed

+250
-63
lines changed

10 files changed

+250
-63
lines changed

.github/workflows/check.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,7 @@ jobs:
328328
run: |
329329
set -eo pipefail
330330
cd clients/algoliasearch-client-swift
331+
find Sources -type f | rev | cut -d '/' -f1 | rev | sort | uniq -d
331332
[ $(find Sources -type f | rev | cut -d '/' -f1 | rev | sort | uniq -d | wc -l) -gt 0 ] && echo "Duplicates found" && exit 1 || echo "No duplicate found"
332333
333334
- name: Build clients

generators/src/main/java/com/algolia/codegen/AlgoliaSwiftGenerator.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ public class AlgoliaSwiftGenerator extends Swift5ClientCodegen {
9797
"snippetresultoption",
9898
"sortremainingby",
9999
"source",
100+
"status",
100101
"supportedlanguage",
101102
"tagfilters",
102103
"taskstatus",

specs/abtesting/common/parameters.yml

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@
22
ID:
33
in: path
44
name: id
5-
description: Unique A/B test ID.
5+
description: Unique A/B test identifier.
66
required: true
77
schema:
8-
type: integer
9-
example: 390
8+
$ref: '#/abTestID'
109

1110
# misc
1211
index:
@@ -16,37 +15,39 @@ index:
1615

1716
abTestID:
1817
type: integer
19-
description: Unique A/B test ID.
18+
description: Unique A/B test identifier.
2019
example: 224
2120

2221
endAt:
2322
type: string
24-
description: End date timestamp in [ISO-8601](https://wikipedia.org/wiki/ISO_8601) format.
25-
example: '2023-06-17T00:00:00Z'
23+
description: End date and time of the A/B test, in RFC 3339 format.
24+
example: 2023-06-17T00:00:00Z
2625

2726
createdAt:
2827
type: string
29-
description: Creation date timestamp in [ISO-8601](https://wikipedia.org/wiki/ISO_8601) format.
30-
example: '2023-06-15T15:06:04.249906Z'
28+
description: Date and time when the A/B test was created, in RFC 3339 format.
29+
example: 2023-06-15T15:06:04.249906Z
3130

3231
updatedAt:
3332
type: string
34-
description: Update date timestamp in [ISO-8601](https://wikipedia.org/wiki/ISO_8601) format.
35-
example: '2023-06-15T15:06:44.400601Z'
33+
description: Date and time when the A/B test was last updated, in RFC 3339 format.
34+
example: 2023-06-15T15:06:44.400601Z
3635

3736
name:
3837
type: string
3938
description: A/B test name.
40-
example: 'Custom ranking sales rank test'
39+
example: Custom ranking sales rank test
4140

4241
description:
4342
type: string
44-
description: A/B test description.
45-
example: 'Current production index'
43+
description: Description for this variant.
44+
example: Current production index
4645

4746
trafficPercentage:
4847
type: integer
49-
description: A/B test traffic percentage.
48+
description: Percentage of search requests each variant receives.
49+
minimum: 0
50+
maximum: 100
5051
example: 60
5152

5253
currencies:
@@ -65,6 +66,7 @@ currencies:
6566
standardDeviation: 10.3
6667
additionalProperties:
6768
$ref: '#/currency'
69+
x-additionalPropertiesName: currency code
6870

6971
currency:
7072
type: object

specs/abtesting/common/schemas/ABTest.yml

Lines changed: 102 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ ABTests:
55
items:
66
$ref: '#/ABTest'
77
- type: 'null'
8+
description: No A/B tests are configured for this application.
89

910
ABTest:
1011
type: object
@@ -13,45 +14,62 @@ ABTest:
1314
abTestID:
1415
$ref: '../parameters.yml#/abTestID'
1516
clickSignificance:
17+
description: |
18+
A/B test significance calculated from click events.
19+
20+
Values of 0.95 or higher can be considered significant,
21+
that is, the difference between A and B variants is _not_ due to random variations.
22+
Lower values have a.
1623
oneOf:
1724
- type: number
1825
format: double
19-
description: >
20-
[A/B test significance](https://www.algolia.com/doc/guides/ab-testing/what-is-ab-testing/in-depth/how-ab-test-scores-are-calculated/#statistical-significance-or-chance) based on click data. A value of 0.95 or over is considered to be _significant_.
2126
example: 1
2227
- type: 'null'
2328
conversionSignificance:
29+
description: |
30+
A/B test significance calculated from conversion events.
31+
32+
Values of 0.95 or higher can be considered significant,
33+
that is, the difference between A and B variants is _not_ due to random variations.
2434
oneOf:
2535
- type: number
2636
format: double
27-
description: >
28-
[A/B test significance](https://www.algolia.com/doc/guides/ab-testing/what-is-ab-testing/in-depth/how-ab-test-scores-are-calculated/#statistical-significance-or-chance) based on conversion. A value of 0.95 or over is considered to be _significant_.
2937
example: 1
3038
- type: 'null'
3139
addToCartSignificance:
40+
description: |
41+
A/B test significance calculated from add-to-cart events.
42+
43+
Values of 0.95 or higher can be considered significant,
44+
that is, the difference between A and B variants is _not_ due to random variations.
3245
oneOf:
3346
- type: number
3447
format: double
35-
description: >
36-
[A/B test significance](https://www.algolia.com/doc/guides/ab-testing/what-is-ab-testing/in-depth/how-ab-test-scores-are-calculated/#statistical-significance-or-chance) based on add-to-cart data. A value of 0.95 or over is considered to be _significant_.
3748
example: 1
3849
- type: 'null'
3950
purchaseSignificance:
51+
description: |
52+
A/B test significance calculated from purchase events.
53+
54+
Values of 0.95 or higher can be considered significant,
55+
that is, the difference between A and B variants is _not_ due to random variations.
4056
oneOf:
4157
- type: number
4258
format: double
43-
description: >
44-
[A/B test significance](https://www.algolia.com/doc/guides/ab-testing/what-is-ab-testing/in-depth/how-ab-test-scores-are-calculated/#statistical-significance-or-chance) based on purchase data. A value of 0.95 or over is considered to be _significant_.
4559
example: 1
4660
- type: 'null'
4761
revenueSignificance:
62+
description: |
63+
A/B test significance calculated from revenue data.
64+
65+
Values of 0.95 or higher can be considered significant,
66+
that is, the difference between A and B variants is _not_ due to random variations.
4867
oneOf:
4968
- type: object
5069
additionalProperties:
5170
type: number
5271
format: double
53-
description: >
54-
[A/B test significance](https://www.algolia.com/doc/guides/ab-testing/what-is-ab-testing/in-depth/how-ab-test-scores-are-calculated/#statistical-significance-or-chance) based on revenue data. A value of 0.95 or over is considered to be _significant_.
72+
x-additionalPropertiesName: currency code
5573
example:
5674
USD: 1
5775
EUR: 0.87
@@ -65,11 +83,11 @@ ABTest:
6583
name:
6684
$ref: '../parameters.yml#/name'
6785
status:
68-
type: string
69-
description: A/B test status.
70-
example: 'running'
86+
$ref: '#/Status'
7187
variants:
7288
$ref: 'Variant.yml#/variants'
89+
configuration:
90+
$ref: '#/ABTestConfiguration'
7391
required:
7492
- status
7593
- name
@@ -83,3 +101,74 @@ ABTest:
83101
- revenueSignificance
84102
- abTestID
85103
- variants
104+
105+
Status:
106+
type: string
107+
description: |
108+
A/B test status.
109+
110+
- `active`. The A/B test is live and search traffic is split between the two variants.
111+
- `stopped`. You stopped the A/B test. The A/B test data is still available for analysis.
112+
- `expired`. The A/B test was automatically stopped after reaching its end date.
113+
- `failed`. Creating the A/B test failed.
114+
example: active
115+
enum:
116+
- active
117+
- stopped
118+
- expired
119+
- failed
120+
121+
ABTestConfiguration:
122+
title: configuration
123+
type: object
124+
description: A/B test configuration.
125+
properties:
126+
outliers:
127+
$ref: '#/Outliers'
128+
emptySearch:
129+
$ref: '#/EmptySearch'
130+
minimumDetectableEffect:
131+
$ref: '#/MinimumDetectableEffect'
132+
required:
133+
- outliers
134+
135+
Outliers:
136+
type: object
137+
description: Configuration for handling outliers.
138+
properties:
139+
exclude:
140+
type: boolean
141+
description: Whether to exclude outliers when calculating A/B test results.
142+
default: true
143+
144+
EmptySearch:
145+
type: object
146+
description: Configuration for handling empty searches.
147+
properties:
148+
exclude:
149+
type: boolean
150+
description: Whether to exclude empty searches when calculating A/B test results.
151+
152+
MinimumDetectableEffect:
153+
type: object
154+
description: Configuration for the smallest difference between test variants you want to detect.
155+
properties:
156+
size:
157+
type: number
158+
format: double
159+
minimum: 0
160+
maximum: 1
161+
description: |
162+
Smallest difference in an observable metric between variants.
163+
For example, to detect a 10% difference between variants, set this value to 0.1.
164+
effect:
165+
$ref: '#/Effect'
166+
167+
Effect:
168+
type: string
169+
description: Metric for which you want to detect the smallest relative difference.
170+
enum:
171+
- addToCartRate
172+
- clickThroughRate
173+
- conversionRate
174+
- purchaseRate

specs/abtesting/common/schemas/AddABTestsVariant.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,10 @@ abTestsVariant:
2424

2525
customSearchParams:
2626
type: object
27-
description: Applies search parameters from [a restricted set of options](https://www.algolia.com/doc/api-reference/api-methods/add-ab-test/#method-param-customsearchparameters). Only use this parameter if the two variants use the same index.
28-
example: {'typoTolerance': false,'synonyms': false}
27+
description: |
28+
Search parameters to add to the test variant.
29+
Only use this parameter if the two variants use the same index.
30+
example: {'typoTolerance': false, 'synonyms': false}
2931
additionalProperties: false
3032
properties:
3133
customSearchParameters:

specs/abtesting/common/schemas/Variant.yml

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
variants:
22
type: array
3-
description: A/B test variants.
3+
description: |
4+
A/B test variants.
5+
6+
The first variant is your _control_ index, typically your production index.
7+
The second variant is an index with changed settings that you want to test against the control.
48
items:
59
$ref: '#/variant'
610

@@ -16,13 +20,15 @@ variant:
1620
oneOf:
1721
- type: number
1822
format: double
19-
description: Variant's [add-to-cart rate](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#add-to-cart-rate).
23+
description: |
24+
[Add-to-cart rate](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#add-to-cart-rate) for this variant.
2025
example: 0.0
2126
- type: 'null'
2227
averageClickPosition:
2328
oneOf:
2429
- type: integer
25-
description: Variant's [average click position](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-position).
30+
description: |
31+
[Average click position](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-position) for this variant.
2632
example: 0
2733
- type: 'null'
2834
clickCount:
@@ -33,7 +39,8 @@ variant:
3339
oneOf:
3440
- type: number
3541
format: double
36-
description: Variant's [click-through rate](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-through-rate).
42+
description: |
43+
[Click-through rate](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#click-through-rate) for this variant.
3744
example: 0.22219857724813036
3845
- type: 'null'
3946
conversionCount:
@@ -44,7 +51,8 @@ variant:
4451
oneOf:
4552
- type: number
4653
format: double
47-
description: Variant's [conversion rate](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#conversion-rate).
54+
description: |
55+
[Conversion rate](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#conversion-rate) for this variant.
4856
example: 0.14546725846658964
4957
- type: 'null'
5058
currencies:
@@ -53,7 +61,10 @@ variant:
5361
$ref: '../parameters.yml#/description'
5462
estimatedSampleSize:
5563
type: integer
56-
description: The estimated number of searches that will need to be run to achieve the desired confidence level and statistical power. A `minimumDetectableEffect` must be set in the `configuration` object for this to be used.
64+
description: |
65+
Estimated number of searches required to achieve the desired statistical significance.
66+
67+
The A/B test configuration must include a `mininmumDetectableEffect` setting for this number to be included in the response.
5768
example: 0
5869
filterEffects:
5970
$ref: '../parameters.yml#/filterEffects'
@@ -62,7 +73,7 @@ variant:
6273
noResultCount:
6374
oneOf:
6475
- type: integer
65-
description: Number of [searches without results](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#searches-without-results) for that variant.
76+
description: Number of [searches without results](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#searches-without-results) for this variant.
6677
example: 0
6778
- type: 'null'
6879
purchaseCount:
@@ -73,13 +84,14 @@ variant:
7384
oneOf:
7485
- type: number
7586
format: double
76-
description: Variant's [purchase rate](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#purchase-rate).
87+
description: |
88+
[Purchase rate](https://www.algolia.com/doc/guides/search-analytics/concepts/metrics/#purchase-rate) for this variant.
7789
example: 0.0
7890
- type: 'null'
7991
searchCount:
8092
oneOf:
8193
- type: integer
82-
description: Number of searches carried out during the A/B test.
94+
description: Number of searches for this variant.
8395
example: 86269
8496
- type: 'null'
8597
trackedSearchCount:
@@ -89,13 +101,13 @@ variant:
89101
userCount:
90102
oneOf:
91103
- type: integer
92-
description: Number of users during the A/B test.
104+
description: Number of users that made searches to this variant.
93105
example: 55501
94106
- type: 'null'
95107
trackedUserCount:
96108
oneOf:
97109
- type: integer
98-
description: Number of users that performed a tracked search during the A/B test.
110+
description: Number of users that made tracked searches to this variant.
99111
example: 55501
100112
- type: 'null'
101113
required:

0 commit comments

Comments
 (0)