def move_to_log(block_positions, block_type, observations): s = 'MoveTo Log~ {} x={} y={} z={}, {}'.format(block_type, block_positions['x'], block_positions['y'], block_positions['z'], get_time_second()) Testing.addLog(s, observations)
def _spec_test_output(self, spec): '''Wrapper that checks spec file and returns output''' pkg = Testing.getTestedSpecPackage(spec) Testing.startTest() # call check_spec() directly, as check() doesn't work with getTestedSpecPackage() SCLCheck.check.check_spec(pkg, pkg.name) return Testing.getOutput()
def main(): trainList = [([0, 0], [0]), ([0, 1], [1]), ([1, 0], [1]), ([1, 1], [0])] testList = [([0, 0], [0]), ([0, 1], [1]), ([1, 0], [1]), ([1, 1], [0])] totalResults = [] for i in range(0, 101): print "Testing with", i, "perceptrons in hidden layer." results = [] for j in range(0, 10): if i == 0: results.append( NeuralNet.buildNeuralNet((trainList, testList), maxItr=200, hiddenLayerList=[])[1]) else: results.append( NeuralNet.buildNeuralNet((trainList, testList), maxItr=200, hiddenLayerList=[i])[1]) totalResults.append((i, max(results), Testing.average(results), Testing.stDeviation(results))) for i, maximum, avg, sd in totalResults: print i, ",", maximum, ",", avg, ",", sd
def _spec_test_output(self, spec): '''Wrapper that checks spec file and returns output''' with Testing.getTestedSpecPackage(spec) as pkg: Testing.startTest() # call check_spec() directly, as check() doesn't work with # getTestedSpecPackage() SCLCheck.check.check_spec(pkg, pkg.name) return Testing.getOutput()
def changeParamValueToggle(self, w, path, value_name, old_path=None): param_widget = self.getParamWidget(w, path, value_name, old_path) self.assertNotEqual(param_widget, None) pos = param_widget.valueTestPosition() widget = param_widget.valueTestWidget() QTest.mouseMove(widget, pos) Testing.process_events(self.qapp, t=PROCESS_EVENT_TIME) QTest.mouseClick(widget, Qt.LeftButton, pos=pos) Testing.process_events(self.qapp, t=PROCESS_EVENT_TIME)
def saveNodeWidget(self, w, path, old_path=None): node_widget = self.getNodeWidget(w, path, old_path) self.assertNotEqual(node_widget, None) apply_button = Testing.findQObjectsByName(node_widget, "apply_button") self.assertEqual(len(apply_button), 1) self.assertEqual(apply_button[0].isEnabled(), True) self.clickButton(apply_button) Testing.process_events(self.qapp, t=PROCESS_EVENT_TIME) self.assertEqual(apply_button[0].isEnabled(), False)
def selectMesh(self, w, mesh_type, dim=2, nx=10, ny=10): path = "/Mesh" self.clickOnTree(w, path, expand=True, include=True) self.changeParamTypeCombo(w, path, mesh_type) self.changeParamValueText(w, path, "nx", str(nx)) self.changeParamValueText(w, path, "ny", str(ny)) self.changeParamCombo(w, path, "dim", "2") self.saveNodeWidget(w, path) Testing.process_events(self.qapp, t=PROCESS_EVENT_TIME)
def testing(): for i in range(numberOfGenerations): currentGeneration = currentGeneration + 1 for j in range(numberOfUpdateSamples): ra.deleteTestSamples() ra.storeTestSamples(sample_count) testing.add_samples_to_trained_model(currentGeneration) cnn.train_model(numberOfEpochs, is_update=True)
def computePlain(): InputData.plainSusFile = dr.readFile(InputData.plainSusPath) InputData.plainCompFile = dr.readFile(InputData.plainCompPath) InputData.plainRes = an.analyseFileComp( Testing.multFingerprints(InputData.plainSusFile, InputData.plainCompFile)) InputData.plainResOffset = an.analyseFileComp( Testing.offsetFingerprints(InputData.plainSusFile, InputData.plainCompFile))
def setOutput(self, w, csv=False, exodus=False): path = "/Outputs" self.clickOnTree(w, path, expand=True, include=True) if exodus: self.changeParamValueToggle(w, path, "exodus") if csv: self.changeParamValueToggle(w, path, "csv") Testing.process_events(self.qapp, t=PROCESS_EVENT_TIME) self.saveNodeWidget(w, path) Testing.process_events(self.qapp, t=PROCESS_EVENT_TIME)
def computePar(): InputData.parSusFile = dr.readByParagraphs(InputData.parSusPath) InputData.parCompFile = dr.readByParagraphs(InputData.parCompPath) InputData.parRes = an.analyseParagraphComp( Testing.multFprintParagraph(InputData.parSusFile, InputData.parCompFile)) InputData.parResOffset = an.analyseParagraphComp( Testing.offsetFprintParagraph(InputData.parSusFile, InputData.parCompFile))
def addVariable(self, w, var_name, include_vars=False, expand_vars=False, include=True): self.addToNode(w, "/Variables", expand=expand_vars, include=include_vars) new_path = "/Variables/New0" if include: self.clickOnTree(w, new_path, include=True) self.clickOnTree(w, new_path) self.changeParamValueText(w, new_path, "name", var_name) name_path = "/Variables/%s" % var_name self.saveNodeWidget(w, name_path, new_path) Testing.process_events(self.qapp, t=PROCESS_EVENT_TIME)
def setExecutioner(self, w, exe_type, solve_type=None, petsc_iname=None, petsc_value=None, include_exe=False, expand_exe=False): path = "/Executioner" self.clickOnTree(w, path, expand=expand_exe, include=include_exe) self.changeParamTypeCombo(w, path, exe_type) if petsc_iname: self.changeParamValueText(w, path, "petsc_options_iname", petsc_iname) if petsc_value: self.changeParamValueText(w, path, "petsc_options_value", petsc_value) if solve_type: self.changeParamCombo(w, path, "solve_type", solve_type) self.saveNodeWidget(w, path) Testing.process_events(self.qapp, t=PROCESS_EVENT_TIME)
def clickTab(self, app, tab_name): peacock_tab_widgets = Testing.findQObjectsByName(app, "PeacockMainWindow/tab_plugin") self.assertEqual(len(peacock_tab_widgets), 1) tabs = peacock_tab_widgets[0] for i in range(tabs.count()): if tabs.tabText(i) == tab_name: tab_bar = tabs.tabBar() rect = tab_bar.tabRect(i) QTest.mouseMove(tab_bar, rect.center()) QTest.mouseClick(tab_bar, Qt.LeftButton, pos=rect.center(), delay=100) Testing.process_events(self.qapp, t=PROCESS_EVENT_TIME) return
def addKernel(self, w, name, kernel_type, variable, include_kernels=False, expand_kernels=False): self.addToNode(w, "/Kernels", expand=expand_kernels, include=include_kernels) new_path = "/Kernels/New0" if include_kernels: self.clickOnTree(w, new_path, include=True) self.clickOnTree(w, new_path) self.changeParamTypeCombo(w, new_path, kernel_type) self.changeParamCombo(w, new_path, "variable", variable) self.changeParamValueText(w, new_path, "name", name) name_path = "/Kernels/%s" % name self.saveNodeWidget(w, name_path, new_path) Testing.process_events(self.qapp, t=PROCESS_EVENT_TIME)
def addBC(self, w, name, variable, boundary, bc_type="DirichletBC", value="0", include_bc=False, expand_bc=False, include=True): self.addToNode(w, "/BCs", expand=expand_bc, include=include_bc) new_path = "/BCs/New0" if include: self.clickOnTree(w, new_path, include=True) self.clickOnTree(w, new_path) self.changeParamTypeCombo(w, new_path, bc_type) self.changeParamValueText(w, new_path, "name", name) name_path = "/BCs/%s" % name self.changeParamValueText(w, name_path, "value", value, new_path) self.changeParamValueText(w, name_path, "boundary", boundary, new_path) self.saveNodeWidget(w, name_path, new_path) Testing.process_events(self.qapp, t=PROCESS_EVENT_TIME)
def testExtraCredit(setFunc=setEntropy, infoFunc=infoGain): examples, attrValues, labelName, labelValues = getExtraCreditDataset() print 'Testing Poker dataset. Number of examples %d.' % len(examples) tree = makeTree(examples, attrValues, labelName, setFunc, infoFunc) f = open('poker.out', 'w') f.write(str(tree)) f.close() print 'Tree size: %d.\n' % tree.count() print 'Entire tree written out to poker.out in local directory\n' evaluation = Testing.getAverageClassificaionRate( (examples, attrValues, labelName, labelValues)) print 'Results for training set:\n%s\n' % str(evaluation) Testing.printDemarcation() return (tree, evaluation)
def main(): for i in range(0, 41, 5): penResults = [] for j in range(0, 5): if i == 0: penResults.append(Testing.testPenData([])[1]) else: penResults.append(Testing.testPenData([i])[1]) print "testPenData iteration ", j + 1, " complete with ", penResults[ j], " accuracy.\n" print "testPenData Max = ", max(penResults) print "testPenData Average = ", Testing.average(penResults) print "testPenData Std Deviation = ", Testing.stDeviation( penResults), "\n" for i in range(0, 41, 5): carResults = [] for j in range(0, 5): if i == 0: carResults.append(Testing.testCarData([])[1]) else: carResults.append(Testing.testCarData([i])[1]) print "testCarData iteration ", j + 1, " complete with ", carResults[ j], " accuracy.\n" print "testCarData Max = ", max(carResults) print "testCarData Average = ", Testing.average(carResults) print "testCarData Std Deviation = ", Testing.stDeviation( carResults), "\n"
def testcheck(self): SpecCheck.check.check_source(self.pkg) out = "\n".join(Testing.getOutput()) self.assertFalse( re.search( r" E: specfile-error error: query of specfile .*\.spec failed, can't parse", out))
def DTfunc(arg1, arg2, arg3=None): #encode tree-depths if "balance.scale" in arg1: depth = 3 if "nursery" in arg1: depth = 7 if "led" in arg1: depth = 7 if "synthetic.social" in arg1: depth = 8 #Read training file Rf = ReadTrFile.ReadTrFile(arg1) #Read Testing file Tf = ReadTeFile.ReadTeFile(arg2) #Initializer the Trainer class Train = Training.Training(depth, Rf.D, Rf.dictfile, Rf.attributedict, Rf.labeldict, Rf.avcdict) #Generate Decision Tree trlabeldict, dtroot = Train.GenDT() #Initialize Tester Test = Testing.Testing(dtroot, Tf.dictfile) #Perform Decision Tree based Testing prlabel = Test.parsetestfile() #Calculate and Print Confusion Matrix cm = utilities.CalcConMat(Tf.dictfile, prlabel, Rf.labeldict) #Calculate quality of classifer for report if arg3 == True: QualityCalc.QualityCalc(cm)
def clickTab(self, app, tab_name): peacock_tab_widgets = Testing.findQObjectsByName( app, "PeacockMainWindow/tab_plugin") self.assertEqual(len(peacock_tab_widgets), 1) tabs = peacock_tab_widgets[0] for i in range(tabs.count()): if tabs.tabText(i) == tab_name: tab_bar = tabs.tabBar() rect = tab_bar.tabRect(i) QTest.mouseMove(tab_bar, rect.center()) QTest.mouseClick(tab_bar, Qt.LeftButton, pos=rect.center(), delay=100) Testing.process_events(self.qapp, t=PROCESS_EVENT_TIME) return
def record(): global waveImage, specImage Testing.record() T.delete(1.0,END) result = "Recognised Digit:" + str(Testing.recognisedNumber) + "\nWith Probability of:" + \ str(Testing.probabilityOfRecognisedDegit*100) + "%" T.insert(END, result) spectrogram.createPlots() print("saved") waveImage = PhotoImage(file='wave.ppm', height=250, width=390) waveLabel.configure(image=waveImage) waveLabel.place(relx=0.01, rely=0.01) specImage = PhotoImage(file='spec.ppm', height=250, width=360) specLabel.configure(image=specImage) specLabel.place(relx=0.53, rely=0.01)
def organizing data= ts.import_clean_data("Tea Room/2017-2018/item_sales.csv") #print(data.groupby(["Gross Sales"]).sum().sort_values("Item", ascending=False)) sort_by_gross_sales = data.sort_values('Gross Sales', ascending=False) print(sort_by_gross_sales)
def changeParamCombo(self, w, path, value_name, new_value, old_path=None): param_widget = self.getParamWidget(w, path, value_name, old_path) self.assertNotEqual(param_widget, None) pos = param_widget.valueTestPosition() widget = param_widget.valueTestWidget() QTest.mouseMove(widget, pos) Testing.process_events(self.qapp, t=PROCESS_EVENT_TIME) QTest.mouseClick(widget, Qt.LeftButton, pos=pos) # Now the selector should pop up which is a QListView list_views = Testing.findQObjectsByType(widget, "PyQt5.QtWidgets.QListView") self.assertEqual(len(list_views), 1) lv = list_views[0] model = lv.model() matches = model.findItems(new_value) self.assertEqual(len(matches), 1) model_idx = model.indexFromItem(matches[0]) rect = lv.visualRect(model_idx) QTest.mouseMove(lv, pos=rect.center()) Testing.process_events(self.qapp, t=PROCESS_EVENT_TIME) QTest.mouseClick(lv.viewport(), Qt.LeftButton, pos=rect.center(), delay=100) Testing.process_events(self.qapp, t=PROCESS_EVENT_TIME)
def changeParamValueText(self, w, path, value_name, new_text, old_path=None): param_widget = self.getParamWidget(w, path, value_name, old_path) self.assertNotEqual(param_widget, None) pos = param_widget.valueTestPosition() widget = param_widget.valueTestWidget() QTest.mouseMove(widget, pos) Testing.process_events(self.qapp, t=PROCESS_EVENT_TIME) QTest.mouseClick(widget, Qt.LeftButton, pos=pos) QTest.mouseDClick(widget, Qt.LeftButton, pos=pos) # The default editing widget on a QTreeWidgetItem is a QLineEdit. # But it doesn't seem to show up until the item has focus. # This is pretty brittle but seems to work OK for now. line_edit = Testing.findQObjectsByType(widget, "PyQt5.QtWidgets.QLineEdit") for obj in line_edit: if obj.objectName() == "": widget = obj break Testing.process_events(self.qapp, t=PROCESS_EVENT_TIME) QTest.keyClick(widget, Qt.Key_Backspace) QTest.keyClicks(widget, new_text) QTest.keyClick(widget, Qt.Key_Return) Testing.process_events(self.qapp, t=PROCESS_EVENT_TIME)
def test(root): data = Testing.createData(2000, 20) model = TableModel() model.importDict(data) app = App(root) master = app.main table = LargeTable(master, model) #table.load('large.table') table.createTableFrame()
def addToNode(self, w, path, expand=False, include=False): if expand: self.clickOnTree(w, path, expand=True) if include: self.clickOnTree(w, path, include=True) node_widget = self.getNodeWidget(w, path) add_button = Testing.findQObjectsByName(node_widget, "add_button") self.assertEqual(add_button[0].isEnabled(), True) self.clickButton(add_button)
def test(root): data = Testing.createData(2000,20) model = TableModel() model.importDict(data) app = App(root) master = app.main table = LargeTable(master, model) #table.load('large.table') table.createTableFrame()
def testing(): test = Testing.test() test.checkSystemTools() #checkModule companyId = 1 moduleToTest1 = "munozvet" moduleToTest2 = "munozvet" test.testModuleCheckout(companyId, moduleToTest1, moduleToTest2) pass
def _print(msgtype, pkg, reason, details): global _badness_score threshold = badnessThreshold() badness = 0 if threshold >= 0: badness = Config.badness(reason) # anything with badness is an error if badness: msgtype = 'E' # errors without badness become warnings elif msgtype == 'E': msgtype = 'W' ln = "" if pkg.current_linenum is not None: ln = "%s:" % pkg.current_linenum arch = "" if pkg.arch is not None: arch = ".%s" % pkg.arch s = "%s%s:%s %s: %s" % (pkg.name, arch, ln, msgtype, reason) if badness: s = s + " (Badness: %d)" % badness for d in details: s = s + " %s" % d if Testing and Testing.isTest(): Testing.addOutput(s) else: if _rawout: print(s.encode(locale.getpreferredencoding(), "replace"), file=_rawout) if not Config.isFiltered(s): printed_messages[msgtype] += 1 _badness_score += badness if threshold >= 0: _diagnostic.append(s + "\n") else: __print(s) if Config.info: printDescriptions(reason) return True return False
def startHacking(max_pages): page = 1 driver = login() while page <= max_pages: url = "http://codeforces.com/contest/903/status/A/page/" + str( page) + "?order=BY_ARRIVED_DESC" #url = "http://codeforces.com/contest/915/status/A/page/" + str(page) + "?order=BY_ARRIVED_DESC" source_code = requests.get(url) plain_text = source_code.text soup = BeautifulSoup(plain_text, "lxml") view_source = soup.findAll('a', {'class': 'view-source'}) verdict = soup.findAll('span', {'class': 'verdict-accepted'}) i = 0 for verd in verdict: if verd.text == "Accepted": #if i<1: code_url = "http://codeforces.com" + view_source[i].get('href') #code_url = "http://codeforces.com/contest/915/submission/34174730" code = requests.get(code_url) plain = code.text code_soup = BeautifulSoup(plain, "lxml") rows = code_soup.findAll('td') lang = rows[3].text[6:-6] #print(lang) s = plain.find('<pre class="prettyprint') custom_code = plain[s + 73:] e = custom_code.find('<div class="roundbox ') custom_code = custom_code[:e - 30] #print(s, s + e) custom_code = custom_code.replace(">", ">") custom_code = custom_code.replace("<", "<") custom_code = custom_code.replace("'", "'") custom_code = custom_code.replace(""", '"') custom_code = custom_code.replace("&", "&") #print(code_url) #print(custom_code) Testing.custom_invoc(custom_code, lang, driver) i += 1 page += 1
def clickOnTree(self, w, path, expand=False, include=False): tree = self.getTreeWidget(w) item = tree.findPathItem(path) self.assertNotEqual(item, None) tree.scrollToItem(item) tree.setCurrentItem(item) rect = tree.visualItemRect(item) viewport = tree.viewport() pos = rect.center() if expand or include: pos = rect.bottomLeft() pos.setY(pos.y() - rect.height()/2) if include: pos.setX(pos.x() + 10) QTest.mouseMove(tree, pos) Testing.process_events(self.qapp, t=PROCESS_EVENT_TIME) QTest.mouseClick(viewport, Qt.LeftButton, delay=100, pos=pos) Testing.process_events(self.qapp, t=PROCESS_EVENT_TIME)
def clickOnTree(self, w, path, expand=False, include=False): tree = self.getTreeWidget(w) item = tree.findPathItem(path) self.assertNotEqual(item, None) tree.scrollToItem(item) tree.setCurrentItem(item) rect = tree.visualItemRect(item) viewport = tree.viewport() pos = rect.center() if expand or include: pos = rect.bottomLeft() pos.setY(pos.y() - rect.height() / 2) if include: pos.setX(pos.x() + 10) QTest.mouseMove(tree, pos) Testing.process_events(self.qapp, t=PROCESS_EVENT_TIME) QTest.mouseClick(viewport, Qt.LeftButton, delay=100, pos=pos) Testing.process_events(self.qapp, t=PROCESS_EVENT_TIME)
def analyzer(disease, precaution, disease_var): global i, added_symptoms Disease, Precaution = model.model(added_symptoms) disease_var.set(" Disease: " + Disease[0]) disease.insert(INSERT, Disease[1]) for i in Precaution: if i != 'Nan': precaution.insert(INSERT, i) precaution.insert(INSERT, ', ')
def evaluate_SVM(self, type="standard"): average_classifier, classifier_metrics = Testing.evaluate_classifier( self.dataFrame, classifier=Classifier(Algorithm.SVM, "SVM"), feature_representation=self.f_vector, fold_quantity=self.fold_quantity, test_size=self.test_size, type=type, number_of_files_for_training=self.number_of_files_to_test, ) return average_classifier, classifier_metrics
def main(): ##v user chooses the function1 print "\nDo you want to:\n1. Extract frames\n2. Train and test\n" user_reqs=str(raw_input("\n\n(1/2) :>> ")) if (user_reqs=="1"): VideoToFrames.videoToFrames() ##^ print "\nEnter the MODE : \n" print "\nFor training mode type <load> and press enter..." print "For testing mode press enter...\n" user_request=str(raw_input("\n:>> ")) S=[] if(user_request!="load"): #this is testing mode print "\n---------------You have selected <testing mode>---------------\n" print "\nImporting training data from cached copy..." for file_no in range(1,cache_range+1): #< 'cache_range+1' instead of number if(os.path.isfile(dir_save+str(file_no)+'.p')): S += pickle.load(open(dir_save+str(file_no)+'.p', 'rb')) else: #this is training mode print "\n---------------You have selected <training mode>---------------\n" S=preprocess_and_training() #ref below... #v filecount=0 for file_no in range(1,vid_nos+1): if(os.path.isfile(dir_save+str(file_no)+'.p')): filecount+=1 else: pickle.dump(S, open(dir_save+str(file_no)+'.p', 'wb')) break #pickle.dump(S, open(dir_save+'1.p', 'wb')) #CHANGE THE save file NUMBER HERE. %d.p <<<<<<<<<<<<<<<(FOR EACH TRAINING) print "\nlength of S: ",len(S) print len(S) #v Testing.import_and_test_abnormal(S)
def RTfunc(arg1, arg2, arg3=None): #encode num-trees if "balance.scale" in arg1: numtrees = 150 numatt = 2 depth = 2 databag = 1 if "nursery" in arg1: numtrees = 100 numatt = 8 depth = 7 databag = 1 if "led" in arg1: numtrees = 65 numatt = 7 depth = 7 databag = 1 if "synthetic.social" in arg1: numtrees = 135 numatt = 12 depth = 8 databag = 1 #Read Training file Rf = ReadTrFile.ReadTrFile(arg1) #Read Testing file Tf = ReadTeFile.ReadTeFile(arg2) #Build DT's and test them prlabel = {} for x in range(0, numtrees): Dr = [] size = len(Rf.D) for y in range(0, size): #Sampling with replacement if databag == 1: index = random.randint(0, size - 1) else: index = y Dr.append(Rf.D[index]) Train = Training.Training(depth, Dr, Rf.dictfile, Rf.attributedict) dtroot = Train.GenDTRF(numatt) Test = Testing.Testing(dtroot, Tf.dictfile, prlabel) prlabel = Test.parsetestfile() #Calculate Confusion Matrix for Random forest results cm = utilities.CalcConMat(Tf.dictfile, prlabel, Rf.labeldict) #Calculate quality if arg3 == True: QualityCalc.QualityCalc(cm)
def objective_func(x): x_map = x[1:6] x_map.append(x[-1]) x_map.append(x[0]) x_reduce = x[6:] x_reduce.append(x[0]) X_map = [] X_reduce = [] X_map.append(x_map) X_reduce.append(x_reduce) return int(Testing.test(X_map,X_reduce))
def testcheck(self): SpecCheck.check.check_spec(self.pkg, self.pkg.name) out = "\n".join(Testing.getOutput()) self.assertTrue("patch-not-applied Patch3" in out) self.assertFalse(re.search("patch-not-applied Patch\\b", out)) self.assertFalse(re.search("patch-not-applied Patch[01245]", out)) self.assertTrue("libdir-macro-in-noarch-package" not in out) self.assertTrue(len(re.findall("macro-in-comment", out)) == 1) self.assertTrue("unversioned-explicit-provides unversioned-provides" in out) self.assertTrue("unversioned-explicit-provides versioned-provides" not in out) self.assertTrue("unversioned-explicit-obsoletes unversioned-obsoletes" in out) self.assertTrue("unversioned-explicit-obsoletes versioned-obsoletes" not in out)
def changeParamTypeCombo(self, w, path, new_type, old_path=None): node_widget = self.getNodeWidget(w, path, old_path) self.assertNotEqual(node_widget, None) type_combo = Testing.findQObjectsByName(node_widget, "type_combo") self.assertEqual(len(type_combo), 1) target = type_combo[0] QTest.mouseMove(target) QTest.mouseClick(target, Qt.LeftButton, delay=100) # Now the selector should pop up which is a QListView list_views = Testing.findQObjectsByType(target, "PyQt5.QtWidgets.QListView") self.assertEqual(len(list_views), 1) lv = list_views[0] model = lv.model() matches = model.findItems(new_type) self.assertEqual(len(matches), 1) model_idx = model.indexFromItem(matches[0]) rect = lv.visualRect(model_idx) QTest.mouseMove(lv, pos=rect.center()) Testing.process_events(self.qapp, t=PROCESS_EVENT_TIME) QTest.mouseClick(lv.viewport(), Qt.LeftButton, pos=rect.center(), delay=100) Testing.process_events(self.qapp, t=PROCESS_EVENT_TIME)
def testcheck(self): SpecCheck.check.check_spec(self.pkg, self.pkg.name) out = "\n".join(Testing.getOutput()) self.assertFalse("patch-not-applied" in out)
def setUp(self): self.pkg = Testing.getTestedSpecPackage('spec/SpecCheck') Testing.startTest()
def setUp(self): self.pkg = Testing.getTestedPackage('PamCheck') Testing.startTest()
import Testing import NeuralNetUtil import NeuralNet Testing.testPenData()
def _rpm_test_output(self, rpm): '''Wrapper that checks RPM package and returns output''' with Testing.getTestedPackage(rpm) as pkg: Testing.startTest() BinariesCheck.check.check(pkg) return Testing.getOutput()
def runTests(self): """Run tests""" import Testing Testing.formatTests(Testing.basictests) print 'tests completed ok' return
import Testing import NeuralNetUtil import NeuralNet n = 0 print "~~~~~~~~~~~~~~~~~~~~~~~TestCarData~~~~~~~~~~~~~~~~~~~~~~~" while n <= 40: c = 0 carList = [] print "------- #", n, "neurons per hidden layer -------" while c < 5: print "Iteration #", c + 1 car_Net, car_test = Testing.buildNeuralNet(Testing.carData, maxItr = 200, hiddenLayerList = [n]) carList.append(car_test) c += 1 print "Iteration result:" print "Accuracy standard deviation", Testing.stDeviation(carList) print "Accuracy average:", Testing.average(carList) print "Max Accuracy:", max(carList) n += 5
# -*- coding: utf-8 -*- from Testing import * t = Testing() t.init() t.setTime("22h02m0s") t.setRef(1 , "2h31m49s", "89º15'51''", "22h04m20s", "0º27'09''", "36º49'17''") t.setRef(2 , "18h36m56s", "38º47'03''", "22h05m07s", "78º10'04''", "70º05'19''") #t.goto1("100","160") t.goto("18h03m48s", "24º23'00''", "22h06m52s") #t.goto("13h17m55s", "8º29'04''", "22h07m51s")
def _rpm_test_output(self, rpm): '''Wrapper that checks RPM package and returns output''' pkg = Testing.getTestedPackage(rpm) Testing.startTest() SCLCheck.check.check(pkg) return Testing.getOutput()
import Testing import NeuralNetUtil import NeuralNet p = 0 penList= [] print "~~~~~~~~~~~~~~~~~~~~~~~TestPenData~~~~~~~~~~~~~~~~~~~~~~~" while p < 5: print "Iteration #", p + 1 pen_Net, pen_test = Testing.testCarData() penList.append(pen_test) p += 1 print "Iteration result:" print "Accuracy standard deviation", Testing.stDeviation(penList) print "Accuracy average:", Testing.average(penList) print "Max Accuracy:", max(penList)
new_model = logs.logs_object('TeraSort') MapFeature_list = np.array(new_model.get_MapFeature_list()) RedFeature_list =np.array(new_model.get_RedFeature_list()) MapMean_list = np.array(new_model.get_MapMean_list()) RedMean_list = np.array(new_model.get_RedMean_list()) MapDev_list = np.array(new_model.get_MapDev_list()) RedDev_list = np.array(new_model.get_RedDev_list()) Target_list = np.array(new_model.get_target_list()) for i in range(10): MF_train, MF_test,RF_train, RF_test, MM_train, MM_test, RM_train, RM_test,MD_train, MD_test,RD_train, RD_test,T_train, T_test,= cross_validation.train_test_split(MapFeature_list,RedFeature_list,MapMean_list,RedMean_list,MapDev_list,RedDev_list,Target_list, test_size=0.3, random_state=0) print 'start' engine = Build_Model.WhatIf_Engine(MF_train,RF_train,MM_train,RM_train,MD_train,RD_train,T_train) engine.Build_MapMean_Model() engine.Build_MapDev_Model() engine.Build_RedMean_Model() engine.Build_RedDev_Model() engine.Build_Final_Model() predict_result = Testing.test(MF_test,RF_test) print T_test print predict_result print new_model.get_error_rate(T_test,predict_result)