This section describes metrics available for experiments.Documentation Index
Fetch the complete documentation index at: https://doc.lucidworks.com/llms.txt
Use this file to discover all available pages before exploring further.
Click-Through Rate
The Click-Through Rate (CTR) metric provides the rate of clicks per query for a variant. The CTR is a number between 0 and 1, that is, what proportion of queries lead to clicks. Variants with a CTR closer to 1 perform better than variants with a lower rate. CTR is cumulative, that is, each time it is calculated, it is calculated from the beginning of the experiment. After each variant has reached a stable level, you should not see large day-to-day fluctuations in the CTR. The automatically-created job that generates the Click-Through Rate metrics is named<EXPERIMENT-NAME>-<METRIC-NAME>, for example, Experiment-CTR.
Conversion Rate
The Conversion Rate metric provides the rate of some type of signal per variant, that is, what proportion of queries lead to some type of signal, such ascart, purchase or like signals. (These signal types are not predefined.)
For example, if you are interested in how many queries convert into cart signals, specify the cart signal type in the conversion rate metric.
The Click-Through Rate metric is a conversion rate for click signals.
The automatically-created job that generates the Conversion Rate metrics is named <EXPERIMENT-NAME>-<METRIC-NAME>, for example, Experiment-Conversion.
Mean Reciprocal Rank (MRR)
The Mean Reciprocal Rank (MRR) metric measures the position of documents that were clicked on in ranked results. It ranges from 0 (at the very bottom) to 1 (at the very top). MRR penalizes clicks that occur further down in the results, which indicate a ranking issue where relevant documents are not ranked high enough. Variants with an MRR closer to 1 indicate that users are clicking on documents that have higher ranks. The automatically-created job that generates the Mean Reciprocal Rank metrics is named<EXPERIMENT-NAME>-<METRIC-NAME>, for example, Experiment-MRR.
Response Time
The Response Time metric computes the named statistic (for example,mean, variance or max) from response-time data. The default statistic is avg (average, the same as mean).
You can use the Response Time metric to evaluate the impact of adding additional stages to a query pipeline, for example, a recommendation or machine learning stage.
The response time is the end-to-end processing time from when a query pipeline receives a query to when the pipeline supplies a response:
- No Experiment stage. If a query pipeline does not have an Experiment stage, then there is no experiment-processing overhead in the response times.
- Experiment stage. If a query pipeline includes an Experiment stage, then processing by that stage is included in the response times.
<EXPERIMENT-NAME>-<METRIC-NAME>, for example, Experiment-Response_time.
Supported functions
When adding the Response Time metric to an experiment, specify one of these Spark SQL function names or aliases for the Statistic.| Function name or alias | Description |
|---|---|
avg | Mean response time |
kurtosis | Kurtosis of the response times |
max | Maximum response time |
mean | Mean response time |
median | Median response time. This is an alias for percentile(query_time,0.5). |
min | Minimum response time |
percentile_N | Nth percentile of the response times, that is, the value at or closest to the percentile. N is an integer between 1 and 100. This is an alias for the function percentile(query_time,N/100). |
skewness | Skewness of the response times |
sum | Sum of the response times |
stddev | Standard deviation of the response times |
variance | Variance of the response times |
Custom SQL
Under the covers, Lucidworks Search computes all experiment metrics using Lucidworks Search’s SQL aggregation engine. The Custom SQL metric lets you define your own SQL to compute a metric per variant. The SQL must project these three columns in the final output, and perform a GROUP BY onvariant_id:
value.* A double field that represents the metric provided by this custom SQLcount.* The number of rows used to compute the value for a variant, that is, how many signals contributed to this valuevariant_id. The unique identifier of the variant
variant_queries is built into the experiment job framework. This view is transient and is not defined in the table catalog; it only exists for the duration of the metrics job. The variant_queries view exposes all response signals for a given variant ID. The variant_queries view exposes the following fields pulled from response signals:
| Field | Description |
|---|---|
id | Response signal ID set by a query pipeline and returned to the client application using the x-fusion-query-id response header |
variant_id | Experiment variant this response signal is associated with |
query_doc_ids | Comma-delimited list of document IDs returned in the response, in ranked order |
query_timestamp | ISO-8601 timestamp for the time when Lucidworks Search executed the query |
query_user_id | User associated with the query. The front-end application must supply this. |
query_rows | Number of rows returned for this query, that is, the page size |
query_hits | Total number of documents that match this query, that is, the number of documents that were found |
query_offset | Page offset |
query_time | Total time to execute the query (in milliseconds) |
fusion_query_id field to join the variant_signals view with other signal types such as click. For example, if you want to get a count of clicks per variant, you would use:
- At line 1, we project the required
value,count, andvariant_idcolumns as the output for our custom SQL; this is required for all custom SQL metrics. - At line 2, we use a built-in macro that represents the input collection for our metrics job. The SQL engine replaces the
${inputCollection}variable with the correct collection name at runtime, which is typically a signals collection. - At line 3, we use the
fusion_query_idcolumn to joinclicksignals with theidcolumn of thevariant_queriesview. This illustrates how thevariant_queriesview helps simplify the SQL you have to write to build a custom metric. - At line 4, we filter signals to only include
clicksignals. Behind the scenes, Lucidworks Search will send a query to Solr withfq=type:click. - At line 5, we group by the variant_id to compute the aggregated metrics for each variant; all Custom SQL must perform a group by variant_id.
query_offset and query_rows columns associated with each click in a variant:
<EXPERIMENT-NAME>-<METRIC-NAME>, for example, Experiment-SQL.
Query Relevance
The Query Relevance metric calculates the performance of queries against a “gold standard” or “ground truth” dataset that lists which documents should be returned for each query. You can either predetermine the queries that will be used and the documents that should be returned, and place them in a Solr collection in the correct format, or let thegroundTruth job use historical click signals to generate the ground truth data automatically.
Note that the Query Relevance metric does not calculate metrics based on live traffic. Instead, it issues the queries specified in the ground truth collection against each variant, and calculates the performance of the queries.
The jobs that generate the Query Relevance metrics are named <EXPERIMENT-NAME>-groundTruth-<METRIC-NAME> and <EXPERIMENT-NAME>-rankingMetrics-<METRIC-NAME>, for example, Experiment-groundTruth-QR and Experiment-rankingMetrics-QR.
ImportantYou must run the
groundTruth job by hand the first time. Query Relevance rankingMetrics jobs that run before the groundTruth job runs do not produce metrics. Subsequently, the groundTruth job runs once a month.Ground Truth Queries
Query relevance metrics rely on having a set of queries and a list of documents that should be returned for those queries in ranked order. Specifically, a ground truth dataset contains tuples of query + document ID + weight, such as the following data for a fictitious Home Improvement search application:| Query | Document ID | Weight |
|---|---|---|
| hammer | 123 | 0.9 |
| hammer | 456 | 0.8 |
| hammer | 789 | 0.7 |
| masking tape | 234 | 0.85 |
| masking tape | 567 | 0.82 |
| masking tape | 890 | 0.76 |