OneCompiler

transactions

106

Validate.html

<!DOCTYPE html> <html > <head> <title>Document</title> </head> <body> <script> function validateForm(username, password) { if (username.length < 3 || password.length < 6) { return false; } else { return true; } } let username = prompt(“Please enter your username”); let password = prompt(“Please enter your password”); if (validateForm(username, password)) { alert(“You have successfully logged in!”); } else { alert(“Sorry, your username or password was invalid.”); } </script> </body> </html>

Items=[‘item1’,’item2’,’item3’,’item4’]
Transactions=[[‘item1’,‘item2’,‘item3’],
[‘item2’,‘item3’],
[‘item1’,‘item2’,‘item4’],
[‘item1’,‘item4’],
[‘item2’,‘item3’,‘item4’],
[‘item1’,‘item3’,‘item4’],
[‘item1’,‘item2’],
[‘item1’,‘item3’],
[‘item3’,‘item4’],
[‘item2’,‘item4’]
]
Frommlxtend.preprocessingimportTransactionEncoder
Frommlxtend.frequent_patternsimportapriori,association_rules
#Convertthetransacti
onsintoabinarymatrix
Te=TransactionEncoder()
Te_ary=te.fi
t_transform(transacti
ons)
#ConvertthebinarymatrixintoapandasDataFrame
Df=pd.DataFrame(te_ary,col
umns=te.columns_)
#Generatefrequentitemsetswithaminimumsupportof0.3
Frequent_i
temsets=apriori
(df,min_support=0.
#Generateassociati
3,use_colnames=True)
onruleswithaminimumconfidenceof0.7
Associati
on_rules=associati
on_rules(frequent_i
min_threshol
d=0.7)
#Printthefrequenti
temsets,metri
c=”confidence”,
temsetsandassociationrul
es
Print(fr
equent_itemsets)
Print(associ
ation_rul
es)