Comments (9)
You need to specify the name of the time column if it is not time
. You can do TimeSeriesData(df, time_col_name='index')
. The time
attribute of TimeSeriesData
needs to consist of Datetime
objects - how are you looking to convert the index values to Datetimes?
from kats.
I am doing just that:
df :
0,0.09177
1,0.09567
2,0.08444
3,0.08971
And then I run:
TimeSeriesData(df, time_col_name='index')
But then the index is automatically transformed to datetime:
index 0
0 1970-01-01 00:00:00.000000000 0.091773
1 1970-01-01 00:00:00.000000001 0.095667
2 1970-01-01 00:00:00.000000002 0.084443
3 1970-01-01 00:00:00.000000003 0.089711
from kats.
Yes, the times need to be Datetimes.
from kats.
@jeffhandl OK , but let's say I want to treat them just as order and not specifically datetime - is it possible?
from kats.
No, you need datetime values in the time column - that is required.
from kats.
@jeffhandi will be it presented in the future or there is a workaround? since ordered data is actually can be treated as a time series, even if the index is not specifically datetime
from kats.
@orko19 If you have ts_df = TimeSeriesData(df, time_col_name='index')
, you can recover the indices by doing ts_df.time.index
. Does that help?
from kats.
@jeffhandl When I run on my dataframe:
df.apply(lambda x : CUSUMDetector(TimeSeriesData(pd.DataFrame(x['value']).
reset_index(), time_col_name="index")).
detector(), axis=1)
I get:
[(TimeSeriesChangePoint(start_time: 1970-01-01 00:00:00.000000095, end_time: 1970-01-01 00:00:00.000000095, confidence: 1.0), <kats.detectors.cusum_detection.CUSUMMetadata object at 0x1db27ef40>)]
[(TimeSeriesChangePoint(start_time: 1970-01-01 00:00:00.000000057, end_time: 1970-01-01 00:00:00.000000057, confidence: 1.0), <kats.detectors.cusum_detection.CUSUMMetadata object at 0x1db27e9a0>)]
[(TimeSeriesChangePoint(start_time: 1970-01-01 00:00:00.000000229, end_time: 1970-01-01 00:00:00.000000229, confidence: 1.0), <kats.detectors.cusum_detection.CUSUMMetadata object at 0x1db27e6d0>)]
[(TimeSeriesChangePoint(start_time: 1970-01-01 00:00:00.000000095, end_time: 1970-01-01 00:00:00.000000095, confidence: 1.0), <kats.detectors.cusum_detection.CUSUMMetadata object at 0x1db27ef10>)]
[(TimeSeriesChangePoint(start_time: 1970-01-01 00:00:00.000000057, end_time: 1970-01-01 00:00:00.000000057, confidence: 1.0), <kats.detectors.cusum_detection.CUSUMMetadata object at 0x1db27e340>)]
So I meant to ask if there is a way that the output of the detector will be the actual index? Or a workaround to go back from TimeSeriesChangePoint to row/index in the original dataframe?
from kats.
Yes, let's say ts_df
is the name o the time series and cp
is the name of a changepoint. Then cp[0][0].start_time
is the time of the changepoint, so you can do ts_df.time_to_index().get_loc(cp[0][0].start_time)
.
from kats.
Related Issues (20)
- Ax-Platform Issue HOT 1
- metalearner metadata error
- Hyper Parameter Tuning Explanation
- pip install kats fail HOT 22
- After installation on Databricks Error object.__init__() takes exactly one argument HOT 3
- Is it possible to "conda install kats"? HOT 1
- Anomaly detection in multivariate time series documentation benchmark
- Can't install Kats in Python 3.11, 3.10, 3.9
- Kats installation failure HOT 5
- KeyError: 'overall_anomaly_score' HOT 1
- kats 0.2.0 ax-platform dependency
- Tutorial 202 detection BOCPDetector parameter error HOT 1
- Issues on first use HOT 1
- Implementation of online/real time inference for detection of change point by bocpd
- pip install error for kats 0.2.0
- kats installation error HOT 13
- How can I set custom model parameters in GetMetaData?
- Kats installation failure due to Cython and numpy HOT 2
- Feature request: make pip installable with exclusion of fbprophet or any other pystan depender
- Unable to install Kats
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kats.