US 20030212851 A1 Abstract A system, method, and computer program product provides a useful measure of the accuracy of a Naïve Bayes predictive model and reduced computational expense relative to conventional techniques. A method for measuring accuracy of a Naive Bayes predictive model comprises the steps of receiving a training dataset comprising a plurality of rows of data, building a Naïve Bayes predictive model using the training dataset, for each of at least a portion of the plurality of rows of data in the training dataset incrementally untraining the Naïve Bayes predictive model using the row of data and determining an accuracy of the incrementally untrained Naïve Bayes predictive model, and determining an aggregate accuracy of the Naïve Bayes predictive model.
Claims(33) 1. A method for measuring accuracy of a Naïve Bayes predictive model comprising the steps of:
defining code executable by a database management system for performing cross-validation of the Naïve Bayes predictive model;
executing the defined code so as to perform cross-validation of the Naïve Bayes predictive model; and
outputting an indication of the accuracy of the Naïve Bayes predictive model.
2. The method of receiving a training dataset comprising a plurality of rows of data; building a Naïve Bayes predictive model using the training dataset; for each of at least a portion of the plurality of rows of data in the training dataset: incrementally untraining the Naïve Bayes predictive model using the row of data, and determining an accuracy of the incrementally untrained Naïve Bayes predictive model; and determining an aggregate accuracy of the Naïve Bayes predictive model. 3. The method of computing probabilities of target values based on counts of occurrences of target values in training dataset.
4. The method of if a target value of the row of data equals a target value being computed, computing a probability of the target value based on a count of occurrence of the target value minus one; and
if the target value of the row of data does not equal the target value being computed, computing a probability of the target value based on the count of occurrence of the target value.
5. The method of applying the incrementally untrained Naïve Bayes predictive model to the row of data to generate an output; and
determining an error between the model output and the row of data.
6. The method of determining an average of the determined errors between the model output and the row of data.
7. A system for measuring accuracy of a Naïve Bayes predictive model comprising:
a processor operable to execute computer program instructions;
a memory operable to store computer program instructions executable by the processor; and
computer program instructions stored in the memory and executable to perform the steps of:
defining code executable by a database management system for performing cross-validation of the Naïve Bayes predictive model;
executing the defined code so as to perform cross-validation of the Naïve Bayes predictive model; and
outputting an indication of the accuracy of the Naïve Bayes predictive model.
8. The system of receiving a training dataset comprising a plurality of rows of data; building a Naïve Bayes predictive model using the training dataset; for each of at least a portion of the plurality of rows of data in the training dataset:
incrementally untraining the Naïve Bayes predictive model using the row of data, and
determining an accuracy of the incrementally untrained Naïve Bayes predictive model; and
determining an aggregate accuracy of the Naïve Bayes predictive model. 9. The system of computing probabilities of target values based on counts of occurrences of target values in training dataset.
10. The system of if a target value of the row of data equals a target value being computed, computing a probability of the target value based on a count of occurrence of the target value minus one; and
if the target value of the row of data does not equal the target value being computed, computing a probability of the target value based on the count of occurrence of the target value.
11. The system of applying the incrementally untrained Naïve Bayes predictive model to the row of data to generate an output; and
determining an error between the model output and the row of data.
12. The system of determining an average of the determined errors between the model output and the row of data.
13. A computer program product for measuring accuracy of a Naïve Bayes predictive model comprising:
a computer readable medium;
computer program instructions, recorded on the computer readable medium, executable by a processor, for performing the steps of:
defining code executable by a database management system for performing cross-validation of the Naïve Bayes predictive model;
executing the defined code so as to perform cross-validation of the Naïve Bayes predictive model; and
outputting an indication of the accuracy of the Naïve Bayes predictive model.
14. The computer program product of receiving a training dataset comprising a plurality of rows of data; building a Naïve Bayes predictive model using the training dataset; for each of at least a portion of the plurality of rows of data in the training dataset:
incrementally untraining the Naïve Bayes predictive model using the row of data, and
determining an accuracy of the incrementally untrained Naïve Bayes predictive model; and
determining an aggregate accuracy of the Naïve Bayes predictive model. 15. The computer program product of computing probabilities of target values based on counts of occurrences of target values in training dataset.
16. The computer program product of if a target value of the row of data equals a target value being computed, computing a probability of the target value based on a count of occurrence of the target value minus one; and
if the target value of the row of data does not equal the target value being computed, computing a probability of the target value based on the count of occurrence of the target value.
17. The computer program product of applying the incrementally untrained Naïve Bayes predictive model to the row of data to generate an output; and
determining an error between the model output and the row of data.
18. The computer program product of determining an average of the determined errors between the model output and the row of data.
19. A method for measuring accuracy of a Naïve Bayes predictive model comprising the steps of:
receiving a training dataset comprising a plurality of partitions of rows of data;
building a Naïve Bayes predictive model using the training dataset;
for each of at least a portion of the plurality of partitions of data in the training dataset:
incrementally untraining the Naïve Bayes predictive model using rows of data in the partition, and
determining an accuracy of the incrementally untrained Naïve Bayes predictive model; and
determining an aggregate accuracy of the Naïve Bayes predictive model.
20. The method of 21. The method of if a target value of a row of data in the partition equals a target value being computed, computing a probability of the target value based on a count of occurrence of the target value minus one; and
if the target value of the row of data in the partition does not equal the target value being computed, computing a probability of the target value based on the count of occurrence of the target value.
22. The method of determining an error between the model output and the row of data.
23. The method of determining an average of the determined errors between the model output and the row of data.
24. A system for measuring accuracy of a Naïve Bayes predictive model comprising:
a processor operable to execute computer program instructions;
a memory operable to store computer program instructions executable by the processor; and
computer program instructions stored in the memory and executable to perform the steps of:
receiving a training dataset comprising a plurality of partitions of rows of data;
building a Naïve Bayes predictive model using the training dataset;
for each of at least a portion of the plurality of partitions of data in the training dataset:
incrementally untraining the Naïve Bayes predictive model using rows of data in the partition, and
determining an accuracy of the incrementally untrained Naïve Bayes predictive model; and
determining an aggregate accuracy of the Naïve Bayes predictive model.
25. The system of 26. The system of if a target value of a row of data in the partition equals a target value being computed, computing a probability of the target value based on a count of occurrence of the target value minus one; and
if the target value of the row of data in the partition does not equal the target value being computed, computing a probability of the target value based on the count of occurrence of the target value.
27. The system of determining an error between the model output and the row of data.
28. The system of determining an average of the determined errors between the model output and the row of data.
29. A computer program product for measuring accuracy of a Naïve Bayes predictive model comprising:
a computer readable medium;
computer program instructions, recorded on the computer readable medium, executable by a processor, for performing the steps of:
receiving a training dataset comprising a plurality of partitions of rows of data;
building a Naïve Bayes predictive model using the training dataset;
for each of at least a portion of the plurality of partitions of data in the training dataset:
incrementally untraining the Naïve Bayes predictive model using rows of data in the partition, and
determining an accuracy of the incrementally untrained Naïve Bayes predictive model; and
determining an aggregate accuracy of the Naïve Bayes predictive model.
30. The computer program product of 31. The computer program product of if a target value of a row of data in the partition equals a target value being computed, computing a probability of the target value based on a count of occurrence of the target value minus one; and
if the target value of the row of data in the partition does not equal the target value being computed, computing a probability of the target value based on the count of occurrence of the target value.
32. The computer program product of determining an error between the model output and the row of data.
33. The computer program product of determining an average of the determined errors between the model output and the row of data.
Description [0001] The benefit of provisional application 60/379,110, filed May 10, 2002, under 35 U.S.C. §119(e), is hereby claimed. [0002] The present invention relates to a system, method, and computer program product for measuring accuracy of a Naive Bayes predictive model using cross-validation. [0003] Data mining is a technique by which hidden patterns may be found in a group of data. True data mining doesn't just change the presentation of data, but actually discovers previously unknown relationships among the data. Data mining is typically implemented as software in association with database systems. Data mining includes several major steps. First, data mining models are generated by based on one or more data analysis algorithms. Initially, the models are “untrained”, but are “trained” by processing training data and generating information that defines the model. The generated information is then deployed for use in data mining, for example, by providing predictions of future behavior or recommendations for actions to be taken based on specific past behavior. [0004] One particularly useful type of data mining model is based on the Bayesian classification technique. Bayesian classifiers are statistical classifiers. They can predict class membership probabilities, such as the probability that a given sample belongs to a particular class. Bayesian classification is based on Bayes theorem. Studies comparing classification algorithms have found a simple Bayesian classifier known as the naive Bayesian classifier to be comparable in performance with decision tree and neural network classifiers. Bayesian classifiers have also exhibited high accuracy and speed when applied to large databases. [0005] Users of a data mining predictive model benefit from knowing in advance how accurate a model's predictions will be. Cross-validation is one technique for measuring the accuracy of a predictive model. Leave-one-out cross-validation is an especially accurate special case of cross-validation, but it is ordinarily computationally expensive. Thus, a need arises for a technique by which leave-one-out cross-validation may be performed that provides a useful measure of the accuracy of a predictive model, but that provides reduced computational expense relative to conventional techniques. [0006] The present invention is a system, method, and computer program product that provides a useful measure of the accuracy of a Naïve Bayes predictive model, but that provides reduced computational expense relative to conventional techniques. [0007] In one embodiment of the present invention, a method for measuring accuracy of a Naïve Bayes predictive model comprises the steps of defining code executable by a database management system for performing cross-validation of the Naïve Bayes predictive model, executing the defined code so as to perform cross-validation of the Naïve Bayes predictive model, and outputting a an indication of the accuracy of the Naïve Bayes predictive model. The executing step may comprise the steps of receiving a training dataset comprising a plurality of rows of data, building a Naïve Bayes predictive model using the training dataset, for each of at least a portion of the plurality of rows of data in the training dataset, incrementally untraining the Naïve Bayes predictive model using the row of data, and determining an accuracy of the incrementally untrained Naïve Bayes predictive model, and determining an aggregate accuracy of the Naïve Bayes predictive model. [0008] The step of building the Naïve Bayes predictive model using the training dataset may comprise the step of computing probabilities of target values based on counts of occurrences of target values in training dataset. The step of incrementally untraining the Naïve Bayes predictive model may comprise the steps of if a target value of the row of data equals a target value being computed, computing a probability of the target value based on a count of occurrence of the target value minus one and if the target value of the row of data does not equal the target value being computed, computing a probability of the target value based on the count of occurrence of the target value. The step of determining an accuracy of the incrementally untrained Naïve Bayes predictive model may comprise the steps of applying the incrementally untrained Naïve Bayes predictive model to the row of data to generate an output and determining an error between the model output and the row of data. The step of determining an aggregate accuracy of the Naïve Bayes predictive model may comprise the step of determining an average of the determined errors between the model output and the row of data. [0009] In one embodiment of the present invention, a method for measuring accuracy of a Naïve Bayes predictive model comprises the steps of receiving a training dataset comprising a plurality of partitions of rows of data, building a Naïve Bayes predictive model using the training dataset, for each of at least a portion of the plurality of partitions of data in the training dataset, incrementally untraining the Naïve Bayes predictive model using rows of data in the partition, and determining an accuracy of the incrementally untrained Naïve Bayes predictive model, and determining an aggregate accuracy of the Naïve Bayes predictive model. The step of building the Naïve Bayes predictive model using the training dataset may comprise the step of computing probabilities of target values based on counts of occurrences of target values in training dataset. The step of incrementally untraining the Naïve Bayes predictive model may comprise the steps of if a target value of a row of data in the partition equals a target value being computed, computing a probability of the target value based on a count of occurrence of the target value minus one, and if the target value of the row of data in the partition does not equal the target value being computed, computing a probability of the target value based on the count of occurrence of the target value. The step of determining an accuracy of the incrementally untrained Naïve Bayes predictive model may comprise the steps of applying the incrementally untrained Naïve Bayes predictive model to the row of data to generate an output, and determining an error between the model output and the row of data. The step of determining an aggregate accuracy of the Naïve Bayes predictive model may comprise the step of determining an average of the determined errors between the model output and the row of data. [0010] The details of the present invention, both as to its structure and operation, can best be understood by referring to the accompanying drawings, in which like reference numbers and designations refer to like elements. [0011]FIG. 1 is an exemplary data flow diagram of a data mining process, including building and scoring of models and generation of predictions/recommendations. [0012]FIG. 2 is an exemplary block diagram of a data mining system, in which the present invention may be implemented. [0013]FIG. 3 is an exemplary flow diagram of a process of leave-one-out cross-validation of a Naïve Bayes model, according to the present invention. [0014]FIG. 4 is an exemplary data flow diagram of the processing shown in FIG. 3 and FIG. 5. [0015]FIG. 5 is an exemplary flow diagram of a process of n-fold cross-validation of a Naïve Bayes model, according to the present invention. [0016] An exemplary data flow diagram of a data mining process, including building and scoring of models and generation of predictions/recommendations, is shown in FIG. 1. The training/model building step [0017] Training/model building step [0018] Scoring step [0019] Scored data [0020] An exemplary block diagram of a data mining system [0021] Input/output circuitry [0022] Memory [0023] In the example shown in FIG. 2, memory [0024] As shown in FIG. 2, the present invention contemplates implementation on a system or systems that provide multi-processor, multi-tasking, multi-process, and/or multi-thread computing, as well as implementation on systems that provide only single processor, single thread computing. Multi-processor computing involves performing computing using more than one processor. Multi-tasking computing involves performing computing using more than one operating system task. A task is an operating system concept that refers to the combination of a program being executed and bookkeeping information used by the operating system. Whenever a program is executed, the operating system creates a new task for it. The task is like an envelope for the program in that it identifies the program with a task number and attaches other bookkeeping information to it. Many operating systems, including UNIX®, OS/20, and WINDOWS®, are capable of running many tasks at the same time and are called multitasking operating systems. Multi-tasking is the ability of an operating system to execute more than one executable at the same time. Each executable is running in its own address space, meaning that the executables have no way to share any of their memory. This has advantages, because it is impossible for any program to damage the execution of any of the other programs running on the system. However, the programs have no way to exchange any information except through the operating system (or by reading files stored on the file system). Multi-process computing is similar to multi-tasking computing, as the terms task and process are often used interchangeably, although some operating systems make a distinction between the two. [0025] The most straightforward way to determine accuracy is to build a model using a portion of the available training data, and compute the model's error rate when applied to the remainder of the data. If the same data were used both for building the model and for scoring, the model would be given an unfair advantage that would artificially inflate its apparent accuracy. When working with a limited amount of training data, however, setting aside enough data to support an accurate scoring measure might seriously detract from the quality of the model, which generally improves as more data is available. Cross-validation is a way to mitigate this problem. [0026] With leave-n-out cross-validation, the training data is divided into n partitions, each containing approximately 1/n of the data's records. Next, n models are built; for each model, all but one of the partitions are used for training, and the remaining one is used for scoring the model's accuracy. Typically, the accuracy measures are then averaged together. [0027] Leave-one-out cross-validation is a special case of leave-n-out cross-validation. In leave-one-out cross-validation, the number of partitions is equal to the number of training records, and each partition consists of a single record. Thus, the number of models equals the number of training records, with each model being built from almost all the training data. Building so many models is computationally expensive. But with Naïve Bayes models, there is a shortcut: it is possible to build a single model, using all the training data, and then quickly modify the model to make it as though a particular record had not been used when building the model. This process can be called “incrementally untraining” the model for that record. By measuring the model's accuracy on each training record, first temporarily incrementally untraining the model for that record, we obtain the same result as by building many models, but without incurring the greatly multiplied expense of actually building them. [0028] Naïve Bayes uses Bayes' Theorem, combined with a (“naive”) presumption of conditional independence, to predict, for each record (a set of values, one for each field), the value of a target (output) field, from evidence given by one or more predictor (input) fields. [0029] Given target field T with possible values T1, . . . Tm, and predictor fields I1, . . . In, with values (in the current record) of I1*, . . . In*, the probability that the target T has value T [0030] Thus, the probability of each target value is straightforwardly computed by multiplying and dividing several counts; these counts are part of the Naive Bayes model itself. Incremental untraining in support of leave-one-out cross-validation is accomplished simply by multiplying or dividing by one less than the specified count (provided that the current training record's target value equals the value whose probability is being computed; otherwise, the specified count is used without modification). Likewise, incremental untraining in support of leave-n-out cross-validation is accomplished simply by multiplying or dividing by n less than the specified count (provided that the current training record's target value equals the value whose probability is being computed; otherwise, the specified count is used without modification). [0031] An exemplary flow diagram of a process [0032] In step [0033] In step [0034] In step [0035] When all rows in training dataset [0036] An exemplary flow diagram of a process [0037] In step [0038] In step [0039] In step [0040] When all partitions in training dataset [0041] Thus, the model (or a copy thereof) is trained once and untrained once for each training record, merely doubling the amount of work, instead of requiring n times as much work to build n models conventionally. [0042] It is important to note that while the present invention has been described in the context of a fully functioning data processing system, those of ordinary skill in the art will appreciate that the processes of the present invention are capable of being distributed in the form of a computer readable medium of instructions and a variety of forms and that the present invention applies equally regardless of the particular type of signal bearing media actually used to carry out the distribution. Examples of computer readable media include recordable-type media such as floppy disc, a hard disk drive, RAM, and CD-ROM's, as well as transmission-type media, such as digital and analog communications links. [0043] Although specific embodiments of the present invention have been described, it will be understood by those of skill in the art that there are other embodiments that are equivalent to the described embodiments. Accordingly, it is to be understood that the invention is not to be limited by the specific illustrated embodiments, but only by the scope of the appended claims. Referenced by
Classifications
Legal Events
Rotate |