The ore.odmNMF
function builds an Oracle Data Mining Non-Negative Matrix Factorization (NMF) model for feature extraction. Each feature extracted by NMF is a linear combination of the original attribution set. Each feature has a set of non-negative coefficients, which are a measure of the weight of each attribute on the feature. If the argument allow.negative.scores
is TRUE
, then negative coefficients are allowed.
For information on the ore.odmNMF
function arguments, invoke help(ore.odmNMF)
.
Example 4-17 Using the ore.odmNMF Function
This example creates an NMF model on a training data set and scores on a test data set.
training.set <- ore.push(npk[1:18, c("N","P","K")]) scoring.set <- ore.push(npk[19:24, c("N","P","K")]) nmf.mod <- ore.odmNMF(~., training.set, num.features = 3) features(nmf.mod) summary(nmf.mod) predict(nmf.mod, scoring.set)Listing for Example 4-17
R> training.set <- ore.push(npk[1:18, c("N","P","K")]) R> scoring.set <- ore.push(npk[19:24, c("N","P","K")]) R> nmf.mod <- ore.odmNMF(~., training.set, num.features = 3) R> features(nmf.mod) FEATURE_ID ATTRIBUTE_NAME ATTRIBUTE_VALUE COEFFICIENT 1 1 K 0 3.723468e-01 2 1 K 1 1.761670e-01 3 1 N 0 7.469067e-01 4 1 N 1 1.085058e-02 5 1 P 0 5.730082e-01 6 1 P 1 2.797865e-02 7 2 K 0 4.107375e-01 8 2 K 1 2.193757e-01 9 2 N 0 8.065393e-03 10 2 N 1 8.569538e-01 11 2 P 0 4.005661e-01 12 2 P 1 4.124996e-02 13 3 K 0 1.918852e-01 14 3 K 1 3.311137e-01 15 3 N 0 1.547561e-01 16 3 N 1 1.283887e-01 17 3 P 0 9.791965e-06 18 3 P 1 9.113922e-01 R> summary(nmf.mod) Call: ore.odmNMF(formula = ~., data = training.set, num.features = 3) Settings: value feat.num.features 3 nmfs.conv.tolerance .05 nmfs.nonnegative.scoring nmfs.nonneg.scoring.enable nmfs.num.iterations 50 nmfs.random.seed -1 prep.auto on Features: FEATURE_ID ATTRIBUTE_NAME ATTRIBUTE_VALUE COEFFICIENT 1 1 K 0 3.723468e-01 2 1 K 1 1.761670e-01 3 1 N 0 7.469067e-01 4 1 N 1 1.085058e-02 5 1 P 0 5.730082e-01 6 1 P 1 2.797865e-02 7 2 K 0 4.107375e-01 8 2 K 1 2.193757e-01 9 2 N 0 8.065393e-03 10 2 N 1 8.569538e-01 11 2 P 0 4.005661e-01 12 2 P 1 4.124996e-02 13 3 K 0 1.918852e-01 14 3 K 1 3.311137e-01 15 3 N 0 1.547561e-01 16 3 N 1 1.283887e-01 17 3 P 0 9.791965e-06 18 3 P 1 9.113922e-01 R> predict(nmf.mod, scoring.set) '1' '2' '3' FEATURE_ID 19 0.1972489 1.2400782 0.03280919 2 20 0.7298919 0.0000000 1.29438165 3 21 0.1972489 1.2400782 0.03280919 2 22 0.0000000 1.0231268 0.98567623 2 23 0.7298919 0.0000000 1.29438165 3 24 1.5703239 0.1523159 0.00000000 1