query
stringlengths
9
3.4k
document
stringlengths
9
87.4k
metadata
dict
negatives
listlengths
4
101
negative_scores
listlengths
4
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
This func calc the number of words in one song
def get_len(song, album): length = 0 words = dbase()[album][0][song] words = words[2] words = words.split() for word in words: length += 1 return str(length)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def song_length(ans):\r\n length = 0\r\n flag = 1\r\n albums = simple_album_list()\r\n for album in albums:\r\n songs = simple_songs_list(album)\r\n for song in songs:\r\n if ans == song:\r\n words = dbase()[album][0][song]\r\n words = words[2]\r\n...
[ "0.7641895", "0.74189013", "0.7375139", "0.7181407", "0.71441495", "0.70609474", "0.70113283", "0.6958899", "0.6921988", "0.6921822", "0.6886437", "0.6875009", "0.6845606", "0.68437195", "0.68406963", "0.6803877", "0.67994726", "0.67805064", "0.6773257", "0.67365235", "0.6724...
0.764421
0
This func calc how many words there is in all of the songs, albums. using "get_len" function
def song_length(ans): length = 0 flag = 1 albums = simple_album_list() for album in albums: songs = simple_songs_list(album) for song in songs: if ans == song: words = dbase()[album][0][song] words = words[2] words = w...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_len(song, album):\r\n length = 0\r\n words = dbase()[album][0][song]\r\n words = words[2]\r\n words = words.split()\r\n for word in words:\r\n length += 1\r\n return str(length)", "def common():\r\n full_song = \"\"\r\n albums = simple_album_list()\r\n for album in album...
[ "0.8198582", "0.66658145", "0.64683807", "0.6397444", "0.6326289", "0.6298644", "0.623144", "0.62150586", "0.62072754", "0.61455053", "0.6131659", "0.61273545", "0.6073577", "0.60692155", "0.6067708", "0.60635406", "0.60574627", "0.59762967", "0.5966263", "0.59660995", "0.595...
0.81630695
1
This function returns the lyrics of specific song
def song_lyrics(ans): albums = simple_album_list() for album in albums: songs = simple_songs_list(album) for song in songs: if ans == song: words = dbase()[album][0][song] words = words[2] return words
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lyrics(self):\n return get_lyrics(self.artist, self.title,'')", "def get_lyrics(artist, song, language='', linesep='\\n', timeout=None):\n return get_all_lyrics(artist, song, language, linesep, timeout)[0]", "def get_lyrics(self):\n url = 'http://api.lyricsnmusic.com/songs?api_key=[5358b25...
[ "0.82025915", "0.7692463", "0.760172", "0.72425085", "0.71974313", "0.71780723", "0.7152949", "0.71083266", "0.70352906", "0.7034073", "0.7004775", "0.6972529", "0.69618744", "0.6934143", "0.6913037", "0.68426704", "0.68249315", "0.6794879", "0.6770472", "0.67184097", "0.6686...
0.81326777
1
This function finds what album the song in
def song_album(ans): albums = simple_album_list() for album in albums: songs = simple_songs_list(album) for song in songs: if ans == song: return album
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_album_playlist(data):\n\n return data['album'].lower() + '.m3u'", "def search_for_album(album_name):\n\n print(f'Searching for album: {album_name}')\n\n search_result = spotifyObject.search(q=f'\"{album_name}\"', limit=20, type='album')\n\n items = search_result['albums']['items']\n\n res...
[ "0.7356128", "0.72707754", "0.7060411", "0.7050987", "0.69334686", "0.6912387", "0.67691773", "0.66861814", "0.66782176", "0.66549325", "0.66268027", "0.6598319", "0.65646094", "0.6564256", "0.6559331", "0.6554879", "0.65491766", "0.65131474", "0.6505864", "0.64808756", "0.64...
0.83801645
0
This func finds a song by a string from the user(by name)
def song_by_word(ans): songs_list = "" ans = ans.lower() albums = simple_album_list() for album in albums: songs = simple_songs_list(album) for song in songs: song = str(song) if ans in song.lower(): songs_list += song + ", " return s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search_song(self, name):\n self.logger.debug('Searched for Song: {}'.format(name))\n results = self.sp.search(q='track:' + name, type='track')\n songs = [song for song in results['tracks']['items']]\n i = 1\n songs_ls = []\n table_ls = []\n for song in songs:\n ...
[ "0.6947447", "0.6876963", "0.6818424", "0.6807256", "0.67954665", "0.67806184", "0.6759367", "0.667911", "0.65942836", "0.65542203", "0.64625835", "0.64612514", "0.6326261", "0.6276666", "0.6270919", "0.62137413", "0.620946", "0.60927653", "0.6086777", "0.6085682", "0.6072206...
0.6074408
20
This func finds a song by a string from the user(by lyrics)
def lyrics_by_word(ans): songs_list = "" ans = ans.lower() albums = simple_album_list() for album in albums: songs = simple_songs_list(album) for song in songs: x = song_lyrics(song) song = str(song) if ans in x: songs_list +=...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search_song(title, artist):\n\ttitle = quote(title, safe='')\n\tartist = quote(artist, safe='')\n\tbase_url = SPOTIFY_API_HOST + 'search/' + '?q=track:{0}+artist:{1}&type=track&limit=1'\n\turl = base_url.format(title, artist)\n\tresults = requests.get(url).json()\n\n\ttry:\n\t\tif results['tracks']['total'] ==...
[ "0.6918285", "0.687244", "0.66271144", "0.6582607", "0.6552037", "0.65269274", "0.64055306", "0.6378039", "0.63699645", "0.63548654", "0.63060015", "0.63043284", "0.62030554", "0.61645436", "0.61451346", "0.61190856", "0.6113265", "0.60822713", "0.60463125", "0.6037531", "0.6...
0.6374961
8
This function makes list of the top 50 commonest words of all songs
def common(): full_song = "" albums = simple_album_list() for album in albums: songs = simple_songs_list(album) for song in songs: full_song += str(song_lyrics(song)) split_lyrics = full_song.lower().split() counter = collections.Counter(split_lyrics) most_wo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def top_k_frequent(top_k, words, list_of_texts):\n dict_top_freq = {}\n for word in words:\n dict_top_freq[word.lower()] = 0\n for string in list_of_texts:\n if word.lower() in string.lower():\n counter = string.lower().count(word.lower())\n dict_top_fre...
[ "0.738273", "0.7270854", "0.72609174", "0.6993908", "0.6986561", "0.69415885", "0.6875806", "0.6855121", "0.684043", "0.6821874", "0.6817871", "0.68166554", "0.67563236", "0.6738581", "0.6699482", "0.6695034", "0.6693428", "0.66674244", "0.6641728", "0.66324925", "0.66190416"...
0.7426751
0
This function makes list of the top 50 commonest words of all songs
def stats(): times_lst = [] time_dict = {} for album, details in dbase().items(): time_m = 0 time_s = 0 for songs, details_s in details[0].items(): time = details_s[1].split(":") min = int(time[0]) sec = int(time[1]) time_m +=...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def common():\r\n full_song = \"\"\r\n albums = simple_album_list()\r\n for album in albums:\r\n songs = simple_songs_list(album)\r\n for song in songs:\r\n full_song += str(song_lyrics(song))\r\n split_lyrics = full_song.lower().split()\r\n counter = collections.Counter(spl...
[ "0.7426751", "0.738273", "0.7270854", "0.72609174", "0.6993908", "0.6986561", "0.69415885", "0.6875806", "0.6855121", "0.684043", "0.6821874", "0.6817871", "0.68166554", "0.67563236", "0.6738581", "0.6699482", "0.6695034", "0.6693428", "0.66674244", "0.6641728", "0.66324925",...
0.0
-1
This function organise the two answer to one answers
def organise(times, words): length_lst = "" comm_lst = "" for item in times: length_lst += str(item[0]) + " - " + str(item[1]) + "\n" for item in words: comm_lst += str(item[0]) + " - " + str(item[1]) + "\n" return length_lst, comm_lst
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def putTogetherAnAnswer(self):\n currentLayer = self.frames[\"layer \" + str(self.currentFrame)]\n possibleTopics = []\n subject = \"\"\n\n # Authentication\n if self.authenticateQuestions.authStepInProgress != 0:\n return self.authenticateQuestions.continueAuth(self.i...
[ "0.5920408", "0.5828135", "0.5653084", "0.5597326", "0.55670136", "0.55494255", "0.5470206", "0.54302776", "0.54012376", "0.5351897", "0.53424776", "0.5341781", "0.5333092", "0.53298074", "0.5328876", "0.52590394", "0.52549297", "0.52336955", "0.52108526", "0.5204357", "0.519...
0.0
-1
line Tuple containing the (rho, theta) parameters of the line point Tuple containing the (x,y) coods of the line
def get_normal_dist(line, point): # Rotate: x_rot = np.cos(line[1])*point[0] + np.sin(line[1])*point[1] # Normal distance: x_rot - rho: return x_rot - line[0]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_line_points(y1, y2, line):\n if line is None:\n return None\n\n slope, intercept = line\n\n # make sure everything is integer as cv2.line requires it\n x1 = int((y1 - intercept) / slope)\n x2 = int((y2 - intercept) / slope)\n y1 = int(y1)\n y2 = int(y2)\n\n return ((x1, y1),...
[ "0.67866886", "0.62087274", "0.62049174", "0.61395484", "0.60201013", "0.6018803", "0.60153675", "0.59591883", "0.5937377", "0.5927099", "0.5927099", "0.5925086", "0.59203935", "0.59140366", "0.591017", "0.59039605", "0.59010077", "0.5860332", "0.5824119", "0.5807715", "0.580...
0.54883045
59
Points List of tuples, where each tuple has (x,y) coods of the points. numLines Number of pairs of points to be randomly sampled numIter Number of ietrations for which estimates of Prob should be refined e_tilde Critical distance for 50% probability of memebership in the line gamma_tilde Critical fraction of valid poin...
def iterative_function(points, numLines, numIter, e_tilde, gamma_tilde, beta_tilde): numPoints = len(points) # Randomly sample pairs and get the corresponding rho and theta parameters for a line fitted to the pair: # Returns a list of tuples - Each tuple has the rho and theta parameters for the l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generateData(numPoints,x,y):\n\tfor i in range(0,numPoints):\n\t\tif (i % 2 == 0):\n\t\t\tx.append(random.normalvariate(25, 15))\n\t\t\ty.append(random.normalvariate(25, 15))\n\t\t\t \n\t\t\t\n\t\telse:\n\t\t\tx.append(random.normalvariate(75, 15))\n\t\t\ty.append(random.normalvariate(75, 15))", "def generat...
[ "0.6171076", "0.61004645", "0.60166216", "0.5971953", "0.5899086", "0.5896352", "0.5832605", "0.58060277", "0.5772896", "0.57310075", "0.57118297", "0.5706741", "0.5691438", "0.5668014", "0.566632", "0.564936", "0.5631067", "0.56161624", "0.56137055", "0.55902743", "0.5562805...
0.6206707
0
Points List of tuples, where each tuple has (x,y) coods of the points. numLines Number of pairs of points to be randomly sampled numIter Number of ietrations for which estimates of Prob should be refined e_tilde Critical distance for 50% probability of memebership in the line gamma_tilde Critical fraction of valid poin...
def iterative_function_vect(points, numLines, numIter, e_tilde, gamma_tilde, beta_tilde): numPoints = len(points) # Randomly sample pairs and get the corresponding rho and theta parameters for a line fitted to the pair: # Returns a list of tuples - Each tuple has the rho and theta parameters for ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def iterative_function(points, numLines, numIter, e_tilde, gamma_tilde, beta_tilde):\n \n numPoints = len(points)\n \n # Randomly sample pairs and get the corresponding rho and theta parameters for a line fitted to the pair: \n # Returns a list of tuples - Each tuple has the rho and theta parameters...
[ "0.6206707", "0.6171076", "0.61004645", "0.60166216", "0.5971953", "0.5899086", "0.5896352", "0.5832605", "0.58060277", "0.5772896", "0.57310075", "0.5706741", "0.5691438", "0.5668014", "0.566632", "0.564936", "0.5631067", "0.56161624", "0.56137055", "0.55902743", "0.55628055...
0.57118297
11
`tokens` = a POStagged sentence [(w1, t1), ...] `index` = the index of the token we want to extract features for `history` = the previous predicted IOB tags
def features(self, tokens, index, history): # print history # print tokens # Pad the sequence with placeholders tokens = [('[START2]', '[START2]'), ('[START1]', '[START1]')] + list(tokens) + [('[END1]', '[END1]'), ('[END2]', '[END2]')] history = ['[START2]', '[START1]'] + list(history) # shift the index w...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def features(self, tokens, index, history):\r\n # for more details see: http://nlpforhackers.io/named-entity-extraction/\r\n \r\n # init the stemmer\r\n stemmer = SnowballStemmer('english')\r\n\r\n # Pad the sequence with placeholders\r\n tokens = [('[START2]', '[START2]')...
[ "0.7563386", "0.75412214", "0.7117187", "0.7014282", "0.6412167", "0.6303176", "0.6270073", "0.6218353", "0.6175226", "0.6162875", "0.6147514", "0.60744673", "0.5989423", "0.5949292", "0.5910468", "0.5908066", "0.5878046", "0.58631885", "0.58319926", "0.58020437", "0.57797873...
0.7014282
4
This function call from contact.
def call_from_contact(self): log_test_case(self.name, 'call_from_contact') #lick_textview_by_text(SC.PRIVATE_CONTACT_NUMBER) click_textview_by_id('primary_action_view') sleep(1) goback() sleep(3) return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def call(self):", "def force_contact(self, *args, **kwargs) -> Any:\n pass", "def call(self, callee: \"SIPPhoneTemplate\") -> None:", "def call(self) -> global___Snippet.ClientCall:", "def call(self) -> global___Snippet.ClientCall:", "def receiveContactList(self, contactList):", "def moment_cont...
[ "0.68409646", "0.660355", "0.6514977", "0.6372869", "0.6372869", "0.6274491", "0.6248815", "0.61637676", "0.61566913", "0.60917664", "0.5976085", "0.59733593", "0.59509075", "0.58956426", "0.5874206", "0.58698475", "0.585964", "0.58154577", "0.580931", "0.58043754", "0.579605...
0.7567253
0
main function ,entry search and show contact record
def test_case_main(self, case_results): log_test_case(self.name, 'drag up and down') drag_by_param(95, 50, 95, 85, 1) drag_by_param(95, 85, 95, 50, 1) sleep(1) drag_by_param(95, 50, 95, 85, 1) drag_by_param(95, 85, 95, 50, 1) sleep(1) self.ime = IME() ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search_contact_list(self):\n\n search_db = Database()\n result = search_db.contact_search(self.name)\n if not result:\n print Fore.YELLOW + ' No such contact'\n return None\n if result > 1:\n print ' Which contact ??'\n for items in result:\n...
[ "0.7752023", "0.69799906", "0.6894951", "0.65923977", "0.65287244", "0.65113544", "0.6378645", "0.6268453", "0.6262349", "0.6240841", "0.62032676", "0.6161232", "0.6122713", "0.611453", "0.6100291", "0.60771734", "0.6071167", "0.6057014", "0.6046095", "0.60439444", "0.6032808...
0.0
-1
Creates a .yaml file in $2 for each image in $1
def create_comments_files(images_dir, comments_dir): # where to look for the images join = os.path.join # report_dir = join(data_dir, 'report') # where to put the comments # comments_dir = join(data_dir, 'comments') # obtain files in data_dir/report ending in .eps eps_files = g...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_stage(self, images):\n\n for i, image in enumerate(images):\n pass\n # logging_tags = logs.image_config_to_tags(image, self.group_by_keywords)", "def transform_images(img1,img2):", "def build_images(prefix, images, tag=None, commit_range=None, push=False, chart_version=None,...
[ "0.64322525", "0.58754206", "0.5844284", "0.57787067", "0.57245845", "0.5698436", "0.56889397", "0.566494", "0.5650807", "0.56390005", "0.5597248", "0.5579034", "0.5577779", "0.5542533", "0.55192894", "0.5499594", "0.54623115", "0.54603213", "0.54489523", "0.54113674", "0.541...
0.0
-1
Returns the URL patterns for the tasks in this module
def getDjangoURLPatterns(): patterns = [ (r'gsoc/tasks/assignslots/assign$', r'soc.modules.gsoc.tasks.slot_assignment.assignSlots'), (r'gsoc/tasks/assignslots/program$', r'soc.modules.gsoc.tasks.slot_assignment.assignProgramSlots'), ] return patterns
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_urls(self):\n return patterns('')", "def urlpatterns(self) -> list:\n raise NotImplementedError()", "def getDjangoURLPatterns():\n\n patterns = [\n (r'^tasks/gci/task/bulk_create_tasks$',\n 'soc.modules.gci.tasks.bulk_create.bulkCreateTasks'),]\n\n return patterns", "def ur...
[ "0.8020168", "0.79488254", "0.7764272", "0.76677144", "0.76162356", "0.7482352", "0.73301244", "0.7311515", "0.72021514", "0.71234316", "0.7077645", "0.7022449", "0.6972498", "0.69355255", "0.68901694", "0.67814434", "0.66251045", "0.65685457", "0.6550831", "0.65432143", "0.6...
0.728069
8
Assign slots for organizations within a program Gets the slot assignment data as a JSON string from the program and enqueues a task to process the slot assignments
def assignProgramSlots(request, *args, **kwargs): program = None params = request.REQUEST # Query the program entity try: program = program_logic.getFromKeyName(params["programkey"]) except KeyError: logging.error("programkey not in params") return responses.terminateTask() if not program: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assignSlots(request, *args, **kwargs):\n\n # Setup an artifical request deadline\n timelimit = int(request.REQUEST.get(\"timelimit\", 20000))\n timekeeper = Timekeeper(timelimit)\n\n program_key = request.REQUEST.get(\"programkey\")\n last_key = request.REQUEST.get(\"lastkey\", \"\")\n program = program_...
[ "0.8256426", "0.5762987", "0.56316525", "0.54743224", "0.53757113", "0.5314603", "0.5236988", "0.52270603", "0.52103895", "0.51965916", "0.5142545", "0.5133743", "0.5121921", "0.5057504", "0.49842697", "0.49663857", "0.49040845", "0.4877993", "0.48507854", "0.4843296", "0.481...
0.7803846
1
Sets the slots attribute for each organization entity
def assignSlots(request, *args, **kwargs): # Setup an artifical request deadline timelimit = int(request.REQUEST.get("timelimit", 20000)) timekeeper = Timekeeper(timelimit) program_key = request.REQUEST.get("programkey") last_key = request.REQUEST.get("lastkey", "") program = program_logic.getFromKeyName(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def occupy_slot(self, slot, vehicle):\n self.__occupied_slots__[slot.slot_number] = vehicle.registration_number, vehicle.color\n self.__vehicle_slot_mapping__[vehicle.registration_number] = slot.slot_number\n self.__available_slots__.remove(slot)", "def extend_slots(self, prediction, item):\...
[ "0.5510804", "0.5312831", "0.52753824", "0.52753824", "0.5273821", "0.52403814", "0.5212397", "0.51739573", "0.51648086", "0.51483923", "0.51372176", "0.51309526", "0.5111528", "0.5084358", "0.5033539", "0.49991065", "0.4996006", "0.4996006", "0.4996006", "0.49839744", "0.494...
0.6378653
0
receive batch from replay and transfer batch from cpu to gpu
def sample_batch(pid, args, batch_queue, port_dict, device, actor_id_to_ip_dataport, local_size, cache_array): def recv_data(k, data_stream, actor_set, real_data_tasks_i): for real_data in data_stream: tmp = [] tmp.append(real_data.state) tmp.append(real_data.action) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process(self, sess):\n global send_counter\n \n #sess.run(self.sync) # copy weights from shared to local\n rollout = self.pull_batch_from_queue()\n batch = process_rollout(rollout, gamma=0.99, lambda_=1.0)\n\n should_compute_summary = self.task == 0 and self.local_ste...
[ "0.6505807", "0.63949424", "0.63113874", "0.61615974", "0.6134468", "0.6134468", "0.61168593", "0.6034089", "0.5956476", "0.5939015", "0.58440447", "0.5803942", "0.5793098", "0.57923245", "0.57748014", "0.5772822", "0.57639885", "0.5756384", "0.5732913", "0.57300854", "0.5729...
0.7087414
0
initial connect replay server update priority
def update_prios(prios_queue, port_dict): conn = grpc.insecure_channel(port_dict['replay_ip'] + ':' + port_dict['updatePrioriPort']) client = apex_data_pb2_grpc.UpdateBatchPrioriStub(channel=conn) while True: idxes, prios = prios_queue.get() response = client.Send(apex_data_pb2.UpdatePrioriR...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pre_irc_client(self):\n pass", "def server_activate(self):\n\t\tpass", "def connect(self):\n return 1", "def before_rpc(self, cmd, counter, xpath, kind=''):\n index = counter + xpath\n replay_type = kind[kind.find('basic ') + 6:]\n\n if not cmd:\n cmd = 'show...
[ "0.5780111", "0.57402444", "0.56140244", "0.5552766", "0.5545041", "0.54940057", "0.5485339", "0.542677", "0.54266566", "0.5413707", "0.5408652", "0.54038936", "0.5394475", "0.53876066", "0.53664225", "0.5342196", "0.5314109", "0.527661", "0.5275035", "0.52600473", "0.5251919...
0.0
-1
thread to fill parameter queue
def train(args, n_actors, batch_queue, prios_queue, param_queue): def _fill_param(): while True: model_dict = {} state_dict = model.state_dict() for k, v in state_dict.items(): model_dict[k] = v.cpu().numpy() param_queue.put(model_dict) en...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_thread(self):", "def main(self,q,controlQueue):\n\n self.dataQueue=q\n\n t1=threading.Thread(target=self.updater,args=(controlQueue,))\n #t2=threading.Thread(target=self.xMotor,args=(controlQueue,))\n #t3=threading.Thread(target=self.yMotor,args=(controlQueue,))\n t...
[ "0.6220907", "0.6174841", "0.6161662", "0.6155145", "0.61485934", "0.61485934", "0.6116193", "0.6083776", "0.6083776", "0.6083776", "0.6083776", "0.6083776", "0.6027521", "0.5898596", "0.5845421", "0.58248895", "0.5790226", "0.5786648", "0.5782508", "0.57810104", "0.57805663"...
0.0
-1
Set some data reader parameters for reading SPAM data
def setParameters(self) -> None: # get a list of the header and data files in the folder self.headerF = glob.glob(os.path.join(self.dataPath, "*.XTR")) if len(self.headerF) == 0: self.headerF = glob.glob(os.path.join(self.dataPath, "*.XTRX")) self.dataF = glob.glob(os.path.jo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _read_custom_pars(self):\n if self.use_defaults:\n param_set = \"default_values\"\n else:\n param_set = \"parameters\"\n self.outpars = self.input_cfg_json_data[param_set][self.step_title]", "def set_parameters(cls):\r\n \"\"\" EXECUTE THIS FUNCTION IN THE FA...
[ "0.60721964", "0.58910024", "0.5845442", "0.5730312", "0.56539893", "0.553149", "0.54175955", "0.5407873", "0.5407873", "0.5407873", "0.54072744", "0.53905016", "0.53378683", "0.53369725", "0.5336671", "0.53322905", "0.5329099", "0.53075695", "0.5299745", "0.5289717", "0.5258...
0.5704668
4
Get raw data from data file, returned in mV SPAM raw data is single precision float with unit Volts. Calling this applies the ts_lsb calculated when the headers are read. This is because when a recording consists of multiple data files, each channel of each data file might have a different scaling. The only way to make...
def getUnscaledSamples(self, **kwargs) -> TimeData: # initialise chans, startSample and endSample with the whole dataset options = self.parseGetDataKeywords(kwargs) # get the files to read and the samples to take from them, in the correct order dataFilesToRead, samplesToRead, scalings =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_magnetometer(self):\n data = self.mag.read_bytes(Register.OUT_X_L_M, 6)\n return lsm9ds1.to_vector(data)", "def read_raw_data(self):\n dat_file = os.path.join(DATA_DIR, self.patient_number + '.txt')\n if not os.path.exists(dat_file):\n raise AssertionError(\"{} doe...
[ "0.5571445", "0.5542686", "0.55078024", "0.5504112", "0.54853296", "0.5461196", "0.5426089", "0.539896", "0.5366386", "0.53356355", "0.53265965", "0.53247327", "0.529701", "0.52936316", "0.5283426", "0.527169", "0.52697086", "0.5268657", "0.5241611", "0.5232119", "0.5224715",...
0.55713576
1
Get the data files that have to be read to cover the sample range
def getDataFilesForSamples( self, startSample: int, endSample: int ) -> Tuple[List[str], List[List[int]], List[float]]: # have the datafiles saved in sample order beginning with the earliest first # go through each datafile and find the range to be read dataFilesToRead = [] s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_samples_file(foldername, filter=None):\n samples = []\n for file in os.listdir(foldername):\n if filter and file.find(filter) == -1:\n continue\n for sample in sfile(foldername + '/' + file, None).get_samples():\n samples.append(sample)\n return samples", "def...
[ "0.61742574", "0.60562795", "0.5931317", "0.5895991", "0.5861483", "0.58041275", "0.5802405", "0.57899123", "0.5788426", "0.57653975", "0.5759746", "0.5747541", "0.57445914", "0.57307", "0.5728617", "0.5701655", "0.5679718", "0.56450206", "0.5641442", "0.5636241", "0.56325316...
0.73086745
0
Get data scaled to physical values
def getPhysicalSamples(self, **kwargs): # initialise chans, startSample and endSample with the whole dataset options = self.parseGetDataKeywords(kwargs) # get data timeData = self.getUnscaledSamples( chans=options["chans"], startSample=options["startSample"], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _process(self, data: np.ndarray) -> np.ndarray:\n return data[..., 1] * self.scale", "def scale(self, data: np.ndarray):\n if self.scale_type == \"min_max\":\n scaled_data = (data - self.predictor_min) / (\n self.predictor_max - self.predictor_mean\n )\n ...
[ "0.7218168", "0.71448", "0.7138502", "0.69515485", "0.6725166", "0.66584325", "0.6623131", "0.66130257", "0.65810096", "0.6528474", "0.64878947", "0.6486401", "0.6462088", "0.6444527", "0.6427217", "0.6423392", "0.6414994", "0.6407963", "0.6400517", "0.6399533", "0.6392617", ...
0.0
-1
Get the sections in SPAM header files (XTR and XTRX) Returns
def spamHeaders(self) -> Tuple[List[str], Dict[str, str]]: sections = ["STATUS", "TITLE", "PROJECT", "FILE", "SITE", "CHANNAME", "DATA"] sectionHeaders = {} sectionHeaders["STATUS"] = ["STATUS"] sectionHeaders["TITLE"] = ["AUTHOR", "VERSION", "DATE", "COMMENT"] sectionHeaders["FI...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_header_and_sequence_lists(fh_in):\n temp = ''\n isSeq = isSecStr = False\n sequence_header = secstr_header = sequence = secstr = []\n for line in fh_in:\n if (isSeq | isSecStr) & (line[0] != \">\"):\n temp += line.strip()\n elif line[0] == \">\" & line.strip().endswith(...
[ "0.66375244", "0.6181933", "0.6116806", "0.6039351", "0.6034466", "0.60314673", "0.6021332", "0.6004215", "0.5954007", "0.5933811", "0.5928915", "0.59252787", "0.590929", "0.5903301", "0.587604", "0.58664584", "0.5863298", "0.58631116", "0.58611786", "0.58450514", "0.5824852"...
0.5751077
27
Get defaults for channel headers Returns Dict[str, Any] Dictionary of headers for channels and default values
def chanDefaults(self) -> Dict[str, Any]: chanH = {} chanH["gain_stage1"] = 1 chanH["gain_stage2"] = 1 chanH["hchopper"] = 0 # this depends on sample frequency chanH["echopper"] = 0 # channel output information (sensor_type, channel_type, ts_lsb, pos_x1, pos_x2, pos_y1, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def defaults():\n return {}", "def default_channel_response_data(channel):\n channel_record = Channel.objects.get(name=channel.name)\n return {\n \"title\": channel.title,\n \"name\": channel.name,\n \"description\": channel.description,\n \"public_description\": channel....
[ "0.62941504", "0.6244179", "0.620184", "0.59563303", "0.5954738", "0.58055735", "0.5720258", "0.57148266", "0.56928277", "0.5690497", "0.5689257", "0.56565005", "0.56229764", "0.55866164", "0.55399114", "0.55186236", "0.5510632", "0.54901797", "0.5486276", "0.5461099", "0.544...
0.70106703
0
Read header files For SPAM data, the may be more than one header file as data can be split up into smaller files as it is recorded. In that case, the header information should be somehow merged. All sampling frequencies should be the same
def readHeader(self) -> None: # read header files self.headersList = [] self.chanHeadersList = [] for headerFile in self.headerF: if "xtrx" in headerFile.lower(): headers, chanHeaders = self.readHeaderXTRX(headerFile) else: headers,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_header(self):\n # Read entire header into memory in one read to minimize Disk I/O.\n self.fh.seek(0)\n hdr = self.fh.read(self.header['header size'])\n\n # Find several markers in the byte-string\n # Each of these may occur more than once, find last.\n polylist_po...
[ "0.68931645", "0.68798554", "0.68419707", "0.6750417", "0.67503536", "0.6726142", "0.64970535", "0.64856166", "0.6483004", "0.6462398", "0.642394", "0.63903534", "0.6343897", "0.63411504", "0.62974936", "0.6291137", "0.62813884", "0.6280724", "0.62803566", "0.62442863", "0.62...
0.7617964
0
Read a XTR header file The raw data for SPAM is in single precision Volts. However, if there are multiple data files for a single recording, each one may have a different gain. Therefore, a scaling has to be calculated for each data file and channel. This scaling will convert all channels to mV. For the most part, this...
def readHeaderXTR(self, headerFile: str) -> None: with open(headerFile, "r") as f: lines = f.readlines() sectionLines = {} # let's get data for line in lines: line = line.strip() line = line.replace("'", " ") # continue if line is empty ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def readHead(self):\n filesize = self.rhd.tell()\n \n #the order in which all of this is called is critcal\n self.header_identifier = hex(np.uint32(struct.unpack('<I', self.rhd.read(4))))\n v = np.int8(struct.unpack('BBBB', self.rhd.read(4)))\n\n #read each property of the...
[ "0.6155055", "0.5993816", "0.5884923", "0.58070946", "0.55780053", "0.5524579", "0.55149055", "0.5444751", "0.5440984", "0.5410213", "0.5406023", "0.5403349", "0.540114", "0.53573203", "0.52880806", "0.52805924", "0.52777493", "0.5273233", "0.5264056", "0.52473116", "0.523383...
0.66186225
0
Read a XTRX header files XTRX are newer header files and will supercede XTR
def readHeaderXTRX(self, headerFile): raise NotImplementedError("Support for XTRX files has not yet been implemented")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def readHeader(self) -> None:\n # read header files\n self.headersList = []\n self.chanHeadersList = []\n for headerFile in self.headerF:\n if \"xtrx\" in headerFile.lower():\n headers, chanHeaders = self.readHeaderXTRX(headerFile)\n else:\n ...
[ "0.6655318", "0.6545926", "0.6512777", "0.5899843", "0.58021617", "0.5711781", "0.5699319", "0.568349", "0.5606272", "0.5598395", "0.5573075", "0.5572416", "0.556946", "0.5562428", "0.5521986", "0.55197376", "0.5510907", "0.5490756", "0.54724866", "0.54674906", "0.5455055", ...
0.7716968
0
Read headers from the raw data files Read the headers from the raw file and figure out the data byte offset.
def headersFromRawFile(self, rawFile: str, headers: Dict) -> None: dFile = open(os.path.join(self.dataPath, rawFile), "r", encoding="ISO-8859-1") generalHeaderString = dFile.read(1000) # this should be long enough generalSplit = generalHeaderString.split() # read GENERAL HEADER ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _read_header(self):\n f = self._open(self.filename, 'rb')\n idx = 0\n header = b''\n # reading the header \n while idx < 13: \n header += f.readline().rstrip() # removes the \"\\n\\r\" at the end\n idx += 1\n # \"magically\" compute the data offse...
[ "0.732197", "0.70453995", "0.70345956", "0.6827632", "0.67381376", "0.67219263", "0.6580198", "0.6544923", "0.64966327", "0.64756894", "0.6393467", "0.6361028", "0.6350547", "0.63097715", "0.6288819", "0.62671334", "0.62456226", "0.62452", "0.6240933", "0.61506295", "0.611367...
0.70389855
2
Merge headers from all the header files Checks all the header files to see if there are any gaps and calculates the sample ranges for each file together with the total number of samples. Sets the start and end time of the recording and class variables datetimeStart and datetimeStop.
def mergeHeaders(self, headersList: List, chanHeadersList: List) -> None: # take the first header as an example self.headers = headersList[0] self.chanHeaders = chanHeadersList[0] if len(headersList) == 1: # just fill in the data file list and data ranges self.dat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def readHeaderXTR(self, headerFile: str) -> None:\n with open(headerFile, \"r\") as f:\n lines = f.readlines()\n sectionLines = {}\n # let's get data\n for line in lines:\n line = line.strip()\n line = line.replace(\"'\", \" \")\n # continue i...
[ "0.6403937", "0.61514765", "0.6100263", "0.5859067", "0.58415174", "0.58295155", "0.57660097", "0.56070304", "0.55764234", "0.5484562", "0.5480894", "0.5478244", "0.545221", "0.5397874", "0.53785336", "0.5354963", "0.51996344", "0.5187501", "0.5178293", "0.5173099", "0.516023...
0.71078265
0
Information about the data files as a list of strings Returns List[str] List of information about the data files
def printDataFileList(self) -> List[str]: textLst: List[str] = [] textLst.append("Data File\t\tSample Ranges") for dFile, sRanges in zip(self.dataFileList, self.dataRanges): textLst.append("{}\t\t{} - {}".format(dFile, sRanges[0], sRanges[1])) textLst.append("Total samples = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_data(self):\n data_list = []\n for root, dirs, files in os.walk(pathfinder.data_path()):\n for name in files:\n data_list.append(os.path.join(root, name))\n return data_list", "def getDataFiles(directoryName):\r\n \r\n return listdir(directoryName)", ...
[ "0.7393555", "0.7135669", "0.69985956", "0.6970242", "0.6864774", "0.6864221", "0.68211174", "0.67915004", "0.678704", "0.6742841", "0.6741322", "0.6736098", "0.67299247", "0.6709108", "0.6708198", "0.6699793", "0.6695189", "0.66744316", "0.6654875", "0.6652273", "0.66320395"...
0.7159409
1
Print a list of the data files
def printDataFileInfo(self) -> None: blockPrint( "{} Data File List".format(self.__class__.__name__), self.printDataFileList(), )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def printDataFileList(self) -> List[str]:\n textLst: List[str] = []\n textLst.append(\"Data File\\t\\tSample Ranges\")\n for dFile, sRanges in zip(self.dataFileList, self.dataRanges):\n textLst.append(\"{}\\t\\t{} - {}\".format(dFile, sRanges[0], sRanges[1]))\n textLst.append...
[ "0.7421527", "0.7151215", "0.7037491", "0.68719506", "0.67474115", "0.6731406", "0.67165095", "0.66810274", "0.65934056", "0.65144914", "0.647909", "0.64371884", "0.64266837", "0.6414693", "0.64125454", "0.63596314", "0.63500434", "0.63232774", "0.6245325", "0.623468", "0.619...
0.6734756
5
Given a set of results, return a list of LDAPSearchResult objects.
def get_search_results(results): if len(results) == 0: return [] if type(results) == tuple and len(results) == 2: (code, arr) = results elif type(results) == list: arr = results res = [] for item in arr: res.append(LDAPSearchResult(item)) return res
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_search_results(fields, results):\n my_results = []\n for result in results:\n my_results.append(SearchAnimeResult(fields, result))\n return my_results", "def list_results(cls, output_dir, **kwargs):\n results = cls.load(output_dir, **kwargs)\n return results.get_results()"...
[ "0.5853295", "0.5794549", "0.5777972", "0.5770905", "0.5710312", "0.57052636", "0.56758606", "0.56412905", "0.5539216", "0.5504885", "0.5490016", "0.54144686", "0.53994405", "0.5384345", "0.53460926", "0.53145885", "0.53108484", "0.5308784", "0.5290834", "0.52842665", "0.5256...
0.7374579
0
In Ms we must remove the quotes.
def test_set_ms_filename(self): self.expect(self.request.get('HTTP_USER_AGENT', ANY)).result('MSIE') self.replay() set_attachment_content_disposition(self.request, 'MS Name') self.assertEquals( self.header[0], 'attachment; filename=%s' % quote('MS Name'))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dequote(self, in_str):\n in_str = in_str.replace(\"'\", \"\")\n in_str = in_str.replace('\"', \"\")\n return in_str", "def embeded_triple_quotes():\n pass", "def _strip_quotes(self, val):\n logger.debug('Strip quotes')\n val = val.strip()\n if val.startswith('\"...
[ "0.697623", "0.6833524", "0.6796816", "0.6723186", "0.65923566", "0.6580481", "0.65477896", "0.65477896", "0.64594156", "0.64291596", "0.6404944", "0.63892174", "0.6367405", "0.6345285", "0.6312037", "0.62679034", "0.6257897", "0.6241633", "0.6211071", "0.61968356", "0.617006...
0.0
-1
Normaly we have the filename in quotes
def test_filename(self): self.expect(self.request.get('HTTP_USER_AGENT', ANY)).result('DEF') self.replay() set_attachment_content_disposition(self.request, 'Default Name') self.assertEquals( self.header[0], 'attachment; filename="%s"' % 'Default Name')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def quoted_filename(self):\n if \" \" in self._filename:\n return f'\"{self._filename}\"'\n return self._filename", "def _escape_filename(filename):\n #Is adding the following helpful\n #if os.path.isfile(filename):\n # #On Windows, if the file exists, we can ask for\n # ...
[ "0.8299621", "0.74909776", "0.7401939", "0.73211366", "0.7225268", "0.7137683", "0.70245075", "0.6966879", "0.6926033", "0.684065", "0.6761801", "0.6725638", "0.6718539", "0.66415536", "0.6637449", "0.6604877", "0.66015303", "0.6574798", "0.6571564", "0.6570204", "0.65622014"...
0.0
-1
Look for transaction receipt, only raise not found error if they are missing for longer than two minutes.
async def _check_transaction_receipt(self, tx_hash: str, timestamp: int): async_scheduler: AsyncCallScheduler = AsyncCallScheduler.shared_instance() try: return await async_scheduler.call_async(self._w3.eth.getTransactionReceipt, tx_hash) except TransactionNotFound as e: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wait_for_receipt(tx_hash, duration=C.EVM_TIMEOUT):\n slept = 0\n tx_rcpt = None\n\n while slept < duration:\n # because web3 throws if not present vs returning None (like the docs say)\n try:\n tx_rcpt = g.w3.eth.getTransactionReceipt(tx_hash)\n except TransactionNotFou...
[ "0.6613937", "0.6224734", "0.5850289", "0.56903857", "0.5246986", "0.52447987", "0.51985824", "0.51980007", "0.5125841", "0.5107872", "0.50937873", "0.50544405", "0.4955215", "0.49193367", "0.49190685", "0.48734447", "0.48641413", "0.48391086", "0.48348594", "0.483187", "0.48...
0.7078107
0
Look for failed transactions, and emit transaction fail event if any are found.
async def check_transaction_receipts(self): async_scheduler: AsyncCallScheduler = AsyncCallScheduler.shared_instance() tasks = [self._check_transaction_receipt(tx_hash, self._pending_tx_dict[tx_hash]['timestamp']) for tx_hash in self._pending_tx_dict.keys()] transaction_receipts...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transaction_failed(self):", "def transaction_failed_before_processing(self):", "def test_fail_transaction(self):\n source_wallet = self.source_user.wallets.last()\n target_wallet = self.target_user.wallets.last()\n\n source_balance_init = source_wallet.balance\n target_balance_i...
[ "0.6845539", "0.6508842", "0.6043803", "0.59724367", "0.58863974", "0.5845787", "0.5680421", "0.5539082", "0.5481254", "0.5476299", "0.5471279", "0.5429954", "0.5421628", "0.54185337", "0.5392355", "0.5377968", "0.53582096", "0.5348797", "0.5295418", "0.52938634", "0.52896744...
0.51061434
28
This function WILL result in immediate network calls (e.g. to get the gas price, nonce and gas cost), even though it is written in sync manner.
def execute_transaction(self, contract_function: ContractFunction, **kwargs) -> str: if self._network_status is not NetworkStatus.CONNECTED: raise EnvironmentError("Cannot send transactions when network status is not connected.") gas_price: int = self.gas_price transaction_args: Dic...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sync() -> None:", "def do_sync(self):\n raise NotImplementedError() # pragma: no cover", "def lock(self):\n self.words = None\n self.keys = {}\n self.passphrase = b''\n self.language = ''\n self.unspent_txs = {}\n self.spent_txs = []\n self.balanc...
[ "0.5842357", "0.5409376", "0.5385483", "0.518371", "0.5168875", "0.51402295", "0.51202995", "0.50815713", "0.50815713", "0.5059374", "0.5057339", "0.5057225", "0.5049696", "0.5042864", "0.502704", "0.5019603", "0.5010587", "0.49878943", "0.49797568", "0.49772134", "0.4973907"...
0.0
-1
Maintain the approve amounts for a token. This function will be used to ensure trade execution using exchange protocols such as 0x, but should be defined in child classes
async def check_and_fix_approval_amounts(self, spender: str) -> List[str]: min_approve_amount: int = int(Decimal("1e35")) target_approve_amount: int = int(Decimal("1e36")) async_scheduler: AsyncCallScheduler = AsyncCallScheduler.shared_instance() # Get currently approved amounts ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def approve(self, approver: str, to: str, amount, key: bytes):\n raw_tx = self.approve_build_transaction(approver, to, amount)\n signed_tx = self._sign(raw_tx, key)\n self.send_and_wait(signed_tx)", "def approve(_spender: address, _amount: uint256) -> bool:\n\n self.allowed[msg.sender][_s...
[ "0.7216647", "0.6862428", "0.64983207", "0.63403976", "0.62941015", "0.6252941", "0.6056391", "0.6046018", "0.60323536", "0.57856506", "0.5753322", "0.5654326", "0.56351185", "0.5621246", "0.5617158", "0.5562989", "0.55543655", "0.5552366", "0.5540227", "0.55319315", "0.55084...
0.668693
2
Test case for add_asset_share_feed
def test_add_asset_share_feed(self): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_add_assets_signal(self):\n story = create_story(title=\"Test Story\", summary=\"Test Summary\",\n byline=\"Test Byline\", status='published')\n asset = create_html_asset(type='text', title='Test Asset', \n body='Test content')\n ...
[ "0.65638447", "0.6394304", "0.63698304", "0.6273951", "0.613335", "0.6046205", "0.60451096", "0.60319424", "0.599211", "0.5991656", "0.5964404", "0.59383875", "0.5885912", "0.58813864", "0.5863835", "0.57720274", "0.57403314", "0.5740057", "0.57348704", "0.5733369", "0.572277...
0.9495953
0
Return user details from Facebook account
def get_user_details(self, response): email = response.get("email") return {"email": email, "username": email.split("@")[0]}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_facebook_user_info(access_token):\n required_data_list = []\n for per in settings.FACEBOOK_EXTENDED_PERMISSIONS:\n required_data_list.append(per.replace(\"user_\",\"\"))\n \n required_data_list.append(\"picture.type(large)\")\n required_data = (\", \").join([data for data in required_...
[ "0.75915205", "0.7549937", "0.75489026", "0.7247428", "0.7169986", "0.71510726", "0.71399206", "0.7130518", "0.6965519", "0.6933262", "0.6878169", "0.68746084", "0.6857427", "0.6842357", "0.6841119", "0.68202627", "0.680102", "0.677454", "0.6769051", "0.67508054", "0.67205805...
0.66149896
32
Loads user data from service
def user_data(self, access_token, *args, **kwargs): params = self.setting("PROFILE_EXTRA_PARAMS", {}) response = kwargs.get('response') or {} params["access_token"] = access_token headers = { "Authorization": "%s %s" % ( response.get("token_type", "Bearer").ca...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load(self):\n\n self.refresh_token()\n\n endpoint = app.config['API']['url'] + 'user/get/' + self._id\n response = requests.get(\n endpoint,\n verify = app.config['API']['verify_ssl'],\n headers = {\n 'Authorization': self.token,\n ...
[ "0.7237133", "0.71659297", "0.6840109", "0.68110734", "0.6732239", "0.6647199", "0.6626025", "0.6564652", "0.6559671", "0.655537", "0.655537", "0.655537", "0.655537", "0.65010494", "0.65010494", "0.6469503", "0.64684176", "0.6422018", "0.640237", "0.6358974", "0.63496375", ...
0.0
-1
Build redirect with redirect_state parameter.
def get_redirect_uri(self, state=None): regex = re.compile(r"\:(80|443)\/") uri = regex.sub("/", self.redirect_uri) if self.REDIRECT_STATE and state: uri = url_add_parameters(uri, {'redirect_state': state}) return uri
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_redirect_uri(self, state=None):\n if state is not None:\n uri = self.blank_redirect_uri\n if self.REDIRECT_STATE and state:\n uri = url_add_parameters(uri, {'redirect_state': state})\n else:\n uri = self.redirect_uri\n return uri", "def...
[ "0.6220852", "0.58699924", "0.5820168", "0.5787547", "0.568278", "0.560986", "0.5485404", "0.54818624", "0.54510164", "0.5417507", "0.54143995", "0.54086787", "0.5376258", "0.53444564", "0.53163904", "0.52998877", "0.5273541", "0.525929", "0.5201142", "0.51966715", "0.5181374...
0.5998109
1
Finish the auth process once the access_token was retrieved
def do_auth(self, access_token, *args, **kwargs): data = self.user_data(access_token, *args, **kwargs) response = kwargs.get('response') or {} response.update(data or {}) if 'access_token' not in response: response['access_token'] = access_token kwargs.update({'respon...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def auth_complete(self, *args, **kwargs):\n self.process_error(self.data)\n params = self.auth_complete_params(self.validate_state())\n\n response = requests.post(self.ACCESS_TOKEN_URL, data=params,\n headers=self.auth_headers())\n if response.status_code...
[ "0.77423286", "0.6978665", "0.6935192", "0.6700793", "0.6664119", "0.65909183", "0.65890825", "0.6557191", "0.65195364", "0.6448075", "0.64399666", "0.6421506", "0.6376332", "0.63507086", "0.63101214", "0.6293467", "0.6244578", "0.6234269", "0.6204466", "0.6197578", "0.615388...
0.61004966
23
Compute softmax probabilities for all actions.
def softmax(x1, x2, x3, beta): xs = np.array((x1, x2, x3)) num = np.exp(xs * beta) den = np.exp(xs * beta).sum() return num / den
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def softmax(inputs):\n probs = np.exp(inputs)\n # print(probs.shape)\n # t = np.sum(probs, axis=0)\n # print(t.shape)\n\n probs /= np.sum(probs, axis=0)[np.newaxis,:]\n return probs", "def softmax(x):\n shape = x.shape\n probs = np.exp(x - np.max(x, axis=len(shape) - 1, keepdims=True))\n ...
[ "0.7465903", "0.73197216", "0.71343404", "0.71002626", "0.70893115", "0.70893115", "0.6964765", "0.6963534", "0.69254", "0.6904407", "0.6894728", "0.6893124", "0.68816084", "0.68766975", "0.68731517", "0.6869365", "0.6868904", "0.6868904", "0.6868904", "0.6868904", "0.6868904...
0.0
-1
This is probably inefficient, but a useful way to find e.g. the scene position under the mouse cursor.
def read_pixel(self, name: str, x: int, y: int, gl_type=gl.GL_FLOAT, gl_format=gl.GL_RGBA): c_type = GLTYPE_TO_CTYPE[gl_type] texture = self.textures[name] position_value = (c_type * 4)() with self: gl.glReadBuffer(gl.GL_COLOR_ATTACHMENT0 + texture.unit) gl.glRead...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mousePos():\n data = display.Display().screen().root.query_pointer()._data\n return data[\"root_x\"], data[\"root_y\"]", "def cursorPosGL(self):\n globalPos = QtGui.QCursor.pos()\n pos = self.mapFromGlobal(globalPos)\n y = self.size().height() - pos.y()\n return pos.x(), y",...
[ "0.76065445", "0.7346294", "0.7346294", "0.7276934", "0.72699213", "0.72340405", "0.70662713", "0.70662713", "0.70391846", "0.68502015", "0.6846693", "0.68412995", "0.68412995", "0.6807147", "0.6766796", "0.6728611", "0.6693625", "0.6693625", "0.6693625", "0.6686737", "0.6631...
0.0
-1
Loads surface mesh using meshio. Not meant for mixed shape meshes.
def load_mesh(fname): fname = abs_fname_(fname) m = meshio.read(fname) mesh = Mesh() mesh.vertices = m.points for i, c in enumerate(m.cells): if i == 0: faces = c.data else: faces = np.vstack((faces, c.data)) mesh.faces = faces return mesh
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_mesh(self, script_to_apply=None): \n # convert to an obj file using meshlab\n if script_to_apply is None:\n meshlabserver_cmd = 'meshlabserver -i \\\"%s\\\" -o \\\"%s\\\"' %(self.filename, self.obj_filename)\n else:\n meshlabserver_cmd = 'meshlabserver -i ...
[ "0.7057171", "0.70245314", "0.67579937", "0.67061126", "0.6692487", "0.6679398", "0.6569063", "0.6533282", "0.6514972", "0.6505622", "0.6436628", "0.6435029", "0.6251096", "0.62127954", "0.62039167", "0.6150478", "0.61312926", "0.611122", "0.6106273", "0.6066741", "0.6060872"...
0.7224944
0
Loads volume mesh using meshio. Not meant for mixed shape meshes.
def load_volume_mesh(fname): fname = abs_fname_(fname) m = meshio.read(fname) mesh = Mesh() mesh.vertices = m.points for i, c in enumerate(m.cells): if i == 0: elements = c.data else: elements = np.vstack((elements, c.data)) mesh.elements = elements ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read(self, mesh_path: str) -> None:\n\n reader = VtuReader(mesh_path)\n self.set_mesh_data(mesh=reader.mesh, bc=reader.bc, mpc=reader.mpc)", "def load_volume_mixd(dim, fname=None, mxyz=None, mien=None, hexa=False):\n vertices, elements = mixd_load_(fname, mxyz, mien)\n\n mesh = Mesh()\n ...
[ "0.70592856", "0.6962647", "0.69257474", "0.6415933", "0.6392293", "0.6390476", "0.6343733", "0.6273749", "0.6219491", "0.620209", "0.609297", "0.60837203", "0.6062914", "0.6002005", "0.5998866", "0.5905394", "0.586846", "0.585365", "0.5845951", "0.580518", "0.57808256", "0...
0.7867217
0
Raw loading function that can be used from `load_mixd` and `load_volume_mixd`. Meant for internal use.
def mixd_load_(fname=None, mxyz=None, mien=None): fname = abs_fname_(fname) if fname is None and (mxyz is None and mien is None): raise ValueError( "Either `fname` or (`mxyz` and `mien`) needs to be defined." ) if fname is None: if ( (mxyz is None and mien i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load(self):\n\n raise NotImplementedError", "def _load_disk(self):", "def _load_disk(self):", "def loadRaw(self, path, preprocfunc=None):\n # Only for 8 and 32 bit images\n depth = self.getDepth()\n if depth==1:\n mamba.raiseExceptionOnError(mambaCore.ERR_BAD_DEPTH)\n ...
[ "0.6166569", "0.61044806", "0.61044806", "0.6067018", "0.6023306", "0.6013337", "0.59904814", "0.59666723", "0.5963483", "0.5954268", "0.59243995", "0.5867219", "0.58107245", "0.5805746", "0.5797998", "0.57825094", "0.5765734", "0.57507634", "0.5726716", "0.56981766", "0.5690...
0.0
-1
Loads mixd volume meshes.
def load_volume_mixd(dim, fname=None, mxyz=None, mien=None, hexa=False): vertices, elements = mixd_load_(fname, mxyz, mien) mesh = Mesh() mesh.vertices = vertices.reshape(-1, dim) if hexa: mesh.elements = elements.reshape(-1, 8) else: mesh.elements = elements.reshape(-1, 4) re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_volume_mesh(fname):\n fname = abs_fname_(fname)\n\n m = meshio.read(fname)\n mesh = Mesh()\n mesh.vertices = m.points\n\n for i, c in enumerate(m.cells):\n if i == 0:\n elements = c.data\n else:\n elements = np.vstack((elements, c.data))\n\n mesh.eleme...
[ "0.6619064", "0.6575824", "0.5888349", "0.5782488", "0.5687946", "0.56595165", "0.55847037", "0.5549612", "0.5535285", "0.54974794", "0.5464577", "0.54594773", "0.54511726", "0.5433815", "0.5415109", "0.53885984", "0.53758585", "0.5352629", "0.5302441", "0.53019255", "0.53004...
0.7286509
0
Loads spline files of extension `.iges` `.xml` `.itd`
def load_splines(fname): fname = str(fname) fname = abs_fname_(fname) sr = splinelibpy.Reader() ext = os.path.splitext(fname)[1] if ext == ".iges": loaded_splines = sr.read_iges(fname) elif ext == ".xml": loaded_splines = sr.read_xml(fname) elif ext == ".itd": ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load(self):\n if self.__fname == '':\n print('You must pass in a file name to load!')\n return []\n\n ext = os.path.splitext(self.__fname)[1]\n first_pt = None\n if len(self.__fea.points) > 0:\n first_pt = self.__fea.points[0]\n if ext == '.dx...
[ "0.598407", "0.5837179", "0.56815714", "0.5675505", "0.5656372", "0.56464905", "0.56287754", "0.55418855", "0.5446652", "0.54027593", "0.5383158", "0.5353577", "0.5353577", "0.53077507", "0.5288568", "0.5288151", "0.5274512", "0.52620083", "0.5251903", "0.52356094", "0.523395...
0.71475726
0
Checks if fname is absolute. If not, turns it into an abspath. Tilde safe.
def abs_fname_(fname): if os.path.isabs(fname): pass elif '~' in fname: fname = os.path.expanduser(fname) else: fname = os.path.abspath(fname) return fname
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _makeAbsolute(fname):\n if fname[0] != '/':\n return os.path.join(os.getcwd(), fname)\n else:\n return fname", "def getAbsFileName(fname):\n\tfileAbsPath=os.path.abspath(fname)\n\treturn fileAbsPath", "def abspath(filename, relative_to = None):\n # Create filename relative to the refer...
[ "0.82105744", "0.7471553", "0.69280857", "0.69023055", "0.6898607", "0.6897593", "0.6879507", "0.6845178", "0.68191797", "0.6804619", "0.67667115", "0.67245203", "0.67103535", "0.6708995", "0.66932917", "0.66385156", "0.6597944", "0.6584722", "0.65428245", "0.6516904", "0.650...
0.83377725
0
Checks to see if the user is a librarian for certain routes
def librarian(f): @wraps(f) def decorated_function(*args, **kwargs): if current_user.lflag == 0: flash("You are not a librarian! Please sign in to a librarian account") return redirect(url_for('main')) return f(*args, **kwargs) return decorated_function
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def librarian_list(request):\n librarian = User.objects.filter(is_student=False, is_lecturer=False, is_parent=False, is_superuser=False)\n user_type = \"Librarian\"\n context = {\n \"librarian\": librarian,\n \"user_type\": user_type,\n }\n return render(request, 'library/librarians_li...
[ "0.62187976", "0.55780613", "0.5519553", "0.54693735", "0.5451162", "0.5360155", "0.53441876", "0.53240615", "0.53006685", "0.5292587", "0.5280629", "0.5270738", "0.5257878", "0.52497697", "0.5249029", "0.52322376", "0.5221979", "0.521075", "0.52094173", "0.5189399", "0.51697...
0.60173243
1
Run the forward pass for a model.
def forward(self, *args, **kwargs) -> Dict[str, Any]: pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_iter_forward(self, runner):\n # unpack features into features and targets\n *features, target = runner.batch\n # Forward features\n runner.output = runner.model(*features)\n # Ensure `targetL` and `outputL` are always in a list format.\n targetL = [target] if not is...
[ "0.71058494", "0.6935403", "0.6893536", "0.6876209", "0.68726456", "0.67623425", "0.67323256", "0.67323256", "0.6713972", "0.67027366", "0.6692563", "0.6682018", "0.6682018", "0.66558874", "0.6654495", "0.6642389", "0.6582641", "0.6569321", "0.6529306", "0.6527974", "0.651852...
0.0
-1
Model specific postprocess and convert model output to standard model outputs.
def postprocess(self, inputs: Dict[str, Any], **kwargs) -> Dict[str, Any]: return inputs
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def postprocess(m):\n logger.info(\"Postprocessing the model...\")\n while len(m.graph.value_info) > 0:\n m.graph.value_info.pop()\n m = other.polish_model(m)\n eliminating.eliminate_single_input_Concat(m.graph)\n eliminating.eliminate_nop_Maxpool_and_AveragePool(m.graph)\n eliminating.eli...
[ "0.65986824", "0.6418254", "0.6402641", "0.6136343", "0.61138946", "0.6085182", "0.6063578", "0.6061771", "0.6020394", "0.5969992", "0.59575593", "0.5906806", "0.5903955", "0.5900462", "0.5887015", "0.58500457", "0.58485085", "0.58485085", "0.58485085", "0.58485085", "0.58485...
0.0
-1
Define the instantiation method of a model,default method is by calling the constructor. Note that in the case of no loading model process in constructor of a task model, a load_model method is added, and thus this method is overloaded
def _instantiate(cls, **kwargs): return cls(**kwargs)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, model: str, **kwargs):\n\n super().__init__(model=model, **kwargs)\n logger.info('load model done')", "def __init__(self, model: str, **kwargs):\n super().__init__(model=model)", "def __call__(self,setup_options=True, instantiate_options=True, verbose=False):\n mo...
[ "0.6906803", "0.661834", "0.6585854", "0.65579903", "0.6555102", "0.6471729", "0.6459663", "0.64521134", "0.64382696", "0.64331865", "0.6394191", "0.6394191", "0.6394191", "0.6394191", "0.63880175", "0.63559264", "0.6355466", "0.63522595", "0.63522595", "0.63354486", "0.63008...
0.0
-1
Instantiate a model from local directory or remote model repo. Note that when loading from remote, the model revision can be specified.
def from_pretrained(cls, model_name_or_path: str, revision: Optional[str] = DEFAULT_MODEL_REVISION, cfg_dict: Config = None, device: str = None, **kwargs): prefetched = kwargs.get('model_prefe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_model(self, model_path: str):", "def load_model(fname: os.PathLike) -> Model:\n return Model.load(fname)", "def _load_from(cls, model_state: dict) -> AbstractModel:\n return cls(model=model_state.get('model'), **model_state.get('kwargs'))", "def load_model_from_file(path, as_builder=False)...
[ "0.67073345", "0.6637043", "0.65116197", "0.6482459", "0.64491147", "0.64228743", "0.6422444", "0.64197296", "0.63858056", "0.6369337", "0.6368034", "0.6346652", "0.6345023", "0.62734", "0.62559134", "0.62544537", "0.6245681", "0.6237426", "0.6231261", "0.6220943", "0.6198383...
0.7069769
0
save the pretrained model, its configuration and other related files to a directory, so that it can be reloaded
def save_pretrained(self, target_folder: Union[str, os.PathLike], save_checkpoint_names: Union[str, List[str]] = None, save_function: Callable = save_checkpoint, config: Optional[dict] = None, **kwarg...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_pretrained(self, save_directory):\n assert os.path.isdir(save_directory), \"Saving path should be a directory where the model and configuration can be saved\"\n\n # Only save the model it-self if we are using distributed training\n model_to_save = self.module if hasattr(self, \"module...
[ "0.7750904", "0.7590839", "0.75015235", "0.74963295", "0.74457264", "0.73923844", "0.7381427", "0.7379934", "0.73715615", "0.7362207", "0.7362207", "0.7362207", "0.73486555", "0.7346712", "0.73033834", "0.7298549", "0.7298549", "0.7298549", "0.7298549", "0.7298549", "0.729822...
0.0
-1
Initializes the Backtest. A Queue is used to hold the Events. The Signals, Orders, and Fills are counted.
def __init__(self, csv_dir, symbol_list, initial_capital, heartbeat, start_date, end_date, data_handler, execution_handler, portfolio, strategy, strat_params_list=None): self.csv_dir = csv_dir self.symbol_list = symbol_list self.initial_capital = initial_capital self.hea...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self._events = collections.deque()\n self._alarms = 0\n self._alarm_active = True\n self._kq = select.kqueue()\n self._kq_events = {}\n self.traceback = ()\n self.event_count = 0\n self._no_tb = False", "def on_init(self, queue=None, *...
[ "0.7210904", "0.7131795", "0.7033969", "0.6756145", "0.673009", "0.67163557", "0.6671295", "0.6656317", "0.6647535", "0.6618624", "0.6594603", "0.6594603", "0.6594603", "0.6594603", "0.6594603", "0.65499914", "0.6525102", "0.6469497", "0.6469497", "0.6403421", "0.63916034", ...
0.0
-1
Generates the trading instance objects from their class types. This method attaches all of the trading objects (DataHandler, Strategy, Portfolio, and ExecutionHandler) to various internal members. This ties together all the other classes to the Backtester object.
def _generate_trading_instances(self): print("Creating DataHandler, Strategy, Portfolio, and ExecutionHandler for") # Set internal data members equal to the classes we passed in earlier, along with necessary parameters. # https://softwareengineering.stackexchange.com/questions/131403/what-is-th...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _generate_trading_instances(self, strategy_params_dict):\n print(\"Creating DataHandler, Strategy, Portfolio, and ExecutionHandler for\")\n print(\"strategy parameter list: %s...\" % strategy_params_dict)\n\n # Set internal data members equal to the classes we passed in earlier, along with...
[ "0.71847904", "0.7100767", "0.6478167", "0.6361291", "0.56882477", "0.56326246", "0.5572381", "0.5539028", "0.55039656", "0.54438514", "0.5403827", "0.5379698", "0.53721094", "0.5297526", "0.5287005", "0.52309954", "0.52309954", "0.51850206", "0.51665777", "0.5139257", "0.511...
0.7943233
0
Executes the backtest. This is where the signal handling of the Backtesting engine is carried out. There are two while loops, the outerloop (heartbeat) and the nested innerloop, which checks if there is an event in the Event Queue object. The inner loop acts on the Event by calling the appropriate method
def _run_backtest(self): i = 0 while True: i += 1 print(i) # Update the market bars if self.data_handler.continue_backtest == True: self.data_handler.update_bars() else: break ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _run_backtest(self):\n i = 0\n\n while True:\n i += 1\n print(i)\n\n # Update the market bars\n if self.data_handler.continue_backtest == True:\n self.data_handler.update_bars()\n else:\n break\n\n # H...
[ "0.7295389", "0.7248762", "0.6957512", "0.67003644", "0.66377956", "0.6541956", "0.64540994", "0.64049834", "0.62294203", "0.62108946", "0.61638576", "0.61331415", "0.6129716", "0.60833454", "0.60628366", "0.6045858", "0.6027141", "0.6023538", "0.5971657", "0.59704083", "0.59...
0.7251965
1
Outputs the strategy performance and other metrics from the backtest.
def _output_performance(self): self.portfolio.create_equity_curve_dataframe() print("Creating summary statistics...") stats = self.portfolio.output_summary_stats() print("Creating equity curve...") print(self.portfolio.equity_curve.tail(10)) pprint.pprin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def report_performance(self):\n performance = self.amygdala.visualize(self.timestep, \n self.name, \n self.log_dir)\n print('Final performance is {0:.3}'.format(performance))\n self.backup()\n retu...
[ "0.63392967", "0.63388044", "0.62344825", "0.62191135", "0.61377233", "0.61345345", "0.5990634", "0.597709", "0.59057546", "0.5875184", "0.58620185", "0.5844489", "0.5844022", "0.5822778", "0.5800217", "0.58001125", "0.57988024", "0.57855344", "0.57675505", "0.5763641", "0.57...
0.6249993
2
Simulates the backtest and outputs portfolio performance.
def simulate_trading(self): self._run_backtest() self._output_performance()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def backtest_portfolio(self):\n self.rank=dict()\n self.accuracy=dict()\n portfolio = dict()\n \n for algo in self.algos:\n portfolio[algo]=pd.DataFrame(index=self.positions.index)\n self.pos_diff=dict()\n self.pos_diff[algo] = self.positi...
[ "0.7306378", "0.7142306", "0.7061594", "0.7044508", "0.6963376", "0.6885208", "0.6866841", "0.68580073", "0.65411276", "0.6384601", "0.63703954", "0.63657266", "0.6328172", "0.63091695", "0.6296223", "0.629528", "0.629528", "0.6279004", "0.62647766", "0.61990505", "0.6168383"...
0.68904
5
Initializes the Backtest. A Queue is used to hold the Events. The Signals, Orders, and Fills are counted.
def __init__(self, csv_dir, symbol_list, initial_capital, heartbeat, start_date, data_handler, execution_handler, portfolio, strategy, strat_params_list=None): self.csv_dir = csv_dir self.symbol_list = symbol_list self.initial_capital = initial_capital self.heartbeat = h...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self._events = collections.deque()\n self._alarms = 0\n self._alarm_active = True\n self._kq = select.kqueue()\n self._kq_events = {}\n self.traceback = ()\n self.event_count = 0\n self._no_tb = False", "def on_init(self, queue=None, *...
[ "0.72095853", "0.71329", "0.70346403", "0.6754693", "0.67315227", "0.6717928", "0.6671912", "0.66584927", "0.6648384", "0.662001", "0.65959483", "0.65959483", "0.65959483", "0.65959483", "0.65959483", "0.6550823", "0.652473", "0.6470759", "0.6470759", "0.64041936", "0.639307"...
0.0
-1
Generates the trading instance objects from their class types. This method attaches all of the trading objects (DataHandler, Strategy, Portfolio, and ExecutionHandler) to various internal members. This ties together all the other classes to the Backtester object.
def _generate_trading_instances(self, strategy_params_dict): print("Creating DataHandler, Strategy, Portfolio, and ExecutionHandler for") print("strategy parameter list: %s..." % strategy_params_dict) # Set internal data members equal to the classes we passed in earlier, along with necessary pa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _generate_trading_instances(self):\n print(\"Creating DataHandler, Strategy, Portfolio, and ExecutionHandler for\")\n\n # Set internal data members equal to the classes we passed in earlier, along with necessary parameters.\n # https://softwareengineering.stackexchange.com/questions/131403...
[ "0.7944597", "0.71021026", "0.6479502", "0.6362634", "0.56881684", "0.56321007", "0.5572392", "0.55376", "0.5502691", "0.5442817", "0.5403161", "0.5379905", "0.5372698", "0.5296769", "0.52877635", "0.5230109", "0.5230109", "0.5185296", "0.5165134", "0.5138819", "0.5119774", ...
0.71861804
1
Executes the backtest. This is where the signal handling of the Backtesting engine is carried out. There are two while loops, the outerloop (heartbeat) and the nested innerloop, which checks if there is an event in the Event Queue object. The inner loop acts on the Event by calling the appropriate method
def _run_backtest(self): i = 0 while True: i += 1 print(i) # Update the market bars if self.data_handler.continue_backtest == True: self.data_handler.update_bars() else: break # Handle the Events ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _run_backtest(self):\n i = 0\n \n while True:\n i += 1\n print(i)\n \n # Update the market bars\n if self.data_handler.continue_backtest == True:\n self.data_handler.update_bars()\n else:\n brea...
[ "0.7250805", "0.7247759", "0.6956706", "0.6701028", "0.6637288", "0.6541509", "0.64544195", "0.64051026", "0.62292856", "0.621116", "0.6163216", "0.6132048", "0.61309826", "0.60833305", "0.60645205", "0.60457534", "0.6026709", "0.6022797", "0.5971004", "0.59705234", "0.593822...
0.72942674
0
Outputs the strategy performance and other metrics from the backtest.
def _output_performance(self): self.portfolio.create_equity_curve_dataframe() print("Creating summary statistics...") stats = self.portfolio.output_summary_stats() print("Creating equity curve...") print(self.portfolio.equity_curve.tail(10)) pprint.pprint(stats) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def report_performance(self):\n performance = self.amygdala.visualize(self.timestep, \n self.name, \n self.log_dir)\n print('Final performance is {0:.3}'.format(performance))\n self.backup()\n retu...
[ "0.6337549", "0.6247714", "0.62319505", "0.62179327", "0.6136802", "0.61355233", "0.5989832", "0.5975646", "0.59036446", "0.5874888", "0.5862709", "0.584473", "0.58438706", "0.5822467", "0.57994264", "0.5798621", "0.5797651", "0.5784963", "0.5765707", "0.576413", "0.5757759",...
0.6336608
1
Simulates the backtest and outputs portfolio performance. Loops over all variants of strategy parameters of a space generated by a cartesian product of hyperparameter values. Generates new instances of all the data handlers, event queues, and portfolio objects upon each iteration, in order to ensure a "clean slate" for...
def simulate_trading(self): # Create the file output stream posix_now = datetime.datetime.timestamp(datetime.datetime.now()) out_path = os.getcwd() + "/OutputResults/backtest_{}".format(posix_now)[:-7:] + ".csv" out = open(out_path, "w+") spl = len(self.strat_params_list) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parameter_optimization(self):\n out = open(self.csv_dir + self.strategy_id + '_gridsearch.csv', \"w\")\n spl = len(self.para_list)\n for i, sp in enumerate(self.para_list):\n print(\"Strategy %s out of %s...\" % (i + 1, spl))\n self._generate_trading_instances(sp)\n ...
[ "0.6824583", "0.65352273", "0.6505157", "0.63680285", "0.6147844", "0.6038669", "0.59978664", "0.59736603", "0.58891684", "0.58687943", "0.58315384", "0.58308274", "0.5772297", "0.5758246", "0.57433945", "0.57423234", "0.5734684", "0.5721028", "0.5683199", "0.5653934", "0.565...
0.6787927
1
initialize your data structure here.
def __init__(self): self.heap = [] self.stack = []
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _init_empty(self):\n self._data = []", "def __init__(self):\n self.data = []\n self.record = {}", "def __init__(self):\n self.structure = {}", "def __init__(self):\n self._data = []", "def __init__(self):\n self._data = []", "def __init__(self):\n self...
[ "0.7761043", "0.76102185", "0.7555967", "0.7549892", "0.7549892", "0.7549892", "0.7549892", "0.7549892", "0.7549892", "0.752797", "0.7446006", "0.7446006", "0.7446006", "0.7446006", "0.7446006", "0.743338", "0.743338", "0.7408609", "0.7385719", "0.737986", "0.737986", "0.73...
0.0
-1
Function to allow the new name of the file to contain the number at an arbitrary position or the old name of the file at an arbitrary position in the string of the new file name.
def stitch(toName, oldName, num, zfill = -1, mult=1): if zfill != -1: tempNum = str(num).zfill(zfill) if mult > 1: for i in range(num+1, num + mult): tempNum += ' & ' + str(i).zfill(zfill) num = tempNum if len(toName) > 0: # We have 5 potential parts ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fileRename(current_file,num,digits):\n # Key, value pairs of what to replace.\n dictobj = {\n '<num>': get_numbering_format(digits, num),\n '<datetaken>': date_to_string(get_date_taken(current_file),'%Y%m%d__%H_%M'),\n '<dname>': dirname\n }\n # Rename\n new_filename = multi...
[ "0.7255178", "0.71344984", "0.7102937", "0.6988627", "0.6971764", "0.6734604", "0.67219466", "0.671219", "0.6661564", "0.6661564", "0.6653499", "0.663018", "0.66124356", "0.6611557", "0.6605207", "0.655132", "0.6525605", "0.64201343", "0.63903785", "0.6386055", "0.636861", ...
0.0
-1
Anonymous users can make `whoami` requests. They receive a 401 response confirming they are not logged in.
def test_whoami_by_anonymous_user(self): response = self.client.get("/api/users/whoami/") self.assertEqual(response.status_code, 401)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def whoami():\n g.data['authenticated_user'] = g.current_user", "def whoami():\n try:\n\n token = request.headers['token']\n username, uid, wid = read_auth_token(token)\n return dict(username=username, uid=uid, wid=wid)\n\n except SignatureExpired as e:\n return dict(error=st...
[ "0.71340424", "0.7014765", "0.6927591", "0.6695747", "0.6655952", "0.6655952", "0.6635073", "0.65991694", "0.65672773", "0.6493297", "0.64832705", "0.64729846", "0.6437622", "0.6405885", "0.64006865", "0.6381664", "0.6346517", "0.6344521", "0.6308586", "0.6299756", "0.6297887...
0.8336867
0
Loggedin users can make `whoami` requests. They receive their own user object.
def test_whoami_by_logged_in_user(self): user = factories.UserFactory( first_name="Jane", last_name="Doe", email="jane.doe@example.com" ) org_1 = factories.OrganizationFactory() org_access_1 = factories.OrganizationAccessFactory( user=user, organization=org_1 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def whoami():\n g.data['authenticated_user'] = g.current_user", "def whoami():\n return current_user._get_current_object()", "def whoami(self):", "def whoami(self):\n response = requests.get(self.ENDPOINT + '/user-resource/user', headers={'apikey':self.apikey})\n\n return response.json()"...
[ "0.7910836", "0.74055797", "0.730647", "0.72178155", "0.71626765", "0.7057506", "0.6882682", "0.6858402", "0.6839091", "0.6702892", "0.6689809", "0.6612816", "0.6563662", "0.65627337", "0.6543319", "0.65190023", "0.6462778", "0.6462778", "0.63894653", "0.62800586", "0.6200437...
0.0
-1
Fetch node data using k8s API
def get_node_data(cluster_id): try: # fetching the token from secret of the namespace 'dashboard' _TOKEN = [base64.b64decode(secret_item.data['token']).decode('UTF-8') for secret_item in client.CoreV1Api( ).list_namespaced_secret('dashboard').items if base64.b64decode(secret_item.data['names...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(node_instance_id, logger, client, tenant_name):\n if tenant_name:\n logger.info('Explicitly using tenant `{0}`'.format(tenant_name))\n logger.info('Retrieving node instance {0}'.format(node_instance_id))\n try:\n node_instance = client.node_instances.get(node_instance_id)\n except...
[ "0.60346806", "0.59235954", "0.578973", "0.57561266", "0.5736296", "0.5608303", "0.5593132", "0.5583009", "0.556707", "0.5539366", "0.5538481", "0.55283237", "0.5513567", "0.54998785", "0.5490597", "0.5488156", "0.5446512", "0.5438874", "0.5410196", "0.53977907", "0.5386005",...
0.6105052
0
Fetch namespace listing and detail
def get_namespace_data(cluster_id, namespace_id=None): # namespace detail if namespace_id: resource_count = get_resource_count(cluster_id, namespace_id) resource_info = get_resource_info(cluster_id, 'pods', namespace_id) return {'resources': resource_count, 'resource_info': resource_info...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def namespace(self, namespace):\n return self.client.call('GET',\n self.name, params={'namespace': namespace})", "def _fetch_all_namespaces():\n response = _fetch_herd_session() \\\n .get('{}://{}/{}/{}'.format(HERD_REST_PROTOCOL, HERD_BASE_URL,\n ...
[ "0.66033626", "0.65595657", "0.6453324", "0.632987", "0.63076866", "0.62413985", "0.61975986", "0.61743927", "0.6086349", "0.604603", "0.60328054", "0.6023155", "0.6000177", "0.59959286", "0.59717184", "0.59505755", "0.5948675", "0.5923967", "0.5918093", "0.5893192", "0.58521...
0.57417464
24
Fetch deployment listing and detail
def get_deployment_data(cluster_id, namespace_id=None, deployment_id=None): # deployment detail if deployment_id and namespace_id is not None: # creating cell-pod mapping for getting cell details cell_pod_map = get_cell_pod_map(cluster_id) # getting pod count pods_data = [pod for...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_deployments() -> JSONResponse:\n\n deploy_manager = DeployManager()\n deployments = deploy_manager.list()\n return JSONResponse(deployments)", "def test_get_deployments(self):\n pass", "def test_get_deployments(self):\n pass", "def detail(request, deployment_id):\n if reque...
[ "0.6772889", "0.66647077", "0.66647077", "0.6597974", "0.6530962", "0.6526921", "0.6526921", "0.6485451", "0.64644516", "0.63073653", "0.623222", "0.621316", "0.61912525", "0.6129055", "0.6088292", "0.60881466", "0.6058188", "0.60260034", "0.6011649", "0.5992773", "0.5969929"...
0.6200603
12
Fetch compute cell data
def get_compute_cell_data(cluster_id=None, namespace_id=None): cells_info = client.CustomObjectsApi().list_cluster_custom_object('kiyot.elotl.co', 'v1beta1', 'cells') return cells_info
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _fetch_data(self):\n pass", "def getdata(\n self,\n col: str,\n exp: str,\n chan: str,\n res: int,\n xs: Tuple[int, int],\n ys: Tuple[int, int],\n zs: Tuple[int, int],\n ):\n if self.hasdata(col, exp, chan, res, xs, ys, zs):\n ...
[ "0.6227691", "0.6165168", "0.61336154", "0.6130058", "0.6112285", "0.60044104", "0.5895254", "0.57669675", "0.57077354", "0.5702612", "0.56423634", "0.5611894", "0.56060374", "0.559", "0.5576882", "0.5543976", "0.552921", "0.5527102", "0.5463397", "0.54594564", "0.5458928", ...
0.6701156
0
Get count of resources for requested cluster and namespace
def get_resource_count(cluster_id, namespace_id=None): # fetching namespaced resource count if namespace_id: # Deployment count deployment_count = len(client.AppsV1beta2Api().list_namespaced_deployment(namespace_id).items) # Pod count pod_items = client.CoreV1Api().list_namespace...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_cluster_count(self) -> int:\n return len(self.get_all_cluster_ids())", "def count(self, resource):\n return len(self.all(resource))", "def get_count_all(cls, context, cluster_id):\n return cls.dbapi.get_cluster_nodegroup_count(context, cluster_id)", "def test_get_resource_license...
[ "0.66817355", "0.65607", "0.6554999", "0.6523906", "0.65174896", "0.64166987", "0.6349572", "0.6297506", "0.6249817", "0.6204213", "0.6179697", "0.6140397", "0.6123831", "0.6111716", "0.61096334", "0.6105647", "0.6091557", "0.6071596", "0.6053722", "0.6047418", "0.6045339", ...
0.7759584
0
Get the resource details for the namespace to be excluded
def get_hidden_namespace_resources(cluster_id, namespace_id): # Deployment count deployment_count = len(client.AppsV1beta2Api().list_namespaced_deployment(namespace_id).items) # Pod count pod_items = client.CoreV1Api().list_namespaced_pod(namespace_id).items pod_count = len(pod_items) # Cell cou...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exclude_resource_rules(self) -> Optional[Sequence['outputs.NamedRuleWithOperations']]:\n return pulumi.get(self, \"exclude_resource_rules\")", "def exclude_resource_ids_scope(self) -> str:\n return pulumi.get(self, \"exclude_resource_ids_scope\")", "def exclude_resource_ids_scope(self) -> str...
[ "0.60753304", "0.6006292", "0.6006292", "0.57762307", "0.5728827", "0.54888046", "0.53958565", "0.5395732", "0.5374372", "0.53347665", "0.53347665", "0.5316922", "0.52620876", "0.5223665", "0.5212365", "0.5199779", "0.5170026", "0.5170026", "0.51522565", "0.51229185", "0.5110...
0.53204346
11
calculating capacity and usage for requested resources
def get_resource_info(cluster_id, kind, namespace_id=None, pods_list=None): if pods_list is None: pods_list = [] capacity = get_cluster_capacity_info(cluster_id), usage = get_cluster_usage_info(cluster_id, kind, namespace_id, pods_list) if capacity[0]['cpu'] != 0 and capacity[0]['memory'] != 0: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_capacity():\n fs.get_capacity()", "def capacity_used(self):\n raise NotImplementedError()", "def capacity(self):\n capacity = {}\n resources = self.nodes[0].capacity.keys()\n for r in resources:\n values = [n.capacity[r] for n in self.nodes]\n capaci...
[ "0.76844007", "0.7094635", "0.6953356", "0.6724627", "0.6691189", "0.6664577", "0.6574017", "0.6568174", "0.6502811", "0.646026", "0.64514846", "0.64033794", "0.6387363", "0.6367259", "0.6345023", "0.6332639", "0.6331895", "0.6319946", "0.6291326", "0.62830526", "0.62749445",...
0.0
-1
Get cluster capacity from node detail
def get_cluster_capacity_info(cluster_id): cpu_capacity_info = get_node_data(cluster_id) cpu_capacity_in_cores = round(unit_conversion(sum([int(''.join(filter( str.isdigit, str(item['status']['allocatable']['cpu'])))) for item in cpu_capacity_info]), 'm'), 2) memory_capacity_in_gib = round(sum( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_capacity():\n fs.get_capacity()", "def capacity(self):\n capacity = {}\n resources = self.nodes[0].capacity.keys()\n for r in resources:\n values = [n.capacity[r] for n in self.nodes]\n capacity[r] = mean(values) if len(values) > 0 else 0.0\n return ca...
[ "0.7165189", "0.67714345", "0.67460614", "0.66856956", "0.6549141", "0.6534968", "0.65045047", "0.64937866", "0.648811", "0.64549166", "0.64503264", "0.63680506", "0.6324158", "0.6307951", "0.6224518", "0.6187836", "0.61583894", "0.6155459", "0.6146542", "0.6124433", "0.61244...
0.7078413
1
get resource usage information from pods usage
def get_cluster_usage_info(cluster_id, kind, namespace_id=None, pods_list=None): if pods_list is None: pods_list = [] else: logger.info('pod list not none') if pods_list == 'no_pod_resource': return {'cpu': 0, 'memory': 0} else: logger.info('resources no 0') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_resource_info(cluster_id, kind, namespace_id=None, pods_list=None):\n if pods_list is None:\n pods_list = []\n capacity = get_cluster_capacity_info(cluster_id),\n usage = get_cluster_usage_info(cluster_id, kind, namespace_id, pods_list)\n if capacity[0]['cpu'] != 0 and capacity[0]['memor...
[ "0.684437", "0.6337999", "0.6151427", "0.6085964", "0.6063859", "0.6056686", "0.60112286", "0.5989251", "0.5980302", "0.5904598", "0.5870229", "0.58482635", "0.58432084", "0.5836446", "0.5833565", "0.582723", "0.57628006", "0.57566756", "0.5720972", "0.5699034", "0.5695292", ...
0.730197
0
Creating a cellpod mapping
def get_cell_pod_map(cluster_id): # creating a pod-cell mapping cell_pod_map = dict() for cell_info in get_compute_cell_data(cluster_id)['items']: cell_pod_map[cell_info['status']['podName']] = {'cell_name': cell_info['metadata']['name'], 'podN...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def makeMapping(globalMap):\n \n from memops.xml.Implementation import bool2str, str2bool\n\n # Set up top level dictionaries\n loadMaps = globalMap.get('loadMaps')\n mapsByGuid = globalMap.get('mapsByGuid')\n\n abstractTypes = globalMap.get('CCLB').get('abstractTypes')\n exolinks = globalMap.get('CCLB').ge...
[ "0.65705234", "0.6363869", "0.6342318", "0.6297688", "0.6223787", "0.61639667", "0.6126557", "0.60234666", "0.5995557", "0.5985049", "0.5910921", "0.5882835", "0.5853043", "0.58468926", "0.58390236", "0.5810125", "0.58074224", "0.5806761", "0.5770566", "0.5770005", "0.5767886...
0.6313567
3
Providing random mock values for resource capacity and usage.
def randomise(mock_info): mock_info["resource_info"]["usage"]["cpu"] = round(random.uniform(0, 1), 2) mock_info["resource_info"]["usage"]["cpu_percentage"] = round(random.uniform(0, 1), 2) mock_info["resource_info"]["usage"]["memory"] = round(random.uniform(0, 1), 2) mock_info["resource_info"]["usage"][...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_glass_capacity__has_expected_default_value():\n glass = moet.create_glass(\"A\")\n assert glass.capacity == 250", "def _get_random_returns(self): \n return self.asset_process.distrib.random()", "def test_sdram(self):\n sdram = SDRAMResource(128 * (2**20))\n self.assertEqual(...
[ "0.631372", "0.61010695", "0.60488284", "0.6046735", "0.5982311", "0.5956989", "0.59451956", "0.5942304", "0.59133613", "0.589804", "0.58927816", "0.5846016", "0.57881594", "0.5747037", "0.57254654", "0.57179344", "0.57009256", "0.5674274", "0.5642999", "0.56372076", "0.56222...
0.7475767
0
Abstract base class to define the interface for priors of GP hyperparameter.
def __init__(self, rng=None): if rng is None: self.rng = np.random.RandomState(np.random.randint(0, 10000)) else: self.rng = rng
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prim_method(self):", "def prim_method(self):", "def __init__(self, p1_proba=0.5):\n self.p1_proba = p1_proba", "def get_hyperparams(self):", "def Params(cls):\n return hyperparams.InstantiableParams(cls)", "def __init__(self, prim):\n self.actual = prim", "def gen_parameter(self, g...
[ "0.6436486", "0.6436486", "0.6161557", "0.60954475", "0.6026573", "0.5960026", "0.59499425", "0.59067774", "0.5904224", "0.5884801", "0.58277154", "0.5816997", "0.56939894", "0.56818277", "0.5675402", "0.56377643", "0.5627205", "0.56166977", "0.56117594", "0.5608884", "0.5592...
0.0
-1
Returns N samples from the prior.
def sample_from_prior(self, n_samples): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sample_from_prior(self, n_samples):\n\n p0 = self.min + self.rng.rand(n_samples) * (self.max - self.min)\n return p0[:, np.newaxis]", "def sample_from_prior(self, n_samples):\n\n p0 = self.rng.normal(loc=self.mean, scale=self.sigma, size=n_samples)\n return p0[:, np.newaxis]", "...
[ "0.7308122", "0.7254096", "0.71898454", "0.7128596", "0.6979248", "0.6961805", "0.67606914", "0.6745526", "0.6690407", "0.6622515", "0.6562736", "0.65446556", "0.65446556", "0.6425273", "0.6419413", "0.6395372", "0.63613814", "0.6323354", "0.63091654", "0.6305061", "0.6287302...
0.7954478
0
Computes the gradient of the prior with respect to theta.
def gradient(self, theta): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gradient(self, theta):\n return (1 / (self.sigma * np.sqrt(2 * np.pi))) * (\n -theta / (self.sigma ** 2) * np.exp(-(theta ** 2) / (2 * self.sigma ** 2))\n )", "def gradient(self, theta):\n a = -(6 * self.scale ** 2)\n b = 3 * self.scale ** 2 + np.exp(2 * theta)\n ...
[ "0.8256445", "0.8055304", "0.7947039", "0.7867961", "0.78287417", "0.78280646", "0.7741965", "0.77182055", "0.77098596", "0.76828635", "0.76208895", "0.75614756", "0.72576725", "0.72168595", "0.7216574", "0.7211889", "0.70136374", "0.70051277", "0.6994997", "0.69862175", "0.6...
0.83195007
0
Tophat prior as it used in the original spearmint code.
def __init__(self, l_bound, u_bound, rng=None): if rng is None: self.rng = np.random.RandomState(np.random.randint(0, 10000)) else: self.rng = rng self.min = l_bound self.max = u_bound if not (self.max > self.min): raise Exception( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lnprior(self):\n \n return", "def prior(self):\n return self.__prior", "def prior(self):\n return self.__prior", "def prior(self):\n return self.__prior", "def prior(self):\n return self.__prior", "def get_prior(self):\n return self.prior", "def prio...
[ "0.74466044", "0.68139035", "0.68139035", "0.68139035", "0.68139035", "0.6795314", "0.678799", "0.660923", "0.66089433", "0.65597916", "0.6525363", "0.6508171", "0.6482998", "0.64318466", "0.6383781", "0.6362514", "0.62887466", "0.6265354", "0.6228101", "0.61609983", "0.60756...
0.0
-1
Returns N samples from the prior.
def sample_from_prior(self, n_samples): p0 = self.min + self.rng.rand(n_samples) * (self.max - self.min) return p0[:, np.newaxis]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sample_from_prior(self, n_samples):\n pass", "def sample_from_prior(self, n_samples):\n\n p0 = self.rng.normal(loc=self.mean, scale=self.sigma, size=n_samples)\n return p0[:, np.newaxis]", "def sample_from_prior(self, n_samples):\n\n p0 = self.rng.lognormal(mean=self.mean, sigma...
[ "0.7953035", "0.72522676", "0.718797", "0.71269745", "0.6977341", "0.6960459", "0.6759681", "0.6744323", "0.66894495", "0.6622551", "0.6560197", "0.65461904", "0.65461904", "0.64246196", "0.641773", "0.63970256", "0.6361261", "0.6323558", "0.6306985", "0.63066787", "0.6286872...
0.73065966
1
Computes the gradient of the prior with respect to theta.
def gradient(self, theta): return np.zeros([theta.shape[0]])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gradient(self, theta):\n pass", "def gradient(self, theta):\n pass", "def gradient(self, theta):\n return (1 / (self.sigma * np.sqrt(2 * np.pi))) * (\n -theta / (self.sigma ** 2) * np.exp(-(theta ** 2) / (2 * self.sigma ** 2))\n )", "def gradient(self, theta):\n ...
[ "0.83195007", "0.83195007", "0.8256445", "0.8055304", "0.7947039", "0.7867961", "0.78287417", "0.7741965", "0.77182055", "0.77098596", "0.76828635", "0.76208895", "0.75614756", "0.72576725", "0.72168595", "0.7216574", "0.7211889", "0.70136374", "0.70051277", "0.6994997", "0.6...
0.78280646
7
Horseshoe Prior as it is used in spearmint
def __init__(self, scale=0.1, rng=None): if rng is None: self.rng = np.random.RandomState(np.random.randint(0, 10000)) else: self.rng = rng self.scale = scale
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prior_sample(self):\n pass", "def horde_step(self, observation):", "def lnprior(self):\n \n return", "def brain_weight_oz(self):\r\n return Heart.heart_weight_oz(self) # Used method from Heart Class\r", "def RankineHugoniot(P):\n # prevP = P+1\n # while(abs(P-prevP)>t...
[ "0.58937436", "0.5873536", "0.5848326", "0.58077574", "0.579661", "0.570863", "0.5638334", "0.5638334", "0.5638334", "0.5638334", "0.56263655", "0.559631", "0.55625165", "0.55474657", "0.55131316", "0.5500774", "0.54708487", "0.54665077", "0.54455525", "0.5444476", "0.5435669...
0.0
-1
Returns N samples from the prior.
def sample_from_prior(self, n_samples): lamda = np.abs(self.rng.standard_cauchy(size=n_samples)) p0 = np.log(np.abs(self.rng.randn() * lamda * self.scale)) return p0[:, np.newaxis]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sample_from_prior(self, n_samples):\n pass", "def sample_from_prior(self, n_samples):\n\n p0 = self.min + self.rng.rand(n_samples) * (self.max - self.min)\n return p0[:, np.newaxis]", "def sample_from_prior(self, n_samples):\n\n p0 = self.rng.normal(loc=self.mean, scale=self.sig...
[ "0.7954478", "0.7308122", "0.7254096", "0.71898454", "0.6979248", "0.6961805", "0.67606914", "0.6745526", "0.6690407", "0.6622515", "0.6562736", "0.65446556", "0.65446556", "0.6425273", "0.6419413", "0.6395372", "0.63613814", "0.6323354", "0.63091654", "0.6305061", "0.6287302...
0.7128596
4
Computes the gradient of the prior with respect to theta.
def gradient(self, theta): a = -(6 * self.scale ** 2) b = 3 * self.scale ** 2 + np.exp(2 * theta) b *= np.log(3 * self.scale ** 2 * np.exp(-2 * theta) + 1) return a / b
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gradient(self, theta):\n pass", "def gradient(self, theta):\n pass", "def gradient(self, theta):\n return (1 / (self.sigma * np.sqrt(2 * np.pi))) * (\n -theta / (self.sigma ** 2) * np.exp(-(theta ** 2) / (2 * self.sigma ** 2))\n )", "def gradient(theta, X, y, learni...
[ "0.8320425", "0.8320425", "0.8256829", "0.794873", "0.7868711", "0.7830685", "0.78282064", "0.77438694", "0.77200764", "0.77105415", "0.76834327", "0.7621433", "0.7562439", "0.72585183", "0.7218782", "0.7218774", "0.721298", "0.7015742", "0.7006995", "0.69971156", "0.6987514"...
0.80552995
3
Returns N samples from the prior.
def sample_from_prior(self, n_samples): p0 = self.rng.lognormal(mean=self.mean, sigma=self.sigma, size=n_samples) return p0[:, np.newaxis]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sample_from_prior(self, n_samples):\n pass", "def sample_from_prior(self, n_samples):\n\n p0 = self.min + self.rng.rand(n_samples) * (self.max - self.min)\n return p0[:, np.newaxis]", "def sample_from_prior(self, n_samples):\n\n p0 = self.rng.normal(loc=self.mean, scale=self.sig...
[ "0.7954478", "0.7308122", "0.7254096", "0.7128596", "0.6979248", "0.6961805", "0.67606914", "0.6745526", "0.6690407", "0.6622515", "0.6562736", "0.65446556", "0.65446556", "0.6425273", "0.6419413", "0.6395372", "0.63613814", "0.6323354", "0.63091654", "0.6305061", "0.6287302"...
0.71898454
3
Computes the gradient of the prior with respect to theta.
def gradient(self, theta): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gradient(self, theta):\n return (1 / (self.sigma * np.sqrt(2 * np.pi))) * (\n -theta / (self.sigma ** 2) * np.exp(-(theta ** 2) / (2 * self.sigma ** 2))\n )", "def gradient(self, theta):\n a = -(6 * self.scale ** 2)\n b = 3 * self.scale ** 2 + np.exp(2 * theta)\n ...
[ "0.8256445", "0.8055304", "0.7947039", "0.7867961", "0.78287417", "0.78280646", "0.7741965", "0.77182055", "0.77098596", "0.76828635", "0.76208895", "0.75614756", "0.72576725", "0.72168595", "0.7216574", "0.7211889", "0.70136374", "0.70051277", "0.6994997", "0.69862175", "0.6...
0.83195007
1
Returns N samples from the prior.
def sample_from_prior(self, n_samples): p0 = self.rng.normal(loc=self.mean, scale=self.sigma, size=n_samples) return p0[:, np.newaxis]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sample_from_prior(self, n_samples):\n pass", "def sample_from_prior(self, n_samples):\n\n p0 = self.min + self.rng.rand(n_samples) * (self.max - self.min)\n return p0[:, np.newaxis]", "def sample_from_prior(self, n_samples):\n\n p0 = self.rng.lognormal(mean=self.mean, sigma=self...
[ "0.7954478", "0.7308122", "0.71898454", "0.7128596", "0.6979248", "0.6961805", "0.67606914", "0.6745526", "0.6690407", "0.6622515", "0.6562736", "0.65446556", "0.65446556", "0.6425273", "0.6419413", "0.6395372", "0.63613814", "0.6323354", "0.63091654", "0.6305061", "0.6287302...
0.7254096
2
Computes the gradient of the prior with respect to theta.
def gradient(self, theta): return (1 / (self.sigma * np.sqrt(2 * np.pi))) * ( -theta / (self.sigma ** 2) * np.exp(-(theta ** 2) / (2 * self.sigma ** 2)) )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gradient(self, theta):\n pass", "def gradient(self, theta):\n pass", "def gradient(self, theta):\n a = -(6 * self.scale ** 2)\n b = 3 * self.scale ** 2 + np.exp(2 * theta)\n b *= np.log(3 * self.scale ** 2 * np.exp(-2 * theta) + 1)\n return a / b", "def gradient(...
[ "0.8320425", "0.8320425", "0.80552995", "0.794873", "0.7868711", "0.7830685", "0.78282064", "0.77438694", "0.77200764", "0.77105415", "0.76834327", "0.7621433", "0.7562439", "0.72585183", "0.7218782", "0.7218774", "0.721298", "0.7015742", "0.7006995", "0.69971156", "0.6987514...
0.8256829
2
returns the best possible move
def alpha_beta_search(self, maxDepth, board, player, best_move): """j refers to the list where j[0] = score and j[1] = move""" start = time() #playerPiece = core.BLACK #if player == "BLACK": #print("hi") #playerPiece = core.WHITE self.max_value(boar...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_best_move(state: GameState) -> None:", "def best_move(self):\n if self._move is not None:\n return self._move\n else:\n return self.pass_move", "def get_optimal_move(self):\n # create the root state\n root = State(self.current_board, True, self.__machi...
[ "0.8980694", "0.85602146", "0.8383858", "0.8242038", "0.8026913", "0.7937195", "0.79176444", "0.7797753", "0.77027047", "0.7662692", "0.7647024", "0.7636651", "0.76326895", "0.7620526", "0.75877464", "0.75660557", "0.7504784", "0.7500295", "0.7482623", "0.7458627", "0.745814"...
0.0
-1