Description Usage Arguments Value Examples
A function to predict classes using the logistic regression with the stochastic gradient descent algorithm.
1 | predict(data_test, Train_res, sortie = "Class")
|
data_test |
A test data frame. |
Train_res |
Fitted model from data train using logistic regression. |
sortie |
"Proba" : return probabilities or "Class" : return classes predicted on test data. |
Returns a Vector of probabilities or classes predicted on test data.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | data = iris[(iris$Species=="setosa" | iris$Species=="versicolor"),]
levels(data$Species)
levels(data$Species) <- c(levels(data$Species), c(0,1))
data$Species[data$Species=="setosa"] = 1
data$Species[data$Species=="versicolor"] = 0
data$Species = as.numeric(data$Species)
rows <- sample(nrow(data))
data <- data[rows,]
data$Species = data$Species -4
data_train = data[1:70,]
data_test = data[71:100,]
rm(data)
reg_log=fit(formula=Species~.,data=data_train,eta=0.3,iter_Max=300,mode="Batch_Simple",batch_size=15)
predict(data_test[,-5], reg_log,sortie="Class")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.