Skip to content

Commit

Permalink
cambio de plot_performance_difference_metrics a plot_difference_multiple
Browse files Browse the repository at this point in the history
  • Loading branch information
NavaSergio committed Jul 10, 2024
1 parent 22818b5 commit 67c96f7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
14 changes: 3 additions & 11 deletions CompStats/performance.py
Original file line number Diff line number Diff line change
Expand Up @@ -529,8 +529,8 @@ def plot_difference2(diff_dictionary: dict,
if hue is not None:
df2[hue] = True
at_least_one = False
for key, (left, _) in diff_dictionary['CI'].items():
if left < 0:
for key, (left, right) in diff_dictionary['CI'].items():
if left < 0 < right:
rows = df2[var_name] == key
df2.loc[rows, hue] = False
at_least_one = True
Expand Down Expand Up @@ -614,22 +614,14 @@ def plot_difference_multiple(results_dict, CI=0.05, capsize=0.2, linestyle='none
:param kind: Type of the plot, e.g., 'point', 'bar'.
:param kwargs: Additional keyword arguments for seaborn.catplot.
"""
for metric_name, metric_results in results_dict.items():
for metric_name, metric_results in results_dict['winner'].items():
# Usa catplot para crear y mostrar el gráfico
g = plot_difference2(metric_results)
g.figure.suptitle(metric_name)
# plt.show()



def plot_difference_scatter_multiple(results_dict,algorithm: str):
dict = {}
for metric_name, metric_results in results_dict.items():
# Usa catplot para crear y mostrar el gráfico
g = plot_difference2(metric_results)
g.figure.suptitle(metric_name)
# plt.show()


### este por el momento no.
def plot_scatter_matrix(perf):
Expand Down
3 changes: 3 additions & 0 deletions CompStats/tests/test_performance.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
from CompStats.performance import performance, plot_performance, difference, plot_difference, all_differences
from CompStats.performance import performance_multiple_metrics, plot_performance2, plot_performance_difference_multiple
from CompStats.performance import difference_multiple, plot_scatter_matrix, unique_pairs_differences, plot_performance_multiple
from CompStats.performance import plot_performance_difference_multiple, plot_difference2, plot_difference_multiple



DATA = os.path.join(os.path.dirname(__file__), 'data.csv')
Expand Down Expand Up @@ -89,6 +91,7 @@ def test_difference_multiple():
perf = performance_multiple_metrics(df, "y", metrics)
diff = difference_multiple(perf)
ins = plot_performance_difference_multiple(diff)
ins = plot_difference_multiple(diff)
assert diff['winner']['accuracy_score']['best'] == 'BoW'
assert 'BoW' not in diff['winner']['accuracy_score']['diff'].keys()
# assert isinstance(ins, sns.FacetGrid)
Expand Down

0 comments on commit 67c96f7

Please sign in to comment.