def printResults(self): cr = criteria.Criteria() cr.annualInterestPayment(self.fields) cr.loanToIncome(self.fields) if (cr.isValidLoan(self.fields)): QMessageBox.information( self, "Accepted", self.fields["Last name"].displayText() + " can get the loan") else: QMessageBox.critical( self, "Refused", self.fields["Last name"].displayText() + " can not get the loan")
def fileReader(self): filename = QFileDialog.getOpenFileName(self, 'Open File', '.', "CSV file (*.csv)") cr = criteria.Criteria() with open(filename[0], 'r') as csvFile: data = csv.reader(csvFile, delimiter=",") fields = [] it = 0 for row in data: if (it != 0): cr.annualInterestPayment(None, row[3], row[5]) cr.loanToIncome(None, row[3], row[6]) self.printResultsCSV(row, cr.isValidLoan(None, row[6], row[7])) it += 1
true = model.GMM(N, K0) result = {'G': [], 'AIC': [], 'WAIC': [], 'CV': []} for t in range(ex): # 真の分布からのサンプリング X = [true.data_sampling(a0, b0) for i in range(n)] X_t, X_v = X[:n], X[n:] # 変分ベイズによる学習 for K in range(1, 10): gmm = model.GMM(K, N) for _ in range(iter): gmm.update(X_t) # 各種規準の計算 params = [gmm.poserior_sampling() for _ in range(T)] crt = criteria.Criteria(gmm, true, X_t, X_v, params, (a0, b0)) L = crt.L Ln = crt.Ln G = crt.G AIC = crt.AIC WAIC = crt.WAIC CV = crt.CV result['G'].append(G - L) result['AIC'].append(AIC - Ln) result['WAIC'].append(WAIC - Ln) result['CV'].append(CV - Ln) # 結果をcsvに保存 pd.DataFrame(result).to_csv('GMM/result.csv', index=False)
for t in range(T): # データ生成 nn0 = model.NN(M, H0, N) XY = [nn0.generate(a0, b0) for _ in range(2 * n)] XYt, XYv = XY[:n], XY[n:] Xt = [xy[0] for xy in XYt] Xv = [xy[0] for xy in XYv] Yt = [xy[1] for xy in XYt] Yv = [xy[1] for xy in XYv] # MCMC nn = model.NN(M, H, N) params = nn.sampling(Xt, Yt, size=size, burn=burn) # 各種規準の計算 crt = criteria.Criteria(nn, nn0, XYt, XYv, params, (a0, b0)) L = crt.L Ln = crt.Ln G = crt.G AIC = crt.AIC WAIC = crt.WAIC DIC1 = crt.DIC1 DIC2 = crt.DIC2 CV = crt.CV logger.info( f'loss={G-L:.3g}, AIC={AIC-Ln:.3g},WAIC={WAIC-Ln:.3g}, DIC1={DIC1-Ln:.3g}, DIC2={DIC2-Ln:.3g}, CV={CV-Ln:.3g}' ) result['G'].append(G - L) result['AIC'].append(AIC - Ln) result['WAIC'].append(WAIC - Ln) result['DIC1'].append(DIC1 - Ln)
# Add Gsys server startup group to builder log_sifter_builder.add_group_rule( event_group_rule.EventGroupRule(tag="gsys_startup", trigger_event_tags=[ "gsysd_version_published", "gsys_server_start" ], context_event_tags=[])) # Add PCIE error criteria to the builder log_sifter_builder.add_criteria( criteria.Criteria( symptom_tag="PCIE Error", signal=signals.ExistenceGroupSignal(tag="pcie_error_signal", group_tag="pcie_error"), evaluator=evaluators.ExistenceEvaluator(), action_msg="Possible hardare issues exist. Please check the device." )) # Add SMBus error criteria to the builder log_sifter_builder.add_criteria( criteria.Criteria( symptom_tag="SMBus Error", signal=signals.ExistenceGroupSignal(tag="smbus_error_signal", group_tag="smbus_error"), evaluator=evaluators.ExistenceEvaluator(), action_msg="Possible hardare issues exist. Please check the device." )) # Add rescan loop mode criteria to the builder