mirror of
https://github.com/Doctorado-ML/FImdlp.git
synced 2025-08-17 16:35:52 +00:00
Add get_states_feature method
This commit is contained in:
@@ -119,15 +119,6 @@ class FImdlp(TransformerMixin, BaseEstimator):
|
|||||||
else:
|
else:
|
||||||
result[:, feature] = X
|
result[:, feature] = X
|
||||||
|
|
||||||
def range_features(self):
|
|
||||||
res = []
|
|
||||||
for i in range(self.n_features_in_):
|
|
||||||
if i in self.features_:
|
|
||||||
res.append(list(range(len(self.cut_points_[i]))))
|
|
||||||
else:
|
|
||||||
res.append([])
|
|
||||||
return res
|
|
||||||
|
|
||||||
def transform(self, X):
|
def transform(self, X):
|
||||||
"""Discretize X values.
|
"""Discretize X values.
|
||||||
Parameters
|
Parameters
|
||||||
@@ -186,6 +177,23 @@ class FImdlp(TransformerMixin, BaseEstimator):
|
|||||||
result.append(self.cut_points_[feature])
|
result.append(self.cut_points_[feature])
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
def get_states_feature(self, feature):
|
||||||
|
"""Return the states a feature can take
|
||||||
|
|
||||||
|
Parameters
|
||||||
|
----------
|
||||||
|
feature : int
|
||||||
|
feature to get the states
|
||||||
|
|
||||||
|
Returns
|
||||||
|
-------
|
||||||
|
list
|
||||||
|
states of the feature
|
||||||
|
"""
|
||||||
|
if feature in self.features_:
|
||||||
|
return list(range(len(self.cut_points_[feature]) + 1))
|
||||||
|
return None
|
||||||
|
|
||||||
def join_fit(self, features, target, data):
|
def join_fit(self, features, target, data):
|
||||||
"""Join the selected features with the labels and fit the discretizer
|
"""Join the selected features with the labels and fit the discretizer
|
||||||
of the target variable
|
of the target variable
|
||||||
|
Reference in New Issue
Block a user