Beispiel #1
0
 def div(lst, rank, worst=None, excellent=None):
     if len(lst) > few:
         if worst == None: worst = furthest(any(lst), lst)
         if excellent == None: excellent = furthest(worst, lst)
         if worst.dominates(excellent, t.y.weights, t.y.stats):
             return div(lst, rank, excellent, worst)
         c = dist(worst, excellent)
         tmp = []
         for row in lst:
             a = dist(worst, row)
             if a > trivial + c:
                 return div(lst, rank, row, worst)
             b = dist(excellent, row)
             if b > trivial + c:
                 return div(lst, rank, row, excellent)
             x = (a * a + c * c - b * b) / (2 * c + z)
             tmp += [(x, row)]
         tmp = [pair[1] for pair in sorted(tmp)]
         mid = len(lst) // 2
         rank = div(lst[:mid], rank)
         rank = div(lst[mid:], rank)
     else:
         rank += len(lst)
         for one in lst:
             one.dom = rank
     return rank
Beispiel #2
0
 def representative(self, method='mean'):
   if method == 'mean':
     return [float(np.mean([k.cells[indx] for k in self.rows]))
             for indx in xrange(len(self.rows[0].cells) - 2)]
   elif method == 'median':
     return [float(np.median([k.cells[indx] for k in self.rows]))
             for indx in xrange(len(self.rows[0].cells) - 2)]
   elif method == 'best':
     return sorted(self.rows, key=lambda F: F.cells[-2])[0].cells[:-2]
   elif method == 'any':
     return any(self.rows).cells[:-2]
Beispiel #3
0
 def representative(self, method='mean'):
   if method == 'mean':
     return [float(np.mean([k.cells[indx] for k in self.rows]))
             for indx in xrange(len(self.rows[0].cells) - 2)]
   elif method == 'median':
     return [float(np.median([k.cells[indx] for k in self.rows]))
             for indx in xrange(len(self.rows[0].cells) - 2)]
   elif method == 'best':
     return sorted(self.rows, key=lambda F: F.cells[-2])[0].cells[:-2]
   elif method == 'any':
     return any(self.rows).cells[:-2]
Beispiel #4
0
 def recurse(lst, rank, west=None, east=None, c=None, lvl=1):
     n = len(lst)
     mid = n // 2
     print()
     if n < few:
         rank += 1
         for one in lst:
             one.dom = rank
     else:
         west = west or furthest(any(lst), lst)
         east = east or furthest(west, lst)
         c = c or dist(west, east)
         tmp = []
         for row in lst:
             a = dist(west, row)
             if a > THE["tiny"] + c:
                 return recurse(lst,
                                rank,
                                west=row,
                                east=west,
                                c=a,
                                lvl=lvl)
             b = dist(east, row)
             if b > THE["tiny"] + c:
                 return recurse(lst,
                                rank,
                                west=row,
                                east=east,
                                c=b,
                                lvl=lvl)
             x = (a * a + c * c - b * b) / (2 * c + z)
             tmp += [(x, row)]
         tmp = [pair[1] for pair in sorted(tmp)]
         rest, best = tmp[0:mid], tmp[mid:]
         flip = west.dominates(east, t.y.weights, t.y.lo, t.y.hi)
         rank = recurse(best if flip else rest, rank, lvl=lvl + 1)
         rank = recurse(rest if flip else best, rank, lvl=lvl + 1)
     return rank
Beispiel #5
0
 def oneOther():
   x = any(pop)
   while f(x) in seen:
     x = any(pop)
   seen.append(f(x))
   return x
Beispiel #6
0
 def oneOther():
   x = any(pop)
   while f(x) in seen:
     x = any(pop)
   seen.append(f(x))
   return x
Beispiel #7
0
    'https://cdn.discordapp.com/attachments/521370427545878566/536787837748641802/1548050574095.png',
    0x2196F5
]
Giphy = [
    '<:giphyCard:536775386562953216>',
    'https://cdn.discordapp.com/attachments/521370427545878566/536775384163942401/1548047599005.png',
    0x541C92
]
Discord = [
    '<:disCard:529370875057799180>',
    'https://cdn.discordapp.com/attachments/521370427545878566/529370872742543370/1546281795364.png',
    0x7289DA
]

chatbot_key = '[^H4dyHZZ"qb.BtY_$uu'
translate_key = 'trnsl.1.1.20181124T015421Z.728683bc6d45c4b7.dc656a9c2799f0b85bed3e1da8f58306881e0120'
google_engine_id = "015786823554162166929:mywctwj8es4"
image_engine_id = "015786823554162166929:szgrbbrrox0"
google_key = 'AIzaSyAHdrGpN4Btt_f05b39jAkyxSe33KnI-gA'
gmaps_key = 'AIzaSyAihoCYFho8rqJwnBjxzBlk56SR0uL7_Ks'
youtube_key = 'AIzaSyCVDISbTT6GftDS_xZQHFkOGWvceCGo-7M'
genius_key = 'Bearer EX6CVpCc7rSN6lIEHBf6owHjM8Fl8d_Wr6-PeJEoWRekgXGVRR2DqiuhCsIv9A1w'
wolfram_key = any([
    'HAVTUH-7WV7QUXJ75', '7WV8W8-ET8L7EJWVK', '8UKH9G-QQLK7XU7PP',
    'XWL9P3-J4EJL57H8Y'
])
oxford_key = 'fcbeb8d177eeac005428f1ff1422cce4'
oxford_id = 'a38d0c98'
mapbox_key = 'pk.eyJ1IjoidG9uaXRlZ2Fyc2FoaWRpIiwiYSI6ImNqazlkN3Z0NTBheDUzd252bHZpMzY2bnAifQ.ISZiTcNEyxhQujDxWH4FWg'
picpurify_key = any(
    ['A8cTkCxtdaIJ5rbvpADCLWqAGwTZ1L0J', 'CrGE6Cr6VIj4nWZGii6Rkn4WlL7EadFC'])