Content-Length: 359274 | pFad | http://www.github.com/googleapis/python-aiplatform/commit/9e66508dbf364f51f05daa9415fea06f8367a489

421 Switched from classmethod to staticmethod where applicable and logged… · googleapis/python-aiplatform@9e66508 · GitHub
Skip to content

Commit 9e66508

Browse files
committed
Switched from classmethod to staticmethod where applicable and logged column names
1 parent 332e3e2 commit 9e66508

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

google/cloud/aiplatform/datasets/tabular_dataset.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,8 @@ def column_names(self) -> List[str]:
8585

8686
raise RuntimeError("No valid CSV or BigQuery datasource found.")
8787

88-
@classmethod
89-
def _retrieve_gcs_source_columns(
90-
cls, project: str, gcs_csv_file_path: str
91-
) -> List[str]:
88+
@staticmethod
89+
def _retrieve_gcs_source_columns(project: str, gcs_csv_file_path: str) -> List[str]:
9290
"""Retrieve the columns from a comma-delimited CSV file stored on Google Cloud Storage
9391
9492
Example Usage:
@@ -139,7 +137,7 @@ def _retrieve_gcs_source_columns(
139137
header_line = line[:first_new_line_index]
140138

141139
# Split to make it an iterable
142-
header_line = header_line.split("\n")
140+
header_line = header_line.split("\n")[:1]
143141

144142
csv_reader = csv.reader(header_line, delimiter=",")
145143
except:
@@ -149,8 +147,8 @@ def _retrieve_gcs_source_columns(
149147

150148
return next(csv_reader)
151149

152-
@classmethod
153-
def _retrieve_bq_source_columns(cls, project: str, bq_table_uri: str) -> List[str]:
150+
@staticmethod
151+
def _retrieve_bq_source_columns(project: str, bq_table_uri: str) -> List[str]:
154152
"""Retrieve the columns from a table on Google BigQuery
155153
156154
Example Usage:

google/cloud/aiplatform/training_jobs.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2918,11 +2918,23 @@ def _run(
29182918
training_task_definition = schema.training_job.definition.automl_tabular
29192919

29202920
if self._column_transformations is None:
2921-
column_transformations = [
2922-
{"auto": {"column_name": column_name}}
2921+
_LOGGER.info(
2922+
"No column transformations provided, so now retrieving columns from dataset in order to set default column transformations."
2923+
)
2924+
2925+
column_names = [
2926+
column_name
29232927
for column_name in dataset.column_names
29242928
if column_name != target_column
29252929
]
2930+
column_transformations = [
2931+
{"auto": {"column_name": column_name}} for column_name in column_names
2932+
]
2933+
2934+
_LOGGER.info(
2935+
"The column transformation of type 'auto' was set for the following columns: %s."
2936+
% column_names
2937+
)
29262938
else:
29272939
column_transformations = self._column_transformations
29282940

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://www.github.com/googleapis/python-aiplatform/commit/9e66508dbf364f51f05daa9415fea06f8367a489

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy