AutoML Entity Extraction for Healthcare offre un punto di partenza per addestrare modelli personalizzati di Natural Natural Healthcare.
Preparazione dei dati di addestramento
Per addestrare un modello AutoML Entity Extraction for Healthcare, fornisci campioni rappresentativi del tipo di testo medico che vuoi analizzare e annota le etichette che identificano i tipi di entità che il modello personalizzato vuoi identificare. Tieni presenti i seguenti suggerimenti per la compilazione dei dati di addestramento:
- Per addestrare il tuo modello personalizzato devi fornire tra 50 e 100.000 campioni di testo medico.
- Puoi etichettare il testo medico scegliendo tra 1 e 100 etichette uniche per annotare le entità che vuoi che il modello impari a estrarre.
- Ogni annotazione è un intervallo di testo e un'etichetta associata.
- I nomi delle etichette possono essere compresi tra 2 e 30 caratteri.
- Ogni etichetta può includere un'annotazione compresa tra 1 e 10 parole.
- Per addestrare un modello in modo efficace, il set di dati di addestramento deve utilizzare ogni etichetta almeno 200 volte.
Se prendi nota di un tipo di documento strutturato o semi-strutturato, come una fattura medica o un modulo di consenso, AutoML Natural Language può prendere in considerazione la posizione di un'annotazione sulla pagina come fattore che contribuisce all'etichetta appropriata.
Formattazione dei documenti di addestramento
Per formattare i documenti di addestramento, carica i dati di addestramento su AutoML Natural Language come file JSONL che contengono il testo e i documenti di esempio. Ogni riga del file è un singolo documento di addestramento, specificato in una delle seguenti forme:
- L'intero contenuto del documento, compreso tra 10 e 10.000 byte (codifica UTF-8)
- L'URI di un file PDF da un bucket Cloud Storage associato al tuo progetto
Puoi annotare i documenti di testo direttamente prima di caricarli, nell'interfaccia utente di Natural Language Dopo il caricamento di documenti non annotati o aggiungere annotazioni a documenti annotati in precedenza nell'interfaccia utente.
Documenti JSON
Per aiutarti a creare file JSON di addestramento, AutoML Natural Language offre uno script Python che converte i file di testo normale in file JSONL formattati correttamente. Per informazioni dettagliate, leggi i commenti nello script.
Ogni documento nel file JSONL ha uno dei seguenti formati:
Per i documenti non annotati:
{ "text_snippet": {"content": string} }
Per i documenti annotati:
{ "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} }
Nei file JSONL di esempio:
- Ogni elemento
text_extraction
identifica un'annotazione all'interno dell'elementotext_snippet.content
.text_extraction
indica la posizione del testo annotato specificando il numero di caratteri dall'inizio all'inizio ditext_snippet.content
(start_offset
) e fine (end_offset
). display_name
è l'etichetta dell'entità.start_offset
eend_offset
sono offset di caratteri e non offset di byte. Il carattereend_offset
non è incluso nel testo
Per ulteriori informazioni, consulta
TextSegment
.
Gli elementi text_extraction
sono facoltativi; puoi ometterli se prevedi di
annotare il documento utilizzando l'interfaccia utente di AutoML Natural Language. Ogni annotazione può includere fino a dieci token, in genere parole. Non possono sovrapporsi, ovvero il start_offset
di un'annotazione non può essere compreso tra start_offset
e end_offset
di un'altra annotazione nello stesso documento.
Il seguente esempio di documento di addestramento identifica le malattie specifiche menzionate in un riepilogo del corpo 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 " } }
Documenti PDF
Ogni documento deve essere una sola riga nel file JSONL. L'esempio seguente include interruzioni di riga per una migliore leggibilità; devi rimuoverle nel file JSONL.
Per ulteriori informazioni, vedi jsonlines.org. Per caricare un file PDF come documento, aggrega il percorso del file all'interno di un elemento JSONL document
come mostrato nell'esempio seguente:
{ "document": { "input_config": { "gcs_source": { "input_uris": [ "gs://cloud-ml-data/NL-entity/sample.pdf" ] } } } }
Il valore dell'elemento input_uris
è il percorso di un file PDF in un bucket Cloud Storage associato al progetto. La dimensione massima del file PDF è di 2 MB.