# NOT RUN {
############################
# Training
############################
# Create simulated data
data <- RemixAutoML::FakeDataGenerator(
Correlation = 0.70,
N = 1000L,
ID = 2L,
FactorCount = 2L,
AddDate = TRUE,
AddComment = FALSE,
ZIP = 2L,
TimeSeries = FALSE,
ChainLadderData = FALSE,
Classification = FALSE,
MultiClass = FALSE)
# Run algo
Output <- RemixAutoML::H2OAutoencoder(
# Select the service
AnomalyDetection = TRUE,
DimensionReduction = TRUE,
# Data related args
data = data,
Features = names(data)[2L:(ncol(data)-1L)],
per_feature = FALSE,
RemoveFeatures = FALSE,
ModelID = "TestModel",
model_path = getwd(),
# H2O Environment
NThreads = max(1L, parallel::detectCores()-2L),
MaxMem = "28G",
H2OStart = TRUE,
H2OShutdown = TRUE,
# H2O ML Args
LayerStructure = NULL,
NodeShrinkRate = (sqrt(5) - 1) / 2,
ReturnLayer = 4L,
Activation = "Tanh",
Epochs = 5L,
L2 = 0.10,
ElasticAveraging = TRUE,
ElasticAveragingMovingRate = 0.90,
ElasticAveragingRegularization = 0.001)
# Inspect output
data <- Output$Data
Model <- Output$Model
# If ValidationData is not null
ValidationData <- Output$ValidationData
############################
# Scoring
############################
# Create simulated data
data <- RemixAutoML::FakeDataGenerator(
Correlation = 0.70,
N = 1000L,
ID = 2L,
FactorCount = 2L,
AddDate = TRUE,
AddComment = FALSE,
ZIP = 2L,
TimeSeries = FALSE,
ChainLadderData = FALSE,
Classification = FALSE,
MultiClass = FALSE)
# Run algo
data <- RemixAutoML::H2OAutoencoderScoring(
# Select the service
AnomalyDetection = TRUE,
DimensionReduction = TRUE,
# Data related args
data = data,
Features = names(data)[2L:ncol(data)],
RemoveFeatures = TRUE,
per_feature = FALSE,
ModelObject = NULL,
ModelID = "TestModel",
model_path = getwd(),
# H2O args
NThreads = max(1L, parallel::detectCores()-2L),
MaxMem = "28G",
H2OStart = TRUE,
H2OShutdown = TRUE,
ReturnLayer = 4L)
# }
Run the code above in your browser using DataLab