Skip to content

Commit ffe7309

Browse files
committed
fixing tmp
1 parent 82ea7a7 commit ffe7309

File tree

4 files changed

+12
-11
lines changed

4 files changed

+12
-11
lines changed

R/autoRLearn.R

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -215,16 +215,16 @@ autoRLearn <- function(maxTime, directory, testDirectory, classCol = 'class', me
215215
finalResult$clfs <- bestAlgorithm
216216
finalResult$params <- bestAlgorithmParams
217217
#save results to Temporary File
218-
sendToTmp(metaFeatures, bestAlgorithm, bestAlgorithmParams, finalResult$perf, nModels, metric)
218+
query <- sendToTmp(metaFeatures, bestAlgorithm, bestAlgorithmParams, finalResult$perf, nModels, metric)
219+
#check internet connection and send data in tmp file to database if connection exists
220+
if(checkInternet() == TRUE){
221+
sendToDatabase(query)
222+
}
219223
})
220224
if(inherits(trainFinalModelError, "try-error")){
221225
print('Error: No Enough Computational Resources. Can not build a model over the current dataset!')
222226
}
223227

224-
#check internet connection and send data in tmp file to database if connection exists
225-
if(checkInternet() == TRUE){
226-
sendToDatabase()
227-
}
228228

229229
finalResult$TRData = dataset$FULLTD
230230
finalResult$TEData = dataset$TED

R/runClassifier.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
#' @importFrom caret plsda
5757
#' @importFrom stats glm predict
5858
#' @importFrom nnet nnet
59-
#' @importFrom deepboost deepboost
59+
#' @importFrom deepboost deepboost deepboost.predict
6060
#' @importFrom utils capture.output
6161
#' @importFrom mda fda mars bruto gen.ridge polyreg
6262
#'

R/sendToDatabase.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#' @title Send Results to Knowledge Base
22
#'
33
#' @description Connect to the cloud knowledge base to store the results obtained to be used in meta-learning of future runs.
4-
#'
4+
#' @param tmp String of characters to be sent to knowledge base
55
#' @return None
66
#'
77
#' @examples sendToDatabase()
@@ -14,18 +14,18 @@
1414
#'
1515
#' @keywords internal
1616

17-
sendToDatabase <- function(){
17+
sendToDatabase <- function(tmp){
1818
#Get IP
1919
cntIP <- fromJSON(readLines("http://api.hostip.info/get_json.php", warn=F))$ip
2020

2121
#Update knowledge base
2222
updateKB <- try(
2323
{
24-
tmp <- paste(readLines(system.file("extdata", "tmp", package = "SmartML", mustWork = TRUE)), collapse="\n")
24+
#tmp <- paste(readLines(system.file("extdata", "tmp", package = "SmartML", mustWork = TRUE)), collapse="\n")
2525
res <- POST("https://jncvt2k156.execute-api.eu-west-1.amazonaws.com/default/s3-trigger-rautoml", body = list(data = paste(tmp, "&DATA&", sep=""),
2626
fName = paste(cntIP,".csv&FILENAME&", sep=""),
2727
encode = "json"))
28-
write("", file=system.file("extdata", "tmp", package = "SmartML", mustWork = TRUE),append=TRUE) #Empty the tmp file
28+
#write("", file=system.file("extdata", "tmp", package = "SmartML", mustWork = TRUE),append=TRUE) #Empty the tmp file
2929
})
3030
if(inherits(updateKB, "try-error"))
3131
print('Failed to update Knowledge base.')

R/sendToTmp.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,6 @@ sendToTmp <- function(df, algorithmName, bestParams, perf, nModels, metric = 'ac
3434
df$classProbMean, df$classProbMax, df$classProbMin, df$classEntropy, df$ratioNumToCat, df$nCatFeatures, df$nNumFeatures,
3535
df$nInstances, df$nFeatures, df$nClasses, df$lognFeatures, df$lognInstances, df$classifierAlgorithm, df$params, df$maxTime, metric,
3636
df$performance, nModels)
37-
write(query, file=system.file("extdata", "tmp", package = "SmartML", mustWork = TRUE),append=TRUE)
37+
return(query)
38+
#write(query, file=system.file("extdata", "tmp", package = "SmartML", mustWork = TRUE),append=TRUE)
3839
}

0 commit comments

Comments
 (0)