Beispiel #1
0
def testNormedQuantilesRatingDigraph():
    print('*-------- Testing NormedQuantilesRatingDigraph class -------')
    from randomPerfTabs import RandomCBPerformanceTableau
    from randomPerfTabs import RandomPerformanceGenerator
    import random
    seed = random.randint(1,100)
    #seed = 15
    print('=== >> seed = ',seed)
    nbrActions=1000
    nbrCrit = 13
    tp = RandomCBPerformanceTableau(numberOfActions=nbrActions,NegativeWeights=True,
                                    numberOfCriteria=nbrCrit,seed=seed)
    tp.convertWeights2Positive()
    pq = PerformanceQuantiles(tp,'deciles',LowerClosed=False,Debug=False)
    tpg = RandomPerformanceGenerator(tp,instanceCounter=0,seed=seed*2)
    newActions = tpg.randomActions(10)
    pq.updateQuantiles(newActions,historySize=100)
    nrq = NormedQuantilesRatingDigraph(pq,newActions,
                                       WithSorting=True,
                                       Debug=False)
    nrq.showQuantilesRating()
    nrq.exportRatingGraphViz(graphType='pdf')
    nrq.showSorting()
    nrq.showActionsSortingResult()
    nrq.showQuantilesSorting()
    newActions = tpg.randomPerformanceTableau(1000)
    pq.updateQuantiles(newActions,historySize=0)
    newActions = tpg.randomActions(10)
    pq.updateQuantiles(newActions,historySize=None,Debug=False)
    nrq = NormedQuantilesRatingDigraph(pq,newActions,quantiles='heptiles',
                                       WithSorting=True,
                                       Debug=False)
    nrq.showQuantilesRating()
    nrq.exportRatingGraphViz(graphType='pdf')
    nrq.showSorting()
    nrq.showActionsSortingResult()
    nrq.showQuantilesSorting()
    print(pq.computeQuantileProfile(0.5))
    pq.save(fileName='testPerfQuant')
    pq1 = PerformanceQuantiles('testPerfQuant')
    nrq1 = NormedQuantilesRatingDigraph(pq1,newActions,
                                       WithSorting=False,
                                       Debug=False)
    nrq1.showQuantilesRating()