Skip to content

R interface to scikit-learn through (through Python tisthemachinelearner)

Notifications You must be signed in to change notification settings

Techtonique/tisthemachinelearner_r

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tisthemachinelearner

R interface to scikit-learn through (through Python tisthemachinelearner) with S3 and R6 interfaces.

remotes::install_github("Techtonique/tisthemachinelearner")
library(tisthemachinelearner)
# Load data
data(mtcars)
head(mtcars)

# Split features and target
X <- as.matrix(mtcars[, -1])  # all columns except mpg
y <- mtcars[, 1]              # mpg column

# Create train/test split
set.seed(42)
train_idx <- sample(nrow(mtcars), size = floor(0.8 * nrow(mtcars)))
X_train <- X[train_idx, ]
X_test <- X[-train_idx, ]
y_train <- y[train_idx]
y_test <- y[-train_idx]

# R6 interface
model <- Regressor$new(model_name = "LinearRegression")
model$fit(X_train, y_train)
preds <- model$predict(X_test)
print(preds)

# S3 interface
model <- regressor(X_train, y_train, model_name = "LinearRegression")
preds <- predict(model, X_test)
print(preds)

About

R interface to scikit-learn through (through Python tisthemachinelearner)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published