Skip to content

Commit 1fafeb5

Browse files
committed
clean more code.
1 parent 3f56ded commit 1fafeb5

File tree

5 files changed

+616
-632
lines changed

5 files changed

+616
-632
lines changed

fslite/fs/constants.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,13 @@ def get_fs_univariate_methods() -> List:
7979
Get the list of univariate methods implemented in the library
8080
:return: list
8181
"""
82-
return get_fs_method_by_class["univariate"]
82+
return get_fs_method_by_class("univariate")
83+
84+
def get_fs_multivariate_methods() -> List:
85+
return get_fs_method_by_class("multivariate")
86+
87+
def get_fs_ml_methods() -> List:
88+
return get_fs_method_by_class("ml")
8389

8490

8591
def is_valid_univariate_method(method_name: str) -> bool:

fslite/fs/methods.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
from abc import ABC, abstractmethod
22
from typing import List, Type, Union, Tuple, Optional, Dict, Any
33

4-
from fslite.fs.constants import ML_METHODS, UNIVARIATE_METHODS, MULTIVARIATE_METHODS
5-
from fslite.fs.core import FSDataFrame
4+
from fslite.fs.constants import FS_METHODS, get_fs_multivariate_methods, get_fs_ml_methods
5+
from fslite.fs.fdataframe import FSDataFrame
66
from fslite.fs.ml import MLCVModel
77
from fslite.fs.multivariate import multivariate_filter
88
from fslite.fs.univariate import univariate_filter
@@ -88,7 +88,7 @@ class FSUnivariate(FSMethod):
8888
kwargs (dict): Additional keyword arguments for the feature selection method.
8989
"""
9090

91-
valid_methods = list(UNIVARIATE_METHODS.keys())
91+
valid_methods = list(FS_METHODS.keys())
9292

9393
def __init__(self, fs_method: str, **kwargs):
9494
"""
@@ -161,7 +161,7 @@ class FSMultivariate(FSMethod):
161161
selected_features = fs_multivariate.select_features(fsdf)
162162
"""
163163

164-
valid_methods = list(MULTIVARIATE_METHODS.keys())
164+
valid_methods = list(get_fs_multivariate_methods())
165165

166166
def __init__(self, fs_method: str, **kwargs):
167167
"""
@@ -225,7 +225,7 @@ class FSMLMethod(FSMethod):
225225
kwargs (dict): Additional keyword arguments for the feature selection method.
226226
"""
227227

228-
valid_methods = list(ML_METHODS.keys())
228+
valid_methods = list(get_fs_ml_methods())
229229
_ml_model: MLCVModel = None
230230

231231
def __init__(

0 commit comments

Comments
 (0)