mlr package - Trying to integrate a new clustering learner. Default values in par.vals are being ignored (within makeRLearnerCluster method)Is there any difference between default (package) and public access level of methods in class with default (package) access level?mutable default package values in RR (and R Studio) ignoring Environment variables (default package library)R error when trying to cluster data using pam (package cluster)R function values without default that are ignoredtrying to call a method within a methodR package mlr Multilabel Text Classification: how to classify new dataS4: Use class attributes as default input values for class methodsIncrementing values within methods?Spatial-temporal clustering method or package in R?

A Journey Through Space and Time

how to create a data type and make it available in all Databases?

Why is this code 6.5x slower with optimizations enabled?

A newer friend of my brother's gave him a load of baseball cards that are supposedly extremely valuable. Is this a scam?

DOS, create pipe for stdin/stdout of command.com(or 4dos.com) in C or Batch?

Can you lasso down a wizard who is using the Levitate spell?

Is there really no realistic way for a skeleton monster to move around without magic?

The use of multiple foreign keys on same column in SQL Server

Is it legal to have the "// (c) 2019 John Smith" header in all files when there are hundreds of contributors?

Why is "Reports" in sentence down without "The"

Accidentally leaked the solution to an assignment, what to do now? (I'm the prof)

Are white and non-white police officers equally likely to kill black suspects?

Why has Russell's definition of numbers using equivalence classes been finally abandoned? ( If it has actually been abandoned).

What is the offset in a seaplane's hull?

Copenhagen passport control - US citizen

How is it possible for user's password to be changed after storage was encrypted? (on OS X, Android)

How do I create uniquely male characters?

Motorized valve interfering with button?

Why Is Death Allowed In the Matrix?

A function which translates a sentence to title-case

Finding files for which a command fails

New order #4: World

If Manufacturer spice model and Datasheet give different values which should I use?

Non-Jewish family in an Orthodox Jewish Wedding



mlr package - Trying to integrate a new clustering learner. Default values in par.vals are being ignored (within makeRLearnerCluster method)


Is there any difference between default (package) and public access level of methods in class with default (package) access level?mutable default package values in RR (and R Studio) ignoring Environment variables (default package library)R error when trying to cluster data using pam (package cluster)R function values without default that are ignoredtrying to call a method within a methodR package mlr Multilabel Text Classification: how to classify new dataS4: Use class attributes as default input values for class methodsIncrementing values within methods?Spatial-temporal clustering method or package in R?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I am trying to integrate the MiniBatchKmeans function of package ClusterR to mlr. As per the docs, I have made the following changes:



  1. Created makeRLearner.cluster.MiniBatchKmeans

  2. Created trainLearner.cluster.MiniBatchKmeans

  3. Created predictLearner.cluster.MiniBatchKmeans

  4. Registered the above S3 methods (as described here)

At this point, I am able to create the learner, and call train and predict on them. However, the problem occurs when trying to create the learner without any value of "clusters" provided.



The underlying package (in ClusterR) does not have a default value defined for argument "clusters". As per the mlr approach, I have attempted to provide a default value of "clusters" using par.vals argument. However, this default argument is ignored.



My code:



#' @export
makeRLearner.cluster.MiniBatchKmeans = function()
makeRLearnerCluster(
cl = "cluster.MiniBatchKmeans",
package = "ClusterR",
par.set = makeParamSet(
makeIntegerLearnerParam(id = "clusters", lower = 1L),
makeIntegerLearnerParam(id = "batch_size", default = 10L, lower = 1L),
makeIntegerLearnerParam(id = "num_init", default = 1L, lower = 1L),
makeIntegerLearnerParam(id = "max_iters", default = 100L, lower = 1L),
makeNumericLearnerParam(id = "init_fraction", default = 1, lower = 0),
makeDiscreteLearnerParam(id = "initializer", default = "kmeans++",
values = c("optimal_init", "quantile_init", "kmeans++", "random")),
makeIntegerLearnerParam(id = "early_stop_iter", default = 10L, lower = 1L),
makeLogicalLearnerParam(id = "verbose", default = FALSE,
tunable = FALSE),
makeUntypedLearnerParam(id = "CENTROIDS", default = NULL),
makeNumericLearnerParam(id = "tol", default = 1e-04, lower = 0),
makeNumericLearnerParam(id = "tol_optimal_init", default = 0.3, lower = 0),
makeIntegerLearnerParam(id = "seed", default = 1L)
),
par.vals = list(clusters = 2L),
properties = c("numerics", "prob"),
name = "MiniBatchKmeans",
note = "Note",
short.name = "MBatchKmeans",
callees = c("MiniBatchKmeans", "predict_MBatchKMeans")
)


#' @export
trainLearner.cluster.MiniBatchKmeans = function(.learner, .task, .subset, .weights = NULL, ...)
ClusterR::MiniBatchKmeans(getTaskData(.task, .subset), ...)


#' @export
predictLearner.cluster.MiniBatchKmeans = function(.learner, .model, .newdata, ...)
if (.learner$predict.type == "prob")
pred = ClusterR::predict_MBatchKMeans(data = .newdata,
CENTROIDS = .model$learner.model$centroids,
fuzzy = TRUE, ...)

res = pred$fuzzy_clusters

return(res)
else
pred = ClusterR::predict_MBatchKMeans(data = .newdata,
CENTROIDS = .model$learner.model$centroids,
fuzzy = FALSE, ...)

res = as.integer(pred)

return(res)




The problem (default value of clusters in par.vals above is ignored):



## When defining a value of clusters, it works as expected
lrn <- makeLearner("cluster.MiniBatchKmeans", clusters = 3L)
getLearnerParVals(lrn)
# The below commented lines are printed
# $clusters
# [1] 3

## When not providing a value for clusters, default is not used
lrn <- makeLearner("cluster.MiniBatchKmeans")
getLearnerParVals(lrn)
# The below commented lines are printed
# named list()


Any advice on why I am seeing this behavior? I checked other learner's (like cluster.kmeans, cluster.kkmeans etc) code and I see that they are able to successfully define default values in the same format that I have done. Additionally, here is documentation that this is the right way to go.



Here is my code on github, in case it's helpful for reproducing the problem. There is an added test file (in tests/testthat), but that has issues of its own.



Edit 1 - Actual Error Message
Here is the actual error message that I see when trying to train a learner without explicitly providing default value of "clusters":



lrn <- makeLearner("cluster.MiniBatchKmeans")
train(lrn, cluster_task)
Error in ClusterR::MiniBatchKmeans(getTaskData(.task, .subset), ...) :
argument "clusters" is missing, with no default
10.
ClusterR::MiniBatchKmeans(getTaskData(.task, .subset), ...) at RLearner_cluster_MiniBatchKmeans.R#32
9.
trainLearner.cluster.MiniBatchKmeans(.learner = structure(list(
id = "cluster.MiniBatchKmeans", type = "cluster", package = "ClusterR",
properties = c("numerics", "prob"), par.set = structure(list(
pars = list(clusters = structure(list(id = "clusters", ... at trainLearner.R#24
8.
(function (.learner, .task, .subset, .weights = NULL, ...)

UseMethod("trainLearner")
)(.learner = structure(list(id = "cluster.MiniBatchKmeans", ...
7.
do.call(trainLearner, pars) at train.R#96
6.
fun3(do.call(trainLearner, pars)) at train.R#96
5.
fun2(fun3(do.call(trainLearner, pars))) at train.R#96
4.
fun1(
learner.model = fun2(fun3(do.call(trainLearner, pars)))
) at train.R#96
3.
force(expr) at helpers.R#93
2.
measureTime(fun1(
learner.model = fun2(fun3(do.call(trainLearner, pars)))
)) at train.R#96
1.
train(lrn, cluster_task)









share|improve this question






























    0















    I am trying to integrate the MiniBatchKmeans function of package ClusterR to mlr. As per the docs, I have made the following changes:



    1. Created makeRLearner.cluster.MiniBatchKmeans

    2. Created trainLearner.cluster.MiniBatchKmeans

    3. Created predictLearner.cluster.MiniBatchKmeans

    4. Registered the above S3 methods (as described here)

    At this point, I am able to create the learner, and call train and predict on them. However, the problem occurs when trying to create the learner without any value of "clusters" provided.



    The underlying package (in ClusterR) does not have a default value defined for argument "clusters". As per the mlr approach, I have attempted to provide a default value of "clusters" using par.vals argument. However, this default argument is ignored.



    My code:



    #' @export
    makeRLearner.cluster.MiniBatchKmeans = function()
    makeRLearnerCluster(
    cl = "cluster.MiniBatchKmeans",
    package = "ClusterR",
    par.set = makeParamSet(
    makeIntegerLearnerParam(id = "clusters", lower = 1L),
    makeIntegerLearnerParam(id = "batch_size", default = 10L, lower = 1L),
    makeIntegerLearnerParam(id = "num_init", default = 1L, lower = 1L),
    makeIntegerLearnerParam(id = "max_iters", default = 100L, lower = 1L),
    makeNumericLearnerParam(id = "init_fraction", default = 1, lower = 0),
    makeDiscreteLearnerParam(id = "initializer", default = "kmeans++",
    values = c("optimal_init", "quantile_init", "kmeans++", "random")),
    makeIntegerLearnerParam(id = "early_stop_iter", default = 10L, lower = 1L),
    makeLogicalLearnerParam(id = "verbose", default = FALSE,
    tunable = FALSE),
    makeUntypedLearnerParam(id = "CENTROIDS", default = NULL),
    makeNumericLearnerParam(id = "tol", default = 1e-04, lower = 0),
    makeNumericLearnerParam(id = "tol_optimal_init", default = 0.3, lower = 0),
    makeIntegerLearnerParam(id = "seed", default = 1L)
    ),
    par.vals = list(clusters = 2L),
    properties = c("numerics", "prob"),
    name = "MiniBatchKmeans",
    note = "Note",
    short.name = "MBatchKmeans",
    callees = c("MiniBatchKmeans", "predict_MBatchKMeans")
    )


    #' @export
    trainLearner.cluster.MiniBatchKmeans = function(.learner, .task, .subset, .weights = NULL, ...)
    ClusterR::MiniBatchKmeans(getTaskData(.task, .subset), ...)


    #' @export
    predictLearner.cluster.MiniBatchKmeans = function(.learner, .model, .newdata, ...)
    if (.learner$predict.type == "prob")
    pred = ClusterR::predict_MBatchKMeans(data = .newdata,
    CENTROIDS = .model$learner.model$centroids,
    fuzzy = TRUE, ...)

    res = pred$fuzzy_clusters

    return(res)
    else
    pred = ClusterR::predict_MBatchKMeans(data = .newdata,
    CENTROIDS = .model$learner.model$centroids,
    fuzzy = FALSE, ...)

    res = as.integer(pred)

    return(res)




    The problem (default value of clusters in par.vals above is ignored):



    ## When defining a value of clusters, it works as expected
    lrn <- makeLearner("cluster.MiniBatchKmeans", clusters = 3L)
    getLearnerParVals(lrn)
    # The below commented lines are printed
    # $clusters
    # [1] 3

    ## When not providing a value for clusters, default is not used
    lrn <- makeLearner("cluster.MiniBatchKmeans")
    getLearnerParVals(lrn)
    # The below commented lines are printed
    # named list()


    Any advice on why I am seeing this behavior? I checked other learner's (like cluster.kmeans, cluster.kkmeans etc) code and I see that they are able to successfully define default values in the same format that I have done. Additionally, here is documentation that this is the right way to go.



    Here is my code on github, in case it's helpful for reproducing the problem. There is an added test file (in tests/testthat), but that has issues of its own.



    Edit 1 - Actual Error Message
    Here is the actual error message that I see when trying to train a learner without explicitly providing default value of "clusters":



    lrn <- makeLearner("cluster.MiniBatchKmeans")
    train(lrn, cluster_task)
    Error in ClusterR::MiniBatchKmeans(getTaskData(.task, .subset), ...) :
    argument "clusters" is missing, with no default
    10.
    ClusterR::MiniBatchKmeans(getTaskData(.task, .subset), ...) at RLearner_cluster_MiniBatchKmeans.R#32
    9.
    trainLearner.cluster.MiniBatchKmeans(.learner = structure(list(
    id = "cluster.MiniBatchKmeans", type = "cluster", package = "ClusterR",
    properties = c("numerics", "prob"), par.set = structure(list(
    pars = list(clusters = structure(list(id = "clusters", ... at trainLearner.R#24
    8.
    (function (.learner, .task, .subset, .weights = NULL, ...)

    UseMethod("trainLearner")
    )(.learner = structure(list(id = "cluster.MiniBatchKmeans", ...
    7.
    do.call(trainLearner, pars) at train.R#96
    6.
    fun3(do.call(trainLearner, pars)) at train.R#96
    5.
    fun2(fun3(do.call(trainLearner, pars))) at train.R#96
    4.
    fun1(
    learner.model = fun2(fun3(do.call(trainLearner, pars)))
    ) at train.R#96
    3.
    force(expr) at helpers.R#93
    2.
    measureTime(fun1(
    learner.model = fun2(fun3(do.call(trainLearner, pars)))
    )) at train.R#96
    1.
    train(lrn, cluster_task)









    share|improve this question


























      0












      0








      0








      I am trying to integrate the MiniBatchKmeans function of package ClusterR to mlr. As per the docs, I have made the following changes:



      1. Created makeRLearner.cluster.MiniBatchKmeans

      2. Created trainLearner.cluster.MiniBatchKmeans

      3. Created predictLearner.cluster.MiniBatchKmeans

      4. Registered the above S3 methods (as described here)

      At this point, I am able to create the learner, and call train and predict on them. However, the problem occurs when trying to create the learner without any value of "clusters" provided.



      The underlying package (in ClusterR) does not have a default value defined for argument "clusters". As per the mlr approach, I have attempted to provide a default value of "clusters" using par.vals argument. However, this default argument is ignored.



      My code:



      #' @export
      makeRLearner.cluster.MiniBatchKmeans = function()
      makeRLearnerCluster(
      cl = "cluster.MiniBatchKmeans",
      package = "ClusterR",
      par.set = makeParamSet(
      makeIntegerLearnerParam(id = "clusters", lower = 1L),
      makeIntegerLearnerParam(id = "batch_size", default = 10L, lower = 1L),
      makeIntegerLearnerParam(id = "num_init", default = 1L, lower = 1L),
      makeIntegerLearnerParam(id = "max_iters", default = 100L, lower = 1L),
      makeNumericLearnerParam(id = "init_fraction", default = 1, lower = 0),
      makeDiscreteLearnerParam(id = "initializer", default = "kmeans++",
      values = c("optimal_init", "quantile_init", "kmeans++", "random")),
      makeIntegerLearnerParam(id = "early_stop_iter", default = 10L, lower = 1L),
      makeLogicalLearnerParam(id = "verbose", default = FALSE,
      tunable = FALSE),
      makeUntypedLearnerParam(id = "CENTROIDS", default = NULL),
      makeNumericLearnerParam(id = "tol", default = 1e-04, lower = 0),
      makeNumericLearnerParam(id = "tol_optimal_init", default = 0.3, lower = 0),
      makeIntegerLearnerParam(id = "seed", default = 1L)
      ),
      par.vals = list(clusters = 2L),
      properties = c("numerics", "prob"),
      name = "MiniBatchKmeans",
      note = "Note",
      short.name = "MBatchKmeans",
      callees = c("MiniBatchKmeans", "predict_MBatchKMeans")
      )


      #' @export
      trainLearner.cluster.MiniBatchKmeans = function(.learner, .task, .subset, .weights = NULL, ...)
      ClusterR::MiniBatchKmeans(getTaskData(.task, .subset), ...)


      #' @export
      predictLearner.cluster.MiniBatchKmeans = function(.learner, .model, .newdata, ...)
      if (.learner$predict.type == "prob")
      pred = ClusterR::predict_MBatchKMeans(data = .newdata,
      CENTROIDS = .model$learner.model$centroids,
      fuzzy = TRUE, ...)

      res = pred$fuzzy_clusters

      return(res)
      else
      pred = ClusterR::predict_MBatchKMeans(data = .newdata,
      CENTROIDS = .model$learner.model$centroids,
      fuzzy = FALSE, ...)

      res = as.integer(pred)

      return(res)




      The problem (default value of clusters in par.vals above is ignored):



      ## When defining a value of clusters, it works as expected
      lrn <- makeLearner("cluster.MiniBatchKmeans", clusters = 3L)
      getLearnerParVals(lrn)
      # The below commented lines are printed
      # $clusters
      # [1] 3

      ## When not providing a value for clusters, default is not used
      lrn <- makeLearner("cluster.MiniBatchKmeans")
      getLearnerParVals(lrn)
      # The below commented lines are printed
      # named list()


      Any advice on why I am seeing this behavior? I checked other learner's (like cluster.kmeans, cluster.kkmeans etc) code and I see that they are able to successfully define default values in the same format that I have done. Additionally, here is documentation that this is the right way to go.



      Here is my code on github, in case it's helpful for reproducing the problem. There is an added test file (in tests/testthat), but that has issues of its own.



      Edit 1 - Actual Error Message
      Here is the actual error message that I see when trying to train a learner without explicitly providing default value of "clusters":



      lrn <- makeLearner("cluster.MiniBatchKmeans")
      train(lrn, cluster_task)
      Error in ClusterR::MiniBatchKmeans(getTaskData(.task, .subset), ...) :
      argument "clusters" is missing, with no default
      10.
      ClusterR::MiniBatchKmeans(getTaskData(.task, .subset), ...) at RLearner_cluster_MiniBatchKmeans.R#32
      9.
      trainLearner.cluster.MiniBatchKmeans(.learner = structure(list(
      id = "cluster.MiniBatchKmeans", type = "cluster", package = "ClusterR",
      properties = c("numerics", "prob"), par.set = structure(list(
      pars = list(clusters = structure(list(id = "clusters", ... at trainLearner.R#24
      8.
      (function (.learner, .task, .subset, .weights = NULL, ...)

      UseMethod("trainLearner")
      )(.learner = structure(list(id = "cluster.MiniBatchKmeans", ...
      7.
      do.call(trainLearner, pars) at train.R#96
      6.
      fun3(do.call(trainLearner, pars)) at train.R#96
      5.
      fun2(fun3(do.call(trainLearner, pars))) at train.R#96
      4.
      fun1(
      learner.model = fun2(fun3(do.call(trainLearner, pars)))
      ) at train.R#96
      3.
      force(expr) at helpers.R#93
      2.
      measureTime(fun1(
      learner.model = fun2(fun3(do.call(trainLearner, pars)))
      )) at train.R#96
      1.
      train(lrn, cluster_task)









      share|improve this question
















      I am trying to integrate the MiniBatchKmeans function of package ClusterR to mlr. As per the docs, I have made the following changes:



      1. Created makeRLearner.cluster.MiniBatchKmeans

      2. Created trainLearner.cluster.MiniBatchKmeans

      3. Created predictLearner.cluster.MiniBatchKmeans

      4. Registered the above S3 methods (as described here)

      At this point, I am able to create the learner, and call train and predict on them. However, the problem occurs when trying to create the learner without any value of "clusters" provided.



      The underlying package (in ClusterR) does not have a default value defined for argument "clusters". As per the mlr approach, I have attempted to provide a default value of "clusters" using par.vals argument. However, this default argument is ignored.



      My code:



      #' @export
      makeRLearner.cluster.MiniBatchKmeans = function()
      makeRLearnerCluster(
      cl = "cluster.MiniBatchKmeans",
      package = "ClusterR",
      par.set = makeParamSet(
      makeIntegerLearnerParam(id = "clusters", lower = 1L),
      makeIntegerLearnerParam(id = "batch_size", default = 10L, lower = 1L),
      makeIntegerLearnerParam(id = "num_init", default = 1L, lower = 1L),
      makeIntegerLearnerParam(id = "max_iters", default = 100L, lower = 1L),
      makeNumericLearnerParam(id = "init_fraction", default = 1, lower = 0),
      makeDiscreteLearnerParam(id = "initializer", default = "kmeans++",
      values = c("optimal_init", "quantile_init", "kmeans++", "random")),
      makeIntegerLearnerParam(id = "early_stop_iter", default = 10L, lower = 1L),
      makeLogicalLearnerParam(id = "verbose", default = FALSE,
      tunable = FALSE),
      makeUntypedLearnerParam(id = "CENTROIDS", default = NULL),
      makeNumericLearnerParam(id = "tol", default = 1e-04, lower = 0),
      makeNumericLearnerParam(id = "tol_optimal_init", default = 0.3, lower = 0),
      makeIntegerLearnerParam(id = "seed", default = 1L)
      ),
      par.vals = list(clusters = 2L),
      properties = c("numerics", "prob"),
      name = "MiniBatchKmeans",
      note = "Note",
      short.name = "MBatchKmeans",
      callees = c("MiniBatchKmeans", "predict_MBatchKMeans")
      )


      #' @export
      trainLearner.cluster.MiniBatchKmeans = function(.learner, .task, .subset, .weights = NULL, ...)
      ClusterR::MiniBatchKmeans(getTaskData(.task, .subset), ...)


      #' @export
      predictLearner.cluster.MiniBatchKmeans = function(.learner, .model, .newdata, ...)
      if (.learner$predict.type == "prob")
      pred = ClusterR::predict_MBatchKMeans(data = .newdata,
      CENTROIDS = .model$learner.model$centroids,
      fuzzy = TRUE, ...)

      res = pred$fuzzy_clusters

      return(res)
      else
      pred = ClusterR::predict_MBatchKMeans(data = .newdata,
      CENTROIDS = .model$learner.model$centroids,
      fuzzy = FALSE, ...)

      res = as.integer(pred)

      return(res)




      The problem (default value of clusters in par.vals above is ignored):



      ## When defining a value of clusters, it works as expected
      lrn <- makeLearner("cluster.MiniBatchKmeans", clusters = 3L)
      getLearnerParVals(lrn)
      # The below commented lines are printed
      # $clusters
      # [1] 3

      ## When not providing a value for clusters, default is not used
      lrn <- makeLearner("cluster.MiniBatchKmeans")
      getLearnerParVals(lrn)
      # The below commented lines are printed
      # named list()


      Any advice on why I am seeing this behavior? I checked other learner's (like cluster.kmeans, cluster.kkmeans etc) code and I see that they are able to successfully define default values in the same format that I have done. Additionally, here is documentation that this is the right way to go.



      Here is my code on github, in case it's helpful for reproducing the problem. There is an added test file (in tests/testthat), but that has issues of its own.



      Edit 1 - Actual Error Message
      Here is the actual error message that I see when trying to train a learner without explicitly providing default value of "clusters":



      lrn <- makeLearner("cluster.MiniBatchKmeans")
      train(lrn, cluster_task)
      Error in ClusterR::MiniBatchKmeans(getTaskData(.task, .subset), ...) :
      argument "clusters" is missing, with no default
      10.
      ClusterR::MiniBatchKmeans(getTaskData(.task, .subset), ...) at RLearner_cluster_MiniBatchKmeans.R#32
      9.
      trainLearner.cluster.MiniBatchKmeans(.learner = structure(list(
      id = "cluster.MiniBatchKmeans", type = "cluster", package = "ClusterR",
      properties = c("numerics", "prob"), par.set = structure(list(
      pars = list(clusters = structure(list(id = "clusters", ... at trainLearner.R#24
      8.
      (function (.learner, .task, .subset, .weights = NULL, ...)

      UseMethod("trainLearner")
      )(.learner = structure(list(id = "cluster.MiniBatchKmeans", ...
      7.
      do.call(trainLearner, pars) at train.R#96
      6.
      fun3(do.call(trainLearner, pars)) at train.R#96
      5.
      fun2(fun3(do.call(trainLearner, pars))) at train.R#96
      4.
      fun1(
      learner.model = fun2(fun3(do.call(trainLearner, pars)))
      ) at train.R#96
      3.
      force(expr) at helpers.R#93
      2.
      measureTime(fun1(
      learner.model = fun2(fun3(do.call(trainLearner, pars)))
      )) at train.R#96
      1.
      train(lrn, cluster_task)






      r oop mlr r-s3






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 9 at 4:46







      Prasiddhi

















      asked Mar 9 at 3:50









      PrasiddhiPrasiddhi

      11




      11






















          1 Answer
          1






          active

          oldest

          votes


















          0














          The code in your repository works for me -- are you actually getting an error when you run it? The way that you've encoded the default is really more of an override and not a default. You probably want to do



          makeIntegerLearnerParam(id = "clusters", lower = 1L, default = 2L),


          and remove the par.vals.






          share|improve this answer























          • Yes, I get an error when trying to call train on this learner (without clusters argument explicitly provided). I have updated the error traceback in my question details.

            – Prasiddhi
            Mar 9 at 4:47












          • Works for me without error: > train(lrn, makeClusterTask(id = "foo", iris[,-5])) Model for learner.id=cluster.MiniBatchKmeans; learner.class=cluster.MiniBatchKmeans Trained on: task.id = foo; obs = 150; features = 4 Hyperparameters: clusters=2

            – Lars Kotthoff
            Mar 9 at 4:50











          • Ok, this is driving me crazy. I took a fresh copy and it worked for me. I tried to make the code change you suggested in your answer and it stopped working (same error). Is it somehow related to the registerS3Method call?

            – Prasiddhi
            Mar 9 at 10:20











          • It could be, depending on how exactly you're testing it. The safest way is to start a new R session each time.

            – Lars Kotthoff
            Mar 9 at 21:32











          • As in the package there is no default for the argument clusters it is definitely correct to put a value in par.vals. The default in the parameter description is just "cosmetic". While developing use devtools:load_all() to avoid problems (no guarantee).

            – jakob-r
            Mar 11 at 16:13











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55073807%2fmlr-package-trying-to-integrate-a-new-clustering-learner-default-values-in-pa%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          The code in your repository works for me -- are you actually getting an error when you run it? The way that you've encoded the default is really more of an override and not a default. You probably want to do



          makeIntegerLearnerParam(id = "clusters", lower = 1L, default = 2L),


          and remove the par.vals.






          share|improve this answer























          • Yes, I get an error when trying to call train on this learner (without clusters argument explicitly provided). I have updated the error traceback in my question details.

            – Prasiddhi
            Mar 9 at 4:47












          • Works for me without error: > train(lrn, makeClusterTask(id = "foo", iris[,-5])) Model for learner.id=cluster.MiniBatchKmeans; learner.class=cluster.MiniBatchKmeans Trained on: task.id = foo; obs = 150; features = 4 Hyperparameters: clusters=2

            – Lars Kotthoff
            Mar 9 at 4:50











          • Ok, this is driving me crazy. I took a fresh copy and it worked for me. I tried to make the code change you suggested in your answer and it stopped working (same error). Is it somehow related to the registerS3Method call?

            – Prasiddhi
            Mar 9 at 10:20











          • It could be, depending on how exactly you're testing it. The safest way is to start a new R session each time.

            – Lars Kotthoff
            Mar 9 at 21:32











          • As in the package there is no default for the argument clusters it is definitely correct to put a value in par.vals. The default in the parameter description is just "cosmetic". While developing use devtools:load_all() to avoid problems (no guarantee).

            – jakob-r
            Mar 11 at 16:13















          0














          The code in your repository works for me -- are you actually getting an error when you run it? The way that you've encoded the default is really more of an override and not a default. You probably want to do



          makeIntegerLearnerParam(id = "clusters", lower = 1L, default = 2L),


          and remove the par.vals.






          share|improve this answer























          • Yes, I get an error when trying to call train on this learner (without clusters argument explicitly provided). I have updated the error traceback in my question details.

            – Prasiddhi
            Mar 9 at 4:47












          • Works for me without error: > train(lrn, makeClusterTask(id = "foo", iris[,-5])) Model for learner.id=cluster.MiniBatchKmeans; learner.class=cluster.MiniBatchKmeans Trained on: task.id = foo; obs = 150; features = 4 Hyperparameters: clusters=2

            – Lars Kotthoff
            Mar 9 at 4:50











          • Ok, this is driving me crazy. I took a fresh copy and it worked for me. I tried to make the code change you suggested in your answer and it stopped working (same error). Is it somehow related to the registerS3Method call?

            – Prasiddhi
            Mar 9 at 10:20











          • It could be, depending on how exactly you're testing it. The safest way is to start a new R session each time.

            – Lars Kotthoff
            Mar 9 at 21:32











          • As in the package there is no default for the argument clusters it is definitely correct to put a value in par.vals. The default in the parameter description is just "cosmetic". While developing use devtools:load_all() to avoid problems (no guarantee).

            – jakob-r
            Mar 11 at 16:13













          0












          0








          0







          The code in your repository works for me -- are you actually getting an error when you run it? The way that you've encoded the default is really more of an override and not a default. You probably want to do



          makeIntegerLearnerParam(id = "clusters", lower = 1L, default = 2L),


          and remove the par.vals.






          share|improve this answer













          The code in your repository works for me -- are you actually getting an error when you run it? The way that you've encoded the default is really more of an override and not a default. You probably want to do



          makeIntegerLearnerParam(id = "clusters", lower = 1L, default = 2L),


          and remove the par.vals.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 9 at 4:08









          Lars KotthoffLars Kotthoff

          91.6k11159168




          91.6k11159168












          • Yes, I get an error when trying to call train on this learner (without clusters argument explicitly provided). I have updated the error traceback in my question details.

            – Prasiddhi
            Mar 9 at 4:47












          • Works for me without error: > train(lrn, makeClusterTask(id = "foo", iris[,-5])) Model for learner.id=cluster.MiniBatchKmeans; learner.class=cluster.MiniBatchKmeans Trained on: task.id = foo; obs = 150; features = 4 Hyperparameters: clusters=2

            – Lars Kotthoff
            Mar 9 at 4:50











          • Ok, this is driving me crazy. I took a fresh copy and it worked for me. I tried to make the code change you suggested in your answer and it stopped working (same error). Is it somehow related to the registerS3Method call?

            – Prasiddhi
            Mar 9 at 10:20











          • It could be, depending on how exactly you're testing it. The safest way is to start a new R session each time.

            – Lars Kotthoff
            Mar 9 at 21:32











          • As in the package there is no default for the argument clusters it is definitely correct to put a value in par.vals. The default in the parameter description is just "cosmetic". While developing use devtools:load_all() to avoid problems (no guarantee).

            – jakob-r
            Mar 11 at 16:13

















          • Yes, I get an error when trying to call train on this learner (without clusters argument explicitly provided). I have updated the error traceback in my question details.

            – Prasiddhi
            Mar 9 at 4:47












          • Works for me without error: > train(lrn, makeClusterTask(id = "foo", iris[,-5])) Model for learner.id=cluster.MiniBatchKmeans; learner.class=cluster.MiniBatchKmeans Trained on: task.id = foo; obs = 150; features = 4 Hyperparameters: clusters=2

            – Lars Kotthoff
            Mar 9 at 4:50











          • Ok, this is driving me crazy. I took a fresh copy and it worked for me. I tried to make the code change you suggested in your answer and it stopped working (same error). Is it somehow related to the registerS3Method call?

            – Prasiddhi
            Mar 9 at 10:20











          • It could be, depending on how exactly you're testing it. The safest way is to start a new R session each time.

            – Lars Kotthoff
            Mar 9 at 21:32











          • As in the package there is no default for the argument clusters it is definitely correct to put a value in par.vals. The default in the parameter description is just "cosmetic". While developing use devtools:load_all() to avoid problems (no guarantee).

            – jakob-r
            Mar 11 at 16:13
















          Yes, I get an error when trying to call train on this learner (without clusters argument explicitly provided). I have updated the error traceback in my question details.

          – Prasiddhi
          Mar 9 at 4:47






          Yes, I get an error when trying to call train on this learner (without clusters argument explicitly provided). I have updated the error traceback in my question details.

          – Prasiddhi
          Mar 9 at 4:47














          Works for me without error: > train(lrn, makeClusterTask(id = "foo", iris[,-5])) Model for learner.id=cluster.MiniBatchKmeans; learner.class=cluster.MiniBatchKmeans Trained on: task.id = foo; obs = 150; features = 4 Hyperparameters: clusters=2

          – Lars Kotthoff
          Mar 9 at 4:50





          Works for me without error: > train(lrn, makeClusterTask(id = "foo", iris[,-5])) Model for learner.id=cluster.MiniBatchKmeans; learner.class=cluster.MiniBatchKmeans Trained on: task.id = foo; obs = 150; features = 4 Hyperparameters: clusters=2

          – Lars Kotthoff
          Mar 9 at 4:50













          Ok, this is driving me crazy. I took a fresh copy and it worked for me. I tried to make the code change you suggested in your answer and it stopped working (same error). Is it somehow related to the registerS3Method call?

          – Prasiddhi
          Mar 9 at 10:20





          Ok, this is driving me crazy. I took a fresh copy and it worked for me. I tried to make the code change you suggested in your answer and it stopped working (same error). Is it somehow related to the registerS3Method call?

          – Prasiddhi
          Mar 9 at 10:20













          It could be, depending on how exactly you're testing it. The safest way is to start a new R session each time.

          – Lars Kotthoff
          Mar 9 at 21:32





          It could be, depending on how exactly you're testing it. The safest way is to start a new R session each time.

          – Lars Kotthoff
          Mar 9 at 21:32













          As in the package there is no default for the argument clusters it is definitely correct to put a value in par.vals. The default in the parameter description is just "cosmetic". While developing use devtools:load_all() to avoid problems (no guarantee).

          – jakob-r
          Mar 11 at 16:13





          As in the package there is no default for the argument clusters it is definitely correct to put a value in par.vals. The default in the parameter description is just "cosmetic". While developing use devtools:load_all() to avoid problems (no guarantee).

          – jakob-r
          Mar 11 at 16:13



















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55073807%2fmlr-package-trying-to-integrate-a-new-clustering-learner-default-values-in-pa%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Can't initialize raids on a new ASUS Prime B360M-A motherboard2019 Community Moderator ElectionSimilar to RAID config yet more like mirroring solution?Can't get motherboard serial numberWhy does the BIOS entry point start with a WBINVD instruction?UEFI performance Asus Maximus V Extreme

          Identity Server 4 is not redirecting to Angular app after login2019 Community Moderator ElectionIdentity Server 4 and dockerIdentityserver implicit flow unauthorized_clientIdentityServer Hybrid Flow - Access Token is null after user successful loginIdentity Server to MVC client : Page Redirect After loginLogin with Steam OpenId(oidc-client-js)Identity Server 4+.NET Core 2.0 + IdentityIdentityServer4 post-login redirect not working in Edge browserCall to IdentityServer4 generates System.NullReferenceException: Object reference not set to an instance of an objectIdentityServer4 without HTTPS not workingHow to get Authorization code from identity server without login form

          2005 Ahvaz unrest Contents Background Causes Casualties Aftermath See also References Navigation menue"At Least 10 Are Killed by Bombs in Iran""Iran"Archived"Arab-Iranians in Iran to make April 15 'Day of Fury'"State of Mind, State of Order: Reactions to Ethnic Unrest in the Islamic Republic of Iran.10.1111/j.1754-9469.2008.00028.x"Iran hangs Arab separatists"Iran Overview from ArchivedConstitution of the Islamic Republic of Iran"Tehran puzzled by forged 'riots' letter""Iran and its minorities: Down in the second class""Iran: Handling Of Ahvaz Unrest Could End With Televised Confessions""Bombings Rock Iran Ahead of Election""Five die in Iran ethnic clashes""Iran: Need for restraint as anniversary of unrest in Khuzestan approaches"Archived"Iranian Sunni protesters killed in clashes with security forces"Archived