mirror of
https://github.com/Doctorado-ML/Stree_datasets.git
synced 2025-08-15 15:36:01 +00:00
Rename fs method
This commit is contained in:
@@ -15,8 +15,8 @@ def header(filter_name):
|
||||
for item in ["Normal", "Discret.", filter_name.upper()]:
|
||||
initial += f"{item:10s} "
|
||||
sec_line += "=" * 10 + " "
|
||||
initial += "Reduction"
|
||||
sec_line += "========="
|
||||
initial += "Reduction Features selected"
|
||||
sec_line += "========= " + "=" * 30
|
||||
print(initial)
|
||||
print(sec_line)
|
||||
|
||||
@@ -26,23 +26,24 @@ if len(sys.argv) > 1:
|
||||
filter_name = sys.argv[1]
|
||||
else:
|
||||
filter_name = "cfs"
|
||||
if filter_name not in ["cfs", "fcbs"]:
|
||||
print("First parameter has to be one of: {cfs, fcbs}")
|
||||
if filter_name not in ["cfs", "fcbf"]:
|
||||
print("First parameter has to be one of: {cfs, fcbf}")
|
||||
datasets = Datasets(False, False, "tanveer")
|
||||
header(filter_name)
|
||||
better = worse = equal = 0
|
||||
for dataset in datasets:
|
||||
mdlp = MDLP(random_state=1)
|
||||
X, y = datasets.load(dataset[0])
|
||||
mfs = MFS()
|
||||
mfs = MFS(discrete=True)
|
||||
now_disc = time.time()
|
||||
X_disc = mdlp.fit_transform(X, y)
|
||||
# X_disc = X
|
||||
time_disc = time.time() - now_disc
|
||||
now_selec = time.time()
|
||||
if filter_name == "cfs":
|
||||
features_selected = mfs.cfs(X_disc, y).get_results()
|
||||
else:
|
||||
features_selected = mfs.fcbs(X_disc, y, 5e-2).get_results()
|
||||
features_selected = mfs.fcbf(X_disc, y, 5e-2).get_results()
|
||||
time_selec = time.time() - now_selec
|
||||
output = ""
|
||||
odte_score = stree_score = 0.0
|
||||
@@ -60,5 +61,6 @@ for dataset in datasets:
|
||||
output = f"{dataset[0]:30s} {time_disc:7.3f} {time_selec:7.3f} "
|
||||
output += f"{score_norm:.8f} "
|
||||
output += f"{score_disc:.8f} {score_fs:.8f} "
|
||||
output += f"{X.shape[1]:3} - {len(features_selected):3}"
|
||||
output += f"{X.shape[1]:3} - {len(features_selected):3} "
|
||||
output += f"{features_selected}"
|
||||
print(output)
|
||||
|
Reference in New Issue
Block a user