Skip to content

Commit

Permalink
Update association_rules.py
Browse files Browse the repository at this point in the history
  • Loading branch information
rasbt authored Jul 2, 2024
1 parent f313efe commit aad9473
Showing 1 changed file with 22 additions and 15 deletions.
37 changes: 22 additions & 15 deletions mlxtend/frequent_patterns/association_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,28 @@
import numpy as np
import pandas as pd

_metrics = ["antecedent support",
"consequent support",
"support",
"confidence",
"lift",
"leverage",
"conviction",
"zhangs_metric",
"jaccard",
"certainty",
"kulczynski"
]


def association_rules(df: pd.DataFrame, metric="confidence", min_threshold=0.8, support_only=False, return_metrics: list = _metrics) -> pd.DataFrame:
_metrics = [
"antecedent support",
"consequent support",
"support",
"confidence",
"lift",
"leverage",
"conviction",
"zhangs_metric",
"jaccard",
"certainty",
"kulczynski",
]


def association_rules(
df: pd.DataFrame,
metric="confidence",
min_threshold=0.8,
support_only=False,
return_metrics: list = _metrics,
) -> pd.DataFrame:
"""Generates a DataFrame of association rules including the
metrics 'score', 'confidence', and 'lift'
Expand Down

0 comments on commit aad9473

Please sign in to comment.