Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

c50 code called exit with value 1 #24

Open
moh-kelani opened this issue Dec 19, 2019 · 3 comments
Open

c50 code called exit with value 1 #24

moh-kelani opened this issue Dec 19, 2019 · 3 comments

Comments

@moh-kelani
Copy link

moh-kelani commented Dec 19, 2019

hi everybody
I need help, please
I face this problem when I run my code

Call:
C5.0.default(x = trainingDataset[, -5], y = trainingDataset$play)
-------------------------------
Class specified by attribute `outcome'
*** line 1 of `undefined.data': bad value of `c(2, 3, 1, 1, 2, 1, 3, 2, 1)' for attribute `outlook'
Error limit exceeded

you can have a look ...

> Classes ‘tbl_df’, ‘tbl’ and 'data.frame':	14 obs. of  5 variables:
 $ outlook : Factor w/ 3 levels "Overcast","Rain",..: 3 3 1 2 2 2 1 3 3 2 ...
 $ temp    : Factor w/ 3 levels "Cool","Hot","Mild": 2 2 2 3 1 1 1 3 1 3 ...
 $ humidity: Factor w/ 2 levels "High","Normal": 1 1 1 1 2 2 2 1 2 2 ...
 $ wind    : Factor w/ 2 levels "Strong","Weak": 2 1 2 2 2 1 1 2 2 2 ...
 $ play    : Factor w/ 2 levels "No","Yes": 1 1 2 2 2 1 2 1 2 2 ...

and this is my code

library(C50)
library(caret)
library("readxl")
require(class)
library(rpart)
library(data.tree)
library(dplyr)
library(Cubist)
tennis <- read_excel(file.choose())
dataset=tennis
#tennis =read.csv(file.choose(), header = T, stringsAsFactors = TRUE)
dataset = tennis[,-1]
dataset = mutate(dataset,outlook=as.factor(outlook),temp=as.factor(temp),humidity=as.factor(humidity),wind=as.factor(wind),play=as.factor(play) )
View(dataset)
str(dataset)
summary(dataset)
View(dataset)

#dataset$play <- as.factor(dataset$play)
#dataset$wind <- as.factor(dataset$wind)
#dataset$humidity <- as.factor(dataset$humidity)
#dataset$temp <- as.factor(dataset$temp)
#dataset$outlook <- as.factor(dataset$outlook)

str(dataset)
set.seed(123)
shuffledDataset = dataset[order(runif(nrow(dataset))),]
View(shuffledDataset)
trainingDataset = shuffledDataset[1:9,] #floor(nrow(shuffledDataset)*0.7),]
testingDataset =  shuffledDataset[10:14,] #(floor(nrow(shuffledDataset)*0.7)+1): nrow(shuffledDataset),]

View(trainingDataset)
View(testingDataset)
str(trainingDataset)
str(testingDataset)

model = C5.0(trainingDataset[,-5],trainingDataset$play)
summary(model)
plot(model,type = "s",main = "Decision Tree")
results = predict(model, testingDataset[,-5])
View(cbind(testingDataset, results))
#tmp = results == testingDataset
#tmp
#which(tmp)
#length(which(tmp))
#length(tmp)
#accuracy = length(which(tmp)) / length(tmp) * 100.0
#sprintf("The Accuracy = %2f", accuracy)
table(results,testingDataset$play)
confusionMatrix(results,testingDataset$play)

modelRules <- C5.0(trainingDataset[,-5],trainingDataset$play, rules = TRUE)
summary(modelRules) # view the ruleset`

[tennis2.xlsx](https://github.com/topepo/C5.0/files/3985763/tennis2.xlsx)
@moh-kelani
Copy link
Author

please .. anyone can help?

@topepo
Copy link
Owner

topepo commented May 7, 2021

Sorry for the delay. I was able to run the code without an error. The data set didn't have any splits or rules. This means that none of the predictors were informative.

Can you try to reproduce (perhaps using reprex::reprex()) with the current version?

@topepo
Copy link
Owner

topepo commented May 7, 2021

I think that this is solved by installing the current devel version of Cubist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants