Error

Create custom R script to change necessary Metadata

Fortunately R again can help. From the error message we can see that Evaluate Model is missing a label column from the incoming dataset. Score Model on the other hand creates all the necessary information. This indicates a possible metadata issue. The appropriate columns do exist but need to be further annotated. The solution emerges when reading the appropriate metadata documentation. Typical metadata information includes:

- Treating Boolean or numeric columns as categorical values
- Indicating which column contains the true label, the assigned label or the classification score
- Marking columns as features
- Changing date/time values to a numeric value
- Adding or changing column names

We need to indicate these special columns, i.e. true label, assigned label, and classification score in the dataset moved between the scoring and evaluation modules. The simplest way to do this is by using an Execute R Script as a bridge between the Score and the Evaluate modules.

Before we provide the code of the Execute R Script module, we must make three important observations about the R training script and the R scoring script:

Training Script:
library(e1071)
features <- get.feature.columns(dataset)
labels <- as.factor(get.label.column(dataset))
train.data <- data.frame(features, labels)
feature.names <- get.feature.column.names(dataset)
names(train.data) <- c(feature.names, "Class")
model <- naiveBayes(Class ~ ., train.data)

Scoring Script:
library(e1071)
probabilities <- predict(model, dataset, type="raw")[,2]
classes = 0.5))
scores <- data.frame(classes, probabilities)

In the ‘Training Script’ of the example we can see that the classification column (true label) is called Class
The ‘Scoring Script’ of the example ends with scores <- data.frame(classes, probabilities). The first corresponds to the assigned label and the second to the classification score
The Score Model module has the option Append score columns to output checked, so we expect the ‘Scoring Script’ to add two extra columns on the input dataset: classes and probabilities.

The final R script that will bridge the Score and Evaluation modules is as follows:


dataset1 <- maml.mapInputPort(1)
data.set <- data.frame(true_labels=dataset1$Class,
assigned_label=dataset1$classes,
calibrated_score=dataset1$probabilities)
attr(data.set$assigned_label, "feature.channel") <- "Binary Classification Scores"
attr(data.set$assigned_label, "score.type") <- "Assigned Labels"
attr(data.set$calibrated_score, "feature.channel") <- "Binary Classification Scores"
attr(data.set$calibrated_score, "score.type") <- "Calibrated Score"
names(data.set) <- c("Class" ,"Scored Labels" , "Scored Probabilities")
maml.mapOutputPort("data.set");

The R code provided above is tailored for the specific example; nevertheless, it is easily customized by identifying the corresponding columns and making the appropriate modifications.

Taggings:

C++ vtable error solution

On gcc website (http://gcc.gnu.org/faq.html#vtables) you can read that you have to ensure that all virtual methods that are not pure are defined. Destructor must be defined even if it is declared pure-virtual.

WEKA Crash after exceeding the avaiable Memory

In the lecture "Machine Learning" I have to process different kinds of datasets and perform several machine learning techniques on them. A few classifier like tree-based ones work very good on small datasets with less attributes but doesn't on big datasets with lots of attributes. In the worst case, WEKA crashes because it exceeds its reserved memory space.

Fixing the Import Problem in Mule ESB

If you are programming with the MuleESB suite you are may be forced with the problem, that it is not able to find imports or throws "ClassNotFoundExceptions" after trying to compile your source code. Even after checking the class/build path and adding every jar to them, the problem still exists.

TechScreen - Parse error

It's now for the third time I am browsing the content on TechScreen, and get the following error message: Parse error: syntax error, unexpected ';' in /Library/WebServer/TechScreen/modules/u2/competences/competences.module on line 783 Can somebody help me please? What does this error message mean? How to avoid it ?

Oracle connection error

When you have just installed a database or client Oracle on a computer and want to connect with the parameters that have defined, it generates the error message: ORA-12154: TNS: Could not resolve the connect identifier specified.

Windows XP Installer Problem

I am running Windows XP Home Edition on my computer. After I installed the operating system, it works properly and without problems. Every now and then, sometimes after 2 weeks, sometimes after 3 months, my Windows XP Installer gets damaged. Unfortunatly I can't make out the reason. I already tried to set the system back to a system restore point but it didn't work. By meaning the Windows XP Installer gets damaged i mean, if I try to install programs with the Windows-Installers the message: "Windows Installer service could not be accessed. Contact your support personnel to verify that it is properly registered and enabled" occurs. This occurs for each programm i try to install, which are using the Windows Installer, every other program with own install routine works fine. Unfortunatly a restart of the computer as well as redownloading the installer file does not work. I would be glad to get a working Windows Installer or an other way to install programs using the Windows Installer without reinstalling my operating system every time.
Subscribe to Error