bt_update_squad_classifier=function(update.training.data=T,
squad.detecive.level=.7,
update.detective.classifiers=T,
detective.log="content/0 core/Classifier statistics & history.Rdata"){
library(data.table)
library(tidytext)
library(stringr)
library("stats")
library("httr")
library(tm)
library(tokenizers)
library(splitstackshape)
library(stringr)
library(randomForest)
library(xgboost)
library(mailR)
library(tidytext)
library(plyr)
library(kernlab)
library(class)
library(e1071)
library(udpipe)
library(SuperLearner)
library(caret)
source("code/daily/infrastructure/Bastiat base.R")
## updating training data
if(update.training.data){
print("Updating training data ... ")
bt_update_training_data()
print("Updating training data ... complete.")
}
#dbg
# update.training.data=T
# squad.detecive.level=.7
# update.detective.classifiers=T
# detective.log="content/0 core/Classifier statistics & history.Rdata"
## gathering detectives
load(detective.log)
detectives=c("incumbent", setdiff(unique(subset(model, detective.no %in% subset(stats, date>="2019-03-08" & (score>=squad.detecive.level|score.adjusted>=squad.detecive.level))$detective.no)$name),
c("Wallander","Tin Tin",model$name[nrow(model)])))
## Updating detecitve classifiers if necessary
if(update.detective.classifiers){
print(paste("Updating detectives ..."))
bt_estimate_detective(detective.name=detectives)
print(paste("Updating detectives ... complete"))
}
## Updating squad classifier
print("Updating squad classifier ... ")
bt_estimate_squad(detectives=detectives)
print("Updating squad classifier ... complete.")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.