In Q, this tool uses a basic Large Language Model to categorize open-ended text responses and is capable of using partially categorized data to predict the classification of unclassified responses. Note that our AI Text Categorization module in Displayr is a far superior tool at creating categories from text data because it is built using Displayr AI. However, it uses the category label alone to classify data, whereas you can use partially classified data to predict categories for the remaining data using the Unstructured Text output. This might be preferred if you are working with very obscure themes in your responses.
For example, if you have text data that has been categorized for the first wave of a study, and you wish to use the same categorization for subsequent waves of the same study, you can use this tool. As mentioned, you can also do this with our AI Text Categorization module, but it doesn't use classified responses in the theme to classify new ones. The categories for all cases can then be saved using object inspector > Data > Save Variable(s) for further analysis. This can, in turn, be used to create a QCodes file for use within the AI Text Categorization module if you want to use that method later on.
Example
In Q, go to Create > Text Analysis > Automatic Categorization > Unstructured Text.
With Existing Categorization
- Under the Data tab in the object inspector, go to Data Source > Text variable and select a Text variable.
- Go to Categories > Existing Categorization and select an already categorized variable.
- Make any other selections or changes to the settings that you require.
- Ensure the Automatic box is checked, or click Calculate.
The output below shows automatically generated categories for a question on how people feel about their cell phone provider. The text variable has 2090 responses, 895 of which were provided in an existing categorization by a market researcher. Each row in the example column can be expanded to show all the text in the category. The performance metrics can be viewed in the main table, and the cross-validation performance is visible in the table that appears in the footer.
Without Existing Categorization
- Under Data > Categories > Category creation choose Create new categorization.
- Under Data > Data Source > Text variable select a Text variable.
- Make any other selections or changes to the settings that you require.
- Ensure the Automatic box is checked, or click Calculate
The output below shows automatically generated categories for a question on how people feel about Microsoft. Each row in the example column can be expanded to show all the text in the category.
Extracting a Table of Frequencies
Extracting the table of frequencies from this output can be done by saving the results as a variable into your Data Set and then making a table from that variable:
- Select the Unstructured Text output.
-
In the object inspector, select Save Variable(s) > Categories or First Category.
- Categories: Save variables to the data set containing the categories. Where there are multiple input variables, multiple sets of variables are added for each.
- First category: Save a variable to the data set containing the first category mentioned. Where there are multiple input categories, the first category of each will be saved as a separate variable.
A Question called "Categories from [name of text variable]" will be created in your Data Set. This can then be used like any other variable to create tables and further outputs.
Options
Data Source
Text variable The text variable to run automatic categorization on.
Truncate cases when characters exceed Truncate cases whose number of characters exceeds this number. This is done as the algorithm expects text data to consist of one sentence per case and may not function correctly when cases are too long. If any cases are truncated due to this setting, a warning will be shown, and it is likely that the data does not conform to this assumption (one sentence per case) and is not appropriate for this analysis.
Categories
Category creation Choose between Use existing categorization and Create new categorization.
Existing categorization A Nominal or Binary - Multi question containing an existing categorization to be used. This is hidden if you choose to create a new categorization.
Categories to Ignore Comma-separated list of categories to ignore in the input provided to Existing Categorization, typically used to remove the data reduction variables such as NET, Total, and SUM.
Number of categories The number of categories to automatically generate. This is hidden if you are using an existing categorization.
Translate (Google Cloud Translation)
Source language The language of the input text variable. To specify the language separately for each case, select "Specify with variable" (see Source language variable for more information). The input text is translated from the source language into English before categorization is performed. Translation is done using Google Cloud Translation, and results may change over time as the translation algorithm improves.
Source language variable A text/categorical variable containing the language for each case. Languages should be referred to by the language names in Source language. This control appears when Source language is set to "Specify with variable".
Output language The language of the categories and example text to display in the output.
Cross Validation
These controls are only available when an existing categorization is provided. When provided, the cases in the data that have been given an existing categorization are interpreted as the full training data set, and repeated random sub-sampling cross-validation is performed on the full training data set. In particular, the full training dataset is split into a training and a test dataset, where the test data has its existing categorization removed. The categorization for the test data is then predicted from the available data in the training sub-sample and performance table generated across all cross validation iterations. The controls below determine the size of the training data sub-sample and how many cross-validation iterations of this type are performed. If no existing categorization is provided, then these controls are hidden.
Sample size increment for cross-validation An integer that specifies how large the initial training data sub-sample size will be and how much it will grow for each repeated random sub-sampling cross-validation iteration that is performed. The default value is 50, meaning that the initial training sub-sample will have 50 observations from the full training data set, and 50 more observations will be added for each new cross-validation iteration that is performed.
Number of cross-validation iterations Number of cross-validation iterations to perform for the random sub-sampling cross-validation procedure described above. The default is four iterations, and the default value for the Sample size increment for cross-validation control above is 50. If n > 200 cases are provided for the existing categorization then this would result in 4 randomly generated training and cross validation splits of the full training data whereby the training sub samples will have 50, 100, 150 and 200 cases while the test sub samples will have n - 50, n - 100, n - 150 and n - 200 cases respectively over the four cross validation iterations.
Save Variable(s)
Save categories Adds variables to the data set containing the categories. Where there are multiple input variables, multiple sets of variables are added for each.
Save first category Adds a variable to the data set containing the first category mentioned. Where there are multiple input categories, the first category of each will be saved as a separate variable.