def test_setlogin(self): self.login = login() self.login.login() self.a = self.login.login1() sleep(2) if self.a == "第一次登陆": self.project = project() self.project.project() self.dow = download() self.dow.download() self.DropDown = DropDown() print(self) # def test_affiche(self): self.rpage = Returnpage() self.taffiche = Affiche() try: self.taffiche.affiche() self.title = self.taffiche.Unread() except BaseException as e: self.assertEqual(0, 1, "公告模块,未读测试未通过") if self.title != '无未读公告': try: self.taffiche.Read(self.title) except BaseException: self.assertEqual(0, 1, "公告模块,已读测试未通过") else: print('无未读公告') sleep(1) self.rpage.returnpage()
def __init__(self, tx=None, y=None, z=None, num_components=50): [D, self.WW, self.mu] = pca(tx, num_components) self.y = y self.tx = tx self.z = z for xi in tx: self.projections.append( project(self.WW, xi.reshape(1, -1), self.mu))
def predict(self, X): #in classification, use of RPCA will take a long time, therefore I put it in annotation #X= RPCA.robust_pca(X) testx = X minDist = np.finfo('float').max minClass = -1 Q = project(self.WW, testx.reshape(1, -1), self.mu) rank = [] k = [] for i in xrange(len(self.projections)): dist = self.EuclideanDistance(self.projections[i], Q) rank.append(dist) if dist < minDist: minDist = dist minClass = self.y[i] k.append(minClass) t = rank rank.sort() i = [] i.append(t.index(min(rank))) return minClass
def predicttwo(self, X): #in classification, use of RPCA will take a long time, therefore I put it in annotation #X= RPCA.robust_pca(X) testx = X minDist = np.finfo('float').max minDistwo = np.finfo('float').max minClass = -1 minClasstwo = -1 Q = project(self.WW, testx.reshape(1, -1), self.mu) for i in xrange(len(self.projections)): dist = self.EuclideanDistance(self.projections[i], Q) if dist < minDist: minDist = dist minClass = self.y[i] for i in xrange(len(self.projections)): dist = self.EuclideanDistance(self.projections[i], Q) if dist < minDistwo: minDistwo = dist minClasstwo = self.z[i] return minClass, minClasstwo
from Affiche import AfficheMenu from requirement import RequirmentMenu from Asset import AssetMenu from WorkOrder import WorkOrderMenu from Energy import EnergyMenu from Maintain import MaintainMenu from Visitor import VisitorMenu from inspection import InspectionMenu from Knowledge import KnowledgeMenu from payment import paymentMenu login = login() login.login() a = login.login1() sleep(2) if a == "第一次登陆": project = project() project.project() dow = download() dow.download() DropDown = DropDown() # 公告 affiche = AfficheMenu() # # 巡检 # inspection=PatrolMenu() # # 服务台 # requirment=RequirmentMenu() # # 工单(未走) # wordorder=WorkOrderMenu() # # 计划性维护 # maintain=MaintainMenu() # # 资产