Displaying 10 results from an estimated 10 matches for "svm_model".
2020 Oct 23
5
How to shade area between lines in ggplot2
...2))))
df[, "train"] <- ifelse(runif(nrow(df)) < 0.8, 1, 0)
trainset <- df[df$train == 1, ]
testset <- df[df$train == 0, ]
trainColNum <- grep("train", names(df))
trainset <- trainset[, -trainColNum]
testset <- testset[, -trainColNum]
head(trainset); str(df)
svm_model<- svm(z ~ .,
data = trainset,
type = "C-classification",
kernel = "linear",
scale = FALSE)
#! plot
p = ggplot(data = trainset, aes(x=x, y=y, color=z)) +
geom_point() + scale_color_manual(values = c("red&q...
2020 Oct 23
2
How to shade area between lines in ggplot2
...site: https://plotly.com/ggplot2/geom_ribbon/
I get the answer is geom_ribbon but I am still missing something
```
#! plot
p = ggplot(data = trainset, aes(x=x, y=y, color=z)) +
geom_point() + scale_color_manual(values = c("red", "blue"))
# show support vectors
df_sv = trainset[svm_model$index, ]
p = p + geom_point(data = df_sv, aes(x=x, y=y),
color="purple", size=4, alpha=0.5)
# show hyperplane (decision boundaries are off set by 1/w[2])
w = t(svm_model$coefs) %*% svm_model$SV # %*% = matrix multiplication
slope_1 = -w[1]/w[2]
intercept_1 = svm_model$...
2020 Oct 23
0
How to shade area between lines in ggplot2
...ot;] <- ifelse(runif(nrow(df))
< 0.8, 1, 0)
> trainset <- df[df$train == 1, ] testset <- df[df$train == 0, ] trainColNum
<-
> grep("train", names(df)) trainset <- trainset[, -trainColNum] testset <-
testset[,
> -trainColNum] head(trainset); str(df)
>
> svm_model<- svm(z ~ .,
> data = trainset,
> type = "C-classification",
> kernel = "linear",
> scale = FALSE)
>
> #! plot
> p = ggplot(data = trainset, aes(x=x, y=y, color=z)) +
> geom_point() + s...
2020 Oct 23
2
How to shade area between lines in ggplot2
...> I get the answer is geom_ribbon but I am still missing something ``` #! plot
> > p
> > = ggplot(data = trainset, aes(x=x, y=y, color=z)) +
> > geom_point() + scale_color_manual(values = c("red", "blue")) # show
> > support vectors df_sv = trainset[svm_model$index, ] p = p +
> > geom_point(data = df_sv, aes(x=x, y=y),
> > color="purple", size=4, alpha=0.5) # show hyperplane
> > (decision
> > boundaries are off set by 1/w[2]) w = t(svm_model$coefs) %*%
> > svm_model$SV # %*% = matrix multiplica...
2020 Oct 23
0
How to shade area between lines in ggplot2
...gplot2/geom_ribbon/
> I get the answer is geom_ribbon but I am still missing something ``` #! plot
> p
> = ggplot(data = trainset, aes(x=x, y=y, color=z)) +
> geom_point() + scale_color_manual(values = c("red", "blue")) # show
> support vectors df_sv = trainset[svm_model$index, ] p = p +
> geom_point(data = df_sv, aes(x=x, y=y),
> color="purple", size=4, alpha=0.5) # show hyperplane
> (decision
> boundaries are off set by 1/w[2]) w = t(svm_model$coefs) %*%
> svm_model$SV # %*% = matrix multiplication
> slope_1 = -w[1...
2020 Oct 26
0
How to shade area between lines in ggplot2
...I get the answer is geom_ribbon but I am still missing something ```
> > > #! plot p = ggplot(data = trainset, aes(x=x, y=y, color=z)) +
> > > geom_point() + scale_color_manual(values = c("red", "blue")) #
> > > show support vectors df_sv = trainset[svm_model$index, ] p = p +
> > > geom_point(data = df_sv, aes(x=x, y=y),
> > > color="purple", size=4, alpha=0.5) # show
> > > hyperplane (decision boundaries are off set by 1/w[2]) w =
> > > t(svm_model$coefs) %*% svm_model$SV # %*% = matrix...
2009 Oct 23
1
Data format for KSVM
Hi,
I have a process using svm from the e1071 library. it works.
I want to try using the KSVM library instead. The same data used wiht
e1071 gives me an error with KSVM.
My data is a data.frame.
sample code:
svm_formula <- formula(y ~ a + B + C)
svm_model <- ksvm(formula, data=train_data, type="C-svc",
kernel="rbfdot", C=1)
I get the following error:
"object is not a matrix"
So I tried this:
svm_model <- ksvm(formula, data=as.matrix(train_data), type="C-svc",
kernel="rbfdot", C=1, scaled=...
2020 Oct 27
3
R for-loop to add layer to lattice plot
...1, length(x2))))
df[, "train"] <- ifelse(runif(nrow(df)) < 0.8, 1, 0)
trainset <- df[df$train == 1, ]
testset <- df[df$train == 0, ]
trainColNum <- grep("train", names(df))
trainset <- trainset[, -trainColNum]
testset <- testset[, -trainColNum]
svm_model <- svm(z ~ .,
data = trainset,
type = "C-classification",
kernel = "linear",
scale = FALSE)
# generate contour
xmat = make.grid(matrix(c(testset$x, testset$y),
ncol = 2, byro...
2020 Oct 28
0
R for-loop to add layer to lattice plot
...train"] <- ifelse(runif(nrow(df)) < 0.8, 1, 0)
> trainset <- df[df$train == 1, ]
> testset <- df[df$train == 0, ]
> trainColNum <- grep("train", names(df))
> trainset <- trainset[, -trainColNum]
> testset <- testset[, -trainColNum]
> svm_model <- svm(z ~ .,
> data = trainset,
> type = "C-classification",
> kernel = "linear",
> scale = FALSE)
> # generate contour
> xmat = make.grid(matrix(c(testset$x, testset$y),
>...
2009 Sep 01
1
Logistic Politomic Regression in R
...man <noah@smartmediacorp.com>
Subject: Re: [R] SVM coefficients
Cc: r help <r-help@r-project.org>
Message-ID: <4A9B7C83.9030806@smartmediacorp.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Steve,
That doesn't work.
I just trained an SVM with 80 variables.
svm_model$coefs gives me a list of 10,000 items. My training set is
30,000 examples of 80 variables, so I have no idea what the 10,000 items
represent.
There should be some attribute that lists the "weights" for each of the
80 variables.
--
Noah
On 8/30/09 7:47 PM, Steve Lianoglou wrote:
&g...