Created
July 30, 2019 07:07
-
-
Save mfmakahiya/c2065015ca19b0dba5c4038949c85655 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(Matrix) | |
library(glmnet) | |
library(pROC) | |
library(caret) | |
# Import dataset | |
data1 = read.csv(file = "./data/input/breast-cancer.csv") | |
data1$diagnosis<-ifelse(data1$diagnosis=='M', 1,0) | |
data2 = data.matrix(data1) | |
Matrix(data2, sparse = TRUE) | |
set.seed(6789) | |
# Split the data to train and test | |
split = sample(nrow(data1), floor(0.7*nrow(data1))) | |
train = data1[split,] | |
test = data1[-split,] | |
train_sparse = sparse.model.matrix(~., train[,3:32]) | |
test_sparse = sparse.model.matrix(~., test[,3:32]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment