SA_TRAIN_MODEL

Use this procedure to train a sentiment classifier. You must provide a training set consisting of categorized documents to train the sentiment classifier.

Documents can be in any format supported by Oracle Text and must belong to one or more categories.

Oracle Text first validates the training set table and the categories that are provided. Features extracted from the training set documents are used to train the sentiment classifier. A rule table is created and populated with rules that are generated after the sentiment classifier is trained. The sentiment classifier uses these rules to perform sentiment analysis. The CTXRULE index on the rule table is also built.

Note: When downgrading the database, you must drop any models that were created in Oracle Database 12c Release 2 (12.2) using SA_TRAIN_MODEL. These models are not compatible with earlier releases. The following error occurs if the models are not dropped before the downgrade: ORA-40350: One or more models exist that cannot be downgraded.

Syntax

SA_TRAIN_MODEL(
    clsfier_name IN VARCHAR2,
    index_name IN VARCHAR2,
    docid IN VARCHAR2,
    cattab IN VARCHAR2,
    catdocid IN VARCHAR2,
    catid IN VARCHAR2,
    pref_name IN VARCHAR2
);

**clsfier_name**

Specify the name of the sentiment classifier that must be trained. The maximum length of the sentiment classifier name is 24 bytes.

index_name

Specify the name of text index associated with the document training set. This is a CONTEXT index that must be created on the training data before the sentiment classifier is trained.

docid

Specify the name of the document ID column in the document training set. The document IDs in this column must be unique, and this column must be of data type NUMBER. The values for this column must be stored in an unsigned 32-bit integer and must be in the range 0 to 4294967295.

cattab

Specify the name of the category table that contains the true labels for the training set documents. This table should contain the docid to catid mappings for training the sentiment classifier.

catdocid

Specify the name of document ID column in the category table. The document IDs in this table must also exist in the document table. This column must be a NUMBER. The values for this column must be stored in an unsigned 32-bit integer and must be in the range 0 to 4294967295.

catid

Specify the name of the category ID column in the category table. This column must be a NUMBER. The values for this column can be either 0, 1, or 2. 0 stands for neutral, 1 stands for positive, and 2 stands for negative.

pref_name

Specify the name of sentiment classifier preference, of type SENTIMENT_CLASSIFIER, which is used to train the sentiment classifier. If no name is provided, then the default sentiment classifier, CTXSYS.DEFAULT_SENT_CLASSIFIER, is used.

Related Topics