Open stevebanik opened 9 years ago
UPDATE: Value should likely be num, not chr:
str(foo) 'data.frame': 1439 obs. of 2 variables: $ date : POSIXct, format: "2015-05-11 14:20:00" "2015-05-11 14:21:00" ... $ value: chr "36185.0" "38591.0" "36313.0" "34467.0" ...
I used transform to change that:
D <- transform(foo, value = as.numeric(value)) Warning message: In eval(expr, envir, enclos) : NAs introduced by coercion
And now it's num:
str(D) 'data.frame': 1439 obs. of 2 variables: $ date : POSIXct, format: "2015-05-11 14:20:00" "2015-05-11 14:21:00" ... $ value: num 36185 38591 36313 34467 35717 ...
but "Anom detection needs at least 2 periods worth of data":
anomalyDetectionResult <- AnomalyDetectionTs(D, max_anoms=0.2, threshold = "None", direction='both', plot=TRUE, only_last = "day", e_value = TRUE) Error in detect_anoms(all_data[[i]], k = max_anoms, alpha = alpha, num_obs_per_period = period, : Anom detection needs at least 2 periods worth of data
I seem to recall reading another issue about that, so I'll look for it again.
@stevebanik How did you get your timestamps to be in that format? I've tried doing
foo_timestamp <-as.POSIXct(parse_iso_8601(doc$fields$`@timestamp`))
But my timestamps now are nums
str(foo_dataframe)
'data.frame': 100 obs. of 2 variables:
$ timestamp_list: num 1.44e+09 1.44e+09 1.44e+09 1.44e+09 1.44e+09 ...
$ in_bytes_list : num 977 1965 973 986 977 ...
And when I run the anomaly detector
AnomalyDetectionVec(foo_dataframe, period=100, plot=TRUE)
Error in AnomalyDetectionVec(es_out2, period = 100, plot = TRUE) :
data must be a single data frame, list, or vector that holds numeric values.
My data frame looks like this:
head(foo_dataframe)
timestamp_list in_bytes_list
1 1437617401 977
2 1437617401 1965
3 1437617401 973
4 1437617401 986
5 1437617401 977
6 1437617391 605
Any help would be greatly appreciated!
Same here. Were you able to resolve this?
I created a data.frame called foo and attempted to format it exactly like raw_data, but when I set res, I get an error.
My data.frame:
Setting res, getting an error:
raw_data looks quite like foo:
Any idea what I'm doing wrong?
Thanks,
Steve