# Optimizing Market Basket Analysis by limiting threshold

I'm creating a suggestion model through MBA.

I observed that in my particular model, that if the min_support was placed as 0, the model would take an insanely long time to run, before crashing.

Place the min_support as 0.6, and no values were generated.

Through trial and error, I came to see that a min_support value of 0.02 hit the sweet spot, giving me 50 to 100 rows to work with.

Is there a way that I can mathematically calculate the optimal min_support value.

I'm not looking for a simple for loop that iterates, recalculating each time and checks the number of rows.

hf =apriori(df,min_support=0.02,use_colnames=True).sort_values(by['support'],ascending=False)
`

In this case hf has 51 rows.