## Not run: ------------------------------------
# # Set needed environment variables for multithreading. Only single threading
# # is used in the example.
# #
# # Note: The environment variables are usually set by the user before starting
# # the R programming environment; they are set here only to facilitate
# # a working example. See the section on multithreading in the vignette
# # for further details.
# Sys.setenv(R_BENCH_NUM_THREADS_VARIABLE="MKL_NUM_THREADS")
# Sys.setenv(MKL_NUM_THREADS="1")
# #
# # Generate example microbechmarks that can be run in a few minutes; see
# # the vignette for more involved examples. Clustering microbenchmarks
# # are defined in the examples.
# #
# # Note: These microbenchmarks are different than the microbenchmarks
# # generated by \code{\link{GetDenseMatrixDefaultMicrobenchmarks}}.
# # They are chosen for their short run times and suitability for
# # example code.
# exampleMicrobenchmarks <- GetClusteringExampleMicrobenchmarks()
# # Set the output directory of the CSV summary results files
# resultsDirectory <- "./MachineLearningExampleOutput"
# # Create the output directory
# dir.create(resultsDirectory)
# # Set an appropriate run identifier
# runIdentifier <- "example"
# resultsFrame <- RunMachineLearningBenchmark(runIdentifier, resultsDirectory,
# clusteringMicrobenchmarks=exampleMicrobenchmarks)
#
# # Create a new clustering microbenchmark that tests the clara method from
# # the cluster package using a data set with 16 features, 8 clusters, and
# # 1000 normally distributed feature vectors per cluster.
# claraMicrobenchmark <- list()
# claraMicrobenchmark[["clara_cluster_16_8_1000"]] <- methods::new(
# "ClusteringMicrobenchmark",
# active = TRUE,
# benchmarkName = "clara_cluster_16_8_1000",
# benchmarkDescription = "Example of new clara microbenchmark",
# dataObjectName = NA_character_,
# numberOfFeatures = as.integer(16),
# numberOfClusters = as.integer(8),
# numberOfFeatureVectorsPerCluster = as.integer(1000),
# numberOfTrials = as.integer(3),
# numberOfWarmupTrials = as.integer(1),
# allocatorFunction = ClusteringAllocator,
# benchmarkFunction = ClaraClusteringMicrobenchmark
# )
#
# # Set an appropriate run identifier
# runIdentifier <- "clara_new"
# # Run the clara microbenchmark
# claraResults <- RunMachineLearningBenchmark(runIdentifier, resultsDirectory,
# clusteringMicrobenchmarks=claraMicrobenchmark)
## ---------------------------------------------
Run the code above in your browser using DataLab