teradataml 20.0.0.1__py3-none-any.whl → 20.0.0.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of teradataml might be problematic. Click here for more details.
- teradataml/LICENSE-3RD-PARTY.pdf +0 -0
- teradataml/LICENSE.pdf +0 -0
- teradataml/README.md +306 -0
- teradataml/__init__.py +10 -3
- teradataml/_version.py +1 -1
- teradataml/analytics/__init__.py +3 -2
- teradataml/analytics/analytic_function_executor.py +299 -16
- teradataml/analytics/analytic_query_generator.py +92 -0
- teradataml/analytics/byom/__init__.py +3 -2
- teradataml/analytics/json_parser/metadata.py +13 -3
- teradataml/analytics/json_parser/utils.py +13 -6
- teradataml/analytics/meta_class.py +40 -1
- teradataml/analytics/sqle/DecisionTreePredict.py +1 -1
- teradataml/analytics/sqle/__init__.py +11 -2
- teradataml/analytics/table_operator/__init__.py +4 -3
- teradataml/analytics/uaf/__init__.py +21 -2
- teradataml/analytics/utils.py +66 -1
- teradataml/analytics/valib.py +1 -1
- teradataml/automl/__init__.py +1502 -323
- teradataml/automl/custom_json_utils.py +139 -61
- teradataml/automl/data_preparation.py +247 -307
- teradataml/automl/data_transformation.py +32 -12
- teradataml/automl/feature_engineering.py +325 -86
- teradataml/automl/model_evaluation.py +44 -35
- teradataml/automl/model_training.py +122 -153
- teradataml/catalog/byom.py +8 -8
- teradataml/clients/pkce_client.py +1 -1
- teradataml/common/__init__.py +2 -1
- teradataml/common/constants.py +72 -0
- teradataml/common/deprecations.py +13 -7
- teradataml/common/garbagecollector.py +152 -120
- teradataml/common/messagecodes.py +11 -2
- teradataml/common/messages.py +4 -1
- teradataml/common/sqlbundle.py +26 -4
- teradataml/common/utils.py +225 -14
- teradataml/common/wrapper_utils.py +1 -1
- teradataml/context/context.py +82 -2
- teradataml/data/SQL_Fundamentals.pdf +0 -0
- teradataml/data/complaints_test_tokenized.csv +353 -0
- teradataml/data/complaints_tokens_model.csv +348 -0
- teradataml/data/covid_confirm_sd.csv +83 -0
- teradataml/data/dataframe_example.json +27 -1
- teradataml/data/docs/sqle/docs_17_20/CFilter.py +132 -0
- teradataml/data/docs/sqle/docs_17_20/NaiveBayes.py +162 -0
- teradataml/data/docs/sqle/docs_17_20/OutlierFilterFit.py +2 -0
- teradataml/data/docs/sqle/docs_17_20/Pivoting.py +279 -0
- teradataml/data/docs/sqle/docs_17_20/Shap.py +203 -0
- teradataml/data/docs/sqle/docs_17_20/TDNaiveBayesPredict.py +189 -0
- teradataml/data/docs/sqle/docs_17_20/TFIDF.py +142 -0
- teradataml/data/docs/sqle/docs_17_20/TextParser.py +3 -3
- teradataml/data/docs/sqle/docs_17_20/Unpivoting.py +216 -0
- teradataml/data/docs/tableoperator/docs_17_20/Image2Matrix.py +118 -0
- teradataml/data/docs/uaf/docs_17_20/ACF.py +1 -10
- teradataml/data/docs/uaf/docs_17_20/ArimaEstimate.py +1 -1
- teradataml/data/docs/uaf/docs_17_20/ArimaForecast.py +35 -5
- teradataml/data/docs/uaf/docs_17_20/ArimaValidate.py +3 -1
- teradataml/data/docs/uaf/docs_17_20/ArimaXEstimate.py +293 -0
- teradataml/data/docs/uaf/docs_17_20/AutoArima.py +354 -0
- teradataml/data/docs/uaf/docs_17_20/BreuschGodfrey.py +3 -2
- teradataml/data/docs/uaf/docs_17_20/BreuschPaganGodfrey.py +1 -1
- teradataml/data/docs/uaf/docs_17_20/Convolve.py +13 -10
- teradataml/data/docs/uaf/docs_17_20/Convolve2.py +4 -1
- teradataml/data/docs/uaf/docs_17_20/CopyArt.py +145 -0
- teradataml/data/docs/uaf/docs_17_20/CumulPeriodogram.py +5 -4
- teradataml/data/docs/uaf/docs_17_20/DFFT2Conv.py +4 -4
- teradataml/data/docs/uaf/docs_17_20/DWT.py +235 -0
- teradataml/data/docs/uaf/docs_17_20/DWT2D.py +214 -0
- teradataml/data/docs/uaf/docs_17_20/DickeyFuller.py +18 -21
- teradataml/data/docs/uaf/docs_17_20/DurbinWatson.py +1 -1
- teradataml/data/docs/uaf/docs_17_20/ExtractResults.py +1 -1
- teradataml/data/docs/uaf/docs_17_20/FilterFactory1d.py +160 -0
- teradataml/data/docs/uaf/docs_17_20/GenseriesSinusoids.py +1 -1
- teradataml/data/docs/uaf/docs_17_20/GoldfeldQuandt.py +9 -31
- teradataml/data/docs/uaf/docs_17_20/HoltWintersForecaster.py +4 -2
- teradataml/data/docs/uaf/docs_17_20/IDFFT2.py +1 -8
- teradataml/data/docs/uaf/docs_17_20/IDWT.py +236 -0
- teradataml/data/docs/uaf/docs_17_20/IDWT2D.py +226 -0
- teradataml/data/docs/uaf/docs_17_20/IQR.py +134 -0
- teradataml/data/docs/uaf/docs_17_20/LineSpec.py +1 -1
- teradataml/data/docs/uaf/docs_17_20/LinearRegr.py +2 -2
- teradataml/data/docs/uaf/docs_17_20/MAMean.py +3 -3
- teradataml/data/docs/uaf/docs_17_20/Matrix2Image.py +297 -0
- teradataml/data/docs/uaf/docs_17_20/MatrixMultiply.py +15 -6
- teradataml/data/docs/uaf/docs_17_20/PACF.py +0 -1
- teradataml/data/docs/uaf/docs_17_20/Portman.py +2 -2
- teradataml/data/docs/uaf/docs_17_20/PowerSpec.py +2 -2
- teradataml/data/docs/uaf/docs_17_20/Resample.py +9 -1
- teradataml/data/docs/uaf/docs_17_20/SAX.py +246 -0
- teradataml/data/docs/uaf/docs_17_20/SeasonalNormalize.py +17 -10
- teradataml/data/docs/uaf/docs_17_20/SignifPeriodicities.py +1 -1
- teradataml/data/docs/uaf/docs_17_20/WhitesGeneral.py +3 -1
- teradataml/data/docs/uaf/docs_17_20/WindowDFFT.py +368 -0
- teradataml/data/dwt2d_dataTable.csv +65 -0
- teradataml/data/dwt_dataTable.csv +8 -0
- teradataml/data/dwt_filterTable.csv +3 -0
- teradataml/data/finance_data4.csv +13 -0
- teradataml/data/grocery_transaction.csv +19 -0
- teradataml/data/idwt2d_dataTable.csv +5 -0
- teradataml/data/idwt_dataTable.csv +8 -0
- teradataml/data/idwt_filterTable.csv +3 -0
- teradataml/data/interval_data.csv +5 -0
- teradataml/data/jsons/paired_functions.json +14 -0
- teradataml/data/jsons/sqle/17.20/TD_CFilter.json +118 -0
- teradataml/data/jsons/sqle/17.20/TD_NaiveBayes.json +193 -0
- teradataml/data/jsons/sqle/17.20/TD_NaiveBayesPredict.json +212 -0
- teradataml/data/jsons/sqle/17.20/TD_OneClassSVM.json +9 -9
- teradataml/data/jsons/sqle/17.20/TD_Pivoting.json +280 -0
- teradataml/data/jsons/sqle/17.20/TD_Shap.json +222 -0
- teradataml/data/jsons/sqle/17.20/TD_TFIDF.json +162 -0
- teradataml/data/jsons/sqle/17.20/TD_TextParser.json +1 -1
- teradataml/data/jsons/sqle/17.20/TD_Unpivoting.json +235 -0
- teradataml/data/jsons/sqle/20.00/TD_KMeans.json +250 -0
- teradataml/data/jsons/sqle/20.00/TD_SMOTE.json +266 -0
- teradataml/data/jsons/sqle/20.00/TD_VectorDistance.json +278 -0
- teradataml/data/jsons/storedprocedure/17.20/TD_COPYART.json +71 -0
- teradataml/data/jsons/storedprocedure/17.20/TD_FILTERFACTORY1D.json +150 -0
- teradataml/data/jsons/tableoperator/17.20/IMAGE2MATRIX.json +53 -0
- teradataml/data/jsons/uaf/17.20/TD_ACF.json +1 -18
- teradataml/data/jsons/uaf/17.20/TD_ARIMAESTIMATE.json +3 -16
- teradataml/data/jsons/uaf/17.20/TD_ARIMAFORECAST.json +0 -3
- teradataml/data/jsons/uaf/17.20/TD_ARIMAVALIDATE.json +5 -3
- teradataml/data/jsons/uaf/17.20/TD_ARIMAXESTIMATE.json +362 -0
- teradataml/data/jsons/uaf/17.20/TD_AUTOARIMA.json +469 -0
- teradataml/data/jsons/uaf/17.20/TD_BINARYMATRIXOP.json +0 -3
- teradataml/data/jsons/uaf/17.20/TD_BINARYSERIESOP.json +0 -2
- teradataml/data/jsons/uaf/17.20/TD_BREUSCH_GODFREY.json +2 -1
- teradataml/data/jsons/uaf/17.20/TD_BREUSCH_PAGAN_GODFREY.json +2 -5
- teradataml/data/jsons/uaf/17.20/TD_CONVOLVE.json +3 -6
- teradataml/data/jsons/uaf/17.20/TD_CONVOLVE2.json +1 -3
- teradataml/data/jsons/uaf/17.20/TD_CUMUL_PERIODOGRAM.json +0 -5
- teradataml/data/jsons/uaf/17.20/TD_DFFT.json +1 -4
- teradataml/data/jsons/uaf/17.20/TD_DFFT2.json +2 -7
- teradataml/data/jsons/uaf/17.20/TD_DFFT2CONV.json +1 -2
- teradataml/data/jsons/uaf/17.20/TD_DFFTCONV.json +0 -2
- teradataml/data/jsons/uaf/17.20/TD_DICKEY_FULLER.json +10 -19
- teradataml/data/jsons/uaf/17.20/TD_DTW.json +3 -6
- teradataml/data/jsons/uaf/17.20/TD_DWT.json +173 -0
- teradataml/data/jsons/uaf/17.20/TD_DWT2D.json +160 -0
- teradataml/data/jsons/uaf/17.20/TD_FITMETRICS.json +1 -1
- teradataml/data/jsons/uaf/17.20/TD_GOLDFELD_QUANDT.json +16 -30
- teradataml/data/jsons/uaf/17.20/{TD_HOLT_WINTERS_FORECAST.json → TD_HOLT_WINTERS_FORECASTER.json} +1 -2
- teradataml/data/jsons/uaf/17.20/TD_IDFFT2.json +1 -15
- teradataml/data/jsons/uaf/17.20/TD_IDWT.json +162 -0
- teradataml/data/jsons/uaf/17.20/TD_IDWT2D.json +149 -0
- teradataml/data/jsons/uaf/17.20/TD_IQR.json +117 -0
- teradataml/data/jsons/uaf/17.20/TD_LINEAR_REGR.json +1 -1
- teradataml/data/jsons/uaf/17.20/TD_LINESPEC.json +1 -1
- teradataml/data/jsons/uaf/17.20/TD_MAMEAN.json +1 -3
- teradataml/data/jsons/uaf/17.20/TD_MATRIX2IMAGE.json +209 -0
- teradataml/data/jsons/uaf/17.20/TD_PACF.json +2 -2
- teradataml/data/jsons/uaf/17.20/TD_POWERSPEC.json +5 -5
- teradataml/data/jsons/uaf/17.20/TD_RESAMPLE.json +48 -28
- teradataml/data/jsons/uaf/17.20/TD_SAX.json +210 -0
- teradataml/data/jsons/uaf/17.20/TD_SEASONALNORMALIZE.json +12 -6
- teradataml/data/jsons/uaf/17.20/TD_SIMPLEEXP.json +0 -1
- teradataml/data/jsons/uaf/17.20/TD_TRACKINGOP.json +8 -8
- teradataml/data/jsons/uaf/17.20/TD_UNDIFF.json +1 -1
- teradataml/data/jsons/uaf/17.20/TD_UNNORMALIZE.json +1 -1
- teradataml/data/jsons/uaf/17.20/TD_WINDOWDFFT.json +410 -0
- teradataml/data/load_example_data.py +8 -2
- teradataml/data/medical_readings.csv +101 -0
- teradataml/data/naivebayestextclassifier_example.json +1 -1
- teradataml/data/naivebayestextclassifierpredict_example.json +11 -0
- teradataml/data/patient_profile.csv +101 -0
- teradataml/data/peppers.png +0 -0
- teradataml/data/real_values.csv +14 -0
- teradataml/data/sax_example.json +8 -0
- teradataml/data/scripts/deploy_script.py +1 -1
- teradataml/data/scripts/lightgbm/dataset.template +157 -0
- teradataml/data/scripts/lightgbm/lightgbm_class_functions.template +247 -0
- teradataml/data/scripts/lightgbm/lightgbm_function.template +216 -0
- teradataml/data/scripts/lightgbm/lightgbm_sklearn.template +159 -0
- teradataml/data/scripts/sklearn/sklearn_fit.py +194 -160
- teradataml/data/scripts/sklearn/sklearn_fit_predict.py +136 -115
- teradataml/data/scripts/sklearn/sklearn_function.template +34 -16
- teradataml/data/scripts/sklearn/sklearn_model_selection_split.py +155 -137
- teradataml/data/scripts/sklearn/sklearn_neighbors.py +1 -1
- teradataml/data/scripts/sklearn/sklearn_score.py +12 -3
- teradataml/data/scripts/sklearn/sklearn_transform.py +162 -24
- teradataml/data/star_pivot.csv +8 -0
- teradataml/data/target_udt_data.csv +8 -0
- teradataml/data/templates/open_source_ml.json +3 -1
- teradataml/data/teradataml_example.json +20 -1
- teradataml/data/timestamp_data.csv +4 -0
- teradataml/data/titanic_dataset_unpivoted.csv +19 -0
- teradataml/data/uaf_example.json +55 -1
- teradataml/data/unpivot_example.json +15 -0
- teradataml/data/url_data.csv +9 -0
- teradataml/data/vectordistance_example.json +4 -0
- teradataml/data/windowdfft.csv +16 -0
- teradataml/dataframe/copy_to.py +1 -1
- teradataml/dataframe/data_transfer.py +5 -3
- teradataml/dataframe/dataframe.py +1002 -201
- teradataml/dataframe/fastload.py +3 -3
- teradataml/dataframe/functions.py +867 -0
- teradataml/dataframe/row.py +160 -0
- teradataml/dataframe/setop.py +2 -2
- teradataml/dataframe/sql.py +840 -33
- teradataml/dataframe/window.py +1 -1
- teradataml/dbutils/dbutils.py +878 -34
- teradataml/dbutils/filemgr.py +48 -1
- teradataml/geospatial/geodataframe.py +1 -1
- teradataml/geospatial/geodataframecolumn.py +1 -1
- teradataml/hyperparameter_tuner/optimizer.py +13 -13
- teradataml/lib/aed_0_1.dll +0 -0
- teradataml/opensource/__init__.py +1 -1
- teradataml/opensource/{sklearn/_class.py → _class.py} +102 -17
- teradataml/opensource/_lightgbm.py +950 -0
- teradataml/opensource/{sklearn/_wrapper_utils.py → _wrapper_utils.py} +1 -2
- teradataml/opensource/{sklearn/constants.py → constants.py} +13 -10
- teradataml/opensource/sklearn/__init__.py +0 -1
- teradataml/opensource/sklearn/_sklearn_wrapper.py +1019 -574
- teradataml/options/__init__.py +9 -23
- teradataml/options/configure.py +42 -4
- teradataml/options/display.py +2 -2
- teradataml/plot/axis.py +4 -4
- teradataml/scriptmgmt/UserEnv.py +13 -9
- teradataml/scriptmgmt/lls_utils.py +77 -23
- teradataml/store/__init__.py +13 -0
- teradataml/store/feature_store/__init__.py +0 -0
- teradataml/store/feature_store/constants.py +291 -0
- teradataml/store/feature_store/feature_store.py +2223 -0
- teradataml/store/feature_store/models.py +1505 -0
- teradataml/store/vector_store/__init__.py +1586 -0
- teradataml/table_operators/Script.py +2 -2
- teradataml/table_operators/TableOperator.py +106 -20
- teradataml/table_operators/query_generator.py +3 -0
- teradataml/table_operators/table_operator_query_generator.py +3 -1
- teradataml/table_operators/table_operator_util.py +102 -56
- teradataml/table_operators/templates/dataframe_register.template +69 -0
- teradataml/table_operators/templates/dataframe_udf.template +63 -0
- teradataml/telemetry_utils/__init__.py +0 -0
- teradataml/telemetry_utils/queryband.py +52 -0
- teradataml/utils/dtypes.py +4 -2
- teradataml/utils/validators.py +34 -2
- {teradataml-20.0.0.1.dist-info → teradataml-20.0.0.3.dist-info}/METADATA +311 -3
- {teradataml-20.0.0.1.dist-info → teradataml-20.0.0.3.dist-info}/RECORD +240 -157
- {teradataml-20.0.0.1.dist-info → teradataml-20.0.0.3.dist-info}/WHEEL +0 -0
- {teradataml-20.0.0.1.dist-info → teradataml-20.0.0.3.dist-info}/top_level.txt +0 -0
- {teradataml-20.0.0.1.dist-info → teradataml-20.0.0.3.dist-info}/zip-safe +0 -0
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
def Matrix2Image(data=None, data_filter_expr=None, image="PNG", type=None,
|
|
2
|
+
colormap="viridis", range=None, red=None, green=None,
|
|
3
|
+
blue=None, flip_x=False, flip_y=False,
|
|
4
|
+
input_fmt_input_mode=None,
|
|
5
|
+
output_fmt_index_style="NUMERICAL_SEQUENCE",
|
|
6
|
+
**generic_arguments):
|
|
7
|
+
"""
|
|
8
|
+
DESCRIPTION:
|
|
9
|
+
Matrix2Image() function converts a matrix to an image.
|
|
10
|
+
The conversion produces an image using color maps.
|
|
11
|
+
The color image produced by Matrix2Image() is limited to
|
|
12
|
+
8-bit color depth.
|
|
13
|
+
In previous versions, Plot() with MESH option was used to
|
|
14
|
+
convert a matrix to an image. Plot() is limited to a
|
|
15
|
+
single payload.
|
|
16
|
+
Matrix2Image() can combine three payloads to create RGB
|
|
17
|
+
color images.
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
PARAMETERS:
|
|
21
|
+
data:
|
|
22
|
+
Required Argument.
|
|
23
|
+
Specifies the input matrix.
|
|
24
|
+
Multiple payloads are supported, and each
|
|
25
|
+
payload column is transformed independently.
|
|
26
|
+
Only REAL or MULTIVAR_REAL payload content types are supported.
|
|
27
|
+
Types: TDMatrix
|
|
28
|
+
|
|
29
|
+
data_filter_expr:
|
|
30
|
+
Optional Argument.
|
|
31
|
+
Specifies the filter expression for "data".
|
|
32
|
+
Types: ColumnExpression
|
|
33
|
+
|
|
34
|
+
image:
|
|
35
|
+
Optional Argument.
|
|
36
|
+
Specifies the image output format.
|
|
37
|
+
It can be PNG or JPG.
|
|
38
|
+
Permitted Values: PNG, JPG
|
|
39
|
+
Default Value: PNG
|
|
40
|
+
Types: str
|
|
41
|
+
|
|
42
|
+
type:
|
|
43
|
+
Optional Argument.
|
|
44
|
+
Specifies the type of the image. It can be GRAY, RGB
|
|
45
|
+
or COLORMAP.
|
|
46
|
+
* GRAY has a single payload, the output
|
|
47
|
+
image is a gray scale image.
|
|
48
|
+
* RGB has three payloads corresponding to RED, GREEN and BLUE channels,
|
|
49
|
+
the output image is a RGB color image.
|
|
50
|
+
* COLORMAP has a single payload. The output image is a RGB color image.
|
|
51
|
+
Note:
|
|
52
|
+
If there is a single payload, then the default
|
|
53
|
+
type is GRAY. If there are three payloads, then the
|
|
54
|
+
default type is RGB.
|
|
55
|
+
Permitted Values: GRAY, RGB, COLORMAP
|
|
56
|
+
Types: str
|
|
57
|
+
|
|
58
|
+
colormap:
|
|
59
|
+
Optional Argument.
|
|
60
|
+
Specifies the colormap to use when the "type" is
|
|
61
|
+
COLORMAP. The values correspond to the colormap of
|
|
62
|
+
Plot(). If not specified, then the default colormap is
|
|
63
|
+
"viridis". The value is case-sensitive.
|
|
64
|
+
Default Value: viridis
|
|
65
|
+
Types: str
|
|
66
|
+
|
|
67
|
+
range:
|
|
68
|
+
Optional Argument.
|
|
69
|
+
Specifies the range of the single payload value to be
|
|
70
|
+
scaled. By default, the MIN and MAX values of the
|
|
71
|
+
payload are used as the range. Used when "type" is 'GRAY'
|
|
72
|
+
or 'COLORMAP'.
|
|
73
|
+
Types: float, list of float
|
|
74
|
+
|
|
75
|
+
red:
|
|
76
|
+
Optional Argument.
|
|
77
|
+
Specifies the range of the first payload value. By
|
|
78
|
+
default, the MIN and MAX values of the payload are
|
|
79
|
+
used as the range. It is only used when "type" is 'RGB'.
|
|
80
|
+
Types: float, list of float
|
|
81
|
+
|
|
82
|
+
green:
|
|
83
|
+
Optional Argument.
|
|
84
|
+
Specifies the range of the second payload value.By
|
|
85
|
+
default, the MIN and MAX values of the payload are
|
|
86
|
+
used as the range. It is only used when "type" is 'RGB'.
|
|
87
|
+
Types: float, list of float
|
|
88
|
+
|
|
89
|
+
blue:
|
|
90
|
+
Optional Argument.
|
|
91
|
+
Specifies the range of the third payload value. By
|
|
92
|
+
default, the MIN and MAX values of the payload are
|
|
93
|
+
used as the range. It is only used when "type" is 'RGB'.
|
|
94
|
+
Types: float, list of float
|
|
95
|
+
|
|
96
|
+
flip_x:
|
|
97
|
+
Optional Argument.
|
|
98
|
+
Specifies the indicator to flip the image horizontally.
|
|
99
|
+
When set to True, flip the image otherwise, do not
|
|
100
|
+
flip the image.
|
|
101
|
+
Default Value: False
|
|
102
|
+
Types: bool
|
|
103
|
+
|
|
104
|
+
flip_y:
|
|
105
|
+
Optional Argument.
|
|
106
|
+
Specifies the indicator to flip the image vertically.
|
|
107
|
+
When set to True, flip the image otherwise,
|
|
108
|
+
do not flip the image.
|
|
109
|
+
Default Value: False
|
|
110
|
+
Types: bool
|
|
111
|
+
|
|
112
|
+
input_fmt_input_mode:
|
|
113
|
+
Optional Argument.
|
|
114
|
+
Specifies the input mode supported by the function.
|
|
115
|
+
When there are two input series, then the "input_fmt_input_mode" .
|
|
116
|
+
specification is mandatory.
|
|
117
|
+
Permitted Values:
|
|
118
|
+
* ONE2ONE: Both the primary and secondary series specifications
|
|
119
|
+
contain a series name which identifies the two series
|
|
120
|
+
in the function.
|
|
121
|
+
* MANY2ONE: The MANY specification is the primary series
|
|
122
|
+
declaration. The secondary series specification
|
|
123
|
+
contains a series name that identifies the single
|
|
124
|
+
secondary series.
|
|
125
|
+
* MATCH: Both series are defined by their respective series
|
|
126
|
+
specification instance name declarations.
|
|
127
|
+
Types: str
|
|
128
|
+
|
|
129
|
+
output_fmt_index_style:
|
|
130
|
+
Optional Argument.
|
|
131
|
+
Specifies the index style of the output format.
|
|
132
|
+
Permitted Values: NUMERICAL_SEQUENCE
|
|
133
|
+
Default Value: NUMERICAL_SEQUENCE
|
|
134
|
+
Types: str
|
|
135
|
+
|
|
136
|
+
**generic_arguments:
|
|
137
|
+
Specifies the generic keyword arguments of UAF functions.
|
|
138
|
+
Below are the generic keyword arguments:
|
|
139
|
+
persist:
|
|
140
|
+
Optional Argument.
|
|
141
|
+
Specifies whether to persist the results of the
|
|
142
|
+
function in a table or not. When set to True,
|
|
143
|
+
results are persisted in a table; otherwise,
|
|
144
|
+
results are garbage collected at the end of the
|
|
145
|
+
session.
|
|
146
|
+
Note that, when UAF function is executed, an
|
|
147
|
+
analytic result table (ART) is created.
|
|
148
|
+
Default Value: False
|
|
149
|
+
Types: bool
|
|
150
|
+
|
|
151
|
+
volatile:
|
|
152
|
+
Optional Argument.
|
|
153
|
+
Specifies whether to put the results of the
|
|
154
|
+
function in a volatile ART or not. When set to
|
|
155
|
+
True, results are stored in a volatile ART,
|
|
156
|
+
otherwise not.
|
|
157
|
+
Default Value: False
|
|
158
|
+
Types: bool
|
|
159
|
+
|
|
160
|
+
output_table_name:
|
|
161
|
+
Optional Argument.
|
|
162
|
+
Specifies the name of the table to store results.
|
|
163
|
+
If not specified, a unique table name is internally
|
|
164
|
+
generated.
|
|
165
|
+
Types: str
|
|
166
|
+
|
|
167
|
+
output_db_name:
|
|
168
|
+
Optional Argument.
|
|
169
|
+
Specifies the name of the database to create output
|
|
170
|
+
table into. If not specified, table is created into
|
|
171
|
+
database specified by the user at the time of context
|
|
172
|
+
creation or configuration parameter. Argument is ignored,
|
|
173
|
+
if "output_table_name" is not specified.
|
|
174
|
+
Types: str
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
RETURNS:
|
|
178
|
+
Instance of Matrix2Image.
|
|
179
|
+
Output teradataml DataFrames can be accessed using attribute
|
|
180
|
+
references, such as Matrix2Image_obj.<attribute_name>.
|
|
181
|
+
Output teradataml DataFrame attribute name is:
|
|
182
|
+
1. result
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
RAISES:
|
|
186
|
+
TeradataMlException, TypeError, ValueError
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
EXAMPLES:
|
|
190
|
+
# Notes:
|
|
191
|
+
# 1. Get the connection to Vantage, before importing the
|
|
192
|
+
# function in user space.
|
|
193
|
+
# 2. User can import the function, if it is available on
|
|
194
|
+
# Vantage user is connected to.
|
|
195
|
+
# 3. To check the list of UAF analytic functions available
|
|
196
|
+
# on Vantage user connected to, use
|
|
197
|
+
# "display_analytic_functions()".
|
|
198
|
+
|
|
199
|
+
# Check the list of available UAF analytic functions.
|
|
200
|
+
display_analytic_functions(type="UAF")
|
|
201
|
+
|
|
202
|
+
# Import function Matrix2Image.
|
|
203
|
+
from teradataml import Matrix2Image
|
|
204
|
+
|
|
205
|
+
# Convert the image to matrix using 'TD_IMAGE2MATRIX' using output as gray.
|
|
206
|
+
import teradataml
|
|
207
|
+
# Drop the image table, matrixTable, matrixTable_rgb if it is present.
|
|
208
|
+
try:
|
|
209
|
+
db_drop_table('imageTable')
|
|
210
|
+
db_drop_table('matrixTable')
|
|
211
|
+
db_drop_table('matrixTable_rgb')
|
|
212
|
+
except:
|
|
213
|
+
pass
|
|
214
|
+
|
|
215
|
+
execute_sql('CREATE TABLE imageTable(id INTEGER, image BLOB);')
|
|
216
|
+
|
|
217
|
+
file_dir = os.path.join(os.path.dirname(teradataml.__file__), "data")
|
|
218
|
+
with open(os.path.join(file_dir,'peppers.png'), mode='rb') as file:
|
|
219
|
+
fileContent = file.read()
|
|
220
|
+
|
|
221
|
+
sql = 'INSERT INTO imageTable VALUES(?, ?);'
|
|
222
|
+
parameters = (1, fileContent)
|
|
223
|
+
execute_sql(sql, parameters)
|
|
224
|
+
|
|
225
|
+
execute_sql("CREATE TABLE matrixTable AS (SELECT * FROM TD_IMAGE2MATRIX ( ON (SELECT id, image FROM imageTable) USING OUTPUT ('gray')) t) WITH DATA PRIMARY INDEX (id, y, x);")
|
|
226
|
+
data = DataFrame('matrixTable')
|
|
227
|
+
|
|
228
|
+
# Create teradataml TDMatrix object.
|
|
229
|
+
data_matrix_df = TDMatrix(data=data,
|
|
230
|
+
id="id",
|
|
231
|
+
row_index="Y",
|
|
232
|
+
column_index="X",
|
|
233
|
+
row_index_style="SEQUENCE",
|
|
234
|
+
column_index_style="SEQUENCE",
|
|
235
|
+
payload_field="GRAY",
|
|
236
|
+
payload_content="REAL"
|
|
237
|
+
)
|
|
238
|
+
|
|
239
|
+
# Example 1: Generate Gray Scale Image Output with Fixed Range.
|
|
240
|
+
uaf_out = Matrix2Image(data=data_matrix_df,
|
|
241
|
+
range=[0,255])
|
|
242
|
+
|
|
243
|
+
# Print the result DataFrame.
|
|
244
|
+
print(uaf_out.result)
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
# Example 2: Generate Gray Scale Image Output with Automatic Range.
|
|
248
|
+
uaf_out = Matrix2Image(data=data_matrix_df)
|
|
249
|
+
|
|
250
|
+
# Print the result DataFrame.
|
|
251
|
+
print(uaf_out.result)
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
# Example 3: Generate Colormap Image Output.
|
|
255
|
+
uaf_out = Matrix2Image(data=data_matrix_df,
|
|
256
|
+
type='colormap',
|
|
257
|
+
colormap='viridis',
|
|
258
|
+
range=[0,255])
|
|
259
|
+
|
|
260
|
+
# Print the result DataFrame.
|
|
261
|
+
print(uaf_out.result)
|
|
262
|
+
|
|
263
|
+
# Convert the image to matrix using 'TD_IMAGE2MATRIX' using output as 'rgb'.
|
|
264
|
+
execute_sql("CREATE TABLE matrixTable_rgb AS (SELECT * FROM TD_IMAGE2MATRIX ( ON (SELECT id, image FROM imageTable) USING OUTPUT ('rgb')) t) WITH DATA PRIMARY INDEX (id, y, x);")
|
|
265
|
+
|
|
266
|
+
# Create teradataml DataFrame object.
|
|
267
|
+
data = DataFrame.from_table("matrixTable_rgb")
|
|
268
|
+
|
|
269
|
+
# Create teradataml TDMatrix object.
|
|
270
|
+
data_matrix_df = TDMatrix(data=data,
|
|
271
|
+
id="id",
|
|
272
|
+
row_index="Y",
|
|
273
|
+
column_index="X",
|
|
274
|
+
row_index_style="SEQUENCE",
|
|
275
|
+
column_index_style="SEQUENCE",
|
|
276
|
+
payload_field=["RED", "BLUE", "GREEN"],
|
|
277
|
+
payload_content="MULTIVAR_REAL"
|
|
278
|
+
)
|
|
279
|
+
|
|
280
|
+
# Example 4: Generate RGB Image Output with All Channels Range Fixed.
|
|
281
|
+
uaf_out = Matrix2Image(data=data_matrix_df,
|
|
282
|
+
red=[0,255],
|
|
283
|
+
green=[0,255],
|
|
284
|
+
blue=[0,255])
|
|
285
|
+
|
|
286
|
+
# Print the result DataFrame.
|
|
287
|
+
print(uaf_out.result)
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
# Example 5: Generate RGB Image Output with Automatic Range for All Channels.
|
|
291
|
+
uaf_out = Matrix2Image(data=data_matrix_df)
|
|
292
|
+
|
|
293
|
+
# Print the result DataFrame.
|
|
294
|
+
print(uaf_out.result)
|
|
295
|
+
|
|
296
|
+
"""
|
|
297
|
+
|
|
@@ -113,13 +113,22 @@ def MatrixMultiply(data1=None, data1_filter_expr=None, data2=None,
|
|
|
113
113
|
df2 = DataFrame.from_table("mtx2")
|
|
114
114
|
|
|
115
115
|
# Create teradataml TDMatrix objects.
|
|
116
|
-
data1_matrix_df = TDMatrix(data=df1,
|
|
117
|
-
|
|
118
|
-
|
|
116
|
+
data1_matrix_df = TDMatrix(data=df1,
|
|
117
|
+
id='buoy_id',
|
|
118
|
+
row_index='row_i',
|
|
119
|
+
column_index='column_i',
|
|
120
|
+
row_index_style="SEQUENCE",
|
|
121
|
+
column_index_style="SEQUENCE",
|
|
122
|
+
payload_field='speed1',
|
|
119
123
|
payload_content='REAL')
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
124
|
+
|
|
125
|
+
data2_matrix_df = TDMatrix(data=df2,
|
|
126
|
+
id='buoy_id',
|
|
127
|
+
row_index='row_i',
|
|
128
|
+
column_index='column_i',
|
|
129
|
+
row_index_style="SEQUENCE",
|
|
130
|
+
column_index_style="SEQUENCE",
|
|
131
|
+
payload_field='speed2',
|
|
123
132
|
payload_content='REAL')
|
|
124
133
|
|
|
125
134
|
# Example 1 : Perform a point-wise mathematical operation against two matrixes
|
|
@@ -146,7 +146,6 @@ def PACF(data=None, data_filter_expr=None,
|
|
|
146
146
|
|
|
147
147
|
# Example 1 : Calculate the partial autocorrelation function coefficients using
|
|
148
148
|
# 'LEVINSON_DURBIN' algorithm, with maximum of 10 lags.
|
|
149
|
-
|
|
150
149
|
PACF_out = PACF(data=data_series_df,
|
|
151
150
|
algorithm='LEVINSON_DURBIN',
|
|
152
151
|
max_lags=10)
|
|
@@ -12,8 +12,8 @@ def Portman(data=None, data_filter_expr=None, max_lags=None, test=None,
|
|
|
12
12
|
The following procedure is an example of how to use Portman() function:
|
|
13
13
|
1. Use ArimaEstimate() function to get residuals from the data set.
|
|
14
14
|
2. Use ArimaValidate() function to validate the output.
|
|
15
|
-
3.
|
|
16
|
-
|
|
15
|
+
3. Use Portman() to check the residuals for zero mean white noise using the
|
|
16
|
+
"fitresiduals" output attribute of ArimaValidate() function.
|
|
17
17
|
|
|
18
18
|
PARAMETERS:
|
|
19
19
|
data:
|
|
@@ -16,7 +16,7 @@ def PowerSpec(data=None, data_filter_expr=None, freq_style=None,
|
|
|
16
16
|
* Use ArimaValidate() to validate spectral candidates.
|
|
17
17
|
* Use PowerSpec() with "freq_style" argument set to 'K_PERIODICITY'
|
|
18
18
|
to perform spectral analysis.
|
|
19
|
-
* Use
|
|
19
|
+
* Use DataFrame.plot() to plot the results.
|
|
20
20
|
* Compute the test statistic.
|
|
21
21
|
* Use SignifPeriodicities() on the periodicities of interest.
|
|
22
22
|
More than one periodicities can be entered using the Periodicities
|
|
@@ -98,7 +98,7 @@ def PowerSpec(data=None, data_filter_expr=None, freq_style=None,
|
|
|
98
98
|
a square wave window, which has a magnitude of '1.0'
|
|
99
99
|
for the whole duration of the window.
|
|
100
100
|
* TUKEY : Apply a Tukey smoothing window with the supplied
|
|
101
|
-
alpha value. Must
|
|
101
|
+
alpha value. Must be used with "window_param".
|
|
102
102
|
* BARTLETT : Apply a Bartlett smoothing window.
|
|
103
103
|
* PARZEN : Apply a Parzen smoothing window.
|
|
104
104
|
* WELCH : Apply a Welch smoothing window.
|
|
@@ -2,7 +2,7 @@ def Resample(data=None, data_filter_expr=None, timecode_start_value=None,
|
|
|
2
2
|
timecode_duration=None, sequence_start_value=None,
|
|
3
3
|
sequence_duration=None, interpolate=None, weight=None,
|
|
4
4
|
spline_params_method="NOT_A_KNOT", spline_params_yp1=0.0,
|
|
5
|
-
spline_params_ypn=0.0, **generic_arguments):
|
|
5
|
+
spline_params_ypn=0.0, output_fmt_index_style='FLOW_THROUGH', **generic_arguments):
|
|
6
6
|
"""
|
|
7
7
|
DESCRIPTION:
|
|
8
8
|
The Resample() function transforms an irregular time series into a
|
|
@@ -83,6 +83,7 @@ def Resample(data=None, data_filter_expr=None, timecode_start_value=None,
|
|
|
83
83
|
Specifies the interpolated weighted value.
|
|
84
84
|
Note:
|
|
85
85
|
* Applicable only when "interpolate" set to 'WEIGHTED'.
|
|
86
|
+
* The interpolated value is calculated as: Y_t = Y_{t_LEFT} * (1 - WEIGHT) + (Y-{t_RIGHT} * WEIGHT).
|
|
86
87
|
Types: float
|
|
87
88
|
|
|
88
89
|
spline_params_method:
|
|
@@ -117,6 +118,13 @@ def Resample(data=None, data_filter_expr=None, timecode_start_value=None,
|
|
|
117
118
|
Default Value: 0.0
|
|
118
119
|
Types: float
|
|
119
120
|
|
|
121
|
+
output_fmt_index_style:
|
|
122
|
+
Optional Argument.
|
|
123
|
+
Specifies the index style of the output format.
|
|
124
|
+
Permitted Values: NUMERICAL_SEQUENCE, FLOW_THROUGH
|
|
125
|
+
Default Value: FLOW_THROUGH
|
|
126
|
+
Types: str
|
|
127
|
+
|
|
120
128
|
**generic_arguments:
|
|
121
129
|
Specifies the generic keyword arguments of UAF functions.
|
|
122
130
|
Below are the generic keyword arguments:
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
def SAX(data=None, data_filter_expr=None, window_type='GLOBAL',
|
|
2
|
+
output_type='STRING', mean=None, std_dev=None,
|
|
3
|
+
window_size=None, output_frequency=1,
|
|
4
|
+
points_per_symbol=1, symbols_per_window=1,
|
|
5
|
+
alphabet_size=4, bitmap_level=2, code_stats=0,
|
|
6
|
+
breakpoints=None,
|
|
7
|
+
output_fmt_index_style="NUMERICAL_SEQUENCE",
|
|
8
|
+
**generic_arguments):
|
|
9
|
+
"""
|
|
10
|
+
DESCRIPTION:
|
|
11
|
+
SAX() function uses Piecewise Aggregate Approximation (PAA) and
|
|
12
|
+
transform a timeseries into sequence of symbols.
|
|
13
|
+
The symbols can be characters, string, and bitmap.
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
PARAMETERS:
|
|
17
|
+
data:
|
|
18
|
+
Required Argument.
|
|
19
|
+
Specifies the time series whose value can be REAL or MULTIVAR_REAL.
|
|
20
|
+
Types: TDSeries
|
|
21
|
+
|
|
22
|
+
data_filter_expr:
|
|
23
|
+
Optional Argument.
|
|
24
|
+
Specifies the filter expression for "data".
|
|
25
|
+
Types: ColumnExpression
|
|
26
|
+
|
|
27
|
+
window_type:
|
|
28
|
+
Optional Argument.
|
|
29
|
+
Specifies the window type used in the SAX transformation.
|
|
30
|
+
Default Value: GLOBAL
|
|
31
|
+
Permitted Values: GLOBAL, SLIDING
|
|
32
|
+
Types: str
|
|
33
|
+
|
|
34
|
+
output_type:
|
|
35
|
+
Optional Argument.
|
|
36
|
+
Specifies the output format of the result.
|
|
37
|
+
Default Value: STRING
|
|
38
|
+
Permitted Values: STRING, BITMAP, O_CHARS
|
|
39
|
+
Types: str
|
|
40
|
+
|
|
41
|
+
mean:
|
|
42
|
+
Optional Argument.
|
|
43
|
+
Specifies the global mean values that used to
|
|
44
|
+
calculate the SAX code for every partition.
|
|
45
|
+
Note:
|
|
46
|
+
* If "mean" not specified, the function calculates the mean values
|
|
47
|
+
for every partition.
|
|
48
|
+
* If "mean" specifies a single value but there are multiple payloads,
|
|
49
|
+
the specified value will apply to all payloads.
|
|
50
|
+
* If "mean" specifies multiple values, each value will be
|
|
51
|
+
applied to its corresponding payload.
|
|
52
|
+
Types: float, list of float
|
|
53
|
+
|
|
54
|
+
std_dev:
|
|
55
|
+
Optional Argument.
|
|
56
|
+
Specifies the global standard deviation values that used to
|
|
57
|
+
calculate the SAX code for every partition.
|
|
58
|
+
Note:
|
|
59
|
+
* If "std_dev" not specified, the function calculates the standard
|
|
60
|
+
deviation values for every partition.
|
|
61
|
+
* If "std_dev" specifies a single value but there are multiple payloads,
|
|
62
|
+
the specified value will apply to all payloads.
|
|
63
|
+
* If "std_dev" specifies multiple values, each value will be
|
|
64
|
+
applied to its corresponding payload.
|
|
65
|
+
Types: float, list of float
|
|
66
|
+
|
|
67
|
+
window_size:
|
|
68
|
+
Optional Argument, Required if "window_type" is SLIDING.
|
|
69
|
+
Specifies the size of the window used in the SAX
|
|
70
|
+
transformation. Maximum value is 64000.
|
|
71
|
+
Types: int
|
|
72
|
+
|
|
73
|
+
output_frequency:
|
|
74
|
+
Optional Argument.
|
|
75
|
+
Specifies the number of data points that the window slides
|
|
76
|
+
between successive outputs.
|
|
77
|
+
Note:
|
|
78
|
+
* "output_frequency" is valid only for SLIDING "window_type".
|
|
79
|
+
Default Value: 1
|
|
80
|
+
Types: int
|
|
81
|
+
|
|
82
|
+
points_per_symbol:
|
|
83
|
+
Optional Argument.
|
|
84
|
+
Specifies the number of data points to be converted to one SAX
|
|
85
|
+
symbol.
|
|
86
|
+
Note:
|
|
87
|
+
* "points_per_symbol" is valid for GLOBAL "window_type".
|
|
88
|
+
Default Value: 1
|
|
89
|
+
Types: int
|
|
90
|
+
|
|
91
|
+
symbols_per_window:
|
|
92
|
+
Optional Argument.
|
|
93
|
+
Specifies the number of SAX symbols to be generated for each
|
|
94
|
+
window.
|
|
95
|
+
Note:
|
|
96
|
+
* "symbols_per_window" is valid for SLIDING "window_type".
|
|
97
|
+
Default Value: 1
|
|
98
|
+
Types: int
|
|
99
|
+
|
|
100
|
+
alphabet_size:
|
|
101
|
+
Optional Argument.
|
|
102
|
+
Specifies the number of symbols in the SAX alphabet.
|
|
103
|
+
The alphabet consists of letters from 'a' to 't'.
|
|
104
|
+
The size of the alphabet must be less than or equal to 20
|
|
105
|
+
and greater than or equal to 2.
|
|
106
|
+
Default Value: 4
|
|
107
|
+
Types: int
|
|
108
|
+
|
|
109
|
+
bitmap_level:
|
|
110
|
+
Optional Argument.
|
|
111
|
+
Specifies the level of the bitmap. The bitmap level
|
|
112
|
+
determines the number of consecutive symbols to be
|
|
113
|
+
converted to one symbol on a bitmap.
|
|
114
|
+
"bitmap_level" must be greater than or equal to 1 and less than or equal to 4.
|
|
115
|
+
Default Value: 2
|
|
116
|
+
Types: int
|
|
117
|
+
|
|
118
|
+
code_stats:
|
|
119
|
+
Optional Argument.
|
|
120
|
+
Specifies whether to print the mean and standard deviation
|
|
121
|
+
Default Value: 0
|
|
122
|
+
Types: int
|
|
123
|
+
|
|
124
|
+
breakpoints:
|
|
125
|
+
Optional Argument.
|
|
126
|
+
Specifies the breakpoints to form the SAX code based on "data".
|
|
127
|
+
Types: float, list of float
|
|
128
|
+
|
|
129
|
+
output_fmt_index_style:
|
|
130
|
+
Optional Argument.
|
|
131
|
+
Specifies the index style of the output format.
|
|
132
|
+
Permitted Values: NUMERICAL_SEQUENCE
|
|
133
|
+
Default Value: NUMERICAL_SEQUENCE
|
|
134
|
+
Types: str
|
|
135
|
+
|
|
136
|
+
**generic_arguments:
|
|
137
|
+
Specifies the generic keyword arguments of UAF functions.
|
|
138
|
+
Below are the generic keyword arguments:
|
|
139
|
+
persist:
|
|
140
|
+
Optional Argument.
|
|
141
|
+
Specifies whether to persist the results of the
|
|
142
|
+
function in a table or not. When set to True,
|
|
143
|
+
results are persisted in a table; otherwise,
|
|
144
|
+
results are garbage collected at the end of the
|
|
145
|
+
session.
|
|
146
|
+
Note that, when UAF function is executed, an
|
|
147
|
+
analytic result table (ART) is created.
|
|
148
|
+
Default Value: False
|
|
149
|
+
Types: bool
|
|
150
|
+
|
|
151
|
+
volatile:
|
|
152
|
+
Optional Argument.
|
|
153
|
+
Specifies whether to put the results of the
|
|
154
|
+
function in a volatile ART or not. When set to
|
|
155
|
+
True, results are stored in a volatile ART,
|
|
156
|
+
otherwise not.
|
|
157
|
+
Default Value: False
|
|
158
|
+
Types: bool
|
|
159
|
+
|
|
160
|
+
output_table_name:
|
|
161
|
+
Optional Argument.
|
|
162
|
+
Specifies the name of the table to store results.
|
|
163
|
+
If not specified, a unique table name is internally
|
|
164
|
+
generated.
|
|
165
|
+
Types: str
|
|
166
|
+
|
|
167
|
+
output_db_name:
|
|
168
|
+
Optional Argument.
|
|
169
|
+
Specifies the name of the database to create output
|
|
170
|
+
table into. If not specified, table is created into
|
|
171
|
+
database specified by the user at the time of context
|
|
172
|
+
creation or configuration parameter. Argument is ignored,
|
|
173
|
+
if "output_table_name" is not specified.
|
|
174
|
+
Types: str
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
RETURNS:
|
|
178
|
+
Instance of SAX.
|
|
179
|
+
Output teradataml DataFrames can be accessed using attribute
|
|
180
|
+
references, such as SAX_obj.<attribute_name>.
|
|
181
|
+
Output teradataml DataFrame attribute name is:
|
|
182
|
+
1. result
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
RAISES:
|
|
186
|
+
TeradataMlException, TypeError, ValueError
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
EXAMPLES:
|
|
190
|
+
# Notes:
|
|
191
|
+
# 1. Get the connection to Vantage, before importing the
|
|
192
|
+
# function in user space.
|
|
193
|
+
# 2. User can import the function, if it is available on
|
|
194
|
+
# Vantage user is connected to.
|
|
195
|
+
# 3. To check the list of UAF analytic functions available
|
|
196
|
+
# on Vantage user connected to, use
|
|
197
|
+
# "display_analytic_functions()".
|
|
198
|
+
|
|
199
|
+
# Check the list of available UAF analytic functions.
|
|
200
|
+
display_analytic_functions(type="UAF")
|
|
201
|
+
|
|
202
|
+
# Import function SAX.
|
|
203
|
+
from teradataml import SAX
|
|
204
|
+
|
|
205
|
+
# Load the example data.
|
|
206
|
+
load_example_data("sax", ["finance_data4"])
|
|
207
|
+
|
|
208
|
+
# Create teradataml DataFrame object.
|
|
209
|
+
data = DataFrame.from_table("finance_data4")
|
|
210
|
+
|
|
211
|
+
# Create teradataml TDSeries object.
|
|
212
|
+
data_series_df = TDSeries(data=data,
|
|
213
|
+
id="id",
|
|
214
|
+
row_index="period",
|
|
215
|
+
row_index_style="SEQUENCE",
|
|
216
|
+
payload_field=["expenditure", "income", "investment"],
|
|
217
|
+
payload_content="MULTIVAR_REAL")
|
|
218
|
+
|
|
219
|
+
# Example 1: Execute SAX() function on the TDSeries to transform the
|
|
220
|
+
# time series into sequence of symbols using GLOBAL window.
|
|
221
|
+
uaf_out = SAX(data=data_series_df,
|
|
222
|
+
window_type='GLOBAL',
|
|
223
|
+
output_type='STRING',
|
|
224
|
+
mean=[2045.16666, 2387.41666,759.083333],
|
|
225
|
+
std_dev=[256.612489,317.496587,113.352594],
|
|
226
|
+
output_frequency=1,
|
|
227
|
+
points_per_symbol=2,
|
|
228
|
+
alphabet_size=10,
|
|
229
|
+
code_stats=True)
|
|
230
|
+
|
|
231
|
+
# Print the result DataFrame.
|
|
232
|
+
print(uaf_out.result)
|
|
233
|
+
|
|
234
|
+
# Example 2: Execute SAX() function on the TDSeries to transform the
|
|
235
|
+
# time series into sequence of symbols using SLIDING window.
|
|
236
|
+
uaf_out1 = SAX(data=data_series_df,
|
|
237
|
+
window_type='SLIDING',
|
|
238
|
+
window_size=4,
|
|
239
|
+
symbols_per_window=5,
|
|
240
|
+
code_stats=True)
|
|
241
|
+
|
|
242
|
+
# Print the result DataFrame.
|
|
243
|
+
print(uaf_out1.result)
|
|
244
|
+
|
|
245
|
+
"""
|
|
246
|
+
|