Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'min': 0,
'max': 5
},
{
"name": 1,
"type": 'categorical',
"size": 3,
"i2s": ['A', 'B', 'C']
}
]
categorical_columns = [1]
ordinal_columns = []
# Run
result = Transformer.get_metadata(data, categorical_columns, ordinal_columns)
# Check
assert result == expected_result
def fit(self, data, categoricals=tuple(), ordinals=tuple()):
self.data = data.copy()
self.meta = Transformer.get_metadata(data, categoricals, ordinals)
def fit(self, data, categorical_columns=tuple(), ordinal_columns=tuple()):
self.dtype = data.dtype
self.shape = data.shape
self.meta = Transformer.get_metadata(data, categorical_columns, ordinal_columns)
def fit(self, data, categorical_columns=tuple(), ordinal_columns=tuple()):
self.data = data.copy()
self.meta = Transformer.get_metadata(data, categorical_columns, ordinal_columns)
def fit(self, data, categorical_columns=tuple(), ordinal_columns=tuple()):
self.dtype = data.dtype
self.meta = Transformer.get_metadata(data, categorical_columns, ordinal_columns)
self.models = []
for id_, info in enumerate(self.meta):
if info['type'] == CONTINUOUS:
model = GaussianMixture(self.gmm_n)
model.fit(data[:, [id_]])
self.models.append(model)
else:
nomial = np.bincount(data[:, id_].astype('int'), minlength=info['size'])
nomial = nomial / np.sum(nomial)
self.models.append(nomial)