In [1]:
import sys
sys.path.append("../..")
In [9]:
import devahp as devahp
import all_user_nish_excel as nishinput
import numpy as np
import pandas as pd
from ahptree import AhpTree
from plotly.offline import plot
from plotly.offline import download_plotlyjs, init_notebook_mode, iplot
import plotly.graph_objs as go
init_notebook_mode()
In [3]:
nish_data = nishinput.from_nish_excel("nish_data.xlsx")
In [7]:
ahp = AhpTree(pw=nish_data)
ahp.add_alt("do")
ahp.add_alt("not")
ahp.get_node(["bleeding"]).set_alt_scores([0.9, 0.1])
ahp.get_node(["sore throat"]).set_alt_scores([1, .1])
ahp.get_node(["gp"]).set_alt_scores([1., 5])
ahp.get_node(["qol"]).set_alt_scores([2., 4])
ahp.get_node(["breath"]).set_alt_scores([1.,1])
In [8]:
ahp.synthesize(user='L1')
Out[8]:
This means the user 'L1' prefers do vs not by a factor of 2+
In [15]:
demographics = pd.read_excel('nish_data.xlsx', sheetname='Weight', skiprows=3)
demographics.head()
Out[15]:
In [29]:
treatment2users = demographics['Pat ID'][demographics['Treatment '] == 2]
In [39]:
treatment2usersResults = [ahp.synthesize(user) for user in treatment2users]
#Turn into a dataframe to make it pretty
dos = [result[0] for result in treatment2usersResults]
donts = [result[1] for result in treatment2usersResults]
treatment2df=pd.DataFrame({'Do':dos, 'Do Not':donts}, index=treatment2users)
treatment2df.head()
Out[39]:
I'm interested if any treatment 2 users prefered 'Do Not'
In [42]:
preferDoNot = treatment2df['Do'] < treatment2df['Do Not']
treatment2df.loc[preferDoNot,:]
Out[42]:
Okay, there are a few, let's look at the other way around
In [43]:
preferDo = treatment2df['Do'] >= treatment2df['Do Not']
treatment2df.loc[preferDo,:]
Out[43]:
In [ ]: