def getRepairs(busname): connexion_vsr, cursor_vsr = Util.connectDB(DB_PATH+"_vsr.db") if busname == '369': busname = '396' repair_dates_str = cursor_vsr.execute( "SELECT DISTINCT Visits.Date FROM Visits,Operations WHERE Visits.VisitID = Operations.Visit AND Visits.Bus LIKE '%"+busname+"%'" ) repair_dates = [ Util.str2date(date_str, format = "%Y-%m-%d") for date_str in repair_dates_str ] repair_dates_str = [ Util.date2str(dt, format = "%Y-%m-%d") for dt in repair_dates ] return repair_dates_str
# ------ pvalue1, score1 = como_anomaly.normalityProba_V1( "online", flat_fleet_test_, his_test, all_buses, id_bus, i, h ) # pvalue1, score1 = como_anomaly.normalityProba_V1( "KNN", flat_fleet_test_, his_test, all_buses, id_bus, i ); dir_imgs = "cosmo_KNN/" # pvalue2, score2 = como_anomaly.normalityProba_V2( "RNN", own_test_, his_test, all_buses, id_bus, i ); dir_imgs = "cosmo_RNN/" # pvalue1, score1 = 0.5, 0.5 pvalue2, score2 = pvalue1, score1 h.train( [ bus[0] for bus in fleet_test_ ] )# ; print "nb_nodes", h.nb_nodes Z1.append( pvalue1 ); Z2.append( pvalue2 ) S1.append( score1 ); S2.append( score2 ) #-------------------------- connexion_sig, cursor_sig = Util.connectDB(DB_PATH+filename) connexion_sig, cursor_sig_mil = Util.connectDB(DB_PATH+busname+"_16644.db") connexion_vsr, cursor_vsr = Util.connectDB(DB_PATH+"_vsr.db") if busname == '369': busname = '396' #-------------------------- image = como_ploting.Ploting( busname, dates ) Z1_means, Dev1 = como_anomaly.getZvalues( Z1 ) Z2_means, Dev2 = como_anomaly.getZvalues( Z2 ) image.plotScores(S1, S2); image.plotPValues(Z1, Z2, Z1_means, Z2_means); image.plotDeviations(Dev1, Dev2) #---------- repair_dates_str = cursor_vsr.execute( "SELECT DISTINCT Visits.Date FROM Visits,Operations WHERE Visits.VisitID = Operations.Visit AND Visits.Bus LIKE '%"+busname+"%'" ) repair_dates = [ Util.str2date(date_str, format = "%Y-%m-%d") for date_str in repair_dates_str ]