Restez organisé à l'aide des collections Enregistrez et classez les contenus selon vos préférences.
Les algorithmes de classification de texte sont au cœur de nombreux systèmes logiciels qui traitent les données textuelles à grande échelle. Le logiciel de messagerie utilise la classification du texte pour déterminer si les messages entrants sont envoyés dans la boîte de réception ou filtrés dans le dossier "Spam". Les forums de discussion utilisent la classification du texte pour déterminer si les commentaires doivent être signalés comme inappropriés.
Il s'agit de deux exemples de classification de sujets, catégorisant un document texte dans l'un des ensembles prédéfinis de sujets. Dans de nombreux problèmes de classification thématique, cette catégorisation est principalement basée sur les mots clés contenus dans le texte.
Figure 1: La classification des sujets permet de repérer les spams entrants qui sont filtrés dans un dossier de spam.
Un autre type de classification de texte courant est l'analyse des sentiments, qui vise à identifier la polarité du contenu textuel: le type d'opinion qu'il exprime. Il peut s'agir d'une note binaire "J'aime"/"Je n'aime pas" ou d'un ensemble plus précis d'options, comme une note entre 1 et 5. Par exemple, l'analyse des sentiments consiste à analyser les posts Twitter pour déterminer si les internautes ont aimé le film "La Panthère Noire", ou à extrapoler l'opinion générale du public concernant une nouvelle marque de chaussures Nike à partir des avis de Walmart.
Ce guide présente des bonnes pratiques essentielles de machine learning pour résoudre les problèmes de classification de texte. Dans ce document, vous découvrirez :
Workflow de bout en bout permettant de résoudre les problèmes de classification de texte à l'aide du machine learning
Choisir le modèle adapté à votre problème de classification de texte
Implémenter le modèle de votre choix avec TensorFlow
Workflow de classification de texte
Voici une vue d'ensemble du workflow utilisé pour résoudre les problèmes liés au machine learning:
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2022/09/27 (UTC).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Il n'y a pas l'information dont j'ai besoin","missingTheInformationINeed","thumb-down"],["Trop compliqué/Trop d'étapes","tooComplicatedTooManySteps","thumb-down"],["Obsolète","outOfDate","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Mauvais exemple/Erreur de code","samplesCodeIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 2022/09/27 (UTC)."],[[["\u003cp\u003eText classification algorithms are widely used to categorize text data, with applications like spam filtering and content moderation.\u003c/p\u003e\n"],["\u003cp\u003eTopic classification and sentiment analysis are two common types of text classification, focusing on categorizing text into predefined topics and identifying the sentiment expressed, respectively.\u003c/p\u003e\n"],["\u003cp\u003eThis guide provides a comprehensive workflow for solving text classification problems using machine learning, including data gathering, exploration, preparation, model building, training, evaluation, hyperparameter tuning, and deployment.\u003c/p\u003e\n"],["\u003cp\u003eChoosing the right machine learning model is crucial for effective text classification and is discussed in detail within the guide.\u003c/p\u003e\n"],["\u003cp\u003eTensorFlow is used to implement the chosen model for practical application in text classification tasks.\u003c/p\u003e\n"]]],[],null,["Text classification algorithms are at the heart of a variety of software\nsystems that process text data at scale. Email software uses text classification\nto determine whether incoming mail is sent to the inbox or filtered into the\nspam folder. Discussion forums use text classification to determine whether\ncomments should be flagged as inappropriate.\n\nThese are two examples of topic classification, categorizing a text document\ninto one of a predefined set of topics. In many topic classification problems,\nthis categorization is based primarily on keywords in the text.\n\n**Figure 1: Topic classification is used to flag incoming spam emails, which\nare filtered into a spam folder.**\n\nAnother common type of text classification is ***sentiment analysis***, whose\ngoal is to identify the polarity of text content: the type of opinion it\nexpresses. This can take the form of a binary like/dislike rating, or a more\ngranular set of options, such as a star rating from 1 to 5. Examples of\nsentiment analysis include analyzing Twitter posts to determine if people\nliked the Black Panther movie, or extrapolating the general public's opinion\nof a new brand of Nike shoes from Walmart reviews.\n\nThis guide will teach you some key machine learning best practices for solving\ntext classification problems. Here's what you'll learn:\n\n- The high-level, end-to-end workflow for solving text classification problems using machine learning\n- How to choose the right model for your text classification problem\n- How to implement your model of choice using TensorFlow\n\nText Classification Workflow\n\nHere's a high-level overview of the workflow used to solve machine learning problems:\n\n- [Step 1: Gather Data](/machine-learning/guides/text-classification/step-1)\n- [Step 2: Explore Your Data](/machine-learning/guides/text-classification/step-2)\n- *[Step 2.5: Choose a Model\\*](/machine-learning/guides/text-classification/step-2-5)*\n- [Step 3: Prepare Your Data](/machine-learning/guides/text-classification/step-3)\n- [Step 4: Build, Train, and Evaluate Your Model](/machine-learning/guides/text-classification/step-4)\n- [Step 5: Tune Hyperparameters](/machine-learning/guides/text-classification/step-5)\n- [Step 6: Deploy Your Model](/machine-learning/guides/text-classification/step-6)\n\n**Figure 2: Workflow for solving machine learning problems**\n| \"Choose a model\" is not a formal step of the traditional machine learning workflow; however, selecting an appropriate model for your problem is a critical task that clarifies and simplifies the work in the steps that follow.\n\nThe following sections explain each step in detail, and how to implement them for text data."]]