* refactor toc * refactor toc * Change to pydata-sphinx-theme and update packages requirement list for ReadtheDocs * Remove customized css for old theme * Add index page to each top bar section and limit dropdown maximum to be 4 * Use js to change 'More' to 'Libraries' * Add custom.css to conf.py for further css changes * Add BigDL logo and search bar * refactor toc * refactor toc and add overview * refactor toc and add overview * refactor toc and add overview * refactor get started * add paper and video section * add videos * add grid columns in landing page * add document roadmap to index * reapply search bar and github icon commit * reorg orca and chronos sections * Test: weaken ads by js * update: change left attrbute * update: add comments * update: change opacity to 0.7 * Remove useless theme template override for old theme * Add sidebar releases component in the home page * Remove sidebar search and restore top nav search button * Add BigDL handouts * Add back to homepage button to pages except from the home page * Update releases contents & styles in left sidebar * Add version badge to the top bar * Test: weaken ads by js * update: add comments * remove landing page contents * rfix chronos install * refactor install * refactor chronos section titles * refactor nano index * change chronos landing * revise chronos landing page * add document navigator to nano landing page * revise install landing page * Improve css of versions in sidebar * Make handouts image pointing to a page in new tab * add win guide to install * add dliib installation * revise title bar * rename index files * add index page for user guide * add dllib and orca API * update user guide landing page * refactor side bar * Remove extra style configuration of card components & make different card usage consistent * Remove extra styles for Nano how-to guides * Remove extra styles for Chronos how-to guides * Remove dark mode for now * Update index page description * Add decision tree for choosing BigDL libraries in index page * add dllib models api, revise core layers formats * Change primary & info color in light mode * Restyle card components * Restructure Chronos landing page * Update card style * Update BigDL library selection decision tree * Fix failed Chronos tutorials filter * refactor PPML documents * refactor and add friesian documents * add friesian arch diagram * update landing pages and fill key features guide index page * Restyle link card component * Style video frames in PPML sections * Adjust Nano landing page * put api docs to the last in index for convinience * Make badge horizontal padding smaller & small changes * Change the second letter of all header titles to be small capitalizd * Small changes on Chronos index page * Revise decision tree to make it smaller * Update: try to change the position of ads. * Bugfix: deleted nonexist file config * Update: update ad JS/CSS/config * Update: change ad. * Update: delete my template and change files. * Update: change chronos installation table color. * Update: change table font color to --pst-color-primary-text * Remove old contents in landing page sidebar * Restyle badge for usage in card footer again * Add quicklinks template on landing page sidebar * add quick links * Add scala logo * move tf, pytorch out of the link * change orca key features cards * fix typo * fix a mistake in wording * Restyle badge for card footer * Update decision tree * Remove useless html templates * add more api docs and update tutorials in dllib * update chronos install using new style * merge changes in nano doc from master * fix quickstart links in sidebar quicklinks * Make tables responsive * Fix overflow in api doc * Fix list indents problems in [User guide] section * Further fixes to nested bullets contents in [User Guide] section * Fix strange title in Nano 5-min doc * Fix list indent problems in [DLlib] section * Fix misnumbered list problems and other small fixes for [Chronos] section * Fix list indent problems and other small fixes for [Friesian] section * Fix list indent problem and other small fixes for [PPML] section * Fix list indent problem for developer guide * Fix list indent problem for [Cluster Serving] section * fix dllib links * Fix wrong relative link in section landing page Co-authored-by: Yuwen Hu <yuwen.hu@intel.com> Co-authored-by: Juntao Luo <1072087358@qq.com>
		
			
				
	
	
		
			289 lines
		
	
	
	
		
			8.6 KiB
		
	
	
	
		
			ReStructuredText
		
	
	
	
	
	
			
		
		
	
	
			289 lines
		
	
	
	
		
			8.6 KiB
		
	
	
	
		
			ReStructuredText
		
	
	
	
	
	
Chronos Quick Tour
 | 
						|
=================================
 | 
						|
Welcome to Chronos for building a fast, accurate and scalable time series analysis application🎉! Start with our quick tour to understand some critical concepts and how to use them to tackle your tasks.
 | 
						|
 | 
						|
.. grid:: 1 1 1 1
 | 
						|
 | 
						|
    .. grid-item-card::
 | 
						|
        :text-align: center
 | 
						|
 | 
						|
        **Data processing**
 | 
						|
        ^^^
 | 
						|
        Time series data processing includes imputing, deduplicating, resampling, scale/unscale, roll sampling, etc to process raw time series data(typically in a table) to a format that is understandable to the models. ``TSDataset`` and ``XShardsTSDataset`` are provided for an abstraction.
 | 
						|
        +++
 | 
						|
        .. button-ref:: TSDataset/XShardsTSDataset
 | 
						|
            :color: primary
 | 
						|
            :expand:
 | 
						|
            :outline:
 | 
						|
 | 
						|
            Get Started
 | 
						|
 | 
						|
.. grid:: 1 3 3 3
 | 
						|
    :gutter: 2
 | 
						|
 | 
						|
    .. grid-item-card::
 | 
						|
        :text-align: center
 | 
						|
        :class-card: sd-mb-2
 | 
						|
 | 
						|
        **Forecasting**
 | 
						|
        ^^^
 | 
						|
        Time series forecasting uses history data to predict future data. ``Forecaster`` and ``AutoTSEstimator`` are provided for built-in algorithms and distributed hyperparameter tunning.
 | 
						|
        +++
 | 
						|
        .. button-ref:: Forecaster
 | 
						|
            :color: primary
 | 
						|
            :expand:
 | 
						|
            :outline:
 | 
						|
 | 
						|
            Get Started
 | 
						|
 | 
						|
    .. grid-item-card::
 | 
						|
        :text-align: center
 | 
						|
        :class-card: sd-mb-2
 | 
						|
 | 
						|
        **Anomaly Detection**
 | 
						|
        ^^^
 | 
						|
        Time series anomaly detection finds the anomaly point in time series. ``Detector`` is provided for many built-in algorithms.
 | 
						|
        +++
 | 
						|
        .. button-ref:: Detector
 | 
						|
            :color: primary
 | 
						|
            :expand:
 | 
						|
            :outline:
 | 
						|
 | 
						|
            Get Started
 | 
						|
 | 
						|
    .. grid-item-card::
 | 
						|
        :text-align: center
 | 
						|
        :class-card: sd-mb-2
 | 
						|
 | 
						|
        **Simulation**
 | 
						|
        ^^^
 | 
						|
        Time series simulation generates synthetic time series data. ``Simulator`` is provided for many built-in algorithms.
 | 
						|
        +++
 | 
						|
        .. button-ref:: Simulator(experimental)
 | 
						|
            :color: primary
 | 
						|
            :expand:
 | 
						|
            :outline:
 | 
						|
 | 
						|
            Get Started
 | 
						|
 | 
						|
 | 
						|
TSDataset/XShardsTSDataset
 | 
						|
---------------------
 | 
						|
 | 
						|
In Chronos, we provide a ``TSDataset`` (and a ``XShardsTSDataset`` to handle large data input in distributed fashion) abstraction to represent a time series dataset. It is responsible for preprocessing raw time series data(typically in a table) to a format that is understandable to the models. Many typical transformation, preprocessing and feature engineering method can be called cascadely on ``TSDataset`` or ``XShardsTSDataset``.
 | 
						|
 | 
						|
.. code-block:: python
 | 
						|
 | 
						|
    # !wget https://raw.githubusercontent.com/numenta/NAB/v1.0/data/realKnownCause/nyc_taxi.csv
 | 
						|
    import pandas as pd
 | 
						|
    from sklearn.preprocessing import StandardScaler
 | 
						|
    from bigdl.chronos.data import TSDataset
 | 
						|
 | 
						|
    df = pd.read_csv("nyc_taxi.csv", parse_dates=["timestamp"])
 | 
						|
    tsdata = TSDataset.from_pandas(df,
 | 
						|
                                dt_col="timestamp",
 | 
						|
                                target_col="value")
 | 
						|
    scaler = StandardScaler()
 | 
						|
    tsdata.deduplicate()\
 | 
						|
        .impute()\
 | 
						|
        .gen_dt_feature()\
 | 
						|
        .scale(scaler)\
 | 
						|
        .roll(lookback=100, horizon=1)
 | 
						|
 | 
						|
 | 
						|
.. grid:: 2
 | 
						|
    :gutter: 2
 | 
						|
 | 
						|
    .. grid-item-card::
 | 
						|
 | 
						|
        .. button-ref:: ./data_processing_feature_engineering
 | 
						|
            :color: primary
 | 
						|
            :expand:
 | 
						|
            :outline:
 | 
						|
 | 
						|
            Tutorial
 | 
						|
 | 
						|
    .. grid-item-card::
 | 
						|
 | 
						|
        .. button-ref:: ../../PythonAPI/Chronos/tsdataset
 | 
						|
            :color: primary
 | 
						|
            :expand:
 | 
						|
            :outline:
 | 
						|
 | 
						|
            API Document
 | 
						|
 | 
						|
Forecaster
 | 
						|
-----------------------
 | 
						|
We have implemented quite a few algorithms among traditional statistics to deep learning for time series forecasting in ``bigdl.chronos.forecaster`` package. Users may train these forecasters on history time series and use them to predict future time series.
 | 
						|
 | 
						|
To import a specific forecaster, you may use {algorithm name} + "Forecaster", and call ``fit`` to train the forecaster and ``predict`` to predict future data.
 | 
						|
 | 
						|
.. code-block:: python
 | 
						|
 | 
						|
    from bigdl.chronos.forecaster import TCNForecaster  # TCN is algorithm name
 | 
						|
    from bigdl.chronos.data import get_public_dataset
 | 
						|
 | 
						|
    if __name__ == "__main__":
 | 
						|
        # use nyc_taxi public dataset
 | 
						|
        train_data, _, test_data = get_public_dataset("nyc_taxi")
 | 
						|
        for data in [train_data, test_data]:
 | 
						|
            # use 100 data point in history to predict 1 data point in future
 | 
						|
            data.roll(lookback=100, horizon=1)
 | 
						|
 | 
						|
        # create a forecaster
 | 
						|
        forecaster = TCNForecaster.from_tsdataset(train_data)
 | 
						|
 | 
						|
        # train the forecaster
 | 
						|
        forecaster.fit(train_data)
 | 
						|
 | 
						|
        # predict with the trained forecaster
 | 
						|
        pred = forecaster.predict(test_data)
 | 
						|
 | 
						|
 | 
						|
AutoTSEstimator
 | 
						|
---------------------------
 | 
						|
For time series forecasting, we also provide an ``AutoTSEstimator`` for distributed hyperparameter tunning as an extention to ``Forecaster``. Users only need to create a ``AutoTSEstimator`` and call ``fit`` to train the estimator. A ``TSPipeline`` will be returned for users to predict future data.
 | 
						|
 | 
						|
.. code-block:: python
 | 
						|
 | 
						|
    from bigdl.orca.automl import hp
 | 
						|
    from bigdl.chronos.data import get_public_dataset
 | 
						|
    from bigdl.chronos.autots import AutoTSEstimator
 | 
						|
    from bigdl.orca import init_orca_context, stop_orca_context
 | 
						|
    from sklearn.preprocessing import StandardScaler
 | 
						|
 | 
						|
    if __name__ == "__main__":
 | 
						|
        # initial orca context
 | 
						|
        init_orca_context(cluster_mode="local", cores=4, memory="8g", init_ray_on_spark=True)
 | 
						|
 | 
						|
        # load dataset
 | 
						|
        tsdata_train, tsdata_val, tsdata_test = get_public_dataset(name='nyc_taxi')
 | 
						|
 | 
						|
        # dataset preprocessing
 | 
						|
        stand = StandardScaler()
 | 
						|
        for tsdata in [tsdata_train, tsdata_val, tsdata_test]:
 | 
						|
            tsdata.gen_dt_feature().impute()\
 | 
						|
                .scale(stand, fit=tsdata is tsdata_train)
 | 
						|
 | 
						|
        # AutoTSEstimator initalization
 | 
						|
        autotsest = AutoTSEstimator(model="tcn",
 | 
						|
                                    future_seq_len=10)
 | 
						|
 | 
						|
        # AutoTSEstimator fitting
 | 
						|
        tsppl = autotsest.fit(data=tsdata_train,
 | 
						|
                            validation_data=tsdata_val)
 | 
						|
 | 
						|
        # Prediction
 | 
						|
        pred = tsppl.predict(tsdata_test)
 | 
						|
 | 
						|
        # stop orca context
 | 
						|
        stop_orca_context()
 | 
						|
 | 
						|
.. grid:: 3
 | 
						|
    :gutter: 2
 | 
						|
 | 
						|
    .. grid-item-card::
 | 
						|
 | 
						|
        .. button-ref:: ../QuickStart/chronos-tsdataset-forecaster-quickstart
 | 
						|
            :color: primary
 | 
						|
            :expand:
 | 
						|
            :outline:
 | 
						|
 | 
						|
            Quick Start
 | 
						|
 | 
						|
    .. grid-item-card::
 | 
						|
 | 
						|
        .. button-ref:: ./forecasting
 | 
						|
            :color: primary
 | 
						|
            :expand:
 | 
						|
            :outline:
 | 
						|
 | 
						|
            Tutorial
 | 
						|
 | 
						|
    .. grid-item-card::
 | 
						|
 | 
						|
        .. button-ref:: ../../PythonAPI/Chronos/forecasters
 | 
						|
            :color: primary
 | 
						|
            :expand:
 | 
						|
            :outline:
 | 
						|
 | 
						|
            API Document
 | 
						|
 | 
						|
Detector
 | 
						|
--------------------
 | 
						|
We have implemented quite a few algorithms among traditional statistics to deep learning for time series anomaly detection in ``bigdl.chronos.detector.anomaly`` package.
 | 
						|
 | 
						|
To import a specific detector, you may use {algorithm name} + "Detector", and call ``fit`` to train the detector and ``anomaly_indexes`` to get anomaly data points' indexs.
 | 
						|
 | 
						|
.. code-block:: python
 | 
						|
 | 
						|
    from bigdl.chronos.detector.anomaly import DBScanDetector  # DBScan is algorithm name
 | 
						|
    from bigdl.chronos.data import get_public_dataset
 | 
						|
 | 
						|
    if __name__ == "__main__":
 | 
						|
        # use nyc_taxi public dataset
 | 
						|
        train_data = get_public_dataset("nyc_taxi", with_split=False)
 | 
						|
 | 
						|
        # create a detector
 | 
						|
        detector = DBScanDetector()
 | 
						|
 | 
						|
        # fit a detector
 | 
						|
        detector.fit(train_data.to_pandas()['value'].to_numpy())
 | 
						|
 | 
						|
        # find the anomaly points
 | 
						|
        anomaly_indexes = detector.anomaly_indexes()
 | 
						|
 | 
						|
.. grid:: 3
 | 
						|
    :gutter: 2
 | 
						|
 | 
						|
    .. grid-item-card::
 | 
						|
 | 
						|
        .. button-ref:: ../QuickStart/chronos-anomaly-detector
 | 
						|
            :color: primary
 | 
						|
            :expand:
 | 
						|
            :outline:
 | 
						|
 | 
						|
            Quick Start
 | 
						|
 | 
						|
    .. grid-item-card::
 | 
						|
 | 
						|
        .. button-ref:: ./anomaly_detection
 | 
						|
            :color: primary
 | 
						|
            :expand:
 | 
						|
            :outline:
 | 
						|
 | 
						|
            Tutorial
 | 
						|
 | 
						|
    .. grid-item-card::
 | 
						|
 | 
						|
        .. button-ref:: ../../PythonAPI/Chronos/anomaly_detectors
 | 
						|
            :color: primary
 | 
						|
            :expand:
 | 
						|
            :outline:
 | 
						|
 | 
						|
            API Document
 | 
						|
 | 
						|
Simulator(experimental)
 | 
						|
---------------------
 | 
						|
Simulator is still under activate development with unstable API.
 | 
						|
 | 
						|
.. grid:: 2
 | 
						|
    :gutter: 2
 | 
						|
 | 
						|
    .. grid-item-card::
 | 
						|
 | 
						|
        .. button-ref:: ./simulation
 | 
						|
            :color: primary
 | 
						|
            :expand:
 | 
						|
            :outline:
 | 
						|
 | 
						|
            Tutorial
 | 
						|
 | 
						|
    .. grid-item-card::
 | 
						|
 | 
						|
        .. button-ref:: ../../PythonAPI/Chronos/simulator
 | 
						|
            :color: primary
 | 
						|
            :expand:
 | 
						|
            :outline:
 | 
						|
 | 
						|
            API Document
 |