Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Fuminides committed Oct 7, 2024
1 parent e3ebb1b commit 95983f4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
7 changes: 4 additions & 3 deletions Demos/demos_module/iris_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@

runner = 1 # 1: single thread, 2+: corresponding multi-thread

n_gen = 20
n_gen = 10
n_pop = 50

nRules = 10
nAnts = 7
nAnts = 3
tolerance = 0.001

iris = datasets.load_iris()
Expand All @@ -72,7 +72,8 @@
fl_classifier.fit(X_train, y_train, n_gen=n_gen, pop_size=n_pop, checkpoints=0, random_state=0)

# print(vis_rules.rules_to_latex(fl_classifier.rule_base))
str_rules = eval_tools.eval_fuzzy_model(fl_classifier, X_train, y_train, X_test, y_test,
fuzzy_evaluator = eval_tools.FuzzyEvaluator(fl_classifier)
str_rules = fuzzy_evaluator.eval_fuzzy_model(X_train, y_train, X_test, y_test,
plot_rules=False, print_rules=True, plot_partitions=True, return_rules=True)
rule_matrix = fl_classifier.rule_base.get_rulebase_matrix()

Expand Down
7 changes: 4 additions & 3 deletions ex_fuzzy/ex_fuzzy/eval_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def get_metric(self,metric:str,X_true:np.array,y_true:np.array,**kwargs):
'''
#Get y predictions
y_pred = self.predict(X_true)

y_true = np.array(y_true)
#Convert str classes to numbers in corresponding class if necessary
unique_classes = self.fl_classifier.classes_names

Expand All @@ -55,6 +55,7 @@ def get_metric(self,metric:str,X_true:np.array,y_true:np.array,**kwargs):
except TypeError:
return f"Invalid arguments passed for the metric '{metric}'."


def eval_fuzzy_model(self,X_train: np.array, y_train: np.array,X_test: np.array, y_test: np.array,
plot_rules=True, print_rules=True, plot_partitions=True,
return_rules=False, print_accuracy=True, print_matthew=True, export_path:str=None) -> None:
Expand Down Expand Up @@ -89,10 +90,10 @@ def eval_fuzzy_model(self,X_train: np.array, y_train: np.array,X_test: np.array,
if print_matthew:
print('MATTHEW CORRCOEF')
print('Train performance: ' +
str(self.get_metric('mattews_corrcoef',X_train,y_train))
str(self.get_metric('matthews_corrcoef',X_train,y_train))
)
print('Test performance: ' +
str(self.get_metric('mattews_corrcoef',X_test,y_test))
str(self.get_metric('matthews_corrcoef',X_test,y_test))
)
print('------------')

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
URL = "https://github.com/Fuminides/ex-fuzzy"
LICENSE = "GPL-3.0"
DOWNLOAD_URL = "https://pypi.org/project/ex-fuzzy/"
VERSION = "1.5.2"
VERSION = "1.5.2b"
INSTALL_REQUIRES = ["numpy", "networkx", "matplotlib", "pymoo", "pandas", "scikit-learn"]
CLASSIFIERS = [
"Development Status :: 4 - Beta",
Expand Down

0 comments on commit 95983f4

Please sign in to comment.