Skip to content

Commit 671c6be

Browse files
committed
Addressing review comments
1 parent 4efa382 commit 671c6be

File tree

2 files changed

+25
-14
lines changed

2 files changed

+25
-14
lines changed

ads/feature_store/dataset.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ def __init__(self, spec: Dict = None, **kwargs) -> None:
164164
self.oci_dataset = self._to_oci_dataset(**kwargs)
165165
self.lineage = OCILineage(**kwargs)
166166

167-
def _to_oci_dataset(self, **kwargs):
167+
def _to_oci_dataset(self, **kwargs) -> OCIDataset:
168168
"""Creates an `OCIDataset` instance from the `Dataset`.
169169
170170
kwargs
@@ -235,8 +235,8 @@ def name(self) -> str:
235235
return self.get_spec(self.CONST_NAME)
236236

237237
@name.setter
238-
def name(self, name: str) -> "Dataset":
239-
return self.with_name(name)
238+
def name(self, name: str):
239+
self.with_name(name)
240240

241241
def with_name(self, name: str) -> "Dataset":
242242
"""Sets the name.
@@ -865,8 +865,6 @@ def _update_from_oci_dataset_model(self, oci_dataset: OCIDataset) -> "Dataset":
865865
features_list.append(output_feature)
866866

867867
value = {self.CONST_ITEMS: features_list}
868-
elif infra_attr == self.CONST_FEATURE_GROUP:
869-
value = getattr(self.oci_dataset, dsc_attr)
870868
else:
871869
value = dataset_details[infra_attr]
872870
self.set_spec(infra_attr, value)
@@ -1207,8 +1205,14 @@ def to_dict(self) -> Dict:
12071205
for key, value in spec.items():
12081206
if hasattr(value, "to_dict"):
12091207
value = value.to_dict()
1210-
spec[key] = value
1211-
1208+
if key == self.CONST_FEATURE_GROUP:
1209+
spec[
1210+
key
1211+
] = self.oci_dataset.client.base_client.sanitize_for_serialization(
1212+
value
1213+
)
1214+
else:
1215+
spec[key] = value
12121216
return {
12131217
"kind": self.kind,
12141218
"type": self.type,

ads/feature_store/feature_stat.py

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
1-
import json
21
from abc import abstractmethod
32

4-
from ads.feature_store.common.utils.utility import none_type_safe_json_loads
5-
from plotly.graph_objs import Figure
3+
from ads.common.decorator.runtime_dependency import OptionalDependency
4+
65
from typing import List
7-
import plotly
8-
import plotly.graph_objects as go
9-
from plotly.subplots import make_subplots
6+
7+
try:
8+
import plotly
9+
from plotly.graph_objs import Figure
10+
import plotly.graph_objects as go
11+
from plotly.subplots import make_subplots
12+
except ModuleNotFoundError:
13+
raise ModuleNotFoundError(
14+
f"The `plotly` module was not found. Please run `pip install "
15+
f"{OptionalDependency.FEATURE_STORE}`."
16+
)
1017

1118

1219
class FeatureStat:
@@ -229,7 +236,7 @@ def to_viz(self):
229236
fig.layout.title = self.CONST_TITLE_FORMAT.format(self.feature_name)
230237
fig.update_layout(title_font_size=20)
231238
fig.update_layout(title_x=0.5)
232-
fig.update_layout(showlegend=False)
239+
# fig.update_layout(showlegend=False)
233240
plotly.offline.iplot(
234241
fig,
235242
filename=self.CONST_PLOT_FORMAT.format(self.feature_name),

0 commit comments

Comments
 (0)