def main(argv): try: workDirResponsive = argv[0] workDirPrivilege = argv[1] numTestInstances = argv[2] numTrainInstances = argv[3] estimation_factor = float(numTestInstances) / float(numTrainInstances) cMatrix = cm() cMatrix.setCostMatrix(float(argv[4]), float(argv[5]), float(argv[6]), float(argv[7]), float(argv[8]), float(argv[9])) cMatrix.setAlpha(float(argv[10])) cmv = cMatrix.getCostMatrix() ccm = computeCm() ccm.get_mcDocumentMatrix( workDirResponsive + '/pickleFiles/ds-op-label.tuple.dictionary.' + str(numTrainInstances) + '.p', workDirResponsive + '/trainf.count.lables.dat', workDirPrivilege + '/pickleFiles/ds-op-label.tuple.dictionary.' + str(numTrainInstances) + '.p', workDirPrivilege + '/trainf.count.lables.dat', cmv) dMatrix = ccm.get_finalDocMatrix(estimation_factor) Misclassification_cost = ccm.compute(dMatrix, cmv) print "The misclassification cost is: ", Misclassification_cost except: raise
def main(argv): try: p2 = phase2() wd = argv[ 0] # Joint Cost Model's Working Directory (Resp and Priv Category ) workDirResponsive = argv[1] # Responsive Category Working Directory ' workDirPrivilege = argv[2] # Privilege Category Working Directory ' numTestInstances = argv[3] rJFile = argv[4] cMatrix = cm() cMatrix.setCostMatrix(float(argv[5]), float(argv[6]), float(argv[7]), float(argv[8]), float(argv[9]), float(argv[10])) cMatrix.setAlpha(float(argv[11])) cmv = cMatrix.getCostMatrix() lamR = cMatrix.getLam_r() p2.computeExpectation( wd, numTestInstances, cmv, lamR, workDirResponsive + '/pickleFiles/ds-op-label.tuple.dictionary.' + str(numTestInstances) + '.p', workDirPrivilege + '/pickleFiles/ds-op-label.tuple.dictionary.' + str(numTestInstances) + '.p') tau_rValue = p2.runphase2( workDirResponsive + '/pickleFiles/ds-op-label.tuple.dictionary.' + str(numTestInstances) + '.p', workDirPrivilege + '/pickleFiles/ds-op-label.tuple.dictionary.' + str(numTestInstances) + '.p', rJFile, wd, numTestInstances, 0) except: raise
def main(argv): try: p1 = phase1() wDir = argv[ 0] # Joint Cost Model's Working Directory (Specific Resp and Priv Cat , and) '/Users/jyothi/Documents/Research/jvdofs/rcv1v2/results' #arg[0] workDirResponsive = argv[ 1] # Responsive WD '/Users/jyothi/Documents/Research/jvdofs/rcv1v2/results/C15' #argv[1] workDirPrivilege = argv[ 2] # Privilege WD '/Users/jyothi/Documents/Research/jvdofs/rcv1v2/results/C17' # argv[2] numTestInstances = argv[3] # 10000#argv[3] cMatrix = cm() cMatrix.setCostMatrix(float(argv[4]), float(argv[5]), float(argv[6]), float(argv[7]), float(argv[8]), float(argv[9])) cMatrix.setAlpha(float(argv[10])) cmv = cMatrix.getCostMatrix() p1.classifyDocuments( wDir, workDirResponsive + '/pickleFiles/ds-op-label.tuple.dictionary.' + str(numTestInstances) + '.p', workDirPrivilege + '/pickleFiles/ds-op-label.tuple.dictionary.' + str(numTestInstances) + '.p', numTestInstances, cmv, reclassify=False) except: raise
def main(argv): try: urbaseline = UncertainityRankingBaseline() responsiveWD = argv[0] privilegeWD = argv[1] wd = argv[2] rJf = argv[3] pJf = argv[4] numTestInstances = argv[5] print "Starting Uncertainity Ranking Baseline Model " cMatrix = cm() cMatrix.setCostMatrix(float(argv[6]), float(argv[7]), float(argv[8]), float(argv[9]), float(argv[10]), float(argv[11])) cMatrix.setAlpha(float(argv[12])) cmv = cMatrix.getCostMatrix() urbaseline.run( responsiveWD + '/pickleFiles/ds-op-label.tuple.dictionary.' + str(numTestInstances) + '.p', privilegeWD + '/pickleFiles/ds-op-label.tuple.dictionary.' + str(numTestInstances) + '.p', wd, wd + '/tauR_value.' + str(numTestInstances) + '.p', wd + '/tauP_value.' + str(numTestInstances) + '.p', rJf, pJf, numTestInstances, cmv) except: raise
def main(argv): try: wd=argv[0] rJf=argv[1] pJf=argv[2] testSetSize=argv[3] cMatrix=cm() cMatrix.setCostMatrix(float(argv[4]),float(argv[5]),float(argv[6]),float(argv[7]),float(argv[8]),float(argv[9])) cMatrix.setAlpha(float(argv[10])) cmv=cMatrix.getCostMatrix() baselineCall=FAB() baselineCall.setJudgments(pJf,rJf) baselineCall.compute_cost(wd+'/docid-D_P-risk.dictionary.'+str(testSetSize)+'.p',wd+'/docid-D_L-risk.dictionary.'+str(testSetSize)+'.p',wd+'/docid-D_W-risk.dictionary.'+str(testSetSize)+'.p',cmv) except: raise
def main(argv): try: wd=argv[0]#'/Users/jyothi/Documents/Research/jvdofs/results/temp/C15C17/' rJf=argv[1]#'/Users/jyothi/Documents/Research/jvdofs/rcv1v2/datFiles/rcv1_C15.txt' pJf=argv[2]#'/Users/jyothi/Documents/Research/jvdofs/rcv1v2/datFiles/rcv1_C17.txt' testSetSize=argv[3] cMatrix=cm() cMatrix.setCostMatrix(float(argv[4]),float(argv[5]),float(argv[6]),float(argv[7]),float(argv[8]),float(argv[9])) cMatrix.setAlpha(float(argv[10])) cmv=cMatrix.getCostMatrix() baselineCall=FAB() baselineCall.setJudgments(pJf,rJf) baselineCall.compute_cost(wd+'/docid-D_P-risk.dictionary.'+str(testSetSize)+'.p',wd+'/docid-D_L-risk.dictionary.'+str(testSetSize)+'.p',wd+'/docid-D_W-risk.dictionary.'+str(testSetSize)+'.p',cmv) except: raise
def main(argv): try: wd= argv[0] # Joint Cost Model's Working Directory (Specific Resp and Priv Cat ) numTestInstances=argv[1] # 10000#argv[3] cMatrix=cm() cMatrix.setCostMatrix(float(argv[2]),float(argv[3]),float(argv[4]),float(argv[5]),float(argv[6]),float(argv[7])) cMatrix.setAlpha(float(argv[8])) lamR=cMatrix.getLam_r() lamP=cMatrix.getLam_p() cca=computeCa() cca.set_tauP(wd+'/tauP_value.'+str(numTestInstances)+'.p') cca.set_tauR(wd+'/tauR_value.'+str(numTestInstances)+'.p') annotation_cost = cca.compute(lamR,cca.get_tauR(),lamP,cca.get_tauP()) print "The total annotation cost is: ", annotation_cost print "RESULTVALUE ",annotation_cost except: raise
def p1caller(pl, pw, lp, lw, wp, wl, alpha): try: costMatrix = cm() costMatrix.setCostMatrix(float(pl), float(pw), float(lp), float(lw), float(wp), float(wl)) costMatrix.setAlpha(float(alpha.strip())) cmvalue = costMatrix.getCostMatrix() p1 = phase1() twd = '/app/data' p1.classifyDocuments( twd, twd + '/GPOL-ds-op-label.tuple.dictionary.20000.p', twd + '/ECAT-ds-op-label.tuple.dictionary.20000.p', 20000, cmvalue, reclassify=False) except: raise
def p3caller(pl, pw, lp, lw, wp, wl, alpha, lambda_P): try: costMatrix = cm() costMatrix.setCostMatrix(float(pl), float(pw), float(lp), float(lw), float(wp), float(wl)) costMatrix.setAlpha(float(alpha.strip())) cmvalue = costMatrix.getCostMatrix() lamP = float(lambda_P) twd = '/app/data' p3 = phase3() p3.computeExpectation( twd, 20000, cmvalue, lamP, twd + '/ECAT-ds-op-label.tuple.dictionary.20000.p') Tau_pValue = p3.runphase3( twd + '/ECAT-ds-op-label.tuple.dictionary.20000.p', twd + '/rcv1_ECAT.txt', twd, 20000, 0) return Tau_pValue except: raise
def p2caller(pl, pw, lp, lw, wp, wl, alpha, lambda_R): try: costMatrix = cm() costMatrix.setCostMatrix(float(pl), float(pw), float(lp), float(lw), float(wp), float(wl)) costMatrix.setAlpha(float(alpha.strip())) cmvalue = costMatrix.getCostMatrix() lamR = lambda_R p2 = phase2() twd = '/app/data' p2.computeExpectation( twd, 20000, cmvalue, lamR, twd + '/GPOL-ds-op-label.tuple.dictionary.20000.p', twd + '/ECAT-ds-op-label.tuple.dictionary.20000.p') Tau_rValue = p2.runphase2( twd + '/GPOL-ds-op-label.tuple.dictionary.20000.p', twd + '/ECAT-ds-op-label.tuple.dictionary.20000.p', twd + '/rcv1_GPOL.txt', twd, 20000, 0) return Tau_rValue except: raise
def main(argv): try: p1 = phase1() wDir = argv[0] workDirResponsive = argv[1] workDirPrivilege = argv[2] numTestInstances = argv[3] cMatrix = cm() cMatrix.setCostMatrix(float(argv[4]), float(argv[5]), float(argv[6]), float(argv[7]), float(argv[8]), float(argv[9])) cMatrix.setAlpha(float(argv[10])) cmv = cMatrix.getCostMatrix() p1.classifyDocuments( wDir, workDirResponsive + '/pickleFiles/ds-op-label.tuple.dictionary.' + str(numTestInstances) + '.p', workDirPrivilege + '/pickleFiles/ds-op-label.tuple.dictionary.' + str(numTestInstances) + '.p', numTestInstances, cmv, reclassify=False) except: raise
def main(argv): try: p3 = phase3() wd = argv[ 0] # Joint Cost Model's Working Directory (Specific Resp and Priv Cat ) workDirResponsive = argv[1] # Responsive WD ' workDirPrivilege = argv[2] # Privilege WD ' numTestInstances = argv[3] pJFile = argv[4] cMatrix = cm() cMatrix.setCostMatrix(float(argv[5]), float(argv[6]), float(argv[7]), float(argv[8]), float(argv[9]), float(argv[10])) cMatrix.setAlpha(float(argv[11])) cmv = cMatrix.getCostMatrix() lamP = cMatrix.getLam_p() p3.computeExpectation( wd, numTestInstances, cmv, lamP, workDirPrivilege + '/pickleFiles/ds-op-label.tuple.dictionary.' + str(numTestInstances) + '.p') p3.runphase3( workDirPrivilege + '/pickleFiles/ds-op-label.tuple.dictionary.' + str(numTestInstances) + '.p', pJFile, wd, numTestInstances, 0) except: raise
def ComputeManualAnnotationCost(self,TAUr,TAUp): cmobj=cm() lam_r=cmobj.getLam_r() lam_p=cmobj.getLam_p() return (lam_r * TAUr + lam_p * TAUp)