Untitled
unknown
plain_text
2 years ago
5.5 kB
3
Indexable
pred_data: ticket_category ticket_type ticket_item ticket_summary \ 0 Application HCM - OPM Administration Application Function error ticket_severity resolution_sla_violated created_date 0 2 - Major\t False 2018-09-28 16:29:45 row: ticket_category ticket_type ticket_item ticket_summary ticket_severity \ 0 0 0 0 0 0 resolution_sla_violated 0 0 New Data ticket_category ticket_type ticket_item ticket_summary ticket_severity \ 0 0 0 0 0 0 resolution_sla_violated 0 0 Similarity Matrix: [[0. 0. 0. 1. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.] [0. 0. 0. 0. 1. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.] [0. 0. 0. 0. 0. 1. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.] [0. 0. 0. 0. 0. 0. 1. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.] [0. 0. 0. 0. 0. 0. 0. 1. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.] [0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 1. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]] Similar Indices (array([0, 1, 2, 3, 4, 5]), array([ 3, 4, 5, 6, 7, 16])) Similar Row Indices [0 1 2 3 4 5] Predicted Output person_who_resolved owner_user_id role_name 0 Tanvir Mirkar 104 L2 Support 1 Tanvir Mirkar 104 L2 Support 2 Tanvir Mirkar 104 L2 Support 3 Tanvir Mirkar 104 L2 Support 4 Tanvir Mirkar 104 L2 Support 5 Tanvir Mirkar 104 L2 Support Recommended users for the ticket are- Recommendation 1: User Tanvir Mirkar, Owner User ID 104, Role Name L2 Support Recommendation 2: User Tanvir Mirkar, Owner User ID 104, Role Name L2 Support Recommendation 3: User Tanvir Mirkar, Owner User ID 104, Role Name L2 Support Recommendation 4: User Tanvir Mirkar, Owner User ID 104, Role Name L2 Support Recommendation 5: User Tanvir Mirkar, Owner User ID 104, Role Name L2 Support Recommendation 6: User Tanvir Mirkar, Owner User ID 104, Role Name L2 Support If you see here, the original data was- Application HCM - OPM Administration Application Function error 2 - Major False 0 Roshni Gangrade 983 L2 Support So when we tested the response it gave the name as Tanvir Mirkar which seems to be totally incorrect . The main problem is here - row: ticket_category ticket_type ticket_item ticket_summary ticket_severity \ 0 0 0 0 0 0 resolution_sla_violated 0 0 where the input data is encoded so every time it gives 0 0 for every field which eventually returns Tanvir Mirkar as the 1st entry. I have shared the codes for get_top_persons_resolved and API code as well , The get_top_persons_resolved takes input , redirects to feature_engineering() function which is as this- import pandas as pd from sklearn.preprocessing import LabelEncoder import numpy as np import pdb def feature_engineering(data): ## Creating a dictionary #pdb.set_trace() input_data= data # Convert the 'creation_date' and 'resolution_date' columns to datetime input_data['created_date']=pd.to_datetime(input_data['created_date']) #input_data['ticket_resolution_date']=pd.to_datetime(input_data['ticket_resolution_date']) #input_data['ticket_resolution_time']=input_data.apply(lambda row:row['ticket_resolution_date']-row['created_date'],axis=1) #input_data['ticket_resolution_time'] =input_data['ticket_resolution_time'].apply(lambda x: x.total_seconds() / 3600) ## removing three columns and getting a final dataframe for building input_data.drop(columns=['created_date'],axis=1,inplace=True) ## Performing Encoding for Categorical Columns- label_enc= LabelEncoder() input_data['ticket_category']=label_enc.fit_transform(input_data['ticket_category']) input_data['ticket_type']=label_enc.fit_transform(input_data['ticket_type']) input_data['ticket_item']=label_enc.fit_transform(input_data['ticket_item']) input_data['ticket_severity']=label_enc.fit_transform(input_data['ticket_severity']) input_data['ticket_summary']=label_enc.fit_transform(input_data['ticket_summary']) input_data['resolution_sla_violated'] = label_enc.fit_transform(input_data['resolution_sla_violated']) return input_data Now can you tell what changes can be done in order to avoid this issue after encoding and get correct prediction.
Editor is loading...