Search code examples
pythonjupyter-notebookazure-databricksipywidgetsdeprecation-warning

DeprecationWarning: The `ipykernel.comm.Comm` class has been deprecated. Please use the `comm` module instead


I'm trying to build recommendation engine using Azure Databricks notebook by using the algorithm from mlxtend library. I'm able to train the model successfully. However, there is a warning during training process as shown in the screenshot below:

enter image description here

I have tried to upgrade ipykernel ipywidgets through %pip install --upgrade ipykernel ipywidgets but the warning still there. May I know how should I do in order to avoid this warning? Thank you.


Solution

  • I have tried the below approach to avoid the below warning:

    enter image description here

    frequent_itemsets = apriori(df.drop(columns=['user_id']), min_support=0.6, use_colnames=True)
    print("Frequent Itemsets:")
    print(frequent_itemsets)
    rules = association_rules(frequent_itemsets, metric="confidence", min_threshold=0.7)
    print("\nAssociation Rules:")
    print(rules[['antecedents', 'consequents', 'support', 'confidence']]
    warnings.filterwarnings("ignore", category=DeprecationWarning, message="DataFrames with non-bool types result in worse computational performance")
    
    

    By adding warnings.filterwarnings(“ignore”),you can suppress the warnings that are being displayed during the training process.

    Results:

    Frequent Itemsets:
       support  itemsets
    0      0.6  (item_A)
    1      0.6  (item_B)
    2      0.6  (item_C)
    3      0.6  (item_D)
    
    Association Rules:
    Empty DataFrame
    Columns: [antecedents, consequents, support, confidence]
    Index: []