#!/usr/bin/env python # coding: utf-8 # In[1]: import pandas as pd data = pd.read_csv('delaware_anomaly.csv') # In[2]: data.head() # In[7]: data['MERCHANT'].value_counts() # In[3]: data.shape # In[4]: data.dtypes # In[13]: from pycaret.anomaly import * s = setup(data, session_id = 123, ignore_features = ['CAT_DESCR'], high_cardinality_features= ['MERCHANT'], numeric_features = ['FISCAL_YEAR', 'FISCAL_PERIOD' ]) # In[14]: get_config('X').columns # In[15]: iforest = create_model('iforest') # In[16]: r = assign_model(iforest) r.head() # In[21]: r['Anomaly_Score'].hist(bins=100, figsize=(10,6)) # In[ ]: