<jupyter_start><jupyter_text>Sistemas Inteligentes Aprendizaje de conocimiento<jupyter_code>n <- 1.4
m <- 1
as.integer(n)
as.numeric(m)
typeof(n)
class(m)
print('Hola')
a <- c(1,2,3)
print(a)
a <- numeric(5)
print(a)
a <- 1:10
print(a)
a <- seq(11)
print(a)
a <- seq(11, 21)
print(a)
a <- seq(1, 5.6, 0.5)
print(a)
length(a)
d <- data.frame(c(2,4,8), c('c', 'b', 'a'))
print(d)
d <- data.frame(col1=c(2,4,8), col2=c('c', 'b', 'a'))
print(d)
cbind(d, col3=c(7,6,5))
factor(c('rojo', 'azul', 'verde'))
d = cbind(d, col4=factor(c('rojo', 'azul', 'verde')))
d$col4
summary(d)
d[2,1]
library(mlbench)
library(caret)
data(Sonar)
head(Sonar)
summary(Sonar)
111/97
111/(111+97)
inTrain <- createDataPartition(y=Sonar$Class, p=0.75, list=FALSE)
inTrain
entrena <- Sonar[inTrain,]
entrena
testing <- Sonar[-inTrain,]
modelo <- train(Class ~ ., data = entrena, method = "J48")
install.packages("rJava")
# modelo <- train(Class ~., data=entrena, methos="J48", tuneGrud=data.frame(C=(0.01, 0.02, 0.03)))
# ctrl <- trainControl(method="boots", repeats=3, number=3, summaryFunction=defaultSummary, classProbs=TRUE)
# modelo <- train(Class ~ ., data=entrena, method="J48", trControl=ctrl)
# modelo <- train(Class ~ ., data=entrena, method="J48", trControl=ctrl, metric="")
# pred <- predict(modelo, newdata=testing)
# pred
# confusionMatrix(data=pred, testing$Class)<jupyter_output><empty_output><jupyter_text>Práctica 1<jupyter_code>wifi <- read.delim( "https://archive.ics.uci.edu/ml/machine-learning-databases/00422/wifi_localization.txt", header = F)
write.csv(wifi,"wifi.csv",row.names = F)
summary(wifi)
wifi$V8 <- as.factor(wifi$V8)
library(ggplot2)
ggplot(wifi , aes(x=V1)) + geom_density()+facet_wrap(~V8)
library(reshape2)
ggplot(melt(wifi) , aes(x=value,color=V8)) + geom_density()+facet_grid(V8~variable)
head(melt(wifi))
ggplot(wifi , aes(x=V1,y=V2,color=V8)) + geom_point()
makePairs <- function(data,classIndex){
    dfm <- NULL
    for(i in 1:ncol(data)){
        if(i==classIndex)
            next
        for(j in 1:ncol(data)){
            if(j==classIndex)
                next
            if(i==j)
                next
            dfm <- rbind(dfm,data.frame(x=data[,i],y=data[,j],
            Var1=colnames(data)[i],
            Var2=colnames(data)[j],
            class=data[,classIndex]))
        }
    }
    dfm$Var2 <- relevel(dfm$Var2,levels(dfm$Var1)[1])
    dfm
}
dataToPlot <- makePairs(wifi,8)
ggplot(dataToPlot, aes_string(x = "x", y = "y")) + 
    facet_grid(Var1 ~ Var2, scales = "free") +
    geom_point(aes(colour=class), alpha=0.6)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.20178156467854377, 'fraction_numerical': 0.039504260263361735, 'mean_word_length': 4.5310492505353315, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 9, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '27173', 'license': 'MIT', 'n_tokens_mistral': 1182, 'n_tokens_neox': 1092, 'n_words': 173, 'path': 'aprendizaje-automatico/2018-11-15-r-lab.ipynb', 'repo_name': 'thewilly/GIISOF01-4-008-Sistemas-Inteligentes', 'size': '2582'}