rm(list = ls(all = TRUE))
ls
x <- sample(c(0,1), 100, replace=TRUE)
x
y <- sample(c(0,1), 100, replace = TRUE)
y
x
x <- sample(c(0,1), 100, replace = TRUE)#
y <- sample(c(0,1), 100, replace = TRUE)#
p <- runif(100)#
cuts <- seq(0,1, length.out = 100)
cuts
labels <- sample(c(0,1), 100, replace = TRUE)#
pred <- sample(c(0,1), 100, replace = TRUE)#
p <- runif(100)#
cuts <- seq(0,1, length.out = 100)#
#
true_pos <- false_pos <- 0#
#
calculate.aux <- function(labels, pred, p, cuts) {#
  for(i in seq_along(cuts)) {#
    for(j in seq_along(labels)) {#
      if(labels[j] == 1L) { ### true positive#
        if((1-p[i]) < cut[i]) { ### classified as true#
          true_pos <- true_pos + 1           #
        }#
      } else { ### true negative#
        if((1-p[i]) < cut[i]) { ### classified as true#
          false_pos <- false_pos + 1#
        }	#
      }#
    }#
  }#
}
true_pos
false_pos
labels <- sample(c(0,1), 200, replace = TRUE)#
pred <- sample(c(0,1), 200, replace = TRUE)#
p <- runif(200)#
cuts <- seq(0,1, length.out = 100)#
#
true_pos <- false_pos <- 0#
#
calculate.aux <- function(labels, pred, p, cuts) {#
  for(i in seq_along(cuts)) {#
    for(j in seq_along(labels)) {#
      if(labels[j] == 1) { ### true positive#
        if((1-p[j]) < cut[i]) { ### classified as true#
          true_pos <- true_pos + 1           #
        }#
      } else { ### true negative#
        if((1-p[j]) < cut[i]) { ### classified as true#
          false_pos <- false_pos + 1#
        }	#
      }#
    }#
  }#
}
true_pos
false_pos
labels <- sample(c(0,1), 200, replace = TRUE)#
pred <- sample(c(0,1), 200, replace = TRUE)#
p <- runif(200)#
cuts <- seq(0,1, length.out = 100)#
#
true_pos <- false_pos <- 0#
#
calculate.aux <- function(labels, pred, p, cuts) {#
  #
  N <- length(labels)#
  x <- vector('list', length(cuts))#
  #
  for(i in seq_along(cuts)) {#
    for(j in seq_along(labels)) {#
      if(labels[j] == 1) { ### true positive#
        if((1-p[j]) < cut[i]) { ### classified as true#
          true_pos <- true_pos + 1           #
        }#
      } else { ### true negative#
        if((1-p[j]) < cut[i]) { ### classified as true#
          false_pos <- false_pos + 1#
        }	#
      }#
    }#
    x[[i]] <- c(true_pos / N, false_pos / N)#
  }#
}#
#
calculate.auc(labels, pred, p, cuts)
labels <- sample(c(0,1), 200, replace = TRUE)#
pred <- sample(c(0,1), 200, replace = TRUE)#
p <- runif(200)#
cuts <- seq(0,1, length.out = 100)#
#
true_pos <- false_pos <- 0#
#
calculate.auc <- function(labels, pred, p, cuts) {#
  #
  N <- length(labels)#
  x <- vector('list', length(cuts))#
  #
  for(i in seq_along(cuts)) {#
    for(j in seq_along(labels)) {#
      if(labels[j] == 1) { ### true positive#
        if((1-p[j]) < cut[i]) { ### classified as true#
          true_pos <- true_pos + 1           #
        }#
      } else { ### true negative#
        if((1-p[j]) < cut[i]) { ### classified as true#
          false_pos <- false_pos + 1#
        }	#
      }#
    }#
    x[[i]] <- c(true_pos / N, false_pos / N)#
  }#
}#
#
calculate.auc(labels, pred, p, cuts)
labels <- sample(c(0,1), 200, replace = TRUE)#
pred <- sample(c(0,1), 200, replace = TRUE)#
p <- runif(200)#
cuts <- seq(0,1, length.out = 100)#
#
true_pos <- false_pos <- 0#
#
calculate.auc <- function(labels, pred, p, cuts) {#
  #
  N <- length(labels)#
  x <- vector('list', length(cuts))#
  #
  for(i in seq_along(cuts)) {#
    for(j in seq_along(labels)) {#
      if(labels[j] == 1) { ### true positive#
        if((1-p[j]) < cuts[i]) { ### classified as true#
          true_pos <- true_pos + 1           #
        }#
      } else { ### true negative#
        if((1-p[j]) < cuts[i]) { ### classified as true#
          false_pos <- false_pos + 1#
        }	#
      }#
    }#
    x[[i]] <- c(true_pos / N, false_pos / N)#
  }#
}#
#
calculate.auc(labels, pred, p, cuts)
labels <- sample(c(0,1), 200, replace = TRUE)#
pred <- sample(c(0,1), 200, replace = TRUE)#
p <- runif(200)#
cuts <- seq(0,1, length.out = 100)#
#
true_pos <- false_pos <- 0#
#
calculate.auc <- function(labels, pred, p, cuts) {#
  #
  N <- length(labels)#
  x <- vector('list', length(cuts))#
  #
  for(i in seq_along(cuts)) {#
    for(j in seq_along(labels)) {#
      if(labels[j] == 1) { ### true positive#
        if((1-p[j]) < cuts[i]) { ### classified as true#
          true_pos <- true_pos + 1           #
        }#
      } else { ### true negative#
        if((1-p[j]) < cuts[i]) { ### classified as true#
          false_pos <- false_pos + 1#
        }	#
      }#
    }#
    x[[i]] <- c(true_pos / N, false_pos / N)#
  }#
  return(x)#
}#
#
calculate.auc(labels, pred, p, cuts)
labels <- sample(c(0,1), 200, replace = TRUE)#
pred <- sample(c(0,1), 200, replace = TRUE)#
p <- runif(200)#
cuts <- seq(0,1, length.out = 100)#
#
true_pos <- false_pos <- 0#
#
calculate.auc <- function(labels, pred, p, cuts) {#
  #
  N <- length(labels)#
  x <- vector('list', length(cuts))#
  #
  for(i in seq_along(cuts)) {#
    for(j in seq_along(labels)) {#
      if(labels[j] == 1) { ### true positive#
        if((1-p[j]) < cuts[i]) { ### classified as true#
          true_pos <- true_pos + 1           #
        }#
      } else { ### true negative#
        if((1-p[j]) < cuts[i]) { ### classified as true#
          false_pos <- false_pos + 1#
        }	#
      }#
    }#
    x[[i]] <- c(true_pos / N, false_pos / N)#
  }#
  return(x)#
}#
#
x <- calculate.auc(labels, pred, p, cuts)#
x <- do.call("rbind", x)
x
plot(x[,1], x[,2])
datasize <- 1000#
#
labels <- sample(c(0,1), datasize, replace = TRUE)#
pred <- sample(c(0,1), datasize, replace = TRUE)#
p <- runif(datasize)#
cuts <- seq(0,1, length.out = 100)#
#
true_pos <- false_pos <- 0#
#
calculate.auc <- function(labels, pred, p, cuts) {#
  #
  N <- length(labels)#
  x <- vector('list', length(cuts))#
  #
  for(i in seq_along(cuts)) {#
    for(j in seq_along(labels)) {#
      if(labels[j] == 1) { ### true positive#
        if((1-p[j]) < cuts[i]) { ### classified as true#
          true_pos <- true_pos + 1           #
        }#
      } else { ### true negative#
        if((1-p[j]) < cuts[i]) { ### classified as true#
          false_pos <- false_pos + 1#
        }	#
      }#
    }#
    x[[i]] <- c(true_pos / N, false_pos / N)#
  }#
  return(x)#
}#
#
x <- calculate.auc(labels, pred, p, cuts)#
x <- do.call("rbind", x)
x
datasize <- 100000#
#
labels <- sample(c(0,1), datasize, replace = TRUE)#
pred <- sample(c(0,1), datasize, replace = TRUE)#
p <- runif(datasize)#
cuts <- seq(0,1, length.out = 100)#
#
true_pos <- false_pos <- 0#
#
calculate.auc <- function(labels, pred, p, cuts) {#
  #
  N <- length(labels)#
  x <- vector('list', length(cuts))#
  #
  for(i in seq_along(cuts)) {#
    for(j in seq_along(labels)) {#
      if(labels[j] == 1) { ### true positive#
        if((1-p[j]) < cuts[i]) { ### classified as true#
          true_pos <- true_pos + 1           #
        }#
      } else { ### true negative#
        if((1-p[j]) < cuts[i]) { ### classified as true#
          false_pos <- false_pos + 1#
        }	#
      }#
    }#
    x[[i]] <- c(true_pos / N, false_pos / N)#
  }#
  return(x)#
}#
#
x <- calculate.auc(labels, pred, p, cuts)#
x <- do.call("rbind", x)
cuts
diff(cuts)
rm(list = ls(all = TRUE))
q(save = "y")
q(save = "yes")
library(RSofia)
?RSofia
seq_len
q()
sofia
sofia.formula
q()
library(RUnit)
checkEquals
?checkEquals
q()
ls
ls()
"x" <- function(a, b, c) a + b + c
x
paste("a","b", sep ="") <- function(a, b, c) a * b * c
create_function_text <- function(learner, loop) {#
#
  function_txt <- ""#
  #
  function_txt <- paste("LOOP_TYPE = ", loop, #
                        "LEARNER_TYPE = ", learner,#
                        "\n",#
                        "weights.RSofia <- sofia(Is.Virginica ~ ., irismod, random_seed = RANDOM_SEED",#
                        ", learner_type = LEARNER_TYPE, loop_type = LOOP_TYPE)$weights",#
                        ", weights.sofia_ml <- sofia_ml_test_results[[paste(LEARNER_TYPE, LOOP_TYPE, sep = "_")]]",#
                        "checkEqualsNumeric(weights.RSofia, weights.sofia_ml, tolerance = TOLERANCE)")#
                        #
  cat(function_txt)#
#
	#
}
create_function_text <- function(learner, loop) {#
#
  function_txt <- paste("LOOP_TYPE = ", loop, #
      "LEARNER_TYPE = ", learner,#
      "weights.RSofia <- sofia(Is.Virginica ~ ., irismod, random_seed = RANDOM_SEED",#
      ", learner_type = LEARNER_TYPE, loop_type = LOOP_TYPE)$weights",#
      ", weights.sofia_ml <- sofia_ml_test_results[[paste(LEARNER_TYPE, LOOP_TYPE, sep = '_')]]",#
      "checkEqualsNumeric(weights.RSofia, weights.sofia_ml, tolerance = TOLERANCE)")#
                        #
  cat(function_txt)#
#
	#
}
create_function_text <- function(learner, loop) {#
#
  function_txt <- paste("LOOP_TYPE = ", loop, #
      "LEARNER_TYPE = ", learner,#
      "weights.RSofia <- sofia(Is.Virginica ~ ., irismod, random_seed = RANDOM_SEED",#
      ", learner_type = LEARNER_TYPE, loop_type = LOOP_TYPE)$weights",#
      ", weights.sofia_ml <- sofia_ml_test_results[[paste(LEARNER_TYPE, LOOP_TYPE, sep = '_')]]",#
      "checkEqualsNumeric(weights.RSofia, weights.sofia_ml, tolerance = TOLERANCE)")#
                        #
  cat(function_txt)#
#
	#
}#
#
create_function_text("pegasos", "stochastic")
x <- "hello-this-is"
x
gsub("-","_",x)
create_function_text <- function(learner, loop) {#
#
#
  function_txt.name <- paste("test.sofia."#
    , gsub(learner,"-","_"),"."#
    , gsub(loop, "-","_")#
    , "{ \n", sep ="")#
#
  function_txt.body <- paste("LOOP_TYPE = ", loop, #
      "LEARNER_TYPE = ", learner,#
      "weights.RSofia <- sofia(Is.Virginica ~ ., irismod, random_seed = RANDOM_SEED",#
      ", learner_type = LEARNER_TYPE, loop_type = LOOP_TYPE)$weights",#
      ", weights.sofia_ml <- sofia_ml_test_results[[paste(LEARNER_TYPE, LOOP_TYPE, sep = '_')]]",#
      "checkEqualsNumeric(weights.RSofia, weights.sofia_ml, tolerance = TOLERANCE)", sep = "\n")#
                      #
  function_txt.end <- "\n}"#
                        #
  function_txt <- paste(function_txt.name, function_txt.body, function_txt.end, sep = "\n")#
                        #
  cat(function_txt)#
#
	#
}#
#
create_function_text("pegasos", "stochastic")
create_function_text <- function(learner, loop) {#
#
#
  function_txt.name <- paste("test.sofia."#
    , gsub(learner,"-","_"),"."#
    , gsub(loop, "-","_")#
    , "{ \n", sep ="")#
#
  function_txt.body <- paste("LOOP_TYPE = ", loop, "\n",#
      "LEARNER_TYPE = ", learner, "\n",#
      "weights.RSofia <- sofia(Is.Virginica ~ ., irismod, random_seed = RANDOM_SEED", "\n",#
      ", learner_type = LEARNER_TYPE, loop_type = LOOP_TYPE)$weights", "\n",#
      ", weights.sofia_ml <- sofia_ml_test_results[[paste(LEARNER_TYPE, LOOP_TYPE, sep = '_')]]","\n",#
      "checkEqualsNumeric(weights.RSofia, weights.sofia_ml, tolerance = TOLERANCE)", sep = " ")#
                      #
  function_txt.end <- "\n}"#
                        #
  function_txt <- paste(function_txt.name, function_txt.body, function_txt.end, sep = "\n")#
                        #
  cat(function_txt)#
#
	#
}#
#
create_function_text("pegasos", "stochastic")
create_function_text <- function(learner, loop) {#
#
#
  function_txt.name <- paste("test.sofia."#
    , gsub(learner,"-","_"),"."#
    , gsub(loop, "-","_")#
    , "{ \n", sep ="")#
#
  function_txt.body <- paste("LOOP_TYPE <- ", loop, "\n",#
      "LEARNER_TYPE <- ", learner, "\n",#
      "weights.RSofia <- sofia(Is.Virginica ~ ., irismod, random_seed = RANDOM_SEED", "\n",#
      ", learner_type = LEARNER_TYPE, loop_type = LOOP_TYPE)$weights", "\n",#
      ", weights.sofia_ml <- sofia_ml_test_results[[paste(LEARNER_TYPE, LOOP_TYPE, sep = '_')]]","\n",#
      "checkEqualsNumeric(weights.RSofia, weights.sofia_ml, tolerance = TOLERANCE)", sep = " ")#
                      #
  function_txt.end <- "\n}"#
                        #
  function_txt <- paste(function_txt.name, function_txt.body, function_txt.end, sep = "\n")#
                        #
  cat(function_txt)#
#
	#
}#
#
create_function_text("pegasos", "stochastic")
gsub
create_function_text <- function(learner, loop) {#
#
#
  function_txt.name <- paste("test.sofia."#
    , gsub("-","_",learner),"."#
    , gsub("-","_",loop)#
    , "{ \n", sep ="")#
#
  function_txt.body <- paste("LOOP_TYPE <- ", loop, "\n",#
      "LEARNER_TYPE <- ", learner, "\n",#
      "weights.RSofia <- sofia(Is.Virginica ~ ., irismod, random_seed = RANDOM_SEED", "\n",#
      ", learner_type = LEARNER_TYPE, loop_type = LOOP_TYPE)$weights", "\n",#
      ", weights.sofia_ml <- sofia_ml_test_results[[paste(LEARNER_TYPE, LOOP_TYPE, sep = '_')]]","\n",#
      "checkEqualsNumeric(weights.RSofia, weights.sofia_ml, tolerance = TOLERANCE)", sep = " ")#
                      #
  function_txt.end <- "\n}"#
                        #
  function_txt <- paste(function_txt.name, function_txt.body, function_txt.end, sep = "\n")#
                        #
  cat(function_txt)#
#
	#
}#
#
create_function_text("pegasos", "stochastic")
create_function_text <- function(learner, loop) {#
#
#
  function_txt.name <- paste("test.sofia."#
    , gsub("-","_",learner),"."#
    , gsub("-","_",loop)#
    , " { \n", sep ="")#
#
  function_txt.body <- paste("LOOP_TYPE <- ", loop, "\n",#
      "LEARNER_TYPE <- ", learner, "\n",#
      "weights.RSofia <- sofia(Is.Virginica ~ ., irismod, random_seed = RANDOM_SEED", "\n",#
      ", learner_type = LEARNER_TYPE, loop_type = LOOP_TYPE)$weights", "\n",#
      ", weights.sofia_ml <- sofia_ml_test_results[[paste(LEARNER_TYPE, LOOP_TYPE, sep = '_')]]","\n",#
      "checkEqualsNumeric(weights.RSofia, weights.sofia_ml, tolerance = TOLERANCE)", sep = " ")#
                      #
  function_txt.end <- "\n}"#
                        #
  function_txt <- paste(function_txt.name, function_txt.body, function_txt.end, sep = "\n")#
                        #
  cat(function_txt)#
#
	#
}#
#
create_function_text("pegasos", "stochastic")
create_function_text <- function(learner, loop) {#
#
#
  function_txt.name <- paste("test.sofia."#
    , gsub("-","_",learner),"."#
    , gsub("-","_",loop)#
    , " { \n", sep ="")#
#
  function_txt.body <- paste("LOOP_TYPE <- ", loop, "\n",#
      "LEARNER_TYPE <- ", learner, "\n",#
      "weights.RSofia <- sofia(Is.Virginica ~ ., irismod, random_seed = RANDOM_SEED", "\n",#
      ", learner_type = LEARNER_TYPE, loop_type = LOOP_TYPE)$weights", "\n",#
      ", weights.sofia_ml <- sofia_ml_test_results[[paste(LEARNER_TYPE, LOOP_TYPE, sep = '_')]]","\n",#
      "checkEqualsNumeric(weights.RSofia, weights.sofia_ml, tolerance = TOLERANCE)", sep = "")#
                      #
  function_txt.end <- "\n}"#
                        #
  function_txt <- paste(function_txt.name, function_txt.body, function_txt.end, sep = "\n")#
                        #
  cat(function_txt)#
#
	#
}#
#
create_function_text("pegasos", "stochastic")
create_function_text <- function(learner, loop) {#
#
#
  function_txt.name <- paste("test.sofia."#
    , gsub("-","_",learner),"."#
    , gsub("-","_",loop)#
    , " { \n", sep ="")#
#
  function_txt.body <- paste("LOOP_TYPE <- ", loop, "\n",#
      "LEARNER_TYPE <- \'", learner, "'\n",#
      "weights.RSofia <- sofia(Is.Virginica ~ ., irismod, random_seed = RANDOM_SEED", "\n",#
      ", learner_type = LEARNER_TYPE, loop_type = LOOP_TYPE)$weights", "\n",#
      ", weights.sofia_ml <- sofia_ml_test_results[[paste(LEARNER_TYPE, LOOP_TYPE, sep = '_')]]","\n",#
      "checkEqualsNumeric(weights.RSofia, weights.sofia_ml, tolerance = TOLERANCE)", sep = "")#
                      #
  function_txt.end <- "\n}"#
                        #
  function_txt <- paste(function_txt.name, function_txt.body, function_txt.end, sep = "\n")#
                        #
  cat(function_txt)#
#
	#
}#
#
create_function_text("pegasos", "stochastic")
create_function_text <- function(learner, loop) {#
#
#
  function_txt.name <- paste("test.sofia."#
    , gsub("-","_",learner),"."#
    , gsub("-","_",loop)#
    , " { \n", sep ="")#
#
  function_txt.body <- paste("LOOP_TYPE <- ", loop, "\n",#
      "LEARNER_TYPE <- '", learner, "'\n",#
      "weights.RSofia <- sofia(Is.Virginica ~ ., irismod, random_seed = RANDOM_SEED", "\n",#
      ", learner_type = LEARNER_TYPE, loop_type = LOOP_TYPE)$weights", "\n",#
      ", weights.sofia_ml <- sofia_ml_test_results[[paste(LEARNER_TYPE, LOOP_TYPE, sep = '_')]]","\n",#
      "checkEqualsNumeric(weights.RSofia, weights.sofia_ml, tolerance = TOLERANCE)", sep = "")#
                      #
  function_txt.end <- "\n}"#
                        #
  function_txt <- paste(function_txt.name, function_txt.body, function_txt.end, sep = "\n")#
                        #
  cat(function_txt)#
#
	#
}#
#
create_function_text("pegasos", "stochastic")
create_function_text <- function(learner, loop) {#
#
#
  function_txt.name <- paste("test.sofia."#
    , gsub("-","_",learner),"."#
    , gsub("-","_",loop)#
    , " { \n", sep ="")#
#
  function_txt.body <- paste("LOOP_TYPE <- '", loop, "'\n",#
      "LEARNER_TYPE <- '", learner, "'\n",#
      "weights.RSofia <- sofia(Is.Virginica ~ ., irismod, random_seed = RANDOM_SEED", "\n",#
      ", learner_type = LEARNER_TYPE, loop_type = LOOP_TYPE)$weights", "\n",#
      ", weights.sofia_ml <- sofia_ml_test_results[[paste(LEARNER_TYPE, LOOP_TYPE, sep = '_')]]","\n",#
      "checkEqualsNumeric(weights.RSofia, weights.sofia_ml, tolerance = TOLERANCE)", sep = "")#
                      #
  function_txt.end <- "\n}"#
                        #
  function_txt <- paste(function_txt.name, function_txt.body, function_txt.end, sep = "\n")#
                        #
  cat(function_txt)#
#
	#
}#
#
create_function_text("pegasos", "stochastic")
create_function_text <- function(learner, loop) {#
#
#
  function_txt.name <- paste("test.sofia."#
    , gsub("-","_",learner),"."#
    , gsub("-","_",loop)#
    , " { \n", sep ="")#
#
  function_txt.body <- paste("LOOP_TYPE <- '", loop, "'\n",#
      "LEARNER_TYPE <- '", learner, "'\n\n",#
      "weights.RSofia <- sofia(Is.Virginica ~ ., irismod, random_seed = RANDOM_SEED", "\n",#
      ", learner_type = LEARNER_TYPE, loop_type = LOOP_TYPE)$weights", "\n",#
      ", weights.sofia_ml <- sofia_ml_test_results[[paste(LEARNER_TYPE, LOOP_TYPE, sep = '_')]]","\n",#
      "checkEqualsNumeric(weights.RSofia, weights.sofia_ml, tolerance = TOLERANCE)", sep = "")#
                      #
  function_txt.end <- "\n}"#
                        #
  function_txt <- paste(function_txt.name, function_txt.body, function_txt.end, sep = "\n")#
                        #
  cat(function_txt)#
#
	#
}#
#
create_function_text("pegasos", "stochastic")
create_function_text <- function(learner, loop) {#
#
#
  function_txt.name <- paste("test.sofia."#
    , gsub("-","_",learner),"."#
    , gsub("-","_",loop)#
    , " { \n", sep ="")#
#
  function_txt.body <- paste("LOOP_TYPE <- '", loop, "'\n",#
      "LEARNER_TYPE <- '", learner, "'\n\n",#
      "weights.RSofia <- sofia(Is.Virginica ~ ., irismod, random_seed = RANDOM_SEED", "\n",#
      ", learner_type = LEARNER_TYPE, loop_type = LOOP_TYPE)$weights", "\n",#
      ", weights.sofia_ml <- sofia_ml_test_results[[paste(LEARNER_TYPE, LOOP_TYPE, sep = '_')]]","\n\n",#
      "checkEqualsNumeric(weights.RSofia, weights.sofia_ml, tolerance = TOLERANCE)", sep = "")#
                      #
  function_txt.end <- "\n}"#
                        #
  function_txt <- paste(function_txt.name, function_txt.body, function_txt.end, sep = "\n")#
                        #
  cat(function_txt)#
#
	#
}#
#
create_function_text("pegasos", "stochastic")
create_function_text <- function(learner, loop) {#
#
#
  function_txt.name <- paste("test.sofia."#
    , gsub("-","_",learner),"."#
    , gsub("-","_",loop), " <- function()",#
    , " { \n", sep ="")#
#
  function_txt.body <- paste("LOOP_TYPE <- '", loop, "'\n",#
      "LEARNER_TYPE <- '", learner, "'\n\n",#
      "weights.RSofia <- sofia(Is.Virginica ~ ., irismod, random_seed = RANDOM_SEED", "\n",#
      ", learner_type = LEARNER_TYPE, loop_type = LOOP_TYPE)$weights", "\n",#
      ", weights.sofia_ml <- sofia_ml_test_results[[paste(LEARNER_TYPE, LOOP_TYPE, sep = '_')]]","\n\n",#
      "checkEqualsNumeric(weights.RSofia, weights.sofia_ml, tolerance = TOLERANCE)", sep = "")#
                      #
  function_txt.end <- "\n}"#
                        #
  function_txt <- paste(function_txt.name, function_txt.body, function_txt.end, sep = "\n")#
                        #
  cat(function_txt)#
#
	#
}#
#
create_function_text("pegasos", "stochastic")
create_function_text <- function(learner, loop) {#
#
#
  function_txt.name <- paste("test.sofia."#
    , gsub("-","_",learner),"."#
    , gsub("-","_",loop), " <- function()"#
    , " { \n", sep ="")#
#
  function_txt.body <- paste("LOOP_TYPE <- '", loop, "'\n",#
      "LEARNER_TYPE <- '", learner, "'\n\n",#
      "weights.RSofia <- sofia(Is.Virginica ~ ., irismod, random_seed = RANDOM_SEED", "\n",#
      ", learner_type = LEARNER_TYPE, loop_type = LOOP_TYPE)$weights", "\n",#
      ", weights.sofia_ml <- sofia_ml_test_results[[paste(LEARNER_TYPE, LOOP_TYPE, sep = '_')]]","\n\n",#
      "checkEqualsNumeric(weights.RSofia, weights.sofia_ml, tolerance = TOLERANCE)", sep = "")#
                      #
  function_txt.end <- "\n}"#
                        #
  function_txt <- paste(function_txt.name, function_txt.body, function_txt.end, sep = "\n")#
                        #
  cat(function_txt)#
#
	#
}#
#
create_function_text("pegasos", "stochastic")
create_function_text <- function(learner, loop) {#
#
#
  function_txt.name <- paste("test.sofia."#
    , gsub("-","_",learner),"."#
    , gsub("-","_",loop), " <- function()"#
    , " { \n", sep ="")#
#
  function_txt.body <- paste("  LOOP_TYPE <- '", loop, "'\n",#
      "  LEARNER_TYPE <- '", learner, "'\n\n",#
      "  weights.RSofia <- sofia(Is.Virginica ~ ., irismod, random_seed = RANDOM_SEED", "\n",#
      "  , learner_type = LEARNER_TYPE, loop_type = LOOP_TYPE)$weights", "\n\n",#
      "  weights.sofia_ml <- sofia_ml_test_results[[paste(LEARNER_TYPE, LOOP_TYPE, sep = '_')]]","\n\n",#
      "  checkEqualsNumeric(weights.RSofia, weights.sofia_ml, tolerance = TOLERANCE)", sep = "")#
                      #
  function_txt.end <- "\n}"#
                        #
  function_txt <- paste(function_txt.name, function_txt.body, function_txt.end, sep = "\n")#
                        #
  cat(function_txt)#
#
	#
}#
#
create_function_text("pegasos", "stochastic")
create_function_text <- function(learner, loop, eta) {#
#
#
  function_txt.name <- paste("test.sofia."#
    , gsub("-","_",learner),"."#
    , gsub("-","_",loop), "."#
    , gsub("-","_",eta)," <- function()"#
    , " { \n", sep ="")#
#
  function_txt.body <- paste(#
      "  LOOP_TYPE <- '", loop, "'\n",#
      "  LEARNER_TYPE <- '", learner, "'\n",#
      "  ETA_TYPE <- '", eta, "'\n\n" ,#
      "  weights.RSofia <- sofia(Is.Virginica ~ ., irismod, random_seed = RANDOM_SEED", "\n",#
      "  , learner_type = LEARNER_TYPE, loop_type = LOOP_TYPE)$weights", "\n\n",#
      "  weights.sofia_ml <- sofia_ml_test_results[[paste(LEARNER_TYPE, LOOP_TYPE, sep = '_')]]","\n\n",#
      "  checkEqualsNumeric(weights.RSofia, weights.sofia_ml, tolerance = TOLERANCE)", sep = "")#
                      #
  function_txt.end <- "\n}"#
                        #
  function_txt <- paste(function_txt.name, function_txt.body, function_txt.end, sep = "\n")#
                        #
  cat(function_txt)#
#
	#
}#
#
create_function_text("pegasos", "stochastic", "pegasos")
sofia
library(RSofia)
sofia.fit
?sofia.fit
create_function_text <- function(learner, loop, eta, no_bias_term) {#
#
#
  function_txt.name <- paste("test.sofia."#
    , gsub("-","_",learner),"."#
    , gsub("-","_",loop), "."#
    , gsub("-","_",eta), "."#
    , ifelse(no_bias_term, "bias1", "bias0"), " <- function()"#
    , " { \n", sep ="")#
#
  function_txt.body <- paste(#
      "  LOOP_TYPE <- '", loop, "'\n",#
      "  LEARNER_TYPE <- '", learner, "'\n",#
      "  ETA_TYPE <- '", eta, "'\n\n" ,#
      "  weights.RSofia <- sofia(Is.Virginica ~ ., irismod, random_seed = RANDOM_SEED", "\n",#
      "  , learner_type = LEARNER_TYPE, loop_type = LOOP_TYPE)$weights", "\n\n",#
      "  weights.sofia_ml <- sofia_ml_test_results[[paste(LEARNER_TYPE, LOOP_TYPE, sep = '_')]]","\n\n",#
      "  checkEqualsNumeric(weights.RSofia, weights.sofia_ml, tolerance = TOLERANCE)", sep = "")#
                      #
  function_txt.end <- "\n}"#
                        #
  function_txt <- paste(function_txt.name, function_txt.body, function_txt.end, sep = "\n")#
                        #
  cat(function_txt)#
#
	#
}#
#
create_function_text("pegasos", "stochastic", "pegasos")
create_function_text <- function(learner, loop, eta, no_bias_term) {#
#
#
  function_txt.name <- paste("test.sofia."#
    , gsub("-","_",learner),"."#
    , gsub("-","_",loop), "."#
    , gsub("-","_",eta), "."#
    , ifelse(no_bias_term, "bias1", "bias0"), " <- function()"#
    , " { \n", sep ="")#
#
  function_txt.body <- paste(#
      "  LOOP_TYPE <- '", loop, "'\n",#
      "  LEARNER_TYPE <- '", learner, "'\n",#
      "  ETA_TYPE <- '", eta, "'\n\n" ,#
      "  weights.RSofia <- sofia(Is.Virginica ~ ., irismod, random_seed = RANDOM_SEED", "\n",#
      "  , learner_type = LEARNER_TYPE, loop_type = LOOP_TYPE)$weights", "\n\n",#
      "  weights.sofia_ml <- sofia_ml_test_results[[paste(LEARNER_TYPE, LOOP_TYPE, sep = '_')]]","\n\n",#
      "  checkEqualsNumeric(weights.RSofia, weights.sofia_ml, tolerance = TOLERANCE)", sep = "")#
                      #
  function_txt.end <- "\n}"#
                        #
  function_txt <- paste(function_txt.name, function_txt.body, function_txt.end, sep = "\n")#
                        #
  cat(function_txt)#
#
	#
}#
#
create_function_text("pegasos", "stochastic", "pegasos", 1)
create_function_text <- function(learner, loop, eta, no_bias_term) {#
#
#
  function_txt.name <- paste("test.sofia."#
    , gsub("-","_",learner),"."#
    , gsub("-","_",loop), "."#
    , gsub("-","_",eta), "."#
    , ifelse(no_bias_term, "bias1", "bias0"), " <- function()"#
    , " { \n", sep ="")#
#
  function_txt.body <- paste(#
      #
      "  LOOP_TYPE <- '", loop, "'\n",#
      "  LEARNER_TYPE <- '", learner, "'\n",#
      "  ETA_TYPE <- '", eta, "'\n\n" ,#
      #
      "  weights.RSofia <- sofia(Is.Virginica ~ ., irismod, random_seed = RANDOM_SEED", "\n",#
      "  , learner_type = LEARNER_TYPE, loop_type = LOOP_TYPE, no_bias_term = ",no_bias_term,")$weights", "\n\n",#
      "  weights.sofia_ml <- sofia_ml_test_results[[paste(LEARNER_TYPE, LOOP_TYPE, sep = '_')]]","\n\n",#
      "  checkEqualsNumeric(weights.RSofia, weights.sofia_ml, tolerance = TOLERANCE)", sep = "")#
                      #
  function_txt.end <- "\n}"#
                        #
  function_txt <- paste(function_txt.name, function_txt.body, function_txt.end, sep = "\n")#
                        #
  cat(function_txt)#
#
	#
}#
#
create_function_text("pegasos", "stochastic", "pegasos", 1)
logical(1)
as.logical(1)
create_function_text <- function(learner, loop, eta, no_bias_term) {#
#
#
  function_txt.name <- paste("test.sofia."#
    , gsub("-","_",learner),"."#
    , gsub("-","_",loop), "."#
    , gsub("-","_",eta), "."#
    , ifelse(no_bias_term, "bias1", "bias0"), " <- function()"#
    , " { \n", sep ="")#
#
  function_txt.body <- paste(#
      #
      "  LOOP_TYPE <- '", loop, "'\n",#
      "  LEARNER_TYPE <- '", learner, "'\n",#
      "  ETA_TYPE <- '", eta, "'\n\n" ,#
      #
      "  weights.RSofia <- sofia(Is.Virginica ~ ., irismod, random_seed = RANDOM_SEED", "\n",#
      "  , learner_type = LEARNER_TYPE, loop_type = LOOP_TYPE, no_bias_term = ",no_bias_term,")$weights", "\n\n",#
      "  weights.sofia_ml <- sofia_ml_test_results[[paste(LEARNER_TYPE, LOOP_TYPE, sep = '_')]]","\n\n",#
      "  checkEqualsNumeric(weights.RSofia, weights.sofia_ml, tolerance = TOLERANCE)", sep = "")#
                      #
  function_txt.end <- "\n}"#
                        #
  function_txt <- paste(function_txt.name, function_txt.body, function_txt.end, sep = "\n")#
                        #
  cat(function_txt)#
#
	#
}#
#
create_function_text("pegasos", "stochastic", "pegasos", TRUE)
create_function_text <- function(learner, loop, eta, no_bias_term) {#
#
#
  function_txt.name <- paste("test.sofia."#
    , gsub("-","_",learner),"."#
    , gsub("-","_",loop), "."#
    , gsub("-","_",eta), "."#
    , ifelse(no_bias_term, "bias1", "bias0"), " <- function()"#
    , " { \n", sep ="")#
#
  function_txt.body <- paste(#
      #
      "  LOOP_TYPE <- '", loop, "'\n",#
      "  LEARNER_TYPE <- '", learner, "'\n",#
      "  ETA_TYPE <- '", eta, "'\n\n" ,#
      #
      "  weights.RSofia <- sofia(Is.Virginica ~ ., irismod, random_seed = RANDOM_SEED", "\n",#
      "  , learner_type = LEARNER_TYPE, loop_type = LOOP_TYPE, no_bias_term = ",no_bias_term,")$weights", "\n\n",#
      "  weights.sofia_ml <- sofia_ml_test_results[[paste(LEARNER_TYPE, LOOP_TYPE, sep = '_')]]","\n\n",#
      "  checkEqualsNumeric(weights.RSofia, weights.sofia_ml, tolerance = TOLERANCE)", sep = "")#
                      #
  function_txt.end <- "\n}"#
                        #
  function_txt <- paste(function_txt.name, function_txt.body, function_txt.end, sep = "\n")#
                        #
  cat(function_txt)#
#
	#
}#
#
create_function_text("pegasos", "stochastic", "pegasos", FALSE)
create_function_text <- function(learner, loop, eta, no_bias_term) {#
#
#
  function_txt.name <- paste("test.sofia."#
    , gsub("-","_",learner),"."#
    , gsub("-","_",loop), "."#
    , gsub("-","_",eta), "."#
    , ifelse(no_bias_term, "bias1", "bias0"), " <- function()"#
    , " { \n", sep ="")#
#
  function_txt.body <- paste(#
      #
      "  LOOP_TYPE <- '", loop, "'\n",#
      "  LEARNER_TYPE <- '", learner, "'\n",#
      "  ETA_TYPE <- '", eta, "'\n\n" ,#
      #
      "  weights.RSofia <- sofia(Is.Virginica ~ ., irismod, random_seed = RANDOM_SEED", "\n",#
      "  , eta_type = ETA_TYPE, learner_type = LEARNER_TYPE, loop_type = LOOP_TYPE, no_bias_term = ",no_bias_term,")$weights", "\n\n",#
      "  weights.sofia_ml <- sofia_ml_test_results[[paste(LEARNER_TYPE, LOOP_TYPE, sep = '_')]]","\n\n",#
      "  checkEqualsNumeric(weights.RSofia, weights.sofia_ml, tolerance = TOLERANCE)", sep = "")#
                      #
  function_txt.end <- "\n}"#
                        #
  function_txt <- paste(function_txt.name, function_txt.body, function_txt.end, sep = "\n")#
                        #
  cat(function_txt)#
#
	#
}#
#
create_function_text("pegasos", "stochastic", "pegasos", FALSE)
create_function_text <- function(learner, loop, eta, no_bias_term) {#
#
#
  function_txt.name <- paste("test.sofia."#
    , gsub("-","_",learner),"."#
    , gsub("-","_",loop), "."#
    , gsub("-","_",eta), "."#
    , ifelse(no_bias_term, "bias1", "bias0"), " <- function()"#
    , " { \n", sep ="")#
#
  function_txt.body <- paste(#
      #
      "  LOOP_TYPE <- '", loop, "'\n",#
      "  LEARNER_TYPE <- '", learner, "'\n",#
      "  ETA_TYPE <- '", eta, "'\n\n" ,#
      #
      "  weights.RSofia <- sofia(Is.Virginica ~ ., irismod, random_seed = RANDOM_SEED", "\n",#
      "  , eta_type = ETA_TYPE, learner_type = LEARNER_TYPE, loop_type = LOOP_TYPE, no_bias_term = ",no_bias_term,")$weights", "\n\n",#
      "  weights.sofia_ml <- sofia_ml_test_results[[paste(LEARNER_TYPE, LOOP_TYPE, sep = '_')]]","\n\n",#
      "  checkEqualsNumeric(weights.RSofia, weights.sofia_ml, tolerance = TOLERANCE)", sep = "")#
                      #
  function_txt.end <- "\n}"#
                        #
  function_txt <- paste(function_txt.name, function_txt.body, function_txt.end, sep = "\n")#
                        #
  cat(function_txt)#
#
	#
}#
#
x <- create_function_text("pegasos", "stochastic", "pegasos", FALSE)
x
create_function_text <- function(learner, loop, eta, no_bias_term) {#
#
#
  function_txt.name <- paste("test.sofia."#
    , gsub("-","_",learner),"."#
    , gsub("-","_",loop), "."#
    , gsub("-","_",eta), "."#
    , ifelse(no_bias_term, "bias1", "bias0"), " <- function()"#
    , " { \n", sep ="")#
#
  function_txt.body <- paste(#
      #
      "  LOOP_TYPE <- '", loop, "'\n",#
      "  LEARNER_TYPE <- '", learner, "'\n",#
      "  ETA_TYPE <- '", eta, "'\n\n" ,#
      #
      "  weights.RSofia <- sofia(Is.Virginica ~ ., irismod, random_seed = RANDOM_SEED", "\n",#
      "  , eta_type = ETA_TYPE, learner_type = LEARNER_TYPE, loop_type = LOOP_TYPE, no_bias_term = ",no_bias_term,")$weights", "\n\n",#
      "  weights.sofia_ml <- sofia_ml_test_results[[paste(LEARNER_TYPE, LOOP_TYPE, sep = '_')]]","\n\n",#
      "  checkEqualsNumeric(weights.RSofia, weights.sofia_ml, tolerance = TOLERANCE)", sep = "")#
                      #
  function_txt.end <- "\n}"#
                        #
  function_txt <- paste(function_txt.name, function_txt.body, function_txt.end, sep = "\n")#
                        #
  return(function_txt)#
#
	#
}#
#
x <- create_function_text("pegasos", "stochastic", "pegasos", FALSE)
x
parse(x)
parse
parse(text = x)
x.parsed <- parse(text = x)
x
str(x)
x.parsed
x.parsed(1)
eval(x.parsed)
test.sofia.pegasos.stochastic.pegasos.bias0
test.sofia.pegasos.stochastic.pegasos.bias0(1)
LEARNER_TYPE=c( "pegasos", "sgd-svm", "passive-aggressive", "margin-perceptron", "romma", "logreg-pegasos" )#
LOOP_TYPE=c( "stochastic", "balanced-stochastic", "rank", "roc", "query-norm-rank", "combined-ranking", "combined-roc" )#
ETA_TYPE=c( "pegasos", "basic", "constant" )#
#
#
create_function_text <- function(learner, loop, eta, no_bias_term) {#
#
  function_txt.name <- paste("test.sofia."#
    , gsub("-","_",learner),"."#
    , gsub("-","_",loop), "."#
    , gsub("-","_",eta), "."#
    , ifelse(no_bias_term, "bias1", "bias0"), " <- function()"#
    , " { \n", sep ="")#
#
  function_txt.body <- paste(#
      #
      "  LOOP_TYPE <- '", loop, "'\n",#
      "  LEARNER_TYPE <- '", learner, "'\n",#
      "  ETA_TYPE <- '", eta, "'\n\n" ,#
      #
      "  weights.RSofia <- sofia(Is.Virginica ~ ., irismod, random_seed = RANDOM_SEED", "\n",#
      "  , eta_type = ETA_TYPE, learner_type = LEARNER_TYPE, loop_type = LOOP_TYPE, no_bias_term = ",no_bias_term,")$weights", "\n\n",#
      "  weights.sofia_ml <- sofia_ml_test_results[[paste(LEARNER_TYPE, LOOP_TYPE, sep = '_')]]","\n\n",#
      "  checkEqualsNumeric(weights.RSofia, weights.sofia_ml, tolerance = TOLERANCE)", sep = "")#
                      #
  function_txt.end <- "\n}"#
                        #
  function_txt <- paste(function_txt.name, function_txt.body, function_txt.end, sep = "\n")#
                        #
  return(function_txt)#
#
	#
}#
#
x <- create_function_text("pegasos", "stochastic", "pegasos", FALSE)
l
LEARNER_TYPE <- c( "pegasos", "sgd-svm", "passive-aggressive", "margin-perceptron", "romma", "logreg-pegasos" )#
LOOP_TYPE    <- c( "stochastic", "balanced-stochastic", "rank", "roc", "query-norm-rank", "combined-ranking", "combined-roc" )#
ETA_TYPE     <- c( "pegasos", "basic", "constant" )#
NO_BIAS_TERM <- c( TRUE, FALSE)#
#
create_function_text <- function(learner, loop, eta, no_bias_term) {#
#
  function_txt.name <- paste("test.sofia."#
    , gsub("-","_",learner),"."#
    , gsub("-","_",loop), "."#
    , gsub("-","_",eta), "."#
    , ifelse(no_bias_term, "bias1", "bias0"), " <- function()"#
    , " { \n", sep ="")#
#
  function_txt.body <- paste(#
      #
      "  LOOP_TYPE <- '", loop, "'\n",#
      "  LEARNER_TYPE <- '", learner, "'\n",#
      "  ETA_TYPE <- '", eta, "'\n\n" ,#
      #
      "  weights.RSofia <- sofia(Is.Virginica ~ ., irismod, random_seed = RANDOM_SEED", "\n",#
      "  , eta_type = ETA_TYPE, learner_type = LEARNER_TYPE, loop_type = LOOP_TYPE, no_bias_term = ",no_bias_term,")$weights", "\n\n",#
      "  weights.sofia_ml <- sofia_ml_test_results[[paste(LEARNER_TYPE, LOOP_TYPE, sep = '_')]]","\n\n",#
      "  checkEqualsNumeric(weights.RSofia, weights.sofia_ml, tolerance = TOLERANCE)", sep = "")#
                      #
  function_txt.end <- "\n}"#
                        #
  function_txt <- paste(function_txt.name, function_txt.body, function_txt.end, sep = "\n")#
                        #
  return(function_txt)#
#
	#
}#
#
x <- vector("list")#
#
for(i in LEARNER_TYPE)#
  for(j in LOOP_TYPE)#
    for(k in ETA_TYPE)#
      for(l in NO_BIAS_TERM)#
        create_function_text(i,j,k,l)
LEARNER_TYPE <- c( "pegasos", "sgd-svm", "passive-aggressive", "margin-perceptron", "romma", "logreg-pegasos" )#
LOOP_TYPE    <- c( "stochastic", "balanced-stochastic", "rank", "roc", "query-norm-rank", "combined-ranking", "combined-roc" )#
ETA_TYPE     <- c( "pegasos", "basic", "constant" )#
NO_BIAS_TERM <- c( TRUE, FALSE)#
#
create_function_text <- function(learner, loop, eta, no_bias_term) {#
#
  function_txt.name <- paste("test.sofia."#
    , gsub("-","_",learner),"."#
    , gsub("-","_",loop), "."#
    , gsub("-","_",eta), "."#
    , ifelse(no_bias_term, "bias1", "bias0"), " <- function()"#
    , " { \n", sep ="")#
#
  function_txt.body <- paste(#
      #
      "  LOOP_TYPE <- '", loop, "'\n",#
      "  LEARNER_TYPE <- '", learner, "'\n",#
      "  ETA_TYPE <- '", eta, "'\n\n" ,#
      #
      "  weights.RSofia <- sofia(Is.Virginica ~ ., irismod, random_seed = RANDOM_SEED", "\n",#
      "  , eta_type = ETA_TYPE, learner_type = LEARNER_TYPE, loop_type = LOOP_TYPE, no_bias_term = ",no_bias_term,")$weights", "\n\n",#
      "  weights.sofia_ml <- sofia_ml_test_results[[paste(LEARNER_TYPE, LOOP_TYPE, sep = '_')]]","\n\n",#
      "  checkEqualsNumeric(weights.RSofia, weights.sofia_ml, tolerance = TOLERANCE)", sep = "")#
                      #
  function_txt.end <- "\n}"#
                        #
  function_txt <- paste(function_txt.name, function_txt.body, function_txt.end, sep = "\n")#
                        #
  return(function_txt)#
#
	#
}#
#
x <- vector("list")#
p <- 1#
#
for(i in LEARNER_TYPE)#
  for(j in LOOP_TYPE)#
    for(k in ETA_TYPE)#
      for(l in NO_BIAS_TERM)#
{#
 x[[p]]   <-    create_function_text(i,j,k,l)#
  p <- p+1#
}
x
LEARNER_TYPE <- c( "pegasos", "sgd-svm", "passive-aggressive", "margin-perceptron", "romma", "logreg-pegasos" )#
LOOP_TYPE    <- c( "stochastic", "balanced-stochastic", "rank", "roc", "query-norm-rank", "combined-ranking", "combined-roc" )#
ETA_TYPE     <- c( "pegasos", "basic", "constant" )#
NO_BIAS_TERM <- c( TRUE, FALSE)#
#
create_function_text <- function(learner, loop, eta, no_bias_term) {#
#
  function_txt.name <- paste("test.sofia."#
    , gsub("-","_",learner),"."#
    , gsub("-","_",loop), "."#
    , gsub("-","_",eta), "."#
    , ifelse(no_bias_term, "bias1", "bias0"), " <- function()"#
    , " { \n", sep ="")#
#
  function_txt.body <- paste(#
      #
      "  LOOP_TYPE <- '", loop, "'\n",#
      "  LEARNER_TYPE <- '", learner, "'\n",#
      "  ETA_TYPE <- '", eta, "'\n\n" ,#
      #
      "  weights.RSofia <- sofia(Is.Virginica ~ ., irismod, random_seed = RANDOM_SEED", "\n",#
      "  , eta_type = ETA_TYPE, learner_type = LEARNER_TYPE, loop_type = LOOP_TYPE, no_bias_term = ",no_bias_term,")$weights", "\n\n",#
      "  weights.sofia_ml <- sofia_ml_test_results[[paste(LEARNER_TYPE, LOOP_TYPE, sep = '_')]]","\n\n",#
      "  checkEqualsNumeric(weights.RSofia, weights.sofia_ml, tolerance = TOLERANCE)", sep = "")#
                      #
  function_txt.end <- "\n}"#
                        #
  function_txt <- paste(function_txt.name, function_txt.body, function_txt.end, sep = "\n")#
                        #
  return(function_txt)#
#
	#
}#
#
x <- vector("list")#
p <- 1#
#
for(i in LEARNER_TYPE)#
  for(j in LOOP_TYPE)#
    for(k in ETA_TYPE)#
      for(l in NO_BIAS_TERM)#
        eval(parse(text = create_function_text(i,j,k,l)))
ls()
LEARNER_TYPE <- c( "pegasos", "sgd-svm", "passive-aggressive", "margin-perceptron", "romma", "logreg-pegasos" )#
LOOP_TYPE    <- c( "stochastic", "balanced-stochastic", "rank", "roc", "query-norm-rank", "combined-ranking", "combined-roc" )#
ETA_TYPE     <- c( "pegasos", "basic", "constant" )#
NO_BIAS_TERM <- c( TRUE, FALSE)#
#
create_function_text <- function(learner, loop, eta, no_bias_term) {#
#
  function_txt.name <- paste("test.sofia."#
    , gsub("-","_",learner),"."#
    , gsub("-","_",loop), "."#
    , gsub("-","_",eta), "."#
    , ifelse(no_bias_term, "bias1", "bias0"), " <- function()"#
    , " { \n", sep ="")#
#
  function_txt.body <- paste(#
      #
      "  LOOP_TYPE <- '", loop, "'\n",#
      "  LEARNER_TYPE <- '", learner, "'\n",#
      "  ETA_TYPE <- '", eta, "'\n\n" ,#
      #
      "  weights.RSofia <- sofia(Is.Virginica ~ ., irismod, random_seed = RANDOM_SEED", "\n",#
      "  , eta_type = ETA_TYPE, learner_type = LEARNER_TYPE, loop_type = LOOP_TYPE, no_bias_term = ",no_bias_term,#
      "  )$weights", "\n\n",#
      "  weights.sofia_ml <- sofia_ml_test_results[[paste(LEARNER_TYPE, LOOP_TYPE, sep = '_')]]","\n\n",#
      "  checkEqualsNumeric(weights.RSofia, weights.sofia_ml, tolerance = TOLERANCE)", sep = "")#
                      #
  function_txt.end <- "\n}"#
                        #
  function_txt <- paste(function_txt.name, function_txt.body, function_txt.end, sep = "\n")#
                        #
  return(function_txt)#
#
}#
#
for(i in LEARNER_TYPE)#
  for(j in LOOP_TYPE)#
    for(k in ETA_TYPE)#
      for(l in NO_BIAS_TERM)#
        eval(parse(text = create_function_text(i,j,k,l)))
ls()
q()
getwd()
setwd("/Users/mike/git_sofia/RSofia/inst/SofiaModels")
list.files()
trim
substr
gregexpr
gregexpr(".out", "mike.out")
gregexpr(".out", "mikedddddd.out")
z <- "mike.out"
zz <- gregexpr(".out", z)
zz
substr(z, 1, zz)
substr(z, 1, zz-1)
zz
zz -1
zz
?zz
?gregre
??gregexpr
?gregexpr
setwd("/Users/mike/git_sofia/RSofia/inst/SofiaModels")#
#
lappy(list.files, scan)
setwd("/Users/mike/git_sofia/RSofia/inst/SofiaModels")#
#
lapply(list.files, scan)
setwd("/Users/mike/git_sofia/RSofia/inst/SofiaModels")#
#
lapply(list.files(), scan)
regexpr
setwd("/Users/mike/git_sofia/RSofia/inst/SofiaModels")#
#
files <- list.files()#
#
data <- lapply(files, scan)#
#
names(data) <- sapply(files, function(x) { substr(x, 1, regexpr(".out", x) - 1)})
data
setwd("/Users/mike/git_sofia/RSofia/inst/SofiaModels")#
#
files <- list.files()#
#
data <- sapply(files, scan)#
#
names(data) <- sapply(files, function(x) { substr(x, 1, regexpr(".out", x) - 1)})
data
setwd("/Users/mike/git_sofia/RSofia/inst/SofiaModels")#
#
files <- list.files()#
#
data <- sapply(files, scan)
data
setwd("/Users/mike/git_sofia/RSofia/inst/SofiaModels")#
#
files <- list.files()#
#
data <- t(sapply(files, scan))#
#
names(data) <- sapply(files, function(x) { substr(x, 1, regexpr(".out", x) - 1)})
data
setwd("/Users/mike/git_sofia/RSofia/inst/SofiaModels")#
#
files <- list.files()#
#
data <- t(sapply(files, scan))
data
data
setwd("/Users/mike/git_sofia/RSofia/inst/SofiaModels")#
#
files <- list.files()#
#
data <- (lapply(files, scan))#
#
names(data) <- sapply(files, function(x) { substr(x, 1, regexpr(".out", x) - 1)})
data
setwd("/Users/mike/git_sofia/RSofia/inst/SofiaModels")#
#
files <- list.files()#
#
data <- (lapply(files, scan))#
#
names(data) <- sapply(names(data), function(x) { substr(x, 1, regexpr(".out", x) - 1)})
setwd("/Users/mike/git_sofia/RSofia/inst/SofiaModels")#
#
files <- list.files()#
#
data <- (lapply(files, scan))
substr(x, 1, regexpr(".out", x) - 1)
x
x <- names(data)
substr(x, 1, regexpr(".out", x) - 1)
x
dat
data
names(data)
setwd("/Users/mike/git_sofia/RSofia/inst/SofiaModels")#
#
files <- list.files()#
#
data <- (lapply(files, scan))
data
names(data)
setwd("/Users/mike/git_sofia/RSofia/inst/SofiaModels")#
#
files <- list.files()#
#
data <- lapply(files, scan)#
#
names(data) <- sapply(names(data), function(x) { substr(x, 1, regexpr(".out", x) - 1)})
data
setwd("/Users/mike/git_sofia/RSofia/inst/SofiaModels")#
#
files <- list.files()#
#
data <- lapply(files, scan)
data
lapply
x <- files
x
substr(x, 1, regexpr(".out", x) - 1)
setwd("/Users/mike/git_sofia/RSofia/inst/SofiaModels")#
#
files <- list.files()#
#
data <- lapply(files, scan)#
#
names(data) <- substr(files, 1, regexpr(".out", files) - 1)
data
ls()
q()
setwd("/Users/mike/git_sofia/RSofia/inst/SofiaModels")#
files <- list.files()#
data <- lapply(files, scan)#
names(data) <- substr(files, 1, regexpr(".out", files) - 1)#
#
sofia_ml_test_results <- data#
#
save(sofia_ml_test_results, file = "sofia_ml_test_results.RData")
q()
rm(list = ls(all = TRUE))
ls()
library(RUnit)#
library(RSofia)#
#
LEARNER_TYPE <- c( "pegasos", "sgd-svm", "passive-aggressive", "margin-perceptron", "romma", "logreg-pegasos" )#
LOOP_TYPE    <- c( "stochastic", "balanced-stochastic", "rank", "roc", "query-norm-rank", "combined-ranking", "combined-roc" )#
ETA_TYPE     <- c( "pegasos", "basic", "constant" )#
NO_BIAS_TERM <- c( TRUE, FALSE)#
#
create_function_text <- function(learner, loop, eta, no_bias_term) {#
#
  function_txt.name <- paste("test.sofia."#
    , gsub("-","_",learner),"."#
    , gsub("-","_",loop), "."#
    , gsub("-","_",eta), "."#
    , ifelse(no_bias_term, "bias1", "bias0"), " <- function()"#
    , " { \n", sep ="")#
#
  function_txt.body <- paste(#
      #
      "  LOOP_TYPE <- '", loop, "'\n",#
      "  LEARNER_TYPE <- '", learner, "'\n",#
      "  ETA_TYPE <- '", eta, "'\n\n" ,#
      #
      "  weights.RSofia <- sofia(Is.Virginica ~ ., irismod, random_seed = RANDOM_SEED", "\n",#
      "  , eta_type = ETA_TYPE, learner_type = LEARNER_TYPE, loop_type = LOOP_TYPE, no_bias_term = ",no_bias_term,#
      "  )$weights", "\n\n",#
      "  weights.sofia_ml <- sofia_ml_test_results[[paste(LEARNER_TYPE, LOOP_TYPE, sep = '_')]]","\n\n",#
      "  checkEqualsNumeric(weights.RSofia, weights.sofia_ml, tolerance = TOLERANCE)", sep = "")#
                      #
  function_txt.end <- "\n}"#
                        #
  function_txt <- paste(function_txt.name, function_txt.body, function_txt.end, sep = "\n")#
                        #
  return(function_txt)#
#
}#
#
for(i in LEARNER_TYPE)#
  for(j in LOOP_TYPE)#
    for(k in ETA_TYPE)#
      for(l in NO_BIAS_TERM)#
        eval(parse(text = create_function_text(i,j,k,l)))()
library(RUnit)#
library(RSofia)#
data(irismod)#
#
LEARNER_TYPE <- c( "pegasos", "sgd-svm", "passive-aggressive", "margin-perceptron", "romma", "logreg-pegasos" )#
LOOP_TYPE    <- c( "stochastic", "balanced-stochastic", "rank", "roc", "query-norm-rank", "combined-ranking", "combined-roc" )#
ETA_TYPE     <- c( "pegasos", "basic", "constant" )#
NO_BIAS_TERM <- c( TRUE, FALSE)#
#
create_function_text <- function(learner, loop, eta, no_bias_term) {#
#
  function_txt.name <- paste("test.sofia."#
    , gsub("-","_",learner),"."#
    , gsub("-","_",loop), "."#
    , gsub("-","_",eta), "."#
    , ifelse(no_bias_term, "bias1", "bias0"), " <- function()"#
    , " { \n", sep ="")#
#
  function_txt.body <- paste(#
      #
      "  LOOP_TYPE <- '", loop, "'\n",#
      "  LEARNER_TYPE <- '", learner, "'\n",#
      "  ETA_TYPE <- '", eta, "'\n\n" ,#
      #
      "  weights.RSofia <- sofia(Is.Virginica ~ ., irismod, random_seed = RANDOM_SEED", "\n",#
      "  , eta_type = ETA_TYPE, learner_type = LEARNER_TYPE, loop_type = LOOP_TYPE, no_bias_term = ",no_bias_term,#
      "  )$weights", "\n\n",#
      "  weights.sofia_ml <- sofia_ml_test_results[[paste(LEARNER_TYPE, LOOP_TYPE, sep = '_')]]","\n\n",#
      "  checkEqualsNumeric(weights.RSofia, weights.sofia_ml, tolerance = TOLERANCE)", sep = "")#
                      #
  function_txt.end <- "\n}"#
                        #
  function_txt <- paste(function_txt.name, function_txt.body, function_txt.end, sep = "\n")#
                        #
  return(function_txt)#
#
}#
#
for(i in LEARNER_TYPE)#
  for(j in LOOP_TYPE)#
    for(k in ETA_TYPE)#
      for(l in NO_BIAS_TERM)#
        eval(parse(text = create_function_text(i,j,k,l)))()
library(RUnit)#
library(RSofia)#
data(irismod)#
#
RANDOM_SEED = 1#
#
LEARNER_TYPE <- c( "pegasos", "sgd-svm", "passive-aggressive", "margin-perceptron", "romma", "logreg-pegasos" )#
LOOP_TYPE    <- c( "stochastic", "balanced-stochastic", "rank", "roc", "query-norm-rank", "combined-ranking", "combined-roc" )#
ETA_TYPE     <- c( "pegasos", "basic", "constant" )#
NO_BIAS_TERM <- c( TRUE, FALSE)#
#
create_function_text <- function(learner, loop, eta, no_bias_term) {#
#
  function_txt.name <- paste("test.sofia."#
    , gsub("-","_",learner),"."#
    , gsub("-","_",loop), "."#
    , gsub("-","_",eta), "."#
    , ifelse(no_bias_term, "bias1", "bias0"), " <- function()"#
    , " { \n", sep ="")#
#
  function_txt.body <- paste(#
      #
      "  LOOP_TYPE <- '", loop, "'\n",#
      "  LEARNER_TYPE <- '", learner, "'\n",#
      "  ETA_TYPE <- '", eta, "'\n\n" ,#
      #
      "  weights.RSofia <- sofia(Is.Virginica ~ ., irismod, random_seed = RANDOM_SEED", "\n",#
      "  , eta_type = ETA_TYPE, learner_type = LEARNER_TYPE, loop_type = LOOP_TYPE, no_bias_term = ",no_bias_term,#
      "  )$weights", "\n\n",#
      "  weights.sofia_ml <- sofia_ml_test_results[[paste(LEARNER_TYPE, LOOP_TYPE, sep = '_')]]","\n\n",#
      "  checkEqualsNumeric(weights.RSofia, weights.sofia_ml, tolerance = TOLERANCE)", sep = "")#
                      #
  function_txt.end <- "\n}"#
                        #
  function_txt <- paste(function_txt.name, function_txt.body, function_txt.end, sep = "\n")#
                        #
  return(function_txt)#
#
}#
#
for(i in LEARNER_TYPE)#
  for(j in LOOP_TYPE)#
    for(k in ETA_TYPE)#
      for(l in NO_BIAS_TERM)#
        eval(parse(text = create_function_text(i,j,k,l)))()
setwd("/Users/mike/git_sofia/RSofia/inst/SofiaModels")#
files <- list.files()#
data <- lapply(files, scan)#
names(data) <- substr(files, 1, regexpr(".out", files) - 1)#
#
sofia_ml_test_results <- data
setwd("/Users/mike/git_sofia/RSofia/inst/SofiaModels")#
files <- list.files()#
data <- lapply(files, scan)#
names(data) <- substr(files, 1, regexpr(".out", files) - 1)#
#
sofia_ml_test_results <- data
list.files90
list.file()
list.files()
list.files()
setwd("/Users/mike/git_sofia/RSofia/inst/SofiaModels")#
files <- list.files()#
data <- lapply(files, scan)
unlink("sofia_ml_test_results.RData")
#save(sofia_ml_test_results, file = "sofia_ml_test_results.RData")
setwd("/Users/mike/git_sofia/RSofia/inst/SofiaModels")#
files <- list.files()#
data <- lapply(files, scan)#
names(data) <- substr(files, 1, regexpr(".out", files) - 1)#
#
sofia_ml_test_results <- data#
#
#save(sofia_ml_test_results, file = "sofia_ml_test_results.RData")
sofia_ml_test_results
library(RUnit)#
library(RSofia)#
data(irismod)#
#
RANDOM_SEED = 1#
#
LEARNER_TYPE <- c( "pegasos", "sgd-svm", "passive-aggressive", "margin-perceptron", "romma", "logreg-pegasos" )#
LOOP_TYPE    <- c( "stochastic", "balanced-stochastic", "rank", "roc", "query-norm-rank", "combined-ranking", "combined-roc" )#
ETA_TYPE     <- c( "pegasos", "basic", "constant" )#
NO_BIAS_TERM <- c( TRUE, FALSE)#
#
create_function_text <- function(learner, loop, eta, no_bias_term) {#
#
  function_txt.name <- paste("test.sofia."#
    , gsub("-","_",learner),"."#
    , gsub("-","_",loop), "."#
    , gsub("-","_",eta), "."#
    , ifelse(no_bias_term, "bias1", "bias0"), " <- function()"#
    , " { \n", sep ="")#
#
  function_txt.body <- paste(#
      #
      "  LOOP_TYPE <- '", loop, "'\n",#
      "  LEARNER_TYPE <- '", learner, "'\n",#
      "  ETA_TYPE <- '", eta, "'\n\n" ,#
      #
      "  weights.RSofia <- sofia(Is.Virginica ~ ., irismod, random_seed = RANDOM_SEED", "\n",#
      "  , eta_type = ETA_TYPE, learner_type = LEARNER_TYPE, loop_type = LOOP_TYPE, no_bias_term = ",no_bias_term,#
      "  )$weights", "\n\n",#
      "  weights.sofia_ml <- sofia_ml_test_results[[paste(LEARNER_TYPE, LOOP_TYPE, sep = '_')]]","\n\n",#
      "  checkEqualsNumeric(weights.RSofia, weights.sofia_ml, tolerance = TOLERANCE)", sep = "")#
                      #
  function_txt.end <- "\n}"#
                        #
  function_txt <- paste(function_txt.name, function_txt.body, function_txt.end, sep = "\n")#
                        #
  return(function_txt)#
#
}#
#
for(i in LEARNER_TYPE)#
  for(j in LOOP_TYPE)#
    for(k in ETA_TYPE)#
      for(l in NO_BIAS_TERM)#
        eval(parse(text = create_function_text(i,j,k,l)))()
library(RUnit)#
library(RSofia)#
data(irismod)#
#
RANDOM_SEED = 1L#
TOLERANCE <- .00001#
#
LEARNER_TYPE <- c( "pegasos", "sgd-svm", "passive-aggressive", "margin-perceptron", "romma", "logreg-pegasos" )#
LOOP_TYPE    <- c( "stochastic", "balanced-stochastic", "rank", "roc", "query-norm-rank", "combined-ranking", "combined-roc" )#
ETA_TYPE     <- c( "pegasos", "basic", "constant" )#
NO_BIAS_TERM <- c( TRUE, FALSE)#
#
create_function_text <- function(learner, loop, eta, no_bias_term) {#
#
  function_txt.name <- paste("test.sofia."#
    , gsub("-","_",learner),"."#
    , gsub("-","_",loop), "."#
    , gsub("-","_",eta), "."#
    , ifelse(no_bias_term, "bias1", "bias0"), " <- function()"#
    , " { \n", sep ="")#
#
  function_txt.body <- paste(#
      #
      "  LOOP_TYPE <- '", loop, "'\n",#
      "  LEARNER_TYPE <- '", learner, "'\n",#
      "  ETA_TYPE <- '", eta, "'\n\n" ,#
      #
      "  weights.RSofia <- sofia(Is.Virginica ~ ., irismod, random_seed = RANDOM_SEED", "\n",#
      "  , eta_type = ETA_TYPE, learner_type = LEARNER_TYPE, loop_type = LOOP_TYPE, no_bias_term = ",no_bias_term,#
      "  )$weights", "\n\n",#
      "  weights.sofia_ml <- sofia_ml_test_results[[paste(LEARNER_TYPE, LOOP_TYPE, sep = '_')]]","\n\n",#
      "  checkEqualsNumeric(weights.RSofia, weights.sofia_ml, tolerance = TOLERANCE)", sep = "")#
                      #
  function_txt.end <- "\n}"#
                        #
  function_txt <- paste(function_txt.name, function_txt.body, function_txt.end, sep = "\n")#
                        #
  return(function_txt)#
#
}#
#
for(i in LEARNER_TYPE)#
  for(j in LOOP_TYPE)#
    for(k in ETA_TYPE)#
      for(l in NO_BIAS_TERM)#
        eval(parse(text = create_function_text(i,j,k,l)))()
library(RUnit)#
library(RSofia)#
data(irismod)#
#
RANDOM_SEED = 1L#
TOLERANCE <- .00001#
#
LEARNER_TYPE <- c( "pegasos", "sgd-svm", "passive-aggressive", "margin-perceptron", "romma", "logreg-pegasos" )#
LOOP_TYPE    <- c( "stochastic", "balanced-stochastic", "rank", "roc", "query-norm-rank", "combined-ranking", "combined-roc" )#
ETA_TYPE     <- c( "pegasos", "basic", "constant" )#
NO_BIAS_TERM <- c( TRUE, FALSE)#
#
create_function_text <- function(learner, loop, eta, no_bias_term) {#
#
  function_txt.name <- paste("test.sofia."#
    , gsub("-","_",learner),"."#
    , gsub("-","_",loop), "."#
    , gsub("-","_",eta), "."#
    , ifelse(no_bias_term, "bias1", "bias0"), " <- function()"#
    , " { \n", sep ="")#
#
  function_txt.body <- paste(#
      #
      "  LOOP_TYPE <- '", loop, "'\n",#
      "  LEARNER_TYPE <- '", learner, "'\n",#
      "  ETA_TYPE <- '", eta, "'\n\n" ,#
      "  NO_BIAS_TERM <- ", ifelse(no_bias_term, "bias1", "bias0"),"\n",#
      #
      "  weights.RSofia <- sofia(Is.Virginica ~ ., irismod, random_seed = RANDOM_SEED", "\n",#
      "  , eta_type = ETA_TYPE, learner_type = LEARNER_TYPE, loop_type = LOOP_TYPE, no_bias_term = NO_BIAS_TERM",#
      "  )$weights", "\n\n",#
      "  weights.sofia_ml <- sofia_ml_test_results[[paste(LEARNER_TYPE, LOOP_TYPE, ETA_TYPE,  sep = '_')]]","\n\n",#
      "  checkEqualsNumeric(weights.RSofia, weights.sofia_ml, tolerance = TOLERANCE)", sep = "")#
                      #
  function_txt.end <- "\n}"#
                        #
  function_txt <- paste(function_txt.name, function_txt.body, function_txt.end, sep = "\n")#
                        #
  return(function_txt)#
#
}#
#
for(i in LEARNER_TYPE)#
  for(j in LOOP_TYPE)#
    for(k in ETA_TYPE)#
      for(l in NO_BIAS_TERM)#
        eval(parse(text = create_function_text(i,j,k,l)))()
library(RUnit)#
library(RSofia)#
data(irismod)#
#
RANDOM_SEED = 1L#
TOLERANCE <- .00001#
#
LEARNER_TYPE <- c( "pegasos", "sgd-svm", "passive-aggressive", "margin-perceptron", "romma", "logreg-pegasos" )#
LOOP_TYPE    <- c( "stochastic", "balanced-stochastic", "rank", "roc", "query-norm-rank", "combined-ranking", "combined-roc" )#
ETA_TYPE     <- c( "pegasos", "basic", "constant" )#
NO_BIAS_TERM <- c( TRUE, FALSE)#
#
create_function_text <- function(learner, loop, eta, no_bias_term) {#
#
  function_txt.name <- paste("test.sofia."#
    , gsub("-","_",learner),"."#
    , gsub("-","_",loop), "."#
    , gsub("-","_",eta), "."#
    , ifelse(no_bias_term, "bias1", "bias0"), " <- function()"#
    , " { \n", sep ="")#
#
  function_txt.body <- paste(#
      #
      "  LOOP_TYPE <- '", loop, "'\n",#
      "  LEARNER_TYPE <- '", learner, "'\n",#
      "  ETA_TYPE <- '", eta, "'\n\n" ,#
      "  NO_BIAS_TERM <- ", ifelse(no_bias_term, "bias1", "bias0"),"\n",#
      #
      "  weights.RSofia <- sofia(Is.Virginica ~ ., irismod, random_seed = RANDOM_SEED", "\n",#
      "  , eta_type = ETA_TYPE, learner_type = LEARNER_TYPE, loop_type = LOOP_TYPE, no_bias_term = no_bias_term",#
      "  )$weights", "\n\n",#
      "  weights.sofia_ml <- sofia_ml_test_results[[paste(LEARNER_TYPE, LOOP_TYPE, ETA_TYPE,  sep = '_')]]","\n\n",#
      "  checkEqualsNumeric(weights.RSofia, weights.sofia_ml, tolerance = TOLERANCE)", sep = "")#
                      #
  function_txt.end <- "\n}"#
                        #
  function_txt <- paste(function_txt.name, function_txt.body, function_txt.end, sep = "\n")#
                        #
  return(function_txt)#
#
}#
#
for(i in LEARNER_TYPE)#
  for(j in LOOP_TYPE)#
    for(k in ETA_TYPE)#
      for(l in NO_BIAS_TERM)#
        eval(parse(text = create_function_text(i,j,k,l)))()
library(RUnit)#
library(RSofia)#
data(irismod)#
#
RANDOM_SEED = 1L#
TOLERANCE <- .00001#
#
LEARNER_TYPE <- c( "pegasos", "sgd-svm", "passive-aggressive", "margin-perceptron", "romma", "logreg-pegasos" )#
LOOP_TYPE    <- c( "stochastic", "balanced-stochastic", "rank", "roc", "query-norm-rank", "combined-ranking", "combined-roc" )#
ETA_TYPE     <- c( "pegasos", "basic", "constant" )#
NO_BIAS_TERM <- c( TRUE, FALSE)#
#
create_function_text <- function(learner, loop, eta, no_bias_term) {#
#
  function_txt.name <- paste("test.sofia."#
    , gsub("-","_",learner),"."#
    , gsub("-","_",loop), "."#
    , gsub("-","_",eta), "."#
    , ifelse(no_bias_term, "bias1", "bias0"), " <- function()"#
    , " { \n", sep ="")#
#
  function_txt.body <- paste(#
      #
      "  LOOP_TYPE <- '", loop, "'\n",#
      "  LEARNER_TYPE <- '", learner, "'\n",#
      "  ETA_TYPE <- '", eta, "'\n\n" ,#
      "  NO_BIAS_TERM <- ", ifelse(no_bias_term, "bias1", "bias0"),"\n",#
      #
      "  weights.RSofia <- sofia(Is.Virginica ~ ., irismod, random_seed = RANDOM_SEED", "\n",#
      "  , eta_type = ETA_TYPE, learner_type = LEARNER_TYPE, loop_type = LOOP_TYPE, no_bias_term = no_bias_term",#
      "  )$weights", "\n\n",#
      "  weights.sofia_ml <- sofia_ml_test_results[[paste(LEARNER_TYPE, LOOP_TYPE, ETA_TYPE, sep = '_')]]","\n\n",#
      "  checkEqualsNumeric(weights.RSofia, weights.sofia_ml, tolerance = TOLERANCE)", sep = "")#
                      #
  function_txt.end <- "\n}"#
                        #
  function_txt <- paste(function_txt.name, function_txt.body, function_txt.end, sep = "\n")#
                        #
  return(function_txt)#
#
}#
#
for(i in LEARNER_TYPE)#
  for(j in LOOP_TYPE)#
    for(k in ETA_TYPE)#
      for(l in NO_BIAS_TERM)#
        cat(parse(text = create_function_text(i,j,k,l)))()
library(RUnit)#
library(RSofia)#
data(irismod)#
#
RANDOM_SEED = 1L#
TOLERANCE <- .00001#
#
LEARNER_TYPE <- c( "pegasos", "sgd-svm", "passive-aggressive", "margin-perceptron", "romma", "logreg-pegasos" )#
LOOP_TYPE    <- c( "stochastic", "balanced-stochastic", "rank", "roc", "query-norm-rank", "combined-ranking", "combined-roc" )#
ETA_TYPE     <- c( "pegasos", "basic", "constant" )#
NO_BIAS_TERM <- c( TRUE, FALSE)#
#
create_function_text <- function(learner, loop, eta, no_bias_term) {#
#
  function_txt.name <- paste("test.sofia."#
    , gsub("-","_",learner),"."#
    , gsub("-","_",loop), "."#
    , gsub("-","_",eta), "."#
    , ifelse(no_bias_term, "bias1", "bias0"), " <- function()"#
    , " { \n", sep ="")#
#
  function_txt.body <- paste(#
      #
      "  LOOP_TYPE <- '", loop, "'\n",#
      "  LEARNER_TYPE <- '", learner, "'\n",#
      "  ETA_TYPE <- '", eta, "'\n\n" ,#
      "  NO_BIAS_TERM <- ", ifelse(no_bias_term, "bias1", "bias0"),"\n",#
      #
      "  weights.RSofia <- sofia(Is.Virginica ~ ., irismod, random_seed = RANDOM_SEED", "\n",#
      "  , eta_type = ETA_TYPE, learner_type = LEARNER_TYPE, loop_type = LOOP_TYPE, no_bias_term = no_bias_term",#
      "  )$weights", "\n\n",#
      "  weights.sofia_ml <- sofia_ml_test_results[[paste(LEARNER_TYPE, LOOP_TYPE, ETA_TYPE, sep = '_')]]","\n\n",#
      "  checkEqualsNumeric(weights.RSofia, weights.sofia_ml, tolerance = TOLERANCE)", sep = "")#
                      #
  function_txt.end <- "\n}"#
                        #
  function_txt <- paste(function_txt.name, function_txt.body, function_txt.end, sep = "\n")#
                        #
  return(function_txt)#
#
}#
#
for(i in LEARNER_TYPE)#
  for(j in LOOP_TYPE)#
    for(k in ETA_TYPE)#
      for(l in NO_BIAS_TERM)#
        print(parse(text = create_function_text(i,j,k,l)))()
library(RUnit)#
library(RSofia)#
data(irismod)#
#
RANDOM_SEED = 1L#
TOLERANCE <- .00001#
#
LEARNER_TYPE <- c( "pegasos", "sgd-svm", "passive-aggressive", "margin-perceptron", "romma", "logreg-pegasos" )#
LOOP_TYPE    <- c( "stochastic", "balanced-stochastic", "rank", "roc", "query-norm-rank", "combined-ranking", "combined-roc" )#
ETA_TYPE     <- c( "pegasos", "basic", "constant" )#
NO_BIAS_TERM <- c( TRUE, FALSE)#
#
create_function_text <- function(learner, loop, eta, no_bias_term) {#
#
  function_txt.name <- paste("test.sofia."#
    , gsub("-","_",learner),"."#
    , gsub("-","_",loop), "."#
    , gsub("-","_",eta), "."#
    , ifelse(no_bias_term, "bias1", "bias0"), " <- function()"#
    , " { \n", sep ="")#
#
  function_txt.body <- paste(#
      #
      "  LOOP_TYPE <- '", loop, "'\n",#
      "  LEARNER_TYPE <- '", learner, "'\n",#
      "  ETA_TYPE <- '", eta, "'\n\n" ,#
      "  NO_BIAS_TERM <- ", ifelse(no_bias_term, "bias1", "bias0"),"\n",#
      #
      "  weights.RSofia <- sofia(Is.Virginica ~ ., irismod, random_seed = RANDOM_SEED", "\n",#
      "  , eta_type = ETA_TYPE, learner_type = LEARNER_TYPE, loop_type = LOOP_TYPE, no_bias_term = no_bias_term",#
      "  )$weights", "\n\n",#
      "  weights.sofia_ml <- sofia_ml_test_results[[paste(LEARNER_TYPE, LOOP_TYPE, ETA_TYPE, sep = '_')]]","\n\n",#
      "  checkEqualsNumeric(weights.RSofia, weights.sofia_ml, tolerance = TOLERANCE)", sep = "")#
                      #
  function_txt.end <- "\n}"#
                        #
  function_txt <- paste(function_txt.name, function_txt.body, function_txt.end, sep = "\n")#
                        #
  return(function_txt)#
#
}#
#
for(i in LEARNER_TYPE)#
  for(j in LOOP_TYPE)#
    for(k in ETA_TYPE)#
      for(l in NO_BIAS_TERM)#
        print(parse(text = create_function_text(i,j,k,l)))
library(RUnit)#
library(RSofia)#
data(irismod)#
#
RANDOM_SEED = 1L#
TOLERANCE <- .00001#
#
LEARNER_TYPE <- c( "pegasos", "sgd-svm", "passive-aggressive", "margin-perceptron", "romma", "logreg-pegasos" )#
LOOP_TYPE    <- c( "stochastic", "balanced-stochastic", "rank", "roc", "query-norm-rank", "combined-ranking", "combined-roc" )#
ETA_TYPE     <- c( "pegasos", "basic", "constant" )#
NO_BIAS_TERM <- c( TRUE, FALSE)#
#
create_function_text <- function(learner, loop, eta, no_bias_term) {#
#
  function_txt.name <- paste("test.sofia."#
    , gsub("-","_",learner),"."#
    , gsub("-","_",loop), "."#
    , gsub("-","_",eta), "."#
    , ifelse(no_bias_term, "bias1", "bias0"), " <- function()"#
    , " { \n", sep ="")#
#
  function_txt.body <- paste(#
      #
      "  LOOP_TYPE <- '", loop, "'\n",#
      "  LEARNER_TYPE <- '", learner, "'\n",#
      "  ETA_TYPE <- '", eta, "'\n\n" ,#
      "  NO_BIAS_TERM <- ", ifelse(no_bias_term, "\'bias1\'", "\'bias0\'"),"\n",#
      #
      "  weights.RSofia <- sofia(Is.Virginica ~ ., irismod, random_seed = RANDOM_SEED", "\n",#
      "  , eta_type = ETA_TYPE, learner_type = LEARNER_TYPE, loop_type = LOOP_TYPE, no_bias_term = no_bias_term",#
      "  )$weights", "\n\n",#
      "  weights.sofia_ml <- sofia_ml_test_results[[paste(LEARNER_TYPE, LOOP_TYPE, ETA_TYPE, sep = '_')]]","\n\n",#
      "  checkEqualsNumeric(weights.RSofia, weights.sofia_ml, tolerance = TOLERANCE)", sep = "")#
                      #
  function_txt.end <- "\n}"#
                        #
  function_txt <- paste(function_txt.name, function_txt.body, function_txt.end, sep = "\n")#
                        #
  return(function_txt)#
#
}#
#
for(i in LEARNER_TYPE)#
  for(j in LOOP_TYPE)#
    for(k in ETA_TYPE)#
      for(l in NO_BIAS_TERM)#
        print(parse(text = create_function_text(i,j,k,l)))
library(RUnit)#
library(RSofia)#
data(irismod)#
#
RANDOM_SEED = 1L#
TOLERANCE <- .00001#
#
LEARNER_TYPE <- c( "pegasos", "sgd-svm", "passive-aggressive", "margin-perceptron", "romma", "logreg-pegasos" )#
LOOP_TYPE    <- c( "stochastic", "balanced-stochastic", "rank", "roc", "query-norm-rank", "combined-ranking", "combined-roc" )#
ETA_TYPE     <- c( "pegasos", "basic", "constant" )#
NO_BIAS_TERM <- c( TRUE, FALSE)#
#
create_function_text <- function(learner, loop, eta, no_bias_term) {#
#
  function_txt.name <- paste("test.sofia."#
    , gsub("-","_",learner),"."#
    , gsub("-","_",loop), "."#
    , gsub("-","_",eta), "."#
    , ifelse(no_bias_term, "bias1", "bias0"), " <- function()"#
    , " { \n", sep ="")#
#
  function_txt.body <- paste(#
      #
      "  LOOP_TYPE <- '", loop, "'\n",#
      "  LEARNER_TYPE <- '", learner, "'\n",#
      "  ETA_TYPE <- '", eta, "'\n\n" ,#
      "  NO_BIAS_TERM <- ", ifelse(no_bias_term, "\'bias1\'", "\'bias0\'"),"\n",#
      #
      "  weights.RSofia <- sofia(Is.Virginica ~ ., irismod, random_seed = RANDOM_SEED", "\n",#
      "  , eta_type = ETA_TYPE, learner_type = LEARNER_TYPE, loop_type = LOOP_TYPE, no_bias_term = no_bias_term",#
      "  )$weights", "\n\n",#
      "  weights.sofia_ml <- sofia_ml_test_results[[paste(LEARNER_TYPE, LOOP_TYPE, ETA_TYPE, sep = '_')]]","\n\n",#
      "  checkEqualsNumeric(weights.RSofia, weights.sofia_ml, tolerance = TOLERANCE)", sep = "")#
                      #
  function_txt.end <- "\n}"#
                        #
  function_txt <- paste(function_txt.name, function_txt.body, function_txt.end, sep = "\n")#
                        #
  return(function_txt)#
#
}#
#
for(i in LEARNER_TYPE)#
  for(j in LOOP_TYPE)#
    for(k in ETA_TYPE)#
      for(l in NO_BIAS_TERM)#
        eval(parse(text = create_function_text(i,j,k,l)))()
library(RUnit)#
library(RSofia)#
data(irismod)#
#
RANDOM_SEED = 1L#
TOLERANCE <- .00001#
#
LEARNER_TYPE <- c( "pegasos", "sgd-svm", "passive-aggressive", "margin-perceptron", "romma", "logreg-pegasos" )#
LOOP_TYPE    <- c( "stochastic", "balanced-stochastic", "rank", "roc", "query-norm-rank", "combined-ranking", "combined-roc" )#
ETA_TYPE     <- c( "pegasos", "basic", "constant" )#
NO_BIAS_TERM <- c( TRUE, FALSE)#
#
create_function_text <- function(learner, loop, eta, no_bias_term) {#
#
  function_txt.name <- paste("test.sofia."#
    , gsub("-","_",learner),"."#
    , gsub("-","_",loop), "."#
    , gsub("-","_",eta), "."#
    , ifelse(no_bias_term, "bias1", "bias0"), " <- function()"#
    , " { \n", sep ="")#
#
  function_txt.body <- paste(#
      #
      "  LOOP_TYPE <- '", loop, "'\n",#
      "  LEARNER_TYPE <- '", learner, "'\n",#
      "  ETA_TYPE <- '", eta, "'\n\n" ,#
      "  NO_BIAS_TERM <- ", ifelse(no_bias_term, "\'bias1\'", "\'bias0\'"),"\n",#
      #
      "  weights.RSofia <- sofia(Is.Virginica ~ ., irismod, random_seed = RANDOM_SEED", "\n",#
      "  , eta_type = ETA_TYPE, learner_type = LEARNER_TYPE, loop_type = LOOP_TYPE, no_bias_term = no_bias_term",#
      "  )$weights", "\n\n",#
      "  weights.sofia_ml <- sofia_ml_test_results[[paste(LEARNER_TYPE, LOOP_TYPE, ETA_TYPE, sep = '_')]]","\n\n",#
      "  checkEqualsNumeric(weights.RSofia, weights.sofia_ml, tolerance = TOLERANCE)", sep = "")#
                      #
  function_txt.end <- "\n}"#
                        #
  function_txt <- paste(function_txt.name, function_txt.body, function_txt.end, sep = "\n")#
                        #
  return(function_txt)#
#
}#
#
for(i in LEARNER_TYPE)#
  for(j in LOOP_TYPE)#
    for(k in ETA_TYPE)#
      for(l in NO_BIAS_TERM)#
        eval(parse(text = create_function_text(i,j,k,l)))()
library(RUnit)#
library(RSofia)#
data(irismod)#
#
RANDOM_SEED = 1L#
TOLERANCE <- .00001#
#
LEARNER_TYPE <- c( "pegasos", "sgd-svm", "passive-aggressive", "margin-perceptron", "romma", "logreg-pegasos" )#
LOOP_TYPE    <- c( "stochastic", "balanced-stochastic", "rank", "roc", "query-norm-rank", "combined-ranking", "combined-roc" )#
ETA_TYPE     <- c( "pegasos", "basic", "constant" )#
NO_BIAS_TERM <- c( TRUE, FALSE)#
#
create_function_text <- function(learner, loop, eta, no_bias_term) {#
#
  function_txt.name <- paste("test.sofia."#
    , gsub("-","_",learner),"."#
    , gsub("-","_",loop), "."#
    , gsub("-","_",eta), "."#
    , ifelse(no_bias_term, "bias1", "bias0"), " <- function()"#
    , " { \n", sep ="")#
#
  function_txt.body <- paste(#
      #
      "  LOOP_TYPE <- '", loop, "'\n",#
      "  LEARNER_TYPE <- '", learner, "'\n",#
      "  ETA_TYPE <- '", eta, "'\n\n" ,#
      "  NO_BIAS_TERM <- ", ifelse(no_bias_term, "\'bias1\'", "\'bias0\'"),"\n",#
      #
      "  weights.RSofia <- sofia(Is.Virginica ~ ., irismod, random_seed = RANDOM_SEED", "\n",#
      "  , eta_type = ETA_TYPE, learner_type = LEARNER_TYPE, loop_type = LOOP_TYPE, no_bias_term = no_bias_term",#
      "  )$weights", "\n\n",#
      "  weights.sofia_ml <- sofia_ml_test_results[[paste(LEARNER_TYPE, LOOP_TYPE, ETA_TYPE, NO_BIAS_TERM, sep = '_')]]","\n\n",#
      "  checkEqualsNumeric(weights.RSofia, weights.sofia_ml, tolerance = TOLERANCE)", sep = "")#
                      #
  function_txt.end <- "\n}"#
                        #
  function_txt <- paste(function_txt.name, function_txt.body, function_txt.end, sep = "\n")#
                        #
  return(function_txt)#
#
}#
#
for(i in LEARNER_TYPE)#
  for(j in LOOP_TYPE)#
    for(k in ETA_TYPE)#
      for(l in NO_BIAS_TERM)#
        eval(parse(text = create_function_text(i,j,k,l)))()
library(RUnit)#
library(RSofia)#
data(irismod)#
#
RANDOM_SEED = 1L#
TOLERANCE <- .00001#
#
LEARNER_TYPE <- c( "pegasos", "sgd-svm", "passive-aggressive", "margin-perceptron", "romma", "logreg-pegasos" )#
LOOP_TYPE    <- c( "stochastic", "balanced-stochastic", "rank", "roc", "query-norm-rank", "combined-ranking", "combined-roc" )#
ETA_TYPE     <- c( "pegasos", "basic", "constant" )#
NO_BIAS_TERM <- c( TRUE, FALSE)#
#
create_function_text <- function(learner, loop, eta, no_bias_term) {#
#
  function_txt.name <- paste("test.sofia."#
    , gsub("-","_",learner),"."#
    , gsub("-","_",loop), "."#
    , gsub("-","_",eta), "."#
    , ifelse(no_bias_term, "bias1", "bias0"), " <- function()"#
    , " { \n", sep ="")#
#
  function_txt.body <- paste(#
      #
      "  LOOP_TYPE <- '", loop, "'\n",#
      "  LEARNER_TYPE <- '", learner, "'\n",#
      "  ETA_TYPE <- '", eta, "'\n\n" ,#
      "  NO_BIAS_TERM <- ", ifelse(no_bias_term, "\'bias1\'", "\'bias0\'"),"\n",#
      #
      "  weights.RSofia <- sofia(Is.Virginica ~ ., irismod, random_seed = RANDOM_SEED", "\n",#
      "  , eta_type = ETA_TYPE, learner_type = LEARNER_TYPE, loop_type = LOOP_TYPE, no_bias_term = no_bias_term",#
      "  )$weights", "\n\n",#
      "  weights.sofia_ml <- sofia_ml_test_results[[paste(LEARNER_TYPE, LOOP_TYPE, ETA_TYPE, NO_BIAS_TERM, sep = '_')]]","\n\n",#
      "  checkEqualsNumeric(weights.RSofia, weights.sofia_ml, tolerance = TOLERANCE)", sep = "")#
                      #
  function_txt.end <- "\n}"#
                        #
  function_txt <- paste(function_txt.name, function_txt.body, function_txt.end, sep = "\n")#
                        #
  return(function_txt)#
#
}#
#
for(i in LEARNER_TYPE)#
  for(j in LOOP_TYPE)#
    for(k in ETA_TYPE)#
      for(l in NO_BIAS_TERM)#
      { #
      	cat(i,j,k,l)#
        eval(parse(text = create_function_text(i,j,k,l)))()#
      }
weights.RSof
library(RUnit)#
library(RSofia)#
data(irismod)#
#
RANDOM_SEED = 1L#
TOLERANCE <- .00001#
#
LEARNER_TYPE <- c( "pegasos", "sgd-svm", "passive-aggressive", "margin-perceptron", "romma", "logreg-pegasos" )#
LOOP_TYPE    <- c( "stochastic", "balanced-stochastic", "rank", "roc", "query-norm-rank", "combined-ranking", "combined-roc" )#
ETA_TYPE     <- c( "pegasos", "basic", "constant" )#
NO_BIAS_TERM <- c( TRUE, FALSE)#
#
create_function_text <- function(learner, loop, eta, no_bias_term) {#
#
  function_txt.name <- paste("test.sofia."#
    , gsub("-","_",learner),"."#
    , gsub("-","_",loop), "."#
    , gsub("-","_",eta), "."#
    , ifelse(no_bias_term, "bias1", "bias0"), " <- function()"#
    , " { \n", sep ="")#
#
  function_txt.body <- paste(#
      #
      "  LOOP_TYPE <- '", loop, "'\n",#
      "  LEARNER_TYPE <- '", learner, "'\n",#
      "  ETA_TYPE <- '", eta, "'\n\n" ,#
      "  NO_BIAS_TERM <- ", ifelse(no_bias_term, "\'bias1\'", "\'bias0\'"),"\n",#
      #
      "  weights.RSofia <- sofia(Is.Virginica ~ ., irismod, random_seed = RANDOM_SEED", "\n",#
      "  , eta_type = ETA_TYPE, learner_type = LEARNER_TYPE, loop_type = LOOP_TYPE, no_bias_term = no_bias_term",#
      "  )$weights", "\n\n",#
      "  weights.sofia_ml <- sofia_ml_test_results[[paste(LEARNER_TYPE, LOOP_TYPE, ETA_TYPE, NO_BIAS_TERM, sep = '_')]]","\n\n",#
      "  print(weights.sofial_ml)", "\n",#
      "  print(weigths.RSofia)", "\n",#
      "  checkEqualsNumeric(weights.RSofia, weights.sofia_ml, tolerance = TOLERANCE)", sep = "")#
                      #
  function_txt.end <- "\n}"#
                        #
  function_txt <- paste(function_txt.name, function_txt.body, function_txt.end, sep = "\n")#
                        #
  return(function_txt)#
#
}#
#
for(i in LEARNER_TYPE)#
  for(j in LOOP_TYPE)#
    for(k in ETA_TYPE)#
      for(l in NO_BIAS_TERM)#
      { #
      	cat(i,j,k,l)#
        eval(parse(text = create_function_text(i,j,k,l)))()#
      }
library(RUnit)#
library(RSofia)#
data(irismod)#
#
RANDOM_SEED = 1L#
TOLERANCE <- .00001#
#
LEARNER_TYPE <- c( "pegasos", "sgd-svm", "passive-aggressive", "margin-perceptron", "romma", "logreg-pegasos" )#
LOOP_TYPE    <- c( "stochastic", "balanced-stochastic", "rank", "roc", "query-norm-rank", "combined-ranking", "combined-roc" )#
ETA_TYPE     <- c( "pegasos", "basic", "constant" )#
NO_BIAS_TERM <- c( TRUE, FALSE)#
#
create_function_text <- function(learner, loop, eta, no_bias_term) {#
#
  function_txt.name <- paste("test.sofia."#
    , gsub("-","_",learner),"."#
    , gsub("-","_",loop), "."#
    , gsub("-","_",eta), "."#
    , ifelse(no_bias_term, "bias1", "bias0"), " <- function()"#
    , " { \n", sep ="")#
#
  function_txt.body <- paste(#
      #
      "  LOOP_TYPE <- '", loop, "'\n",#
      "  LEARNER_TYPE <- '", learner, "'\n",#
      "  ETA_TYPE <- '", eta, "'\n\n" ,#
      "  NO_BIAS_TERM <- ", ifelse(no_bias_term, "\'bias1\'", "\'bias0\'"),"\n",#
      #
      "  weights.RSofia <- sofia(Is.Virginica ~ ., irismod, random_seed = RANDOM_SEED", "\n",#
      "  , eta_type = ETA_TYPE, learner_type = LEARNER_TYPE, loop_type = LOOP_TYPE, no_bias_term = no_bias_term",#
      "  )$weights", "\n\n",#
      "  weights.sofia_ml <- sofia_ml_test_results[[paste(LEARNER_TYPE, LOOP_TYPE, ETA_TYPE, NO_BIAS_TERM, sep = '_')]]","\n\n",#
      "  print(weights.sofia_ml)", "\n",#
      "  print(weigths.RSofia)", "\n",#
      "  checkEqualsNumeric(weights.RSofia, weights.sofia_ml, tolerance = TOLERANCE)", sep = "")#
                      #
  function_txt.end <- "\n}"#
                        #
  function_txt <- paste(function_txt.name, function_txt.body, function_txt.end, sep = "\n")#
                        #
  return(function_txt)#
#
}#
#
for(i in LEARNER_TYPE)#
  for(j in LOOP_TYPE)#
    for(k in ETA_TYPE)#
      for(l in NO_BIAS_TERM)#
      { #
      	cat(i,j,k,l)#
        eval(parse(text = create_function_text(i,j,k,l)))()#
      }
library(RUnit)#
library(RSofia)#
data(irismod)#
#
RANDOM_SEED = 1L#
TOLERANCE <- .00001#
#
LEARNER_TYPE <- c( "pegasos", "sgd-svm", "passive-aggressive", "margin-perceptron", "romma", "logreg-pegasos" )#
LOOP_TYPE    <- c( "stochastic", "balanced-stochastic", "rank", "roc", "query-norm-rank", "combined-ranking", "combined-roc" )#
ETA_TYPE     <- c( "pegasos", "basic", "constant" )#
NO_BIAS_TERM <- c( TRUE, FALSE)#
#
create_function_text <- function(learner, loop, eta, no_bias_term) {#
#
  function_txt.name <- paste("test.sofia."#
    , gsub("-","_",learner),"."#
    , gsub("-","_",loop), "."#
    , gsub("-","_",eta), "."#
    , ifelse(no_bias_term, "bias1", "bias0"), " <- function()"#
    , " { \n", sep ="")#
#
  function_txt.body <- paste(#
      #
      "  LOOP_TYPE <- '", loop, "'\n",#
      "  LEARNER_TYPE <- '", learner, "'\n",#
      "  ETA_TYPE <- '", eta, "'\n\n" ,#
      "  NO_BIAS_TERM <- ", ifelse(no_bias_term, "\'bias1\'", "\'bias0\'"),"\n",#
      #
      "  weights.RSofia <- sofia(Is.Virginica ~ ., irismod, random_seed = RANDOM_SEED", "\n",#
      "  , eta_type = ETA_TYPE, learner_type = LEARNER_TYPE, loop_type = LOOP_TYPE, no_bias_term = no_bias_term",#
      "  )$weights", "\n\n",#
      "  weights.sofia_ml <- sofia_ml_test_results[[paste(LEARNER_TYPE, LOOP_TYPE, ETA_TYPE, NO_BIAS_TERM, sep = '_')]]","\n\n",#
      "  print(weights.sofia_ml)", "\n",#
      "  print(weights.RSofia)", "\n",#
      "  checkEqualsNumeric(weights.RSofia, weights.sofia_ml, tolerance = TOLERANCE)", sep = "")#
                      #
  function_txt.end <- "\n}"#
                        #
  function_txt <- paste(function_txt.name, function_txt.body, function_txt.end, sep = "\n")#
                        #
  return(function_txt)#
#
}#
#
for(i in LEARNER_TYPE)#
  for(j in LOOP_TYPE)#
    for(k in ETA_TYPE)#
      for(l in NO_BIAS_TERM)#
      { #
      	cat(i,j,k,l)#
        eval(parse(text = create_function_text(i,j,k,l)))()#
      }
sofia_ml_test_results["pegasos_stochastic_pegasos_bias0"]
sofia_ml_test_results["pegasos_stochastic_pegasos_bias1"]
library(RUnit)#
library(RSofia)#
data(irismod)#
#
RANDOM_SEED = 1L#
TOLERANCE <- .00001#
#
LEARNER_TYPE <- c( "pegasos", "sgd-svm", "passive-aggressive", "margin-perceptron", "romma", "logreg-pegasos" )#
LOOP_TYPE    <- c( "stochastic", "balanced-stochastic", "rank", "roc", "query-norm-rank", "combined-ranking", "combined-roc" )#
ETA_TYPE     <- c( "pegasos", "basic", "constant" )#
NO_BIAS_TERM <- c( TRUE, FALSE)#
#
create_function_text <- function(learner, loop, eta, no_bias_term) {#
#
  function_txt.name <- paste("test.sofia."#
    , gsub("-","_",learner),"."#
    , gsub("-","_",loop), "."#
    , gsub("-","_",eta), "."#
    , ifelse(no_bias_term, "bias0", "bias1"), " <- function()"#
    , " { \n", sep ="")#
#
  function_txt.body <- paste(#
      #
      "  LOOP_TYPE <- '", loop, "'\n",#
      "  LEARNER_TYPE <- '", learner, "'\n",#
      "  ETA_TYPE <- '", eta, "'\n\n" ,#
      "  NO_BIAS_TERM <- ", ifelse(no_bias_term, "\'bias1\'", "\'bias0\'"),"\n",#
      #
      "  weights.RSofia <- sofia(Is.Virginica ~ ., irismod, random_seed = RANDOM_SEED", "\n",#
      "  , eta_type = ETA_TYPE, learner_type = LEARNER_TYPE, loop_type = LOOP_TYPE, no_bias_term = no_bias_term",#
      "  )$weights", "\n\n",#
      "  weights.sofia_ml <- sofia_ml_test_results[[paste(LEARNER_TYPE, LOOP_TYPE, ETA_TYPE, NO_BIAS_TERM, sep = '_')]]","\n\n",#
      "  print(weights.sofia_ml)", "\n",#
      "  print(weights.RSofia)", "\n",#
      "  checkEqualsNumeric(weights.RSofia, weights.sofia_ml, tolerance = TOLERANCE)", sep = "")#
                      #
  function_txt.end <- "\n}"#
                        #
  function_txt <- paste(function_txt.name, function_txt.body, function_txt.end, sep = "\n")#
                        #
  return(function_txt)#
#
}#
#
for(i in LEARNER_TYPE)#
  for(j in LOOP_TYPE)#
    for(k in ETA_TYPE)#
      for(l in NO_BIAS_TERM)#
      { #
      	cat(i,j,k,l)#
        eval(parse(text = create_function_text(i,j,k,l)))()#
      }
library(RUnit)#
library(RSofia)#
data(irismod)#
#
RANDOM_SEED = 1L#
TOLERANCE <- .00001#
#
LEARNER_TYPE <- c( "pegasos", "sgd-svm", "passive-aggressive", "margin-perceptron", "romma", "logreg-pegasos" )#
LOOP_TYPE    <- c( "stochastic", "balanced-stochastic", "rank", "roc", "query-norm-rank", "combined-ranking", "combined-roc" )#
ETA_TYPE     <- c( "pegasos", "basic", "constant" )#
NO_BIAS_TERM <- c( TRUE, FALSE)#
#
create_function_text <- function(learner, loop, eta, no_bias_term) {#
#
  function_txt.name <- paste("test.sofia."#
    , gsub("-","_",learner),"."#
    , gsub("-","_",loop), "."#
    , gsub("-","_",eta), "."#
    , ifelse(no_bias_term, "bias0", "bias1"), " <- function()"#
    , " { \n", sep ="")#
#
  function_txt.body <- paste(#
      #
      "  LOOP_TYPE <- '", loop, "'\n",#
      "  LEARNER_TYPE <- '", learner, "'\n",#
      "  ETA_TYPE <- '", eta, "'\n\n" ,#
      "  NO_BIAS_TERM <- ", ifelse(no_bias_term, "\'bias0\'", "\'bias1\'"),"\n",#
      #
      "  weights.RSofia <- sofia(Is.Virginica ~ ., irismod, random_seed = RANDOM_SEED", "\n",#
      "  , eta_type = ETA_TYPE, learner_type = LEARNER_TYPE, loop_type = LOOP_TYPE, no_bias_term = no_bias_term",#
      "  )$weights", "\n\n",#
      "  weights.sofia_ml <- sofia_ml_test_results[[paste(LEARNER_TYPE, LOOP_TYPE, ETA_TYPE, NO_BIAS_TERM, sep = '_')]]","\n\n",#
      "  print(weights.sofia_ml)", "\n",#
      "  print(weights.RSofia)", "\n",#
      "  checkEqualsNumeric(weights.RSofia, weights.sofia_ml, tolerance = TOLERANCE)", sep = "")#
                      #
  function_txt.end <- "\n}"#
                        #
  function_txt <- paste(function_txt.name, function_txt.body, function_txt.end, sep = "\n")#
                        #
  return(function_txt)#
#
}#
#
for(i in LEARNER_TYPE)#
  for(j in LOOP_TYPE)#
    for(k in ETA_TYPE)#
      for(l in NO_BIAS_TERM)#
      { #
      	cat(i,j,k,l)#
        eval(parse(text = create_function_text(i,j,k,l)))()#
      }
library(RUnit)#
library(RSofia)#
data(irismod)#
#
RANDOM_SEED = 1L#
TOLERANCE <- .00001#
#
LEARNER_TYPE <- c( "pegasos", "sgd-svm", "passive-aggressive", "margin-perceptron", "romma", "logreg-pegasos" )#
LOOP_TYPE    <- c( "stochastic", "balanced-stochastic", "rank", "roc", "query-norm-rank", "combined-ranking", "combined-roc" )#
ETA_TYPE     <- c( "pegasos", "basic", "constant" )#
NO_BIAS_TERM <- c( TRUE, FALSE)#
#
create_function_text <- function(learner, loop, eta, no_bias_term) {#
#
  function_txt.name <- paste("test.sofia."#
    , gsub("-","_",learner),"."#
    , gsub("-","_",loop), "."#
    , gsub("-","_",eta), "."#
    , ifelse(no_bias_term, "bias0", "bias1"), " <- function()"#
    , " { \n", sep ="")#
#
  function_txt.body <- paste(#
      #
      "  LOOP_TYPE <- '", loop, "'\n",#
      "  LEARNER_TYPE <- '", learner, "'\n",#
      "  ETA_TYPE <- '", eta, "'\n\n" ,#
      "  NO_BIAS_TERM <- ", ifelse(no_bias_term, "\'bias0\'", "\'bias1\'"),"\n",#
      #
      "  weights.RSofia <- sofia(Is.Virginica ~ ., irismod, random_seed = RANDOM_SEED", "\n",#
      "  , eta_type = ETA_TYPE, learner_type = LEARNER_TYPE, loop_type = LOOP_TYPE, no_bias_term = no_bias_term",#
      "  )$weights", "\n\n",#
      "  weights.sofia_ml <- sofia_ml_test_results[[paste(LEARNER_TYPE, LOOP_TYPE, ETA_TYPE, NO_BIAS_TERM, sep = '_')]]","\n\n",#
      "  print(weights.sofia_ml)", "\n",#
      "  print(weights.RSofia)", "\n",#
      "  checkEqualsNumeric(weights.RSofia, weights.sofia_ml, tolerance = TOLERANCE)", sep = "")#
                      #
  function_txt.end <- "\n}"#
                        #
  function_txt <- paste(function_txt.name, function_txt.body, function_txt.end, sep = "\n")#
                        #
  return(function_txt)#
#
}#
#
for(i in LEARNER_TYPE)#
  for(j in LOOP_TYPE)#
    for(k in ETA_TYPE)#
      for(l in NO_BIAS_TERM)#
      { #
      	cat(i,j,k,l)#
        eval(parse(text = create_function_text(i,j,k,l)))()#
        print("***")#
      }
sofia_ml_test_results[{"pegasos_balanced-stochastic_basic_bias0.out"}]
sofia_ml_test_results["pegasos_balanced-stochastic_basic_bias0.out"]
sofia_ml_test_results[["pegasos_stochastic_pegasos_bias0.out"]]
sofia_ml_test_results[["pegasos_stochastic_pegasos_bias0"]]
sofia_ml_test_results[["pegasos_stochastic_pegasos_bias1"]]
library(RUnit)#
library(RSofia)#
data(irismod)#
#
RANDOM_SEED = 1L#
TOLERANCE <- .00001#
#
LEARNER_TYPE <- c( "pegasos", "sgd-svm", "passive-aggressive", "margin-perceptron", "romma", "logreg-pegasos" )#
LOOP_TYPE    <- c( "stochastic", "balanced-stochastic", "rank", "roc", "query-norm-rank", "combined-ranking", "combined-roc" )#
ETA_TYPE     <- c( "pegasos", "basic", "constant" )#
NO_BIAS_TERM <- c( TRUE, FALSE)#
#
create_function_text <- function(learner, loop, eta, no_bias_term) {#
#
  function_txt.name <- paste("test.sofia."#
    , gsub("-","_",learner),"."#
    , gsub("-","_",loop), "."#
    , gsub("-","_",eta), "."#
    , ifelse(no_bias_term, "bias0", "bias1"), " <- function()"#
    , " { \n", sep ="")#
#
  function_txt.body <- paste(#
      #
      "  LOOP_TYPE <- '", loop, "'\n",#
      "  LEARNER_TYPE <- '", learner, "'\n",#
      "  ETA_TYPE <- '", eta, "'\n\n" ,#
      "  NO_BIAS_TERM <- ", ifelse(no_bias_term, "\'bias0\'", "\'bias1\'"),"\n",#
      #
      "  weights.RSofia <- sofia(Is.Virginica ~ ., irismod, random_seed = RANDOM_SEED", "\n",#
      "  , eta_type = ETA_TYPE, learner_type = LEARNER_TYPE, loop_type = LOOP_TYPE, no_bias_term = no_bias_term",#
      "  )$weights", "\n\n",#
      "  weights.sofia_ml <- sofia_ml_test_results[[paste(LEARNER_TYPE, LOOP_TYPE, ETA_TYPE, NO_BIAS_TERM, sep = '_')]]","\n\n",#
      "  print(weights.sofia_ml)", "\n",#
      "  print(weights.RSofia)", "\n",#
      "  checkEqualsNumeric(weights.RSofia, weights.sofia_ml, tolerance = TOLERANCE)", sep = "")#
                      #
  function_txt.end <- "\n}"#
                        #
  function_txt <- paste(function_txt.name, function_txt.body, function_txt.end, sep = "\n")#
                        #
  return(function_txt)#
#
}#
#
for(i in LEARNER_TYPE)#
  for(j in LOOP_TYPE)#
    for(k in ETA_TYPE)#
      for(l in NO_BIAS_TERM)#
      { #
      	cat(i,j,k,l)#
        print(parse(text = create_function_text(i,j,k,l)))#
        eval(parse(text = create_function_text(i,j,k,l)))()#
        print("***")#
      }
NO_BIAS_TERM
library(RUnit)#
library(RSofia)#
data(irismod)#
#
RANDOM_SEED = 1L#
TOLERANCE <- .00001#
#
LEARNER_TYPE <- c( "pegasos", "sgd-svm", "passive-aggressive", "margin-perceptron", "romma", "logreg-pegasos" )#
LOOP_TYPE    <- c( "stochastic", "balanced-stochastic", "rank", "roc", "query-norm-rank", "combined-ranking", "combined-roc" )#
ETA_TYPE     <- c( "pegasos", "basic", "constant" )#
NO_BIAS_TERM_ <- c( TRUE, FALSE)#
#
create_function_text <- function(learner, loop, eta, no_bias_term) {#
#
  function_txt.name <- paste("test.sofia."#
    , gsub("-","_",learner),"."#
    , gsub("-","_",loop), "."#
    , gsub("-","_",eta), "."#
    , ifelse(no_bias_term, "bias0", "bias1"), " <- function()"#
    , " { \n", sep ="")#
#
  function_txt.body <- paste(#
      #
      "  LOOP_TYPE <- '", loop, "'\n",#
      "  LEARNER_TYPE <- '", learner, "'\n",#
      "  ETA_TYPE <- '", eta, "'\n\n" ,#
      "  NO_BIAS_TERM <- ", ifelse(no_bias_term, "\'bias0\'", "\'bias1\'"),"\n",#
      #
      "  weights.RSofia <- sofia(Is.Virginica ~ ., irismod, random_seed = RANDOM_SEED", "\n",#
      "  , eta_type = ETA_TYPE, learner_type = LEARNER_TYPE, loop_type = LOOP_TYPE, no_bias_term = no_bias_term",#
      "  )$weights", "\n\n",#
      "  weights.sofia_ml <- sofia_ml_test_results[[paste(LEARNER_TYPE, LOOP_TYPE, ETA_TYPE, NO_BIAS_TERM, sep = '_')]]","\n\n",#
      "  print(weights.sofia_ml)", "\n",#
      "  print(weights.RSofia)", "\n",#
      "  checkEqualsNumeric(weights.RSofia, weights.sofia_ml, tolerance = TOLERANCE)", sep = "")#
                      #
  function_txt.end <- "\n}"#
                        #
  function_txt <- paste(function_txt.name, function_txt.body, function_txt.end, sep = "\n")#
                        #
  return(function_txt)#
#
}#
#
for(i in LEARNER_TYPE)#
  for(j in LOOP_TYPE)#
    for(k in ETA_TYPE)#
      for(l in NO_BIAS_TERM_)#
      { #
      	cat(i,j,k,l)#
        print(parse(text = create_function_text(i,j,k,l)))#
        eval(parse(text = create_function_text(i,j,k,l)))()#
        print("***")#
      }
as.integer(TRUE)
as.integer(FALSE)
library(RUnit)#
library(RSofia)#
data(irismod)#
#
RANDOM_SEED = 1L#
TOLERANCE <- .00001#
#
LEARNER_TYPE <- c( "pegasos", "sgd-svm", "passive-aggressive", "margin-perceptron", "romma", "logreg-pegasos" )#
LOOP_TYPE    <- c( "stochastic", "balanced-stochastic", "rank", "roc", "query-norm-rank", "combined-ranking", "combined-roc" )#
ETA_TYPE     <- c( "pegasos", "basic", "constant" )#
NO_BIAS_TERM_ <- c( TRUE, FALSE)#
#
create_function_text <- function(learner, loop, eta, no_bias_term) {#
#
  function_txt.name <- paste("test.sofia."#
    , gsub("-","_",learner),"."#
    , gsub("-","_",loop), "."#
    , gsub("-","_",eta), "."#
    , ifelse(no_bias_term, "bias0", "bias1"), " <- function()"#
    , " { \n", sep ="")#
#
  function_txt.body <- paste(#
      #
      "  weights.RSofia <- sofia(Is.Virginica ~ ., irismod, random_seed = RANDOM_SEED", "\n",#
      "  , eta_type = ETA_TYPE, learner_type = LEARNER_TYPE, loop_type = LOOP_TYPE, no_bias_term = NO_BIAS_TERM",#
      "  )$weights", "\n\n",#
      "  weights.sofia_ml <- sofia_ml_test_results[[",#
         paste(learner, loop, eta, paste(bias, as.integer(no_bias_term),sep=""), sep = '_'),#
         "]]","\n\n",#
      "  print(weights.sofia_ml)", "\n",#
      "  print(weights.RSofia)", "\n",#
      "  checkEqualsNumeric(weights.RSofia, weights.sofia_ml, tolerance = TOLERANCE)", sep = "")#
                      #
  function_txt.end <- "\n}"#
                        #
  function_txt <- paste(function_txt.name, function_txt.body, function_txt.end, sep = "\n")#
                        #
  return(function_txt)#
#
}#
#
for(i in LEARNER_TYPE)#
  for(j in LOOP_TYPE)#
    for(k in ETA_TYPE)#
      for(l in NO_BIAS_TERM_)#
      { #
      	cat(i,j,k,l)#
        print(parse(text = create_function_text(i,j,k,l)))#
        eval(parse(text = create_function_text(i,j,k,l)))()#
        print("***")#
      }
library(RUnit)#
library(RSofia)#
data(irismod)#
#
RANDOM_SEED = 1L#
TOLERANCE <- .00001#
#
LEARNER_TYPE <- c( "pegasos", "sgd-svm", "passive-aggressive", "margin-perceptron", "romma", "logreg-pegasos" )#
LOOP_TYPE    <- c( "stochastic", "balanced-stochastic", "rank", "roc", "query-norm-rank", "combined-ranking", "combined-roc" )#
ETA_TYPE     <- c( "pegasos", "basic", "constant" )#
NO_BIAS_TERM_ <- c( TRUE, FALSE)#
#
create_function_text <- function(learner, loop, eta, no_bias_term) {#
#
  function_txt.name <- paste("test.sofia."#
    , gsub("-","_",learner),"."#
    , gsub("-","_",loop), "."#
    , gsub("-","_",eta), "."#
    , paste("bias", as.integer(no_bias_term),sep=""), " <- function()"#
    , " { \n", sep ="")#
#
  function_txt.body <- paste(#
      #
      "  weights.RSofia <- sofia(Is.Virginica ~ ., irismod, random_seed = RANDOM_SEED", "\n",#
      "  , eta_type = ETA_TYPE, learner_type = LEARNER_TYPE, loop_type = LOOP_TYPE, no_bias_term = NO_BIAS_TERM",#
      "  )$weights", "\n\n",#
      "  weights.sofia_ml <- sofia_ml_test_results[[",#
         paste(learner, loop, eta, paste("bias", as.integer(no_bias_term),sep=""), sep = '_'),#
         "]]","\n\n",#
      "  print(weights.sofia_ml)", "\n",#
      "  print(weights.RSofia)", "\n",#
      "  checkEqualsNumeric(weights.RSofia, weights.sofia_ml, tolerance = TOLERANCE)", sep = "")#
                      #
  function_txt.end <- "\n}"#
                        #
  function_txt <- paste(function_txt.name, function_txt.body, function_txt.end, sep = "\n")#
                        #
  return(function_txt)#
#
}#
#
for(i in LEARNER_TYPE)#
  for(j in LOOP_TYPE)#
    for(k in ETA_TYPE)#
      for(l in NO_BIAS_TERM_)#
      { #
      	cat(i,j,k,l)#
        print(parse(text = create_function_text(i,j,k,l)))#
        eval(parse(text = create_function_text(i,j,k,l)))()#
        print("***")#
      }
library(RUnit)#
library(RSofia)#
data(irismod)#
#
RANDOM_SEED = 1L#
TOLERANCE <- .00001#
#
LEARNER_TYPE <- c( "pegasos", "sgd-svm", "passive-aggressive", "margin-perceptron", "romma", "logreg-pegasos" )#
LOOP_TYPE    <- c( "stochastic", "balanced-stochastic", "rank", "roc", "query-norm-rank", "combined-ranking", "combined-roc" )#
ETA_TYPE     <- c( "pegasos", "basic", "constant" )#
NO_BIAS_TERM_ <- c( TRUE, FALSE)#
#
create_function_text <- function(learner, loop, eta, no_bias_term) {#
#
  function_txt.name <- paste("test.sofia."#
    , gsub("-","_",learner),"."#
    , gsub("-","_",loop), "."#
    , gsub("-","_",eta), "."#
    , paste("bias", as.integer(no_bias_term),sep=""), " <- function()"#
    , " { \n", sep ="")#
#
  function_txt.body <- paste(#
      #
      "  weights.RSofia <- sofia(Is.Virginica ~ ., irismod, random_seed = RANDOM_SEED", "\n",#
      "  , eta_type = ETA_TYPE, learner_type = LEARNER_TYPE, loop_type = LOOP_TYPE, no_bias_term = NO_BIAS_TERM",#
      "  )$weights", "\n\n",#
      "  weights.sofia_ml <- sofia_ml_test_results[[\'",#
         paste(learner, loop, eta, paste("bias", as.integer(no_bias_term),sep=""), sep = '_'),#
         "\']]","\n\n",#
      "  print(weights.sofia_ml)", "\n",#
      "  print(weights.RSofia)", "\n",#
      "  checkEqualsNumeric(weights.RSofia, weights.sofia_ml, tolerance = TOLERANCE)", sep = "")#
                      #
  function_txt.end <- "\n}"#
                        #
  function_txt <- paste(function_txt.name, function_txt.body, function_txt.end, sep = "\n")#
                        #
  return(function_txt)#
#
}#
#
for(i in LEARNER_TYPE)#
  for(j in LOOP_TYPE)#
    for(k in ETA_TYPE)#
      for(l in NO_BIAS_TERM_)#
      { #
      	cat(i,j,k,l)#
        print(parse(text = create_function_text(i,j,k,l)))#
        eval(parse(text = create_function_text(i,j,k,l)))()#
        print("***")#
      }
library(RUnit)#
library(RSofia)#
data(irismod)#
#
RANDOM_SEED = 1L#
TOLERANCE <- .00001#
#
LEARNER_TYPE <- c( "pegasos", "sgd-svm", "passive-aggressive", "margin-perceptron", "romma", "logreg-pegasos" )#
LOOP_TYPE    <- c( "stochastic", "balanced-stochastic", "rank", "roc", "query-norm-rank", "combined-ranking", "combined-roc" )#
ETA_TYPE     <- c( "pegasos", "basic", "constant" )#
NO_BIAS_TERM_ <- c( TRUE, FALSE)#
#
create_function_text <- function(learner, loop, eta, no_bias_term) {#
#
  function_txt.name <- paste("test.sofia."#
    , gsub("-","_",learner),"."#
    , gsub("-","_",loop), "."#
    , gsub("-","_",eta), "."#
    , paste("bias", as.integer(no_bias_term),sep=""), " <- function()"#
    , " { \n", sep ="")#
#
  function_txt.body <- paste(#
      #
      "  weights.RSofia <- sofia(Is.Virginica ~ ., irismod, random_seed = RANDOM_SEED", "\n",#
      "  eta_type = ", eta,#
      "  learner_type =", learner,#
      "  loop_type = ", loop,#
      "  no_bias_term = ", no_bias_term#
      "  )$weights", "\n\n",#
      "  weights.sofia_ml <- sofia_ml_test_results[[\'",#
         paste(learner, loop, eta, paste("bias", as.integer(no_bias_term),sep=""), sep = '_'),#
         "\']]","\n\n",#
      "  print(weights.sofia_ml)", "\n",#
      "  print(weights.RSofia)", "\n",#
      "  checkEqualsNumeric(weights.RSofia, weights.sofia_ml, tolerance = TOLERANCE)", sep = "")#
                      #
  function_txt.end <- "\n}"#
                        #
  function_txt <- paste(function_txt.name, function_txt.body, function_txt.end, sep = "\n")#
                        #
  return(function_txt)#
#
}#
#
for(i in LEARNER_TYPE)#
  for(j in LOOP_TYPE)#
    for(k in ETA_TYPE)#
      for(l in NO_BIAS_TERM)#
      { #
      	cat(i,j,k,l)#
        print(parse(text = create_function_text(i,j,k,l)))#
        eval(parse(text = create_function_text(i,j,k,l)))()#
        print("***")#
      }
#
create_function_text <- function(learner, loop, eta, no_bias_term) {#
#
  function_txt.name <- paste("test.sofia."#
    , gsub("-","_",learner),"."#
    , gsub("-","_",loop), "."#
    , gsub("-","_",eta), "."#
    , paste("bias", as.integer(no_bias_term),sep=""), " <- function()"#
    , " { \n", sep ="")#
#
  function_txt.body <- paste(#
      #
      "  weights.RSofia <- sofia(Is.Virginica ~ ., irismod, random_seed = RANDOM_SEED", "\n",#
      "  eta_type = ", eta,#
      "  learner_type =", learner,#
      "  loop_type = ", loop,#
      "  no_bias_term = ", no_bias_term#
      "  )$weights", "\n\n",#
      "  weights.sofia_ml <- sofia_ml_test_results[[\'",#
         paste(learner, loop, eta, paste("bias", as.integer(no_bias_term),sep=""), sep = '_'),#
         "\']]","\n\n",#
      "  print(weights.sofia_ml)", "\n",#
      "  print(weights.RSofia)", "\n",#
      "  checkEqualsNumeric(weights.RSofia, weights.sofia_ml, tolerance = TOLERANCE)", sep = "")#
                      #
  function_txt.end <- "\n}"#
                        #
  function_txt <- paste(function_txt.name, function_txt.body, function_txt.end, sep = "\n")#
                        #
  return(function_txt)#
#
}
library(RUnit)#
library(RSofia)#
data(irismod)#
#
RANDOM_SEED = 1L#
TOLERANCE <- .00001#
#
LEARNER_TYPE <- c( "pegasos", "sgd-svm", "passive-aggressive", "margin-perceptron", "romma", "logreg-pegasos" )#
LOOP_TYPE    <- c( "stochastic", "balanced-stochastic", "rank", "roc", "query-norm-rank", "combined-ranking", "combined-roc" )#
ETA_TYPE     <- c( "pegasos", "basic", "constant" )#
NO_BIAS_TERM_ <- c( TRUE, FALSE)#
#
create_function_text <- function(learner, loop, eta, no_bias_term) {#
#
  function_txt.name <- paste("test.sofia."#
    , gsub("-","_",learner),"."#
    , gsub("-","_",loop), "."#
    , gsub("-","_",eta), "."#
    , paste("bias", as.integer(no_bias_term),sep=""), " <- function()"#
    , " { \n", sep ="")#
#
  function_txt.body <- paste(#
      #
      "  weights.RSofia <- sofia(Is.Virginica ~ ., irismod, random_seed = RANDOM_SEED", "\n",#
      "  eta_type = ", eta,#
      "  learner_type =", learner,#
      "  loop_type = ", loop,#
      "  no_bias_term = ", no_bias_term,#
      "  )$weights", "\n\n",#
      "  weights.sofia_ml <- sofia_ml_test_results[[\'",#
         paste(learner, loop, eta, paste("bias", as.integer(no_bias_term),sep=""), sep = '_'),#
         "\']]","\n\n",#
      "  print(weights.sofia_ml)", "\n",#
      "  print(weights.RSofia)", "\n",#
      "  checkEqualsNumeric(weights.RSofia, weights.sofia_ml, tolerance = TOLERANCE)", sep = "")#
                      #
  function_txt.end <- "\n}"#
                        #
  function_txt <- paste(function_txt.name, function_txt.body, function_txt.end, sep = "\n")#
                        #
  return(function_txt)#
#
}#
#
for(i in LEARNER_TYPE)#
  for(j in LOOP_TYPE)#
    for(k in ETA_TYPE)#
      for(l in NO_BIAS_TERM)#
      { #
      	cat(i,j,k,l)#
        print(parse(text = create_function_text(i,j,k,l)))#
        eval(parse(text = create_function_text(i,j,k,l)))()#
        print("***")#
      }
library(RUnit)#
library(RSofia)#
data(irismod)#
#
RANDOM_SEED = 1L#
TOLERANCE <- .00001#
#
LEARNER_TYPE <- c( "pegasos", "sgd-svm", "passive-aggressive", "margin-perceptron", "romma", "logreg-pegasos" )#
LOOP_TYPE    <- c( "stochastic", "balanced-stochastic", "rank", "roc", "query-norm-rank", "combined-ranking", "combined-roc" )#
ETA_TYPE     <- c( "pegasos", "basic", "constant" )#
NO_BIAS_TERM_ <- c( TRUE, FALSE)#
#
create_function_text <- function(learner, loop, eta, no_bias_term) {#
#
  function_txt.name <- paste("test.sofia."#
    , gsub("-","_",learner),"."#
    , gsub("-","_",loop), "."#
    , gsub("-","_",eta), "."#
    , paste("bias", as.integer(no_bias_term),sep=""), " <- function()"#
    , " { \n", sep ="")#
#
  function_txt.body <- paste(#
      #
      "  weights.RSofia <- sofia(Is.Virginica ~ ., irismod, random_seed = RANDOM_SEED,", "\n",#
      "  eta_type = ", eta,#
      "  learner_type =", learner,#
      "  loop_type = ", loop,#
      "  no_bias_term = ", no_bias_term,#
      "  )$weights", "\n\n",#
      "  weights.sofia_ml <- sofia_ml_test_results[[\'",#
         paste(learner, loop, eta, paste("bias", as.integer(no_bias_term),sep=""), sep = '_'),#
         "\']]","\n\n",#
      "  print(weights.sofia_ml)", "\n",#
      "  print(weights.RSofia)", "\n",#
      "  checkEqualsNumeric(weights.RSofia, weights.sofia_ml, tolerance = TOLERANCE)", sep = "")#
                      #
  function_txt.end <- "\n}"#
                        #
  function_txt <- paste(function_txt.name, function_txt.body, function_txt.end, sep = "\n")#
                        #
  return(function_txt)#
#
}#
#
for(i in LEARNER_TYPE)#
  for(j in LOOP_TYPE)#
    for(k in ETA_TYPE)#
      for(l in NO_BIAS_TERM)#
      { #
      	cat(i,j,k,l)#
        print(parse(text = create_function_text(i,j,k,l)))#
        eval(parse(text = create_function_text(i,j,k,l)))()#
        print("***")#
      }
library(RUnit)#
library(RSofia)#
data(irismod)#
#
RANDOM_SEED = 1L#
TOLERANCE <- .00001#
#
LEARNER_TYPE <- c( "pegasos", "sgd-svm", "passive-aggressive", "margin-perceptron", "romma", "logreg-pegasos" )#
LOOP_TYPE    <- c( "stochastic", "balanced-stochastic", "rank", "roc", "query-norm-rank", "combined-ranking", "combined-roc" )#
ETA_TYPE     <- c( "pegasos", "basic", "constant" )#
NO_BIAS_TERM_ <- c( TRUE, FALSE)#
#
create_function_text <- function(learner, loop, eta, no_bias_term) {#
#
  function_txt.name <- paste("test.sofia."#
    , gsub("-","_",learner),"."#
    , gsub("-","_",loop), "."#
    , gsub("-","_",eta), "."#
    , paste("bias", as.integer(no_bias_term),sep=""), " <- function()"#
    , " { \n", sep ="")#
#
  function_txt.body <- paste(#
      #
      "  weights.RSofia <- sofia(Is.Virginica ~ ., irismod, random_seed = RANDOM_SEED", "\n",#
      "  ,eta_type = ", eta,#
      "  ,learner_type =", learner,#
      "  ,loop_type = ", loop,#
      "  ,no_bias_term = ", no_bias_term,#
      "  )$weights", "\n\n",#
      "  weights.sofia_ml <- sofia_ml_test_results[[\'",#
         paste(learner, loop, eta, paste("bias", as.integer(no_bias_term),sep=""), sep = '_'),#
         "\']]","\n\n",#
      "  print(weights.sofia_ml)", "\n",#
      "  print(weights.RSofia)", "\n",#
      "  checkEqualsNumeric(weights.RSofia, weights.sofia_ml, tolerance = TOLERANCE)", sep = "")#
                      #
  function_txt.end <- "\n}"#
                        #
  function_txt <- paste(function_txt.name, function_txt.body, function_txt.end, sep = "\n")#
                        #
  return(function_txt)#
#
}#
#
for(i in LEARNER_TYPE)#
  for(j in LOOP_TYPE)#
    for(k in ETA_TYPE)#
      for(l in NO_BIAS_TERM)#
      { #
      	cat(i,j,k,l)#
        print(parse(text = create_function_text(i,j,k,l)))#
        eval(parse(text = create_function_text(i,j,k,l)))()#
        print("***")#
      }
match()
match(a)
match("a")
as.character
quote
quote("hello")
?quote
dQuote("hello")
x <- sQuote(hello)
x <- sQuote("hello")
x
print(x)
str(x)
x
"\'hello\'"
?sQuote
library(RUnit)#
library(RSofia)#
data(irismod)#
#
RANDOM_SEED = 1L#
TOLERANCE <- .00001#
#
LEARNER_TYPE <- c( "pegasos", "sgd-svm", "passive-aggressive", "margin-perceptron", "romma", "logreg-pegasos" )#
LOOP_TYPE    <- c( "stochastic", "balanced-stochastic", "rank", "roc", "query-norm-rank", "combined-ranking", "combined-roc" )#
ETA_TYPE     <- c( "pegasos", "basic", "constant" )#
NO_BIAS_TERM_ <- c( TRUE, FALSE)#
#
create_function_text <- function(learner, loop, eta, no_bias_term) {#
#
  function_txt.name <- paste("test.sofia."#
    , gsub("-","_",learner),"."#
    , gsub("-","_",loop), "."#
    , gsub("-","_",eta), "."#
    , paste("bias", as.integer(no_bias_term),sep=""), " <- function()"#
    , " { \n", sep ="")#
#
  function_txt.body <- paste(#
      #
      "  weights.RSofia <- sofia(Is.Virginica ~ ., irismod, random_seed = RANDOM_SEED", "\n",#
      "  ,eta_type = '", eta,#
      "'  ,learner_type ='", learner,#
      "'  ,loop_type = '", loop,#
      "'  ,no_bias_term = '", no_bias_term,#
      "'  )$weights", "\n\n",#
      "  weights.sofia_ml <- sofia_ml_test_results[[\'",#
         paste(learner, loop, eta, paste("bias", as.integer(no_bias_term),sep=""), sep = '_'),#
         "\']]","\n\n",#
      "  print(weights.sofia_ml)", "\n",#
      "  print(weights.RSofia)", "\n",#
      "  checkEqualsNumeric(weights.RSofia, weights.sofia_ml, tolerance = TOLERANCE)", sep = "")#
                      #
  function_txt.end <- "\n}"#
                        #
  function_txt <- paste(function_txt.name, function_txt.body, function_txt.end, sep = "\n")#
                        #
  return(function_txt)#
#
}#
#
for(i in LEARNER_TYPE)#
  for(j in LOOP_TYPE)#
    for(k in ETA_TYPE)#
      for(l in NO_BIAS_TERM)#
      { #
      	cat(i,j,k,l)#
        print(parse(text = create_function_text(i,j,k,l)))#
        eval(parse(text = create_function_text(i,j,k,l)))()#
        print("***")#
      }
library(RUnit)#
library(RSofia)#
data(irismod)#
#
RANDOM_SEED = 1L#
TOLERANCE <- .00001#
#
LEARNER_TYPE <- c( "pegasos", "sgd-svm", "passive-aggressive", "margin-perceptron", "romma", "logreg-pegasos" )#
LOOP_TYPE    <- c( "stochastic", "balanced-stochastic", "rank", "roc", "query-norm-rank", "combined-ranking", "combined-roc" )#
ETA_TYPE     <- c( "pegasos", "basic", "constant" )#
NO_BIAS_TERM_ <- c( TRUE, FALSE)#
#
create_function_text <- function(learner, loop, eta, no_bias_term) {#
#
  function_txt.name <- paste("test.sofia."#
    , gsub("-","_",learner),"."#
    , gsub("-","_",loop), "."#
    , gsub("-","_",eta), "."#
    , paste("bias", as.integer(no_bias_term),sep=""), " <- function()"#
    , " { \n", sep ="")#
#
  function_txt.body <- paste(#
      #
      "  weights.RSofia <- sofia(Is.Virginica ~ ., irismod, random_seed = RANDOM_SEED", "\n",#
      "  ,eta_type = '", eta,#
      "'  ,learner_type ='", learner,#
      "'  ,loop_type = '", loop,#
      "'  ,no_bias_term = ", no_bias_term,#
      "  )$weights", "\n\n",#
      "  weights.sofia_ml <- sofia_ml_test_results[[\'",#
         paste(learner, loop, eta, paste("bias", as.integer(no_bias_term),sep=""), sep = '_'),#
         "\']]","\n\n",#
      "  print(weights.sofia_ml)", "\n",#
      "  print(weights.RSofia)", "\n",#
      "  checkEqualsNumeric(weights.RSofia, weights.sofia_ml, tolerance = TOLERANCE)", sep = "")#
                      #
  function_txt.end <- "\n}"#
                        #
  function_txt <- paste(function_txt.name, function_txt.body, function_txt.end, sep = "\n")#
                        #
  return(function_txt)#
#
}#
#
for(i in LEARNER_TYPE)#
  for(j in LOOP_TYPE)#
    for(k in ETA_TYPE)#
      for(l in NO_BIAS_TERM)#
      { #
      	cat(i,j,k,l)#
        print(parse(text = create_function_text(i,j,k,l)))#
        eval(parse(text = create_function_text(i,j,k,l)))()#
        print("***")#
      }
library(RUnit)#
library(RSofia)#
data(irismod)#
#
RANDOM_SEED = 1L#
TOLERANCE <- .00001#
#
LEARNER_TYPE <- c( "pegasos", "sgd-svm", "passive-aggressive", "margin-perceptron", "romma", "logreg-pegasos" )#
LOOP_TYPE    <- c( "stochastic", "balanced-stochastic", "rank", "roc", "query-norm-rank", "combined-ranking", "combined-roc" )#
ETA_TYPE     <- c( "pegasos", "basic", "constant" )#
NO_BIAS_TERM_ <- c( TRUE, FALSE)#
#
create_function_text <- function(learner, loop, eta, no_bias_term) {#
#
  function_txt.name <- paste("test.sofia."#
    , gsub("-","_",learner),"."#
    , gsub("-","_",loop), "."#
    , gsub("-","_",eta), "."#
    , paste("bias", as.integer(no_bias_term),sep=""), " <- function()"#
    , " { \n", sep ="")#
#
  function_txt.body <- paste(#
      #
      "  weights.RSofia <- sofia(Is.Virginica ~ ., irismod, random_seed = RANDOM_SEED", "\n",#
      "  ,eta_type = '", eta,#
      "'  ,learner_type ='", learner,#
      "'  ,loop_type = '", loop,#
      "'", #
      "  )$weights", "\n\n",#
      "  weights.sofia_ml <- sofia_ml_test_results[[\'",#
         paste(learner, loop, eta, paste("bias", as.integer(no_bias_term),sep=""), sep = '_'),#
         "\']]","\n\n",#
      "  print(weights.sofia_ml)", "\n",#
      "  print(weights.RSofia)", "\n",#
      "  checkEqualsNumeric(weights.RSofia, weights.sofia_ml, tolerance = TOLERANCE)", sep = "")#
                      #
  function_txt.end <- "\n}"#
                        #
  function_txt <- paste(function_txt.name, function_txt.body, function_txt.end, sep = "\n")#
                        #
  return(function_txt)#
#
}#
#
for(i in LEARNER_TYPE)#
  for(j in LOOP_TYPE)#
    for(k in ETA_TYPE)#
      for(l in NO_BIAS_TERM)#
      { #
      	cat(i,j,k,l)#
        print(parse(text = create_function_text(i,j,k,l)))#
        eval(parse(text = create_function_text(i,j,k,l)))()#
        print("***")#
      }
library(RUnit)#
library(RSofia)#
data(irismod)#
#
RANDOM_SEED = 1L#
TOLERANCE <- .00001#
#
LEARNER_TYPE <- c( "pegasos", "sgd-svm", "passive-aggressive", "margin-perceptron", "romma", "logreg-pegasos" )#
LOOP_TYPE    <- c( "stochastic", "balanced-stochastic", "rank", "roc", "query-norm-rank", "combined-ranking", "combined-roc" )#
ETA_TYPE     <- c( "pegasos", "basic", "constant" )#
NO_BIAS_TERM_ <- c( TRUE, FALSE)#
#
create_function_text <- function(learner, loop, eta, no_bias_term) {#
#
  function_txt.name <- paste("test.sofia."#
    , gsub("-","_",learner),"."#
    , gsub("-","_",loop), "."#
    , gsub("-","_",eta), "."#
    , paste("bias", as.integer(no_bias_term),sep=""), " <- function()"#
    , " { \n", sep ="")#
#
  function_txt.body <- paste(#
      #
      "  weights.RSofia <- sofia(Is.Virginica ~", ifelse(no_bias_term, "-1 +", ""),#
      " ., irismod, random_seed = RANDOM_SEED", "\n",#
      "  ,eta_type = '", eta,#
      "'  ,learner_type ='", learner,#
      "'  ,loop_type = '", loop,#
      "'", #
      "  )$weights", "\n\n",#
      "  weights.sofia_ml <- sofia_ml_test_results[[\'",#
         paste(learner, loop, eta, paste("bias", as.integer(no_bias_term),sep=""), sep = '_'),#
         "\']]","\n\n",#
      "  print(weights.sofia_ml)", "\n",#
      "  print(weights.RSofia)", "\n",#
      "  checkEqualsNumeric(weights.RSofia, weights.sofia_ml, tolerance = TOLERANCE)", sep = "")#
                      #
  function_txt.end <- "\n}"#
                        #
  function_txt <- paste(function_txt.name, function_txt.body, function_txt.end, sep = "\n")#
                        #
  return(function_txt)#
#
}#
#
for(i in LEARNER_TYPE)#
  for(j in LOOP_TYPE)#
    for(k in ETA_TYPE)#
      for(l in NO_BIAS_TERM)#
      { #
      	cat(i,j,k,l)#
        print(parse(text = create_function_text(i,j,k,l)))#
        eval(parse(text = create_function_text(i,j,k,l)))()#
        print("***")#
      }
library(RUnit)#
library(RSofia)#
data(irismod)#
#
RANDOM_SEED = 1L#
TOLERANCE <- .000001#
#
LEARNER_TYPE <- c( "pegasos", "sgd-svm", "passive-aggressive", "margin-perceptron", "romma", "logreg-pegasos" )#
LOOP_TYPE    <- c( "stochastic", "balanced-stochastic", "rank", "roc", "query-norm-rank", "combined-ranking", "combined-roc" )#
ETA_TYPE     <- c( "pegasos", "basic", "constant" )#
NO_BIAS_TERM_ <- c( TRUE, FALSE)#
#
create_function_text <- function(learner, loop, eta, no_bias_term) {#
#
  function_txt.name <- paste("test.sofia."#
    , gsub("-","_",learner),"."#
    , gsub("-","_",loop), "."#
    , gsub("-","_",eta), "."#
    , paste("bias", as.integer(no_bias_term),sep=""), " <- function()"#
    , " { \n", sep ="")#
#
  function_txt.body <- paste(#
      #
      "  weights.RSofia <- sofia(Is.Virginica ~", ifelse(no_bias_term, "-1 +", ""),#
      " ., irismod, random_seed = RANDOM_SEED", "\n",#
      "  ,eta_type = '", eta,#
      "'  ,learner_type ='", learner,#
      "'  ,loop_type = '", loop,#
      "'", #
      "  )$weights", "\n\n",#
      "  weights.sofia_ml <- sofia_ml_test_results[[\'",#
         paste(learner, loop, eta, paste("bias", as.integer(no_bias_term),sep=""), sep = '_'),#
         "\']]","\n\n",#
      "  print(weights.sofia_ml)", "\n",#
      "  print(weights.RSofia)", "\n",#
      "  checkEqualsNumeric(weights.RSofia, weights.sofia_ml, tolerance = TOLERANCE)", sep = "")#
                      #
  function_txt.end <- "\n}"#
                        #
  function_txt <- paste(function_txt.name, function_txt.body, function_txt.end, sep = "\n")#
                        #
  return(function_txt)#
#
}#
#
for(i in LEARNER_TYPE)#
  for(j in LOOP_TYPE)#
    for(k in ETA_TYPE)#
      for(l in NO_BIAS_TERM)#
      { #
        eval(parse(text = create_function_text(i,j,k,l)))()#
      }
library(RUnit)#
library(RSofia)#
data(irismod)#
#
RANDOM_SEED = 1L#
TOLERANCE <- .00001#
#
LEARNER_TYPE <- c( "pegasos", "sgd-svm", "passive-aggressive", "margin-perceptron", "romma", "logreg-pegasos" )#
LOOP_TYPE    <- c( "stochastic", "balanced-stochastic", "rank", "roc", "query-norm-rank", "combined-ranking", "combined-roc" )#
ETA_TYPE     <- c( "pegasos", "basic", "constant" )#
NO_BIAS_TERM_ <- c( TRUE, FALSE)#
#
create_function_text <- function(learner, loop, eta, no_bias_term) {#
#
  function_txt.name <- paste("test.sofia."#
    , gsub("-","_",learner),"."#
    , gsub("-","_",loop), "."#
    , gsub("-","_",eta), "."#
    , paste("bias", as.integer(no_bias_term),sep=""), " <- function()"#
    , " { \n", sep ="")#
#
  function_txt.body <- paste(#
      #
      "  weights.RSofia <- sofia(Is.Virginica ~", ifelse(no_bias_term, "-1 +", ""),#
      " ., irismod, random_seed = RANDOM_SEED", "\n",#
      "  ,eta_type = '", eta,#
      "'  ,learner_type ='", learner,#
      "'  ,loop_type = '", loop,#
      "'", #
      "  )$weights", "\n\n",#
      "  weights.sofia_ml <- sofia_ml_test_results[[\'",#
         paste(learner, loop, eta, paste("bias", as.integer(no_bias_term),sep=""), sep = '_'),#
         "\']]","\n\n",#
      "  print(weights.sofia_ml)", "\n",#
      "  print(weights.RSofia)", "\n",#
      "  checkEqualsNumeric(weights.RSofia, weights.sofia_ml, tolerance = TOLERANCE)", sep = "")#
                      #
  function_txt.end <- "\n}"#
                        #
  function_txt <- paste(function_txt.name, function_txt.body, function_txt.end, sep = "\n")#
                        #
  return(function_txt)#
#
}#
#
for(i in LEARNER_TYPE)#
  for(j in LOOP_TYPE)#
    for(k in ETA_TYPE)#
      for(l in NO_BIAS_TERM)#
      { #
        eval(parse(text = create_function_text(i,j,k,l)))()#
      }
library(RUnit)#
library(RSofia)#
data(irismod)#
#
RANDOM_SEED = 1L#
TOLERANCE <- .00001#
#
LEARNER_TYPE <- c( "pegasos", "sgd-svm", "passive-aggressive", "margin-perceptron", "romma", "logreg-pegasos" )#
LOOP_TYPE    <- c( "stochastic", "balanced-stochastic", "rank", "roc", "query-norm-rank", "combined-ranking", "combined-roc" )#
ETA_TYPE     <- c( "pegasos", "basic", "constant" )#
NO_BIAS_TERM_ <- c( TRUE, FALSE)#
#
create_function_text <- function(learner, loop, eta, no_bias_term) {#
#
  function_txt.name <- paste("test.sofia."#
    , gsub("-","_",learner),"."#
    , gsub("-","_",loop), "."#
    , gsub("-","_",eta), "."#
    , paste("bias", as.integer(no_bias_term),sep=""), " <- function()"#
    , " { \n", sep ="")#
#
  function_txt.body <- paste(#
      #
      "  weights.RSofia <- sofia(Is.Virginica ~", ifelse(no_bias_term, "-1 +", ""),#
      " ., irismod, random_seed = RANDOM_SEED", "\n",#
      "  ,eta_type = '", eta,#
      "'  ,learner_type ='", learner,#
      "'  ,loop_type = '", loop,#
      "'", #
      "  )$weights", "\n\n",#
      "  weights.sofia_ml <- sofia_ml_test_results[[\'",#
         paste(learner, loop, eta, paste("bias", as.integer(no_bias_term),sep=""), sep = '_'),#
         "\']]","\n\n",#
      "  checkEqualsNumeric(weights.RSofia, weights.sofia_ml, tolerance = TOLERANCE)", sep = "")#
                      #
  function_txt.end <- "\n}"#
                        #
  function_txt <- paste(function_txt.name, function_txt.body, function_txt.end, sep = "\n")#
                        #
  return(function_txt)#
#
}#
#
for(i in LEARNER_TYPE)#
  for(j in LOOP_TYPE)#
    for(k in ETA_TYPE)#
      for(l in NO_BIAS_TERM)#
      { #
        eval(parse(text = create_function_text(i,j,k,l)))()#
      }
library(RUnit)#
library(RSofia)#
data(irismod)#
#
RANDOM_SEED = 1L#
TOLERANCE <- .00001#
#
LEARNER_TYPE <- c( "pegasos", "sgd-svm", "passive-aggressive", "margin-perceptron", "romma", "logreg-pegasos" )#
LOOP_TYPE    <- c( "stochastic", "balanced-stochastic", "rank", "roc", "query-norm-rank", "combined-ranking", "combined-roc" )#
ETA_TYPE     <- c( "pegasos", "basic", "constant" )#
NO_BIAS_TERM <- c( TRUE, FALSE)#
#
create_function_text <- function(learner, loop, eta, no_bias_term) {#
#
  function_txt.name <- paste("test.sofia."#
    , gsub("-","_",learner),"."#
    , gsub("-","_",loop), "."#
    , gsub("-","_",eta), "."#
    , paste("bias", as.integer(no_bias_term),sep=""), " <- function()"#
    , " { \n", sep ="")#
#
  function_txt.body <- paste(#
      #
      "  weights.RSofia <- sofia(Is.Virginica ~", ifelse(no_bias_term, "-1 +", ""),#
      " ., irismod, random_seed = RANDOM_SEED", "\n",#
      "  ,eta_type = '", eta,#
      "'  ,learner_type ='", learner,#
      "'  ,loop_type = '", loop,#
      "'", #
      "  )$weights", "\n\n",#
      "  weights.sofia_ml <- sofia_ml_test_results[[\'",#
         paste(learner, loop, eta, paste("bias", as.integer(no_bias_term),sep=""), sep = '_'),#
         "\']]","\n\n",#
      "  checkEqualsNumeric(weights.RSofia, weights.sofia_ml, tolerance = TOLERANCE)", sep = "")#
                      #
  function_txt.end <- "\n}"#
                        #
  function_txt <- paste(function_txt.name, function_txt.body, function_txt.end, sep = "\n")#
                        #
  return(function_txt)#
#
}#
#
for(i in LEARNER_TYPE)#
  for(j in LOOP_TYPE)#
    for(k in ETA_TYPE)#
      for(l in NO_BIAS_TERM)#
        eval(parse(text = create_function_text(i,j,k,l)))()
setwd("/Users/mike/git_sofia/RSofia/inst/SofiaModels")#
files <- list.files()#
data <- lapply(files, scan)#
names(data) <- substr(files, 1, regexpr(".out", files) - 1)#
#
sofia_ml_test_results <- data
setwd("/Users/mike/git_sofia/RSofia/inst/SofiaModels")#
files <- list.files()#
data <- lapply(files, scan)#
names(data) <- substr(files, 1, regexpr(".out", files) - 1)#
#
sofia_ml_test_results <- data#
#
save(sofia_ml_test_results, file = "/Users/mike/git_sofia/RSofia/data/sofia_ml_test_results.RData")#
#
#save(sofia_ml_test_results, file = "sofia_ml_test_results.RData")
