<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
  <channel>
    <title><![CDATA[Elastic Cloud Hosted - Elasticsearch Labs]]></title>
    <description><![CDATA[Articles and tutorials from the Search team at Elastic]]></description>
    <copyright><![CDATA[© 2026. Elasticsearch B.V. All Rights Reserved]]></copyright>
    <image>
      <title><![CDATA[Elastic Cloud Hosted - Elasticsearch Labs]]></title>
      <url>https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt1121c0bf0e8a6e65/6a88da6340a1841030ef456f/search-labs-thumbnail.png</url>
      <link>https://www.elastic.co/jp/search-labs/blog/category/elastic-cloud-hosted</link>
    </image>
    <link>https://www.elastic.co/jp/search-labs/blog/category/elastic-cloud-hosted</link>
    <atom:link href="https://www.elastic.co/jp/search-labs/rss/category/elastic-cloud-hosted.xml" rel="self" type="application/rss+xml"/>
    <language><![CDATA[jp]]></language>
    <lastBuildDate>Wed, 23 Sep 2026 10:46:05 GMT</lastBuildDate>
  <item>
    <title><![CDATA[ユーザー行動データに基づく判断リストを使用して Elasticsearch で LTR モデルをトレーニングする]]></title>
    <description><![CDATA[UBI データを使用して判断リストを作成し、Elasticsearch での Learning to Rank (LTR) モデルのトレーニングを自動化する方法を学びます。]]></description>
    <content:encoded><![CDATA[<p><a href="https://www.elastic.co/docs/solutions/search/ranking/learning-to-rank-ltr"><em><strong>ランク付け学習</strong></em></a>モデルを使用する際の大きな課題は、モデルをトレーニングするための高品質の<a href="https://www.elastic.co/search-labs/blog/judgment-lists"><em><strong>判断リスト</strong></em></a>を作成することです。従来、このプロセスでは、クエリとドキュメントの関連性を<em><strong>手動で</strong></em>評価し、それぞれにグレードを割り当てていました。これは、拡張性が低く、維持が困難な、時間のかかるプロセスです (数百のエントリを含むリストを手動で更新する必要があることを想像してください)。</p><p>さて、検索アプリケーションでの実際のユーザーインタラクションを使用してこのトレーニングデータを作成できたらどうなるでしょうか?<a href="https://www.elastic.co/search-labs/blog/elasticsearch-plugin-user-behavior-insights"><em><strong>UBI</strong></em></a>データを使用すると、まさにそれが実現できます。検索、クリック、その他のインタラクションをキャプチャして使用し、判断リストを生成できる自動システムを作成します。このプロセスは、手動による操作よりもはるかに簡単に拡張および繰り返すことができ、より良い結果が得られる傾向があります。このブログでは、Elasticsearch に保存されている UBI データをクエリして意味のある信号を計算し、 <a href="https://www.elastic.co/search-labs/blog/elasticsearch-learning-to-rank-introduction"><em><strong>LTR</strong></em></a>モデルのトレーニング データセットを生成する方法について説明します。</p><p><em><strong>完全な実験は</strong></em><a href="https://github.com/Alex1795/elastic-ltr-judgement_list-blog.git"><em><strong> ここで</strong></em></a><em><strong> ご覧いただけます 。</strong></em></p><h2>UBIデータがLTRモデルのトレーニングに役立つ理由</h2><p>UBI データには、手動による注釈に比べていくつかの利点があります。</p><ul><li><p><strong>量:</strong> UBI データは実際のやり取りから得られるため、手動で生成できるよりもはるかに多くのデータを収集できます。もちろん、このデータを生成するのに十分なトラフィックがあることを前提としています。</p></li><li><p><strong>実際のユーザーの意図:</strong>従来、手動の判断リストは、利用可能なデータの専門家による評価から作成されます。一方、UBI データは実際のユーザー行動を反映しています。これは、何が関連しているべきかという理論的な仮定ではなく、ユーザーが実際にコンテンツとやりとりして価値を見出す方法に基づいているため、検索システムの精度を向上させる、より優れたトレーニング データを生成できることを意味します。</p></li><li><p><strong>継続的な更新:</strong>判断リストは時間の経過とともに更新する必要があります。UBI データから作成すれば、最新のデータが得られ、判断リストが更新されます。</p></li><li><p><strong>コスト効率:</strong>判断リストを手動で作成するオーバーヘッドがないため、プロセスを何度でも効率的に繰り返すことができます。</p></li><li><p><strong>自然なクエリ分布</strong>: UBI データは実際のユーザー クエリを表し、より深い変化を促すことができます。たとえば、ユーザーはシステム内で検索する際に自然言語を使用しているでしょうか?もしそうなら、セマンティック検索またはハイブリッド検索アプローチを実装する必要があるかもしれません。</p></li></ul><p>ただし、いくつかの警告も伴います。</p><ul><li><p><strong>バイアスの増幅:</strong>人気のあるコンテンツは、露出が増えるため、クリックされる可能性が高くなります。そのため、人気のあるアイテムが強調され、より良い選択肢が埋もれてしまう可能性があります。</p></li><li><p><strong>カバレッジが不完全:</strong>新しいコンテンツにはインタラクションがないため、結果の上位に表示されることは難しい可能性があります。まれなクエリでは、意味のあるトレーニング データを作成するのに十分なデータ ポイントが不足している場合もあります。</p></li><li><p><strong>季節的な変動:</strong>ユーザーの行動が時間の経過とともに劇的に変化することが予想される場合、履歴データからは、どのような結果が適切であるかについてあまり情報が得られない可能性があります。</p></li><li><p><strong>タスクの曖昧さ:</strong>クリックしても、ユーザーが探していたものが見つかるとは限らない。</p></li></ul><h2>成績計算</h2><h3>LTRトレーニングのグレード</h3><p>LTR モデルをトレーニングするには、ドキュメントがクエリにどの程度関連しているかを数値で表現する必要があります。私たちの実装では、この数値は 0.0 から 5.0+ までの連続したスコアであり、スコアが高いほど関連性が高くなります。</p><p>この評価システムがどのように機能するかを示すために、手動で作成された次の例を考えてみましょう。</p><p>クエリ</p><p>文書の内容</p><p>学年</p><p>説明</p><p>「最高のピザレシピ」</p><p>「本格的なイタリアンピザ生地のレシピ（写真付きステップバイステップ）」</p><p>4.0</p><p>関連性が高く、まさにユーザーが探しているもの</p><p>「最高のピザレシピ」</p><p>「イタリアのピザの歴史」</p><p>1.0</p><p>ピザに関する内容ですが、レシピではありません</p><p>「最高のピザレシピ」</p><p>「初心者向け15分でできる簡単ピザレシピ」</p><p>3.0</p><p>関連性があり、良い結果ですが、「最高」のレシピとは言えないかもしれません。</p><p>「最高のピザレシピ」</p><p>「車のメンテナンスガイド」</p><p>0.0</p><p>全く関係ありません。クエリとは全く関係ありません。</p><p>ここからわかるように、グレードは、ドキュメントが「最高のピザのレシピ」というサンプルクエリにどれだけ関連しているかを数値で表したものです。これらのスコアを使用して、LTR モデルはどのドキュメントを結果の上位に表示する必要があるかを学習できます。</p><p>成績の計算方法は、トレーニング データセットの中核です。これを行うには<a href="https://www.elastic.co/search-labs/blog/judgment-lists">複数のアプローチ</a>があり、それぞれに長所と短所があります。たとえば、関連性がある場合は 1、関連性がない場合は 0 というバイナリ スコアを割り当てたり、クエリごとに結果のドキュメントのクリック数をカウントしたりすることもできます。</p><p>このブログ投稿では、<em><strong>ユーザーの行動を入力として考慮し、グレード番号を出力として計算する、</strong></em>異なるアプローチを使用します。また、ドキュメントの関連性に関係なく、検索結果の上位の方がクリックされる傾向があるという事実から生じる可能性のあるバイアスも修正します。</p><h2>成績の計算 - COECアルゴリズム</h2><p>COEC ( <a href="https://www.wsdm-conference.org/2010/proceedings/docs/p351.pdf">Clicks over Expected Clicks</a> ) アルゴリズムは、ユーザーのクリックから判断グレードを計算する手法です。前述したように、ユーザーは、ドキュメントがクエリに最も関連していない場合でも、上位に表示された結果をクリックする傾向があります。これは、<a href="https://eugeneyan.com/writing/position-bias/">ポジション バイアス</a>と呼ばれます。COEC アルゴリズムを使用する際の基本的な考え方は、すべてのクリックが同等に重要であるわけではないということです。つまり、位置 10 のドキュメントをクリックすると、位置 1 のドキュメントをクリックするよりも、そのドキュメントがクエリとの関連性がはるかに高いことを示します。COEC アルゴリズムに関する研究論文 (上記リンク) を引用します。</p><p><em>「検索結果や広告のクリック率（CTR）は、検索結果の順位によって大幅に低下することがよく知られています。」</em></p><p>ポジションバイアスの詳細については、<a href="https://www.researchgate.net/publication/200110550_An_experimental_comparison_of_click_position-bias_models">こちらを</a>ご覧ください。</p><p>COEC アルゴリズムを使用してこれに対処するには、次の手順に従います。</p><p><strong>1. 位置のベースラインを確立する:</strong>検索位置ごとに 1 から 10 までのクリック率 (CTR) を計算します。つまり、通常、ユーザーの何パーセントが位置 1、位置 2 などをクリックするかを決定します。このステップでは、ユーザーの自然な位置の偏りを捉えます。CTR は次のように計算します。</p><p>どこ：</p><p>p = 位置。1から10まで
Cp = すべてのクエリにおける位置pでの合計クリック数（任意のドキュメント）
 Ip = 総表示回数: すべてのクエリで、任意のドキュメントが位置 p に表示された回数</p><p>ここでは、上位の順位の方がクリック数が多くなると予想されます。</p><p><strong>2.</strong><strong>予想クリック数（EC）を計算する</strong>:</p><p>この指標は、ドキュメントが表示された位置とその位置のCTRに基づいて、ドキュメントが「受け取るべき」クリック数を決定します。ECは次の方法で計算します。</p><p>どこ：</p><p>Qd = 文書dが出現したすべてのクエリ
pos(d,q) = クエリqの結果における文書dの位置</p><p>3.<strong>実際のクリック数をカウントする:</strong>ドキュメントが表示されたすべてのクエリでドキュメントが受け取った実際の合計クリック数をカウントします。以降、 <strong>A(d) と呼びます。</strong></p><p>4. <strong>COECスコアを計算します。</strong>これは、実際のクリック数（A(d)）と予想クリック数（EC(d)）の比率です。</p><p>このメトリックは、次のように位置バイアスを正規化します。</p><ul><li><p>スコア 1.0 は、ドキュメントが表示された位置に応じて、期待どおりに実行されたことを意味します。</p></li><li><p>スコアが 1.0 を超える場合、ドキュメントの位置を見ると予想よりもパフォーマンスが優れていることを意味します。したがって、このドキュメントはクエリに対してより関連性があります。</p></li><li><p>スコアが 1.0 未満の場合、ドキュメントの位置から判断すると、予想よりもパフォーマンスが悪かったことを意味します。したがって、このドキュメントはクエリとの関連性が低くなります。</p></li></ul><p><em><strong>最終結果は、検索システムとの実際のやりとりから抽出された位置ベースの期待を考慮して、ユーザーが探しているものを捉えたグレード番号になります。</strong></em></p><h2>技術的な実装</h2><p>LTR モデルをトレーニングするための判断リストを作成するスクリプトを作成します。</p><p>このスクリプトの入力は、Elastic でインデックス化された UBI データ (クエリとイベント) です。</p><p>出力は、COEC アルゴリズムを使用してこれらの UBI ドキュメントから生成された CSV ファイル内の判断リストです。この判断リストを<a href="https://www.elastic.co/search-labs/blog/elasticsearch-learning-to-rank-introduction">Eland</a>で使用すると、関連する特徴を抽出し、LTR モデルをトレーニングできます。</p><h3>クイックスタート</h3><p>このブログのサンプル データから判断リストを生成するには、次の手順に従います。</p><p>1. リポジトリをクローンします。</p>git clone https://github.com/Alex1795/elastic-ltr-judgement_list-blog.git  
cd elastic-ltr-judgement_list-blog<p>2. 必要なライブラリをインストールする</p><p>このスクリプトには、次のライブラリが必要です。</p><ul><li><p><em>pandas</em> : 判定リストを保存する</p></li><li><p><em>elasticsearch</em> : ElasticデプロイメントからUBIデータを取得する</p></li></ul><p>Python 3.11も必要です</p>pip install -r requirements.txt<p>3. <a href="https://github.com/Alex1795/elastic-ltr-judgement_list-blog/blob/main/.env-example">.envファイル</a>でElasticデプロイメントの環境変数を更新します。</p><ul><li><p>ES_ホスト</p></li><li><p>API_キー</p></li></ul><p>環境変数を追加するには、次を使用します。</p>source .env<p>4. ubi_queries、ubi_events インデックスを作成し、サンプル データをアップロードします。setup.py ファイルを実行します。</p>python setup.py<p>5. Python スクリプトを実行します。</p>python judgement_list-generator.py<p>これらの手順に従うと、次のような judgement_list.csv という新しいファイルが表示されます。</p><img src="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt94317eda8f7af194/6a170aa46f7f04542f914821/2531090131ac9fe3e4e1d79de9d156fc47a7825a-782x531.png" alt="" /><p>このスクリプトは、以下に示す<strong>calculate_relevance_grade()</strong>関数を使用して、前に説明した COEC アルゴリズムを適用して成績を計算します。</p><h2>データアーキテクチャ</h2><h3>Ubiクエリ</h3><p>UBI クエリ インデックスには、検索システムで実行されたクエリに関する情報が含まれています。これはサンプルドキュメントです:</p>{
          "client_id": "client_002",
          "query": "italian pasta recipes",
          "query_attributes": {
            "search_type": "recipe",
            "category": "food",
            "cuisine": "italian"
          },
          "query_id": "q002",
          "query_response_id": "qr002",
          "query_response_object_ids": [
            "doc_011",
            "doc_012",
            "doc_013",
            "doc_014",
            "doc_015",
            "doc_016",
            "doc_017",
            "doc_018",
            "doc_019",
            "doc_020"
          ],
          "timestamp": "2024-08-14T11:15:00Z",
          "user_query": "italian pasta recipes"
        }<p>ここでは、ユーザー（client_id）、クエリの結果（query_response_object_ids）、クエリ自体（timestamp、user_query）のデータを見ることができます。</p><h3>Ubiクリックイベント</h3><p>ubi_events インデックスには、ユーザーが結果内のドキュメントをクリックするたびに収集されたデータが含まれています。これはサンプルドキュメントです:</p>{
          "action_name": "click",
          "application": "recipe_search",
          "client_id": "client_001",
          "event_attributes": {
            "object": {
              "description": "Authentic Italian Pizza Dough Recipe with Step-by-Step Photos",
              "device": "desktop",
              "object_id": "doc_001",
              "position": {
                "ordinal": 1,
                "page_depth": 1
              },
              "user": {
                "city": "New York",
                "country": "USA",
                "ip": "192.168.1.100",
                "location": {
                  "lat": 40.7128,
                  "lon": -74.006
                },
                "region": "NY"
              }
            }
          },
          "message": "User clicked on document doc_001",
          "message_type": "click",
          "query_id": "q001",
          "timestamp": "2024-08-14T10:31:00Z",
          "user_query": "best pizza recipe"
        }<h2>判定リスト生成スクリプト</h2><h3>スクリプトの一般的な概要</h3><p>このスクリプトは、Elasticsearch に保存されているクエリとクリック イベントからの UBI データを使用して、判断リストの生成を自動化します。次のタスクを実行します:</p><ul><li><p>Elasticsearch で UBI データを取得して処理します。</p></li><li><p>UBI イベントをそのクエリと関連付けます。</p></li><li><p>各位置の CTR を計算します。</p></li><li><p>各ドキュメントの予想クリック数 (EC) を計算します。</p></li><li><p>各ドキュメントの実際のクリック数をカウントします。</p></li><li><p>各クエリとドキュメントのペアの COEC スコアを計算します。</p></li><li><p>判定リストを生成し、CSVファイルに書き込みます。</p></li></ul><p>それぞれの機能を見ていきましょう。</p><h3>connect_to_elasticsearch()</h3>def connect_to_elasticsearch(host, api_key):
    """Create and return Elasticsearch client"""
    try:
        es = Elasticsearch(
            hosts=[host],
            api_key=api_key,
            request_timeout=60
        )
        # Test the connection
        if es.ping():
            print(f"✓ Successfully connected to Elasticsearch at {host}")
            return es
        else:
            print("✗ Failed to connect to Elasticsearch")
            return None
    except Exception as e:
        print(f"✗ Error connecting to Elasticsearch: {e}")
        return None<p>この関数は、ホストと API キーを使用して Elasticsearch クライアント オブジェクトを返します。</p><h3>fetch_ubi_data()</h3>def fetch_ubi_data(es_client: Elasticsearch, queries_index: str, events_index: str,
                   size: int = 10000) -&gt; Tuple[List[Dict], List[Dict]]:
    """
    Fetch UBI queries and events data from Elasticsearch indices.

    Args:
        es_client: Elasticsearch client
        queries_index: Name of the UBI queries index
        events_index: Name of the UBI events index
        size: Maximum number of documents to fetch

    Returns:
        Tuple of (queries_data, events_data)
    """
    logger.info(f"Fetching data from {queries_index} and {events_index}")

    # Fetch queries with error handling
    try:
        queries_response = es_client.search(
            index=queries_index,
            body={
                "query": {"match_all": {}},
                "size": size
            }
        )
        queries_data = [hit['_source'] for hit in queries_response['hits']['hits']]
        logger.info(f"Fetched {len(queries_data)} queries")

    except Exception as e:
        logger.error(f"Error fetching queries from {queries_index}: {e}")
        raise

    # Fetch events (only click events for now) with error handling
    try:
        events_response = es_client.search(
            index=events_index,
            body={
                "query": {
                    "term": {"message_type.keyword": "CLICK_THROUGH"}
                },
                "size": size
            }
        )
        events_data = [hit['_source'] for hit in events_response['hits']['hits']]
        logger.info(f"Fetched {len(events_data)} click events")

    except Exception as e:
        logger.error(f"Error fetching events from {events_index}: {e}")
        raise

    logger.info(f"Data fetch completed successfully - Queries: {len(queries_data)}, Events: {len(events_data)}")

    return queries_data, events_data<p>この関数はデータ抽出レイヤーであり、Elasticsearch に接続して match_all クエリを使用して UBI クエリを取得し、UBI イベントをフィルタリングして 'CLICK_THROUGH' イベントのみを取得します。</p><h3>プロセスubi_data()</h3>def process_ubi_data(queries_data: List[Dict], events_data: List[Dict]) -&gt; pd.DataFrame:
    """
    Process UBI data and generate judgment list.

    Args:
        queries_data: List of query documents from UBI queries index
        events_data: List of event documents from UBI events index

    Returns:
        DataFrame with judgment list (qid, docid, grade, keywords)
    """
    logger.info("Processing UBI data to generate judgment list")

    # Group events by query_id
    clicks_by_query = {}
    for event in events_data:
        query_id = event['query_id']
        if query_id not in clicks_by_query:
            clicks_by_query[query_id] = {}

        # Extract clicked document info
        object_id = event['event_attributes']['object']['object_id']
        position = event['event_attributes']['object']['position']['ordinal']

        clicks_by_query[query_id][object_id] = {
            'position': position,
            'timestamp': event['timestamp']
        }

    judgment_list = []

    # Process each query
    for query in queries_data:
        query_id = query['query_id']
        user_query = query['user_query']
        document_ids = query['query_response_object_ids']

        # Get clicks for this query
        query_clicks = clicks_by_query.get(query_id, {})

        # Generate judgment for each document shown
        for doc_id in document_ids:
            grade = calculate_relevance_grade(doc_id, query_clicks, document_ids, queries_data, events_data)

            judgment_list.append({
                'qid': query_id,
                'docid': doc_id,
                'grade': grade,
                'query': user_query
            })

    df = pd.DataFrame(judgment_list)
    logger.info(f"Generated {len(df)} judgment entries for {df['qid'].nunique()} unique queries")

    return df<p>この関数は判定リストの生成を処理します。UBI イベントとクエリを関連付けることで、UBI データの処理を開始します。次に、ドキュメントとクエリのペアごとに calculate_relevance_grade() 関数を呼び出して、判断リストのエントリを取得します。最後に、結果のリストを pandas データフレームとして返します。</p><h3>関連性グレードを計算する()</h3>def calculate_relevance_grade(document_id: str, clicks_data: Dict,
                              query_response_ids: List[str], all_queries_data: List[Dict] = None,
                              all_events_data: List[Dict] = None) -&gt; float:
    """
    Calculate COEC (Click Over Expected Clicks) relevance score for a document.

    Args:
        document_id: ID of the document
        clicks_data: Dictionary of clicked documents with their positions for current query
        query_response_ids: List of document IDs shown in search results (ordered by position)
        all_queries_data: All queries data for calculating position CTR averages
        all_events_data: All events data for calculating position CTR averages

    Returns:
        COEC relevance score (continuous value, typically 0.0 to 5.0+)
    """

    # If no global data provided, fall back to simple position-based grading
    if all_queries_data is None or all_events_data is None:
        logger.warning("No global data provided, falling back to position-based grading")
        # Simple fallback logic
        if document_id in clicks_data:
            position = clicks_data[document_id]['position']
            if position &gt; 3:
                return 4.0
            elif position &gt;= 1 and position &lt;= 3:
                return 3.0
        if document_id in query_response_ids:
            position = query_response_ids.index(document_id) + 1
            if position &lt;= 5:
                return 2.0
            elif position &gt;= 6 and position &lt;= 10:
                return 1.0
        return 0.0

    # Calculate rank-aggregated click-through rates
    position_ctr_averages = {}
    position_impression_counts = {}
    position_click_counts = {}

    # Initialize counters
    for pos in range(1, 11):  # Positions 1-10
        position_impression_counts[pos] = 0
        position_click_counts[pos] = 0

    # Count impressions (every document shown contributes)
    for query in all_queries_data:
        for i, doc_id in enumerate(query['query_response_object_ids'][:10]):  # Top 10 positions
            position = i + 1
            position_impression_counts[position] += 1

    # Count clicks by position
    for event in all_events_data:
        if event.get('action_name') == 'click':
            position = event['event_attributes']['object']['position']['ordinal']
            if position &lt;= 10:
                position_click_counts[position] += 1

    # Calculate average CTR per position
    for pos in range(1, 11):
        if position_impression_counts[pos] &gt; 0:
            position_ctr_averages[pos] = position_click_counts[pos] / position_impression_counts[pos]
        else:
            position_ctr_averages[pos] = 0.0

    # Calculate expected clicks for this specific document
    expected_clicks = 0.0

    # Count how many times this document appeared at each position for any query
    for query in all_queries_data:
        if document_id in query['query_response_object_ids']:
            position = query['query_response_object_ids'].index(document_id) + 1
            if position &lt;= 10:
                expected_clicks += position_ctr_averages[position]

    # Count total actual clicks for this document across all queries
    actual_clicks = 0
    for event in all_events_data:
        if (event.get('action_name') == 'click' and
                event['event_attributes']['object']['object_id'] == document_id):
            actual_clicks += 1

    # Calculate COEC score
    if expected_clicks &gt; 0:
        coec_score = actual_clicks / expected_clicks
    else:
        coec_score = 0.0

    logger.debug(
        f"Document {document_id}: {actual_clicks} clicks / {expected_clicks:.3f} expected = {coec_score:.3f} COEC")

    return coec_score<p>これは COEC アルゴリズムを実装する関数です。各位置の CTR を計算し、次にドキュメントとクエリのペアの実際のクリック数を比較し、最後にそれぞれの実際の COEC スコアを計算します。</p><h3>判断統計を生成する()</h3>def generate_judgment_statistics(df: pd.DataFrame) -&gt; Dict:
    """Generate statistics about the judgment list."""
    stats = {
        'total_judgments': len(df),
        'unique_queries': df['qid'].nunique(),
        'unique_documents': df['docid'].nunique(),
        'grade_distribution': df['grade'].value_counts().to_dict(),
        'avg_judgments_per_query': len(df) / df['qid'].nunique() if df['qid'].nunique() &gt; 0 else 0,
        'queries_with_clicks': len(df[df['grade'] &gt; 1]['qid'].unique()),
        'click_through_rate': len(df[df['grade'] &gt; 1]) / len(df) if len(df) &gt; 0 else 0
    }
    return stats<p>判定リストから、合計クエリ数、合計ユニークドキュメント数、グレード分布などの有用な統計情報を生成します。これは純粋に情報提供であり、結果の判断リストは変更されません。</p><h2>結果と影響</h2><p>クイック スタート セクションの指示に従うと、320 エントリの判定リストを含む CSV ファイルが生成されます (リポジトリで<a href="https://github.com/Alex1795/elastic-ltr-judgement_list-blog/blob/main/judgment_list.csv">サンプル出力を</a>確認できます)。これらのフィールド:</p><ul><li><p>qid: クエリの一意のID</p></li><li><p>docid: 結果のドキュメントの一意の識別子</p></li><li><p>グレード: クエリとドキュメントのペアの計算されたグレード</p></li><li><p>クエリ: ユーザークエリ</p></li></ul><p> 「イタリア料理のレシピ」というクエリの結果を見てみましょう。</p><p>クイド</p><p>ドシド</p><p>学年</p><p>クエリ</p><p>q1-イタリア料理レシピ</p><p>パスタの基本レシピ</p><p>0.0</p><p>イタリアのレシピ</p><p>q1-イタリア料理レシピ</p><p>レシピ_ピザ_マルゲリータ</p><p>3.333333</p><p>イタリアのレシピ</p><p>q1-イタリア料理レシピ</p><p>レシピ_リゾット_ガイド</p><p>10.0</p><p>イタリアのレシピ</p><p>q1-イタリア料理レシピ</p><p>レシピ_フレンチ_クロワッサン</p><p>0.0</p><p>イタリアのレシピ</p><p>q1-イタリア料理レシピ</p><p>レシピ_スペイン_パエリア</p><p>0.0</p><p>イタリアのレシピ</p><p>q1-イタリア料理レシピ</p><p>ギリシャ風ムサカのレシピ</p><p>1.875</p><p>イタリアのレシピ</p><p>結果から、「イタリアのレシピ」というクエリに対して次のことがわかります。</p><ul><li><p>リゾットのレシピは間違いなくクエリに対する最高の結果であり、予想よりも10倍多くのクリックを獲得しています。</p></li><li><p>ピザ マルゲリータも素晴らしい出来栄えです。</p></li><li><p>ギリシャのムサカも（意外にも）良い結果であり、結果上の順位が示唆するよりも良い成績を残しています。これは、イタリア料理のレシピを探していた数人のユーザーが、代わりにこのレシピに興味を持ったことを意味します。おそらくこれらのユーザーは地中海料理全般に興味があるのでしょう。結局のところ、このことからわかるのは、これは上で説明した他の 2 つの「より良い」一致の下に表示される良い結果になる可能性があるということです。</p></li></ul><h2>まとめ</h2><p>UBI データを使用すると、LTR モデルのトレーニングを自動化し、独自のユーザーから高品質の判断リストを作成できます。UBI データは、検索システムがどのように使用されているかを反映する大きなデータセットを提供します。COEC アルゴリズムを使用して成績を生成することで、固有の偏りを考慮しながら、同時にユーザーがより良い結果と考えるものを反映します。ここで概説した方法は、実際のユースケースに適用でき、実際の使用傾向に合わせて進化する、より優れた検索エクスペリエンスを提供できます。</p>]]></content:encoded>
    <link>https://www.elastic.co/search-labs/blog/training-learning-to-rank-models-elasticsearch-ubi-data</link>
    <guid isPermaLink="true">https://www.elastic.co/search-labs/blog/training-learning-to-rank-models-elasticsearch-ubi-data</guid>
    <category><![CDATA[Python]]></category>
    <category><![CDATA[Elastic Cloud Hosted]]></category>
    <dc:creator><![CDATA[Alexander Dávila]]></dc:creator>
    <enclosure url="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt037eb2f4d380fe65/6a170aa67d8d67397170e6e6/762bf09c28829d626d42c2cfadc719e1dd618d1b-1536x1024.png" length="0" type="image/png"/>
    <pubDate>Wed, 15 Oct 2025 00:00:00 GMT</pubDate>
  </item>
  </channel>
</rss>