ヘルスケア医療機関向けのエンティティ抽出モデル

AutoML Entity Extraction for Healthcare は、カスタムの Healthcare Natural Language モデルのトレーニングを行う出発点として使用できます。

トレーニング データの準備

AutoML Entity Extraction for Healthcare モデルをトレーニングするには、分析する医療テキストの種類の代表的なサンプルを指定し、カスタムモデルに識別させるエンティティの種類を識別するラベルでアノテーションを付けます。トレーニング データをコンパイルするときは、次の推奨事項を考慮してください。

  • カスタムモデルをトレーニングするには、医療テキストのサンプルを 50~100,000 個用意する必要があります。
  • 医療テキストには、1~100 個の一意のラベルでラベルを付けて、モデルに抽出を学習させるエンティティにアノテーションを付けることができます。
  • 各アノテーションは、テキストの範囲と関連付けされたラベルです。
  • ラベル名は 2~30 文字にしてください。
  • 各ラベルでは、1~10 個の単語のアノテーション処理が可能です。
  • モデルを効率的にトレーニングするには、トレーニング データセットで各ラベルを 200 回以上使用する必要があります。

医療請求書や同意書フォームなどの構造化文書または半構造化文書にアノテーションを付ける場合、AutoML Natural Language はアノテーションのページ上の位置を適切なラベルの要素の 1 つとみなすことができます。

トレーニング ドキュメントのフォーマット

トレーニング ドキュメントをフォーマットするには、サンプル テキストおよびドキュメントを含む JSONL ファイルとして、AutoML Natural Language にトレーニング データをアップロードします。ファイルの各行は 1 つのトレーニング ドキュメントで、次のいずれかのフォームで指定します。

  • ドキュメントの完全な内容、10~10,000 バイト長(UTF-8 でエンコードされたもの)
  • プロジェクトに関連付けられた Cloud Storage バケットからの PDF ファイルの URI

アノテーションなしのドキュメントをアップロードした後に、AutoML Natural Language UI で、テキスト ドキュメントをアップロードする前にテキスト ドキュメントに直接アノテーションを付けることができます。また、UI で以前にアノテーションを付けたドキュメントにアノテーションを追加することもできます。

JSONL ドキュメント

JSONL トレーニング ファイルを作成するため、AutoML Natural Language には書式なしテキスト ファイルを適切な形式の JSONL ファイルに変換する Python スクリプトが用意されています。詳細については、スクリプトのコメントを参照してください。

JSONL ファイルの各ドキュメントには、次のいずれかの形式があります。

アノテーションのないドキュメントの場合:

{
  "text_snippet":
    {"content": string}
}

アノテーション付きドキュメントの場合:

{
  "annotations": [
     {
      "text_extraction": {
         "text_segment": {
            "end_offset": number, "start_offset": number
          }
       },
       "display_name": string
     },
     {
       "text_extraction": {
          "text_segment": {
             "end_offset": number, "start_offset": number
           }
        },
        "display_name": string
     },
   ...
  ],
  "text_snippet":
    {"content": string}
}

サンプル JSONL ファイルの内容:

  • text_extraction 要素が、text_snippet.content 内のアノテーションを識別します。text_extraction は、text_snippet.content の始まりからアノテーション付きテキストの最初(start_offset)と最後(end_offset)までの文字数を指定することで、テキストの位置を示します。
  • display_name はエンティティのラベルです。
  • start_offsetend_offset は、バイト オフセットではなく、文字オフセットです。end_offset の文字は、テキストに含まれません

詳細については、TextSegment をご覧ください。

text_extraction 要素はオプションです。AutoML Natural Language UI を使用してドキュメントにアノテーションを付ける場合は、省略できます。各アノテーションは最大 10 個のトークン(通常は単語)をカバーできます。アノテーションの重複は禁止されています。つまり、あるアノテーションの start_offset を、同じドキュメント内の別のアノテーションの start_offsetend_offset の間に配置することはできません。

以下のサンプル トレーニング ドキュメントは、アブストラクトに記載されている特定の疾患を NCBI コーパスから特定します。

{
  "annotations": [
    {
      "text_extraction": {
        "text_segment": {
          "end_offset": 67,
          "start_offset": 62
        }
      },
      "display_name": "Modifier"
    },
    {
      "text_extraction": {
        "text_segment": {
          "end_offset": 158,
          "start_offset": 141
        }
      },
      "display_name": "SpecificDisease"
    },
    {
      "text_extraction": {
        "text_segment": {
          "end_offset": 330,
          "start_offset": 290
        }
      },
      "display_name": "SpecificDisease"
    },
    {
      "text_extraction": {
        "text_segment": {
          "end_offset": 337,
          "start_offset": 332
        }
      },
      "display_name": "SpecificDisease"
    },
    {
      "text_extraction": {
        "text_segment": {
          "end_offset": 627,
          "start_offset": 610
        }
      },
      "display_name": "Modifier"
    },
    {
      "text_extraction": {
        "text_segment": {
          "end_offset": 754,
          "start_offset": 749
        }
      },
      "display_name": "Modifier"
    },
    {
      "text_extraction": {
        "text_segment": {
          "end_offset": 875,
          "start_offset": 865
        }
      },
      "display_name": "Modifier"
    },
    {
      "text_extraction": {
        "text_segment": {
          "end_offset": 968,
          "start_offset": 951
        }
      },
      "display_name": "Modifier"
    },
    {
      "text_extraction": {
        "text_segment": {
          "end_offset": 1553,
          "start_offset": 1548
        }
      },
      "display_name": "Modifier"
    },
    {
      "text_extraction": {
        "text_segment": {
          "end_offset": 1652,
          "start_offset": 1606
        }
      },
      "display_name": "CompositeMention"
    },
    {
      "text_extraction": {
        "text_segment": {
          "end_offset": 1833,
          "start_offset": 1826
        }
      },
      "display_name": "DiseaseClass"
    },
    {
      "text_extraction": {
        "text_segment": {
          "end_offset": 1860,
          "start_offset": 1843
        }
      },
      "display_name": "SpecificDisease"
    },
    {
      "text_extraction": {
        "text_segment": {
          "end_offset": 1930,
          "start_offset": 1913
        }
      },
      "display_name": "SpecificDisease"
    },
    {
      "text_extraction": {
        "text_segment": {
          "end_offset": 2129,
          "start_offset": 2111
        }
      },
      "display_name": "SpecificDisease"
    },
    {
      "text_extraction": {
        "text_segment": {
          "end_offset": 2188,
          "start_offset": 2160
        }
      },
      "display_name": "SpecificDisease"
    },
    {
      "text_extraction": {
        "text_segment": {
          "end_offset": 2260,
          "start_offset": 2243
        }
      },
      "display_name": "Modifier"
    },
    {
      "text_extraction": {
        "text_segment": {
          "end_offset": 2356,
          "start_offset": 2339
        }
      },
      "display_name": "Modifier"
    }
  ],
  "text_snippet": {
    "content": "10051005\tA common MSH2 mutation in English and North American HNPCC families:
      origin, phenotypic expression, and sex specific differences in colorectal cancer .\tThe
      frequency , origin , and phenotypic expression of a germline MSH2 gene mutation previously
      identified in seven kindreds with hereditary non-polyposis cancer syndrome (HNPCC) was
      investigated . The mutation ( A-- > T at nt943 + 3 ) disrupts the 3 splice site of exon 5
      leading to the deletion of this exon from MSH2 mRNA and represents the only frequent MSH2
      mutation so far reported . Although this mutation was initially detected in four of 33
      colorectal cancer families analysed from eastern England , more extensive analysis has
      reduced the frequency to four of 52 ( 8 % ) English HNPCC kindreds analysed . In contrast ,
      the MSH2 mutation was identified in 10 of 20 ( 50 % ) separately identified colorectal
      families from Newfoundland . To investigate the origin of this mutation in colorectal cancer
      families from England ( n = 4 ) , Newfoundland ( n = 10 ) , and the United States ( n = 3 ) ,
      haplotype analysis using microsatellite markers linked to MSH2 was performed . Within the
      English and US families there was little evidence for a recent common origin of the MSH2
      splice site mutation in most families . In contrast , a common haplotype was identified
      at the two flanking markers ( CA5 and D2S288 ) in eight of the Newfoundland families .
      These findings suggested a founder effect within Newfoundland similar to that reported by
      others for two MLH1 mutations in Finnish HNPCC families . We calculated age related risks
      of all , colorectal , endometrial , and ovarian cancers in nt943 + 3 A-- > T MSH2 mutation
      carriers ( n = 76 ) for all patients and for men and women separately . For both sexes combined ,
      the penetrances at age 60 years for all cancers  and for colorectal cancer were 0 . 86 and 0 . 57 ,
      respectively . The risk of colorectal cancer was significantly higher  in males
      than females ( 0 . 63 v 0 . 30 and 0 . 84 v 0 . 44 at ages 50 and 60 years , respectively ) .
      For females there was a high risk of endometrial cancer ( 0 . 5 at age 60 years ) and premenopausal
      ovarian cancer ( 0 . 2 at 50 years ) . These intersex differences in colorectal cancer risks
      have implications for screening programmes and for attempts to identify colorectal cancer
      susceptibility modifiers .\n "
  }
}

PDF ドキュメント

JSONL ファイルでの各ドキュメントは、1 行でなければなりません。次のサンプルでは、読みやすくするため改行されています。JSONL ファイルでは改行を削除してください。詳細については、jsonlines.org をご覧ください。PDF ファイルをドキュメントとしてアップロードするには、次のサンプルに示すように、ファイルパスを JSONL document 要素内にラップします。

{
  "document": {
    "input_config": {
      "gcs_source": {
        "input_uris": [ "gs://cloud-ml-data/NL-entity/sample.pdf" ]
      }
    }
  }
}

input_uris 要素の値は、プロジェクトに関連付けられた Cloud Storage バケット内の PDF ファイルのパスです。PDF ファイルの最大サイズは 2 MB です。