no = int(noLimit[0])
MAX_SAMPLES = int(sampleLimit[0])

f = open('Output/AdaBoostPropertyTestOutputFile.txt', 'w')
f.write("\n")
f.write("Execution result of AdaBoost with property based testing approach:\n")

#AdaBoostAdult model evaluation
cexFlag = False
execTime = 0
failed_trials = 0
#Reading the dataset
df = pd.read_csv('Datasets/AdultMod.csv')
for i in tqdm(range(no)):
    start_time = time.time()
    cexPair, failedAtt = quickTestMlAt.funcMain(MAX_SAMPLES, 'AdaBoostAdult',
                                                df)
    execTime = execTime + (time.time() - start_time)
    failed_trials = failed_trials + failedAtt

    if ((len(cexPair) >= 1) & (cexFlag == False)):
        f.write("\n")
        f.write("Counter example pair is:\n")
        f.write(str(cexPair))
        cexFlag = True

execTime = execTime / no
failed_trials = round(failed_trials / no)

f.write("\n")
f.write("Execution time of AdaBoostAdult model is:\n")
f.write(str(execTime))

f = open('Output/NBPropertyTestOutputFile.txt', 'w')
f.write("\n")
f.write("Execution result of NB with property based testing approach:\n")


#NBAdult model evaluation
cexFlag = False
execTime = 0
failed_trials = 0
#Reading the dataset
df = pd.read_csv('Datasets/AdultMod.csv')
for i in tqdm(range(no)):
	start_time = time.time()
	cexPair, failedAtt = quickTestMlAt.funcMain(MAX_SAMPLES, 'NBAdult', df)
	execTime = execTime + (time.time() - start_time)
	failed_trials = failed_trials+failedAtt
    
	if((len(cexPair) >= 1) & (cexFlag == False)):
		f.write("\n")
		f.write("Counter example pair is:\n")
		f.write(str(cexPair))
		cexFlag = True
    
execTime = execTime/no
failed_trials = round(failed_trials/no)

f.write("\n")
f.write("Execution time of NBAdult model is:\n")
f.write(str(execTime))

f = open('Output/kNNPropertyTestOutputFile.txt', 'w')
f.write("\n")
f.write("Execution result of kNN with property based testing approach:\n")


#kNNAdult model evaluation
cexFlag = False
execTime = 0
failed_trials = 0
#Reading the dataset
df = pd.read_csv('Datasets/AdultMod.csv')
for i in tqdm(range(no)):
	start_time = time.time()
	cexPair = quickTestMlAt.funcMain(MAX_SAMPLES, 'kNNAdult', df)
	execTime = execTime + (time.time() - start_time)
	
    
	if((len(cexPair) >= 1) & (cexFlag == False)):
		f.write("\n")
		f.write("Counter example pair is:\n")
		f.write(str(cexPair))
		cexFlag = True
    
execTime = execTime/no


f.write("\n")
f.write("Execution time of kNNAdult model is:\n")
f.write(str(execTime))
#Setting parameters
MAX_SAMPLES = int(input('Give the MAX_SAMPLES limit'))
f = open('Output/ShortOutputPropFile.txt', 'w')
f.write("\n")
f.write("Execution results of short property based testing script:\n")
print('Start executing property based testing')

#NBMpg model evaluation
cexFlag = False
execTime = 0
failed_trials = 0
#Reading the dataset
df = pd.read_csv('Datasets/AutoMPG.csv')
for i in tqdm(range(no)):
    start_time = time.time()
    cexPair, failedAtt = quickTestMlAt.funcMain(MAX_SAMPLES, 'NBMpg', df)
    execTime = execTime + (time.time() - start_time)
    failed_trials = failed_trials + failedAtt

    if ((len(cexPair) >= 1) & (cexFlag == False)):
        f.write("\n")
        f.write("Counter example pair is:\n")
        f.write(str(cexPair))
        cexFlag = True
if (cexFlag == False):
    f.write("\n")
    f.write("No Counter example is found")
execTime = execTime / no
failed_trials = round(failed_trials / no)

f.write("\n")
Example #5
0

f = open('Output/SVMPropertyTestOutputFile.txt', 'w')
f.write("\n")
f.write("Execution result of SVM with property based testing approach:\n")


#SVMAdult model evaluation
cexFlag = False
execTime = 0
failed_trials = 0
#Reading the dataset
df = pd.read_csv('Datasets/AdultMod.csv')
for i in tqdm(range(no)):
	start_time = time.time()
	cexPair, failedAtt = quickTestMlAt.funcMain(MAX_SAMPLES, 'SVMAdult', df)
	execTime = execTime + (time.time() - start_time)
	failed_trials = failed_trials+failedAtt
    
	if((len(cexPair) >= 1) & (cexFlag == False)):
		f.write("\n")
		f.write("Counter example pair is:\n")
		f.write(str(cexPair))
		cexFlag = True
    
execTime = execTime/no
failed_trials = round(failed_trials/no)

f.write("\n")
f.write("Execution time of SVMAdult model is:\n")
f.write(str(execTime))
Example #6
0
no = int(noLimit[0])
MAX_SAMPLES = int(sampleLimit[0])

f = open('Output/MLPPropertyTestOutputFile.txt', 'w')
f.write("\n")
f.write("Execution result of MLP with property based testing approach:\n")

#MLPAdult model evaluation
cexFlag = False
execTime = 0
failed_trials = 0
#Reading the dataset
df = pd.read_csv('Datasets/AdultMod.csv')
for i in tqdm(range(no)):
    start_time = time.time()
    cexPair = quickTestMlAt.funcMain(MAX_SAMPLES, 'MLPAdult', df)
    execTime = execTime + (time.time() - start_time)

    if ((len(cexPair) >= 1) & (cexFlag == False)):
        f.write("\n")
        f.write("Counter example pair is:\n")
        f.write(str(cexPair))
        cexFlag = True

execTime = execTime / no

f.write("\n")
f.write("Execution time of MLPAdult model is:\n")
f.write(str(execTime))

f.write("\n")
no = int(noLimit[0])
MAX_SAMPLES = int(sampleLimit[0])

f = open('Output/LogRegPropertyTestOutputFile.txt', 'w')
f.write("\n")
f.write("Execution result of LogReg with property based testing approach:\n")

#LogRegAdult model evaluation
cexFlag = False
execTime = 0
failed_trials = 0
#Reading the dataset
df = pd.read_csv('Datasets/AdultMod.csv')
for i in tqdm(range(no)):
    start_time = time.time()
    cexPair, failedAtt = quickTestMlAt.funcMain(MAX_SAMPLES, 'LogRegAdult', df)
    execTime = execTime + (time.time() - start_time)
    failed_trials = failed_trials + failedAtt

    if ((len(cexPair) >= 1) & (cexFlag == False)):
        f.write("\n")
        f.write("Counter example pair is:\n")
        f.write(str(cexPair))
        cexFlag = True

execTime = execTime / no
failed_trials = round(failed_trials / no)

f.write("\n")
f.write("Execution time of LogRegAdult model is:\n")
f.write(str(execTime))
 try:
     with open('param_dict.csv', 'w', newline='') as csv_file:
         writer = cv.writer(csv_file)
         for key, value in paramDict.items():
             writer.writerow([key, value])
 except IOError:
     print("I/O error")
 #actor_person_celestial model evaluation
 cexFlag = False
 execTime = 0
 failed_trials = 0
 #Reading the dataset
 df = pd.read_csv(
     'Datasets/dbo_Actor_dbo_CelestialBody_dbo_Person_Multi.csv')
 for i in tqdm(range(iteration_no)):
     cexPair = quickTestMlAt.funcMain(MAX_SAMPLES, job, df)
     if (len(cexPair) >= 1) & (cexFlag == False):
         if j == 0:
             cex_count_S1 += 1
         elif j == 1:
             cex_count_D1 += 1
         elif j == 2:
             cex_count_D2 += 1
 if j == 0:
     f.write('Probability value of S1 is: ' +
             str(cex_count_S1 / iteration_no) + '\n')
 elif j == 1:
     f.write('Probability value of D1 is: ' +
             str(cex_count_D1 / iteration_no) + '\n')
 elif j == 2:
     f.write('Probability value of D2 is: ' +