oracle-ads 2.13.13__py3-none-any.whl → 2.13.15__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.
Files changed (27) hide show
  1. ads/aqua/extension/model_handler.py +7 -3
  2. ads/aqua/modeldeployment/deployment.py +1 -23
  3. ads/common/utils.py +1 -3
  4. ads/feature_engineering/feature_type/boolean.py +15 -14
  5. ads/feature_engineering/feature_type/category.py +12 -11
  6. ads/feature_engineering/feature_type/continuous.py +13 -12
  7. ads/feature_engineering/feature_type/datetime.py +10 -13
  8. ads/feature_engineering/feature_type/gis.py +15 -13
  9. ads/feature_engineering/feature_type/integer.py +11 -10
  10. ads/feature_engineering/feature_type/ip_address.py +9 -7
  11. ads/feature_engineering/feature_type/ip_address_v4.py +7 -6
  12. ads/feature_engineering/feature_type/ip_address_v6.py +7 -6
  13. ads/feature_engineering/feature_type/lat_long.py +15 -14
  14. ads/feature_engineering/feature_type/phone_number.py +8 -7
  15. ads/feature_engineering/feature_type/string.py +12 -12
  16. ads/feature_engineering/feature_type/text.py +6 -7
  17. ads/feature_engineering/feature_type/zip_code.py +11 -9
  18. ads/feature_engineering/utils.py +14 -12
  19. ads/model/transformer/onnx_transformer.py +7 -8
  20. ads/templates/score.jinja2 +3 -3
  21. ads/templates/score_onnx.jinja2 +3 -3
  22. ads/templates/score_onnx_new.jinja2 +3 -3
  23. {oracle_ads-2.13.13.dist-info → oracle_ads-2.13.15.dist-info}/METADATA +7 -4
  24. {oracle_ads-2.13.13.dist-info → oracle_ads-2.13.15.dist-info}/RECORD +27 -27
  25. {oracle_ads-2.13.13.dist-info → oracle_ads-2.13.15.dist-info}/WHEEL +0 -0
  26. {oracle_ads-2.13.13.dist-info → oracle_ads-2.13.15.dist-info}/entry_points.txt +0 -0
  27. {oracle_ads-2.13.13.dist-info → oracle_ads-2.13.15.dist-info}/licenses/LICENSE.txt +0 -0
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env python
2
2
  # Copyright (c) 2024, 2025 Oracle and/or its affiliates.
3
3
  # Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
4
-
4
+ import json
5
5
  from typing import Optional
6
6
  from urllib.parse import urlparse
7
7
 
@@ -341,9 +341,13 @@ class AquaModelChatTemplateHandler(AquaAPIhandler):
341
341
  ):
342
342
  try:
343
343
  oci_data_science_model = OCIDataScienceModel.from_id(model_id)
344
+ chat_template = oci_data_science_model.get_custom_metadata_artifact("chat_template")
345
+ chat_template = chat_template.decode("utf-8")
346
+
347
+ return self.finish(json.dumps({"chat_template": chat_template}))
348
+
344
349
  except Exception as e:
345
- raise HTTPError(404, f"Model not found for id: {model_id}. Details: {str(e)}")
346
- return self.finish(oci_data_science_model.get_custom_metadata_artifact("chat_template"))
350
+ raise HTTPError(404, f"Failed to fetch chat template for model_id={model_id}. Details: {str(e)}")
347
351
 
348
352
  raise HTTPError(400, f"The request {self.request.path} is invalid.")
349
353
 
@@ -769,7 +769,6 @@ class AquaDeploymentApp(AquaApp):
769
769
  logger.info(
770
770
  f"Aqua model deployment {deployment_id} created for model {aqua_model_id}. Work request Id is {deployment.dsc_model_deployment.workflow_req_id}"
771
771
  )
772
- status_list = []
773
772
 
774
773
  progress_thread = threading.Thread(
775
774
  target=self.get_deployment_status,
@@ -1316,37 +1315,17 @@ class AquaDeploymentApp(AquaApp):
1316
1315
  poll_interval=DEFAULT_POLL_INTERVAL,
1317
1316
  )
1318
1317
  except Exception:
1319
- status = ""
1320
- logs = deployment.show_logs().sort_values(by="time", ascending=False)
1321
-
1322
- if logs and len(logs) > 0:
1323
- status = logs.iloc[0]["message"]
1324
-
1325
- status = re.sub(r"[^a-zA-Z0-9]", " ", status)
1326
-
1327
1318
  if data_science_work_request._error_message:
1328
1319
  error_str = ""
1329
1320
  for error in data_science_work_request._error_message:
1330
1321
  error_str = error_str + " " + error.message
1331
1322
 
1332
1323
  error_str = re.sub(r"[^a-zA-Z0-9]", " ", error_str)
1333
- telemetry_kwargs = {
1334
- "ocid": ocid,
1335
- "model_name": model_name,
1336
- "work_request_error": error_str,
1337
- "status": status,
1338
- }
1339
1324
 
1340
- self.telemetry.record_event(
1341
- category=f"aqua/{model_type}/deployment/status",
1342
- action="FAILED",
1343
- **telemetry_kwargs,
1344
- )
1345
- else:
1346
1325
  telemetry_kwargs = {
1347
1326
  "ocid": ocid,
1348
1327
  "model_name": model_name,
1349
- "status": status,
1328
+ "work_request_error": error_str,
1350
1329
  }
1351
1330
 
1352
1331
  self.telemetry.record_event(
@@ -1354,7 +1333,6 @@ class AquaDeploymentApp(AquaApp):
1354
1333
  action="FAILED",
1355
1334
  **telemetry_kwargs,
1356
1335
  )
1357
-
1358
1336
  else:
1359
1337
  telemetry_kwargs = {"ocid": ocid, "model_name": model_name}
1360
1338
  self.telemetry.record_event(
ads/common/utils.py CHANGED
@@ -782,9 +782,7 @@ class JsonConverter(json.JSONEncoder):
782
782
  ),
783
783
  ):
784
784
  return int(obj)
785
- elif isinstance(
786
- obj, (np.float_, np.float16, np.float32, np.float64, np.double)
787
- ):
785
+ elif isinstance(obj, (np.float16, np.float32, np.float64, np.double)):
788
786
  return float(obj)
789
787
  elif isinstance(obj, (np.ndarray,)):
790
788
  return obj.tolist()
@@ -1,7 +1,6 @@
1
1
  #!/usr/bin/env python
2
- # -*- coding: utf-8 -*--
3
2
 
4
- # Copyright (c) 2021, 2022 Oracle and/or its affiliates.
3
+ # Copyright (c) 2021, 2025 Oracle and/or its affiliates.
5
4
  # Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
6
5
 
7
6
  """
@@ -15,19 +14,21 @@ Functions:
15
14
  default_handler(data: pd.Series) -> pd.Series
16
15
  Processes given data and indicates if the data matches requirements.
17
16
  """
17
+
18
18
  import matplotlib.pyplot as plt
19
19
  import pandas as pd
20
+
21
+ from ads.common.decorator.runtime_dependency import (
22
+ OptionalDependency,
23
+ runtime_dependency,
24
+ )
25
+ from ads.feature_engineering import schema
20
26
  from ads.feature_engineering.feature_type.base import FeatureType
21
27
  from ads.feature_engineering.utils import (
28
+ SchemeTeal,
22
29
  _count_unique_missing,
23
- is_boolean,
24
30
  _set_seaborn_theme,
25
- SchemeTeal,
26
- )
27
- from ads.feature_engineering import schema
28
- from ads.common.decorator.runtime_dependency import (
29
- runtime_dependency,
30
- OptionalDependency,
31
+ is_boolean,
31
32
  )
32
33
 
33
34
 
@@ -44,7 +45,7 @@ def default_handler(data: pd.Series, *args, **kwargs) -> pd.Series:
44
45
  :class:`pandas.Series`
45
46
  The logical list indicating if the data matches requirements.
46
47
  """
47
- return pd.Series((is_boolean(value) for value in data.values))
48
+ return pd.Series(is_boolean(value) for value in data.values)
48
49
 
49
50
 
50
51
  class Boolean(FeatureType):
@@ -74,7 +75,7 @@ class Boolean(FeatureType):
74
75
  >>> from ads.feature_engineering.feature_type.boolean import Boolean
75
76
  >>> import pandas as pd
76
77
  >>> import numpy as np
77
- >>> s = pd.Series([True, False, True, False, np.NaN, None], name='bool')
78
+ >>> s = pd.Series([True, False, True, False, np.nan, None], name='bool')
78
79
  >>> s.ads.feature_type = ['boolean']
79
80
  >>> Boolean.validator.is_boolean(s)
80
81
  0 True
@@ -106,7 +107,7 @@ class Boolean(FeatureType):
106
107
 
107
108
  Examples
108
109
  --------
109
- >>> s = pd.Series([True, False, True, False, np.NaN, None], name='bool')
110
+ >>> s = pd.Series([True, False, True, False, np.nan, None], name='bool')
110
111
  >>> s.ads.feature_type = ['boolean']
111
112
  >>> s.ads.feature_stat()
112
113
  Metric Value
@@ -134,7 +135,7 @@ class Boolean(FeatureType):
134
135
 
135
136
  Examples
136
137
  --------
137
- >>> s = pd.Series([True, False, True, False, np.NaN, None], name='bool')
138
+ >>> s = pd.Series([True, False, True, False, np.nan, None], name='bool')
138
139
  >>> s.ads.feature_type = ['boolean']
139
140
  >>> s.ads.feature_plot()
140
141
  """
@@ -155,7 +156,7 @@ class Boolean(FeatureType):
155
156
 
156
157
  Examples
157
158
  --------
158
- >>> s = pd.Series([True, False, True, False, np.NaN, None], name='bool')
159
+ >>> s = pd.Series([True, False, True, False, np.nan, None], name='bool')
159
160
  >>> s.ads.feature_type = ['boolean']
160
161
  >>> s.ads.feature_domain()
161
162
  constraints:
@@ -1,7 +1,6 @@
1
1
  #!/usr/bin/env python
2
- # -*- coding: utf-8 -*--
3
2
 
4
- # Copyright (c) 2021, 2022 Oracle and/or its affiliates.
3
+ # Copyright (c) 2021, 2025 Oracle and/or its affiliates.
5
4
  # Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
6
5
 
7
6
  """
@@ -11,18 +10,20 @@ Classes:
11
10
  Category
12
11
  The Category feature type.
13
12
  """
13
+
14
14
  import matplotlib.pyplot as plt
15
15
  import pandas as pd
16
+
17
+ from ads.common.decorator.runtime_dependency import (
18
+ OptionalDependency,
19
+ runtime_dependency,
20
+ )
21
+ from ads.feature_engineering import schema
16
22
  from ads.feature_engineering.feature_type.base import FeatureType
17
23
  from ads.feature_engineering.utils import (
24
+ SchemeTeal,
18
25
  _count_unique_missing,
19
26
  _set_seaborn_theme,
20
- SchemeTeal,
21
- )
22
- from ads.feature_engineering import schema
23
- from ads.common.decorator.runtime_dependency import (
24
- runtime_dependency,
25
- OptionalDependency,
26
27
  )
27
28
 
28
29
 
@@ -71,7 +72,7 @@ class Category(FeatureType):
71
72
  Examples
72
73
  --------
73
74
  >>> cat = pd.Series(['S', 'C', 'S', 'S', 'S', 'Q', 'S', 'S', 'S', 'C', 'S', 'S', 'S',
74
- 'S', 'S', 'S', 'Q', 'S', 'S', '', np.NaN, None], name='сategory')
75
+ 'S', 'S', 'S', 'Q', 'S', 'S', '', np.nan, None], name='сategory')
75
76
  >>> cat.ads.feature_type = ['сategory']
76
77
  >>> cat.ads.feature_stat()
77
78
  Metric Value
@@ -100,7 +101,7 @@ class Category(FeatureType):
100
101
  Examples
101
102
  --------
102
103
  >>> cat = pd.Series(['S', 'C', 'S', 'S', 'S', 'Q', 'S', 'S', 'S', 'C', 'S', 'S', 'S',
103
- 'S', 'S', 'S', 'Q', 'S', 'S', '', np.NaN, None], name='сategory')
104
+ 'S', 'S', 'S', 'Q', 'S', 'S', '', np.nan, None], name='сategory')
104
105
  >>> cat.ads.feature_type = ['сategory']
105
106
  >>> cat.ads.feature_plot()
106
107
  """
@@ -121,7 +122,7 @@ class Category(FeatureType):
121
122
  Examples
122
123
  --------
123
124
  >>> cat = pd.Series(['S', 'C', 'S', 'S', 'S', 'Q', 'S', 'S', 'S', 'C', 'S', 'S', 'S',
124
- 'S', 'S', 'S', 'Q', 'S', 'S', '', np.NaN, None], name='category')
125
+ 'S', 'S', 'S', 'Q', 'S', 'S', '', np.nan, None], name='category')
125
126
  >>> cat.ads.feature_type = ['category']
126
127
  >>> cat.ads.feature_domain()
127
128
  constraints:
@@ -1,7 +1,6 @@
1
1
  #!/usr/bin/env python
2
- # -*- coding: utf-8 -*--
3
2
 
4
- # Copyright (c) 2021, 2022 Oracle and/or its affiliates.
3
+ # Copyright (c) 2021, 2025 Oracle and/or its affiliates.
5
4
  # Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
6
5
 
7
6
  """
@@ -11,19 +10,21 @@ Classes:
11
10
  Continuous
12
11
  The Continuous feature type.
13
12
  """
13
+
14
14
  import matplotlib.pyplot as plt
15
15
  import pandas as pd
16
+
17
+ from ads.common.decorator.runtime_dependency import (
18
+ OptionalDependency,
19
+ runtime_dependency,
20
+ )
21
+ from ads.feature_engineering import schema
16
22
  from ads.feature_engineering.feature_type.base import FeatureType
17
23
  from ads.feature_engineering.utils import (
18
- _add_missing,
19
- _set_seaborn_theme,
20
24
  SchemeTeal,
25
+ _add_missing,
21
26
  _format_stat,
22
- )
23
- from ads.feature_engineering import schema
24
- from ads.common.decorator.runtime_dependency import (
25
- runtime_dependency,
26
- OptionalDependency,
27
+ _set_seaborn_theme,
27
28
  )
28
29
 
29
30
 
@@ -62,7 +63,7 @@ class Continuous(FeatureType):
62
63
  Examples
63
64
  --------
64
65
  >>> cts = pd.Series([13.32, 3.32, 4.3, 2.45, 6.34, 2.25,
65
- 4.43, 3.26, np.NaN, None], name='continuous')
66
+ 4.43, 3.26, np.nan, None], name='continuous')
66
67
  >>> cts.ads.feature_type = ['continuous']
67
68
  >>> cts.ads.feature_stat()
68
69
  Metric Value
@@ -99,7 +100,7 @@ class Continuous(FeatureType):
99
100
  Examples
100
101
  --------
101
102
  >>> cts = pd.Series([13.32, 3.32, 4.3, 2.45, 6.34, 2.25,
102
- 4.43, 3.26, np.NaN, None], name='continuous')
103
+ 4.43, 3.26, np.nan, None], name='continuous')
103
104
  >>> cts.ads.feature_type = ['continuous']
104
105
  >>> cts.ads.feture_plot()
105
106
 
@@ -125,7 +126,7 @@ class Continuous(FeatureType):
125
126
  Examples
126
127
  --------
127
128
  >>> cts = pd.Series([13.32, 3.32, 4.3, 2.45, 6.34, 2.25,
128
- 4.43, 3.26, np.NaN, None], name='continuous')
129
+ 4.43, 3.26, np.nan, None], name='continuous')
129
130
  >>> cts.ads.feature_type = ['continuous']
130
131
  >>> cts.ads.feature_domain()
131
132
  constraints: []
@@ -1,7 +1,6 @@
1
1
  #!/usr/bin/env python
2
- # -*- coding: utf-8 -*--
3
2
 
4
- # Copyright (c) 2021, 2022 Oracle and/or its affiliates.
3
+ # Copyright (c) 2021, 2025 Oracle and/or its affiliates.
5
4
  # Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
6
5
 
7
6
  """
@@ -11,21 +10,19 @@ Classes:
11
10
  DateTime
12
11
  The DateTime feature type.
13
12
  """
13
+
14
14
  import matplotlib.pyplot as plt
15
15
  import numpy as np
16
16
  import pandas as pd
17
17
  import pandas.api.types as pdtypes
18
- from ads.feature_engineering.feature_type.base import FeatureType
19
- from ads.feature_engineering.utils import (
20
- _add_missing,
21
- _set_seaborn_theme,
22
- SchemeTeal,
23
- )
24
- from ads.feature_engineering import schema
18
+
25
19
  from ads.common.decorator.runtime_dependency import (
26
- runtime_dependency,
27
20
  OptionalDependency,
21
+ runtime_dependency,
28
22
  )
23
+ from ads.feature_engineering import schema
24
+ from ads.feature_engineering.feature_type.base import FeatureType
25
+ from ads.feature_engineering.utils import SchemeTeal, _add_missing, _set_seaborn_theme
29
26
 
30
27
 
31
28
  def default_handler(data: pd.Series, *args, **kwargs) -> pd.Series:
@@ -123,12 +120,12 @@ class DateTime(FeatureType):
123
120
  df_stat = pd.Series(
124
121
  {
125
122
  "count": len(x),
126
- "sample maximum": x.replace(r"", np.NaN).dropna().max(),
127
- "sample minimum": x.replace(r"", np.NaN).dropna().min(),
123
+ "sample maximum": x.replace(r"", np.nan).dropna().max(),
124
+ "sample minimum": x.replace(r"", np.nan).dropna().min(),
128
125
  },
129
126
  name=x.name,
130
127
  ).to_frame()
131
- return _add_missing(x.replace(r"", np.NaN), df_stat)
128
+ return _add_missing(x.replace(r"", np.nan), df_stat)
132
129
 
133
130
  @staticmethod
134
131
  @runtime_dependency(module="seaborn", install_from=OptionalDependency.VIZ)
@@ -1,7 +1,6 @@
1
1
  #!/usr/bin/env python
2
- # -*- coding: utf-8 -*--
3
2
 
4
- # Copyright (c) 2021, 2022 Oracle and/or its affiliates.
3
+ # Copyright (c) 2021, 2025 Oracle and/or its affiliates.
5
4
  # Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
6
5
 
7
6
  """
@@ -11,20 +10,23 @@ Classes:
11
10
  GIS
12
11
  The GIS feature type.
13
12
  """
13
+
14
+ import re
15
+
14
16
  import matplotlib.pyplot as plt
15
17
  import pandas as pd
16
- import re
18
+
19
+ from ads.common.decorator.runtime_dependency import (
20
+ OptionalDependency,
21
+ runtime_dependency,
22
+ )
23
+ from ads.feature_engineering import schema
17
24
  from ads.feature_engineering.feature_type.base import FeatureType
18
25
  from ads.feature_engineering.utils import (
19
- _count_unique_missing,
20
- _str_lat_long_to_point,
21
26
  SchemeNeutral,
22
27
  SchemeTeal,
23
- )
24
- from ads.feature_engineering import schema
25
- from ads.common.decorator.runtime_dependency import (
26
- runtime_dependency,
27
- OptionalDependency,
28
+ _count_unique_missing,
29
+ _str_lat_long_to_point,
28
30
  )
29
31
 
30
32
  PATTERN = re.compile(r"^[(]?(\-?\d+\.\d+?),\s*(\-?\d+\.\d+?)[)]?$", re.VERBOSE)
@@ -126,7 +128,7 @@ class GIS(FeatureType):
126
128
  "-44.510428,-169.269477",
127
129
  "-56.3344375,-166.407038",
128
130
  "",
129
- np.NaN,
131
+ np.nan,
130
132
  None
131
133
  ],
132
134
  name='gis'
@@ -165,7 +167,7 @@ class GIS(FeatureType):
165
167
  "-44.510428,-169.269477",
166
168
  "-56.3344375,-166.407038",
167
169
  "",
168
- np.NaN,
170
+ np.nan,
169
171
  None
170
172
  ],
171
173
  name='gis'
@@ -221,7 +223,7 @@ class GIS(FeatureType):
221
223
  "-44.510428,-169.269477",
222
224
  "-56.3344375,-166.407038",
223
225
  "",
224
- np.NaN,
226
+ np.nan,
225
227
  None
226
228
  ],
227
229
  name='gis'
@@ -1,7 +1,6 @@
1
1
  #!/usr/bin/env python
2
- # -*- coding: utf-8 -*--
3
2
 
4
- # Copyright (c) 2021, 2022 Oracle and/or its affiliates.
3
+ # Copyright (c) 2021, 2025 Oracle and/or its affiliates.
5
4
  # Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
6
5
 
7
6
  """
@@ -11,19 +10,21 @@ Classes:
11
10
  Integer
12
11
  The Integer feature type.
13
12
  """
13
+
14
14
  import matplotlib.pyplot as plt
15
15
  import pandas as pd
16
+
17
+ from ads.common.decorator.runtime_dependency import (
18
+ OptionalDependency,
19
+ runtime_dependency,
20
+ )
21
+ from ads.feature_engineering import schema
16
22
  from ads.feature_engineering.feature_type.base import FeatureType
17
23
  from ads.feature_engineering.utils import (
18
- _add_missing,
19
- _set_seaborn_theme,
20
24
  SchemeTeal,
25
+ _add_missing,
21
26
  _format_stat,
22
- )
23
- from ads.feature_engineering import schema
24
- from ads.common.decorator.runtime_dependency import (
25
- runtime_dependency,
26
- OptionalDependency,
27
+ _set_seaborn_theme,
27
28
  )
28
29
 
29
30
 
@@ -120,7 +121,7 @@ class Integer(FeatureType):
120
121
 
121
122
  Examples
122
123
  --------
123
- >>> s = pd.Series([True, False, True, False, np.NaN, None], name='integer')
124
+ >>> s = pd.Series([True, False, True, False, np.nan, None], name='integer')
124
125
  >>> s.ads.feature_type = ['integer']
125
126
  >>> s.ads.feature_domain()
126
127
  constraints: []
@@ -1,7 +1,6 @@
1
1
  #!/usr/bin/env python
2
- # -*- coding: utf-8 -*--
3
2
 
4
- # Copyright (c) 2021 Oracle and/or its affiliates.
3
+ # Copyright (c) 2021, 2025 Oracle and/or its affiliates.
5
4
  # Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
6
5
 
7
6
  """
@@ -11,11 +10,14 @@ Classes:
11
10
  IpAddress
12
11
  The IpAddress feature type.
13
12
  """
14
- import pandas as pd
13
+
15
14
  import re
15
+
16
+ import pandas as pd
17
+
18
+ from ads.feature_engineering import schema
16
19
  from ads.feature_engineering.feature_type.base import FeatureType
17
20
  from ads.feature_engineering.utils import _count_unique_missing
18
- from ads.feature_engineering import schema
19
21
 
20
22
  PATTERNV4 = re.compile(
21
23
  r"(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)",
@@ -75,7 +77,7 @@ class IpAddress(FeatureType):
75
77
  >>> from ads.feature_engineering.feature_type.ip_address import IpAddress
76
78
  >>> import pandas as pd
77
79
  >>> import numpy as np
78
- >>> s = pd.Series(['192.168.0.1', '2001:db8::', '', np.NaN, None], name='ip_address')
80
+ >>> s = pd.Series(['192.168.0.1', '2001:db8::', '', np.nan, None], name='ip_address')
79
81
  >>> s.ads.feature_type = ['ip_address']
80
82
  >>> IpAddress.validator.is_ip_address(s)
81
83
  0 True
@@ -96,7 +98,7 @@ class IpAddress(FeatureType):
96
98
 
97
99
  Examples
98
100
  --------
99
- >>> s = pd.Series(['2002:db8::', '192.168.0.1', '2001:db8::', '2002:db8::', np.NaN, None], name='ip_address')
101
+ >>> s = pd.Series(['2002:db8::', '192.168.0.1', '2001:db8::', '2002:db8::', np.nan, None], name='ip_address')
100
102
  >>> s.ads.feature_type = ['ip_address']
101
103
  >>> s.ads.feature_stat()
102
104
  Metric Value
@@ -118,7 +120,7 @@ class IpAddress(FeatureType):
118
120
 
119
121
  Examples
120
122
  --------
121
- >>> s = pd.Series(['2002:db8::', '192.168.0.1', '2001:db8::', '2002:db8::', np.NaN, None], name='ip_address')
123
+ >>> s = pd.Series(['2002:db8::', '192.168.0.1', '2001:db8::', '2002:db8::', np.nan, None], name='ip_address')
122
124
  >>> s.ads.feature_type = ['ip_address']
123
125
  >>> s.ads.feature_domain()
124
126
  constraints: []
@@ -1,7 +1,6 @@
1
1
  #!/usr/bin/env python
2
- # -*- coding: utf-8 -*--
3
2
 
4
- # Copyright (c) 2021 Oracle and/or its affiliates.
3
+ # Copyright (c) 2021, 2025 Oracle and/or its affiliates.
5
4
  # Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
6
5
 
7
6
  """
@@ -11,12 +10,14 @@ Classes:
11
10
  IpAddressV4
12
11
  The IpAddressV4 feature type.
13
12
  """
13
+
14
14
  import re
15
15
 
16
16
  import pandas as pd
17
+
18
+ from ads.feature_engineering import schema
17
19
  from ads.feature_engineering.feature_type.base import FeatureType
18
20
  from ads.feature_engineering.utils import _count_unique_missing
19
- from ads.feature_engineering import schema
20
21
 
21
22
  PATTERN = re.compile(
22
23
  r"(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)",
@@ -69,7 +70,7 @@ class IpAddressV4(FeatureType):
69
70
  >>> from ads.feature_engineering.feature_type.ip_address_v4 import IpAddressV4
70
71
  >>> import pandas as pd
71
72
  >>> import numpy as np
72
- >>> s = pd.Series(['192.168.0.1', '2001:db8::', '', np.NaN, None], name='ip_address')
73
+ >>> s = pd.Series(['192.168.0.1', '2001:db8::', '', np.nan, None], name='ip_address')
73
74
  >>> s.ads.feature_type = ['ip_address_v4']
74
75
  >>> IpAddressV4.validator.is_ip_address_v4(s)
75
76
  0 True
@@ -90,7 +91,7 @@ class IpAddressV4(FeatureType):
90
91
 
91
92
  Examples
92
93
  --------
93
- >>> s = pd.Series(['192.168.0.1', '192.168.0.2', '192.168.0.3', '192.168.0.4', np.NaN, None], name='ip_address')
94
+ >>> s = pd.Series(['192.168.0.1', '192.168.0.2', '192.168.0.3', '192.168.0.4', np.nan, None], name='ip_address')
94
95
  >>> s.ads.feature_type = ['ip_address_v4']
95
96
  >>> s.ads.feature_stat()
96
97
  Metric Value
@@ -112,7 +113,7 @@ class IpAddressV4(FeatureType):
112
113
 
113
114
  Examples
114
115
  --------
115
- >>> s = pd.Series(['192.168.0.1', '192.168.0.2', '192.168.0.3', '192.168.0.4', np.NaN, None], name='ip_address_v4')
116
+ >>> s = pd.Series(['192.168.0.1', '192.168.0.2', '192.168.0.3', '192.168.0.4', np.nan, None], name='ip_address_v4')
116
117
  >>> s.ads.feature_type = ['ip_address_v4']
117
118
  >>> s.ads.feature_domain()
118
119
  constraints: []
@@ -1,7 +1,6 @@
1
1
  #!/usr/bin/env python
2
- # -*- coding: utf-8 -*--
3
2
 
4
- # Copyright (c) 2021 Oracle and/or its affiliates.
3
+ # Copyright (c) 2021, 2025 Oracle and/or its affiliates.
5
4
  # Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
6
5
 
7
6
  """
@@ -11,12 +10,14 @@ Classes:
11
10
  IpAddressV6
12
11
  The IpAddressV6 feature type.
13
12
  """
13
+
14
14
  import re
15
15
 
16
16
  import pandas as pd
17
+
18
+ from ads.feature_engineering import schema
17
19
  from ads.feature_engineering.feature_type.base import FeatureType
18
20
  from ads.feature_engineering.utils import _count_unique_missing
19
- from ads.feature_engineering import schema
20
21
 
21
22
  PATTERN = re.compile(
22
23
  r"\s*(?!.*::.*::)(?:(?!:)|:(?=:))(?:[0-9a-f]{0,4}(?:(?<=::)|(?<!::):)){6}(?:[0-9a-f]{0,4}(?:(?<=::)|(?<!::):)[0-9a-f]{0,4}(?:(?<=::)|(?<!:)|(?<=:)(?<!::):)|(?:25[0-4]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-4]|2[0-4]\d|1\d\d|[1-9]?\d)){3})\s*",
@@ -69,7 +70,7 @@ class IpAddressV6(FeatureType):
69
70
  >>> from ads.feature_engineering.feature_type.ip_address_v6 import IpAddressV6
70
71
  >>> import pandas as pd
71
72
  >>> import numpy as np
72
- >>> s = pd.Series(['192.168.0.1', '2001:db8::', '', np.NaN, None], name='ip_address')
73
+ >>> s = pd.Series(['192.168.0.1', '2001:db8::', '', np.nan, None], name='ip_address')
73
74
  >>> s.ads.feature_type = ['ip_address_v6']
74
75
  >>> IpAddressV6.validator.is_ip_address_v6(s)
75
76
  0 False
@@ -90,7 +91,7 @@ class IpAddressV6(FeatureType):
90
91
 
91
92
  Examples
92
93
  --------
93
- >>> s = pd.Series(['2002:db8::', '2001:db8::', '2001:db8::', '2002:db8::', np.NaN, None], name='ip_address')
94
+ >>> s = pd.Series(['2002:db8::', '2001:db8::', '2001:db8::', '2002:db8::', np.nan, None], name='ip_address')
94
95
  >>> s.ads.feature_type = ['ip_address_v6']
95
96
  >>> s.ads.feature_stat()
96
97
  Metric Value
@@ -112,7 +113,7 @@ class IpAddressV6(FeatureType):
112
113
 
113
114
  Examples
114
115
  --------
115
- >>> s = pd.Series(['2002:db8::', '2001:db8::', '2001:db8::', '2002:db8::', np.NaN, None], name='ip_address_v6')
116
+ >>> s = pd.Series(['2002:db8::', '2001:db8::', '2001:db8::', '2002:db8::', np.nan, None], name='ip_address_v6')
116
117
  >>> s.ads.feature_type = ['ip_address_v6']
117
118
  >>> s.ads.feature_domain()
118
119
  constraints: []