Open Astrocito98 opened 2 years ago
Hi. Yes, unfortunately updates happen and this package here is not intended to be updated. this is, because it is also a repository that comes with a publication and should contain all the code that can accurately reproduce our results. However on my side i already fixed this issue for my own code going forward. Can you quickly try the updated function for ClassifyBehaviors and tell me if it works for you? I may fork this package in the future and maintain/update the forked version.
ClassifyBehaviors <- function(t,model, model_parameters){
if(!IsTrackingData(t)){
stop("Object is not of type TrackingData")
}
t <- CreateTestSet(t, model_parameters$integration_period)
t$labels$classifications <- model %>% predict(t$train_x)
t$labels$classifications <- c(rep(NA,model_parameters$integration_period),
model_parameters$Feature_names[apply(t$labels$classifications,MARGIN = 1, FUN = which.max)],
rep(NA,model_parameters$integration_period))
return(t)
}
Hi, thanks for your answer. I first solved the problem by downgrading my TF version to v2.5. Ill problably keep working like this for my current project for consistency. However, I quickly tried with your upgraded version of the code and worked just fine. Havent find any other problem using the package.
Hi, thanks for putting this up, im using this code for my MD project. Everything working well until the moment where i try to create a behavior classifier. Seems like the function predict_classes() has been removed from tensorflow in v2.6. When trying to call the function ClassifyBehaviors it shows the error
AttributeError: 'Sequential' object has no attribute 'predict_classes'
and points what code to use instead. When I try to correct the code on my own the function looks like this
ClassifyBehaviors <- function(t,model, model_parameters){ if(!IsTrackingData(t)){ stop("Object is not of type TrackingData") } t <- CreateTestSet(t, model_parameters$integration_period)
t$labels$classifications <- model %>% predict(t$train_x) %>%
k_argmax()``before "t$labels$classifications <- model %>% predict_classes(t$train_x)
t$labels$classifications <- c(rep(NA,model_parameters$integration_period), model_parameters$Feature_names[t$labels$classifications + 1], rep(NA,model_parameters$integration_period)) return(t) }
That way it allows it to pass that last error, but then it shows
Error in model_parameters$Feature_names[t$labels$classifications + 1] : invalid subscript type 'environment' ``
I'm stuck in trying to correct this error, hope you can update the code so it works with TF v2.6+