Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def fit_data_source(self, ds):
self.input_column_names = self.input_column_names \
if self.input_column_names is not None else ds.get_feature_names('input_features')
self.output_column_names = self.output_column_names \
if self.output_column_names is not None else ds.get_feature_names('output_features')
transformer_already_initialized = False
try:
if len(list(ds.transformer.feature_len_map.keys())) > 0:
transformer_already_initialized = True
except:
pass
if not transformer_already_initialized:
ds.transformer = Transformer(self.input_column_names, self.output_column_names)
self.encoders = ds.encoders
self.transformer = ds.transformer
if self.output_column_names is not None else ds.get_feature_names('output_features')
self.out_types = ds.out_types
for n, out_type in enumerate(self.out_types):
if out_type == COLUMN_DATA_TYPES.NUMERIC:
ds.encoders[self.output_column_names[n]].extra_outputs = len(self.quantiles) - 1
transformer_already_initialized = False
try:
if len(list(ds.transformer.feature_len_map.keys())) > 0:
transformer_already_initialized = True
except:
pass
if not transformer_already_initialized:
ds.transformer = Transformer(self.input_column_names, self.output_column_names)
self.encoders = ds.encoders
self.transformer = ds.transformer