From 16c7906bdd7a1f2a43672c6a346dd0776705253b Mon Sep 17 00:00:00 2001 From: ombhojane Date: Thu, 26 Sep 2024 09:04:23 +0530 Subject: [PATCH] added SVM to tests --- explainableai/model_selection.py | 8 ++++++-- ...est_xai_wrapper.cpython-311-pytest-8.0.2.pyc | Bin 0 -> 31553 bytes tests/test_xai_wrapper.py | 6 ++++-- 3 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 tests/__pycache__/test_xai_wrapper.cpython-311-pytest-8.0.2.pyc diff --git a/explainableai/model_selection.py b/explainableai/model_selection.py index aaded6d..b00ebbb 100644 --- a/explainableai/model_selection.py +++ b/explainableai/model_selection.py @@ -9,14 +9,18 @@ import matplotlib.pyplot as plt import numpy as np -def compare_models(X_train, y_train, X_test, y_test): - models = { +def get_default_models(): + return { 'Logistic Regression': LogisticRegression(max_iter=1000), 'Random Forest': RandomForestClassifier(n_estimators=100, random_state=42), 'SVM': SVC(probability=True, random_state=42), 'XGBoost': XGBClassifier(n_estimators=100, random_state=42), 'Neural Network': MLPClassifier(hidden_layer_sizes=(100, 50), max_iter=1000, random_state=42) } + +def compare_models(X_train, y_train, X_test, y_test, models=None): + if models is None: + models = get_default_models() results = {} for name, model in models.items(): diff --git a/tests/__pycache__/test_xai_wrapper.cpython-311-pytest-8.0.2.pyc b/tests/__pycache__/test_xai_wrapper.cpython-311-pytest-8.0.2.pyc new file mode 100644 index 0000000000000000000000000000000000000000..ea47f2c59b7a39b82235fe6d9c5f8aae6f184510 GIT binary patch literal 31553 zcmeHQZ;Ttqb>AhI|H;$+v;J9;PLgHmZ0jP)lKkKC$+Dfqwi??_YhP@$)GhB!iN`zd zQkHZf+p}RHPNJepo5Vunv}%etR;&W~&;l;dqH({}A4!!56I%!fP_&4FemFx35cpGn zZyt9zJ0wphOAc&Ud&_q-Z{B+|J3G7k-n=)vKg(p22DXbY{$}dGh79AsDdTU6R^rmX zn1=DXVH>ttG$u^(KQt4b44KA^H4!nnBsvilC9#RP_@9_a;(w@^n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