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
Displays statistics on the most frequent times of travel.
def time_stats(df): print("="*40) print('\nCalculating The Most Frequent Times of Travel...\n') start_time = time.time() most_freq_hour = str(df.groupby(['hour'])['Start Time'].count().idxmax()) high_hour_qty = str(df.groupby(['hour'])['Start Time'].count().max()) if len(df['weekday'].unique...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def time_stats(df):\n\n print('\\nDisplaying the statistics on the most frequent times of '\n 'travel...\\n')\n start_time = time.time()\n\n # display the most common month\n most_common_month = df['Month'].mode()[0]\n print('For the selected filter, the month with the most travels is: ' +\...
[ "0.80247396", "0.80233026", "0.7915788", "0.78266186", "0.7822246", "0.78143597", "0.77659196", "0.7740343", "0.773628", "0.77344066", "0.76867086", "0.7668633", "0.7651731", "0.7644636", "0.76399267", "0.76367253", "0.7625196", "0.7623158", "0.7612803", "0.76002145", "0.7583...
0.0
-1
Displays statistics on the most popular stations and trip.
def station_stats(df): print('\nCalculating The Most Popular Stations and Trip...\n') start_time = time.time() # TO DO: display most commonly used start station start_station_high_freq = df.groupby(['Start Station'])['Start Time'].count().idxmax() start_station_high_qty = df.groupby(['Start Statio...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def station_stats(df):\n\n print('\\nCalculating The Most Popular Stations and Trip...\\n')\n start_time = time.time()\n\n # display most commonly used start station\n print(popular_start_station(df))\n\n # display most commonly used end station\n print(popular_end_station(df))\n\n # display m...
[ "0.7815675", "0.7662213", "0.7553417", "0.74914914", "0.74748665", "0.7446617", "0.7428588", "0.74237514", "0.74177027", "0.7400495", "0.7387161", "0.7385634", "0.73647535", "0.735934", "0.73566747", "0.73548365", "0.7351854", "0.7351274", "0.735057", "0.73421645", "0.7340198...
0.69124997
83
Displays statistics on the total and average trip duration.
def trip_duration_stats(df): print('\nCalculating Trip Duration...\n') start_time = time.time() df['time'] = df['End Time'] - df['Start Time'] # TO DO: display total travel time print("Total travel time in that period of time: {}".format(df['time'].sum())) print("Average time of journey: {}".f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trip_duration_stats(data):\n print('\\nCalculating Trip Duration...\\n')\n start_time = time.time()\n # display total travel time\n total_trip_time= data['Trip Duration'].sum()\n print('The Total Travel Time is {} Hours'. format(total_trip_time/3600))\n # display mean travel time\n avg_tri...
[ "0.8141812", "0.8024182", "0.80032814", "0.7948688", "0.79363805", "0.79301584", "0.7925556", "0.79139745", "0.79132074", "0.79069036", "0.79044855", "0.7899693", "0.78905743", "0.7888294", "0.78858185", "0.7883996", "0.78832155", "0.7881429", "0.7872763", "0.78675747", "0.78...
0.76539797
78
Displays statistics on bikeshare users.
def user_stats(df): print('\nCalculating User Stats...\n') start_time = time.time() # TO DO: Display counts of user types user_types = df.groupby(['User Type'])['Start Time'].count() print(user_types.to_string()) print() try: # TO DO: Display counts of gender gender = df.g...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_stats(request):\r\n user_count = UserMgr.count()\r\n pending_activations = ActivationMgr.count()\r\n users_with_bookmarks = BmarkMgr.count(distinct_users=True)\r\n return _api_response(request, {\r\n 'count': user_count,\r\n 'activations': pending_activations,\r\n 'with_bo...
[ "0.73559105", "0.73306274", "0.7287611", "0.72494894", "0.72382116", "0.71733415", "0.7168679", "0.7129041", "0.7076894", "0.7071431", "0.70602304", "0.7056935", "0.70490867", "0.7045232", "0.703642", "0.70238316", "0.7022488", "0.7022265", "0.7012312", "0.70086145", "0.69945...
0.0
-1
Calculate the offset from the page number and number per page
def calculate_offset(page_number, per_page): if page_number < 1: return 0 else: offset = (page_number - 1) * per_page return offset
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_offset(page_num, per_page):\r\n if page_num and per_page:\r\n return (page_num-1) * per_page\r\n else:\r\n return None", "def get_page_offset(self) -> int:\n page_offset: int = self.page_number\n if page_offset <= 1:\n return 0\n return (page_offset - 1)...
[ "0.77995265", "0.76814127", "0.7105734", "0.6967159", "0.6652218", "0.6636704", "0.64200956", "0.63789934", "0.63724935", "0.63724935", "0.63724935", "0.633144", "0.610982", "0.60907185", "0.6062406", "0.60604966", "0.6048903", "0.6029713", "0.6027081", "0.5996911", "0.598415...
0.8489778
0
Lee un archivo con varias palabras. Retorna una palabra aleatoria
def get_file(): with open('archivos/words.txt','r',encoding = 'utf-8') as f : data = f.readlines() data = list(random.choice(data)) data.pop(len(data)-1) return data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def criar_arquivo_palavras(nome_arquivo, palavras):\n with open(nome_arquivo, \"w\") as arquivo:\n for palavra in palavras:\n linha = palavra + \"\\n\" #precisamos adicionar uma quebra de linha manualmente \n arquivo.write(linha)\n return arquivo", "def archivos_de_texto():\n ...
[ "0.6766486", "0.6449598", "0.6287659", "0.553479", "0.5336628", "0.53295815", "0.5316984", "0.53126305", "0.5292266", "0.523313", "0.5224726", "0.5223712", "0.52207124", "0.5208644", "0.51681054", "0.51312065", "0.51303893", "0.5126915", "0.5123113", "0.5107597", "0.5083478",...
0.4792352
52
Recibe un str. Retorna incognita
def incognita(data): incognita =['*' for i in data] return incognita
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _sanitize_string(self, string):\n # get the type of a unicode string\n unicode_type = type(Pyasciigraph._u('t'))\n input_type = type(string)\n if input_type is str:\n if sys.version < '3':\n info = unicode(string)\n else:\n info = ...
[ "0.6074574", "0.5833643", "0.5798127", "0.5772807", "0.5772203", "0.5725126", "0.57122743", "0.5701353", "0.56956816", "0.56872195", "0.56736904", "0.56647235", "0.56609285", "0.56522226", "0.5646415", "0.56392515", "0.56258756", "0.56158435", "0.56100136", "0.5609799", "0.55...
0.0
-1
Se ejecuta un Ciclo while
def cycle(incognita,data,live=5,count=0): while live > 0 and incognita != data: letra_u = input('Digite una letra: ') os.system('cls') for i in data: if i == letra_u: incognita[count] = letra_u count +=1 if letra_u not in ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loop(self):\n pass", "def run(self):\n while not self.gerenciador.fechou():\n self.faz_ped()\n if self.beber:\n self.espera_ped()\n self.recebe_ped()\n self.consome_ped()", "def run(self):\n while not self.gerenciador.f...
[ "0.6770653", "0.65367323", "0.64974135", "0.648513", "0.6402111", "0.63691765", "0.6359044", "0.62001854", "0.60994035", "0.60834765", "0.6077019", "0.6066419", "0.60516566", "0.6025482", "0.6013724", "0.60018843", "0.59823316", "0.5937696", "0.5913396", "0.59045106", "0.5872...
0.0
-1
Defines several fitting mechanism
def func(x, a, c, d): return a*np.exp(-c*x)+d
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fit():\n pass", "def fit(self, X, y=...):\n ...", "def fit(self, X, y=...):\n ...", "def fit(self, X, y=...):\n ...", "def fit(self, X, y=...):\n ...", "def fit(self, X, y=...):\n ...", "def fit(self, X, y=...):\n ...", "def fit(self, X, y=...):\n ...
[ "0.68902004", "0.6626131", "0.6626131", "0.6626131", "0.6626131", "0.6626131", "0.6626131", "0.6626131", "0.6626131", "0.6626131", "0.6626131", "0.63850355", "0.6355559", "0.63157564", "0.6300085", "0.62875515", "0.6248649", "0.62402546", "0.6223098", "0.62152815", "0.6215281...
0.0
-1
This function finds a exponential decay
def exp_decay(timeList, voltageList, ySS=160): parameters, _ = curve_fit(func, timeList, voltageList, p0=(1, 9, ySS), maxfev = 20000) # voltageFit = func(timeList, *parameters) return parameters
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_exp_decay(self, alpha: float):\n x = np.linspace(0, 1, 100)\n y = np.exp(alpha * x)\n\n alpha_guess = guess.exp_decay(x, y)\n\n self.assertAlmostEqualAbsolute(alpha_guess, alpha)", "def get_epsilon_decay_function(e_start, e_end, decay_duration):\n return lambda frame_idx: ...
[ "0.728994", "0.7148073", "0.7136344", "0.7002857", "0.68007094", "0.6703479", "0.6644778", "0.6634951", "0.6614471", "0.6605476", "0.6572798", "0.65458226", "0.65170854", "0.6478091", "0.64659375", "0.6409667", "0.64091176", "0.6402272", "0.6372004", "0.6354398", "0.6350709",...
0.6088513
31
This function finds a
def exp_fit(timeList, voltageList, ySS): bList = [log(max(y-ySS,1e-6)) for y in voltageList] b = np.matrix(bList).T rows = [ [1,t] for t in timeList] A = np.matrix(rows) #w = (pinv(A)*b) (w,residuals,rank,sing_vals) = np.linalg.lstsq(A,b) tau = -1.0/w[1,0] amplitude = np.exp(w[0,0]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find(self, a):\n while a != self.ids[a]:\n a = self.ids[a]\n return a", "def find(self, p):\n pass", "def find(self):\n raise NotImplementedError", "def find(self, sub) -> int:\n pass", "def findWhere(cls, args):\n return cls.search(args)[0][0]", "def ...
[ "0.7021678", "0.6964341", "0.66085345", "0.6586932", "0.6296854", "0.62866414", "0.6269602", "0.6150014", "0.6115063", "0.60636", "0.60221916", "0.6013292", "0.6005816", "0.599785", "0.59703434", "0.5959632", "0.5916025", "0.5914361", "0.5910363", "0.5887992", "0.58734494", ...
0.0
-1
Uses PeakUtil package to find the peak Locations and returns them as a value. It is used to determine the V_rest while the spikes are present
def hist_peak_search(hist, bins): ix = peakutils.indexes(-hist, thres = 0.15/max(-hist), min_dist = 2) peaks = list(bins[list(ix)]) return peaks
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def peak(self) -> Tuple[MeasureInput, MeasureResult]:\n assert self._data\n return self._data[0][2]", "def get_peak(self):\r\n \r\n sensor_1_list = []\r\n\r\n for i in self.return_data:\r\n sensor_1_list.append(i[0])\r\n\r\n sensor_peak = max(sensor_1_list)\r\...
[ "0.69582105", "0.69230056", "0.68650806", "0.6772516", "0.6591027", "0.65485495", "0.65162396", "0.6395621", "0.6379662", "0.63583624", "0.6291672", "0.6255726", "0.62526894", "0.6248705", "0.624049", "0.62010884", "0.6139666", "0.6106271", "0.6080114", "0.60722214", "0.60585...
0.0
-1
Uses PeakUtil package to find the baseline of the signal and returns it as a value.
def baseline_search(voltage, pol_degree): min = np.min(voltage) base = peakutils.baseline(voltage-min, pol_degree, 10000, 0.05) base = base+min return base
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _getBaselineThresh(self):\n print('Calculating 10% baseline')\n self.baseline = obrienBaseline.obrienBaseline(\n self.d['dos1rate'], timeWidth=5.0, \n cadence=0.1)\n self.peak_std = ( (self.d['dos1rate'][self.peakInd]/10 - \n ...
[ "0.7123638", "0.69333345", "0.6769743", "0.6610722", "0.6563401", "0.64849114", "0.63309747", "0.630482", "0.6297155", "0.622598", "0.61856276", "0.597163", "0.59571505", "0.5864661", "0.58142674", "0.5764512", "0.57439363", "0.5738576", "0.5727236", "0.56630546", "0.56570643...
0.67838216
2
Calculate the hessian matrix with finite differences
def hessian(x): x_grad = np.gradient(x) hessian = np.empty((x.ndim, x.ndim) + x.shape, dtype=x.dtype) for k, grad_k in enumerate(x_grad): """ iterate over dimensions apply gradient again to every component of the first derivative. """ tmp_grad = np.gradient(grad_k) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_hessian(self):\n if not self.sparse:\n hess = numpy.dot(self.jacobian_T, self.jacobian)\n else:\n hess = self.jacobian_T*self.jacobian\n return hess", "def _hessian(self):\n log_g = np.log(self._gv())\n log_f = np.log(self._fv())\n h_inf = np.mean((1 -...
[ "0.7896911", "0.7722618", "0.7689578", "0.76618177", "0.7501295", "0.74525297", "0.74314106", "0.742467", "0.74236274", "0.73696274", "0.7363324", "0.72986287", "0.7227161", "0.7213006", "0.7201073", "0.7175992", "0.7172301", "0.7148956", "0.71194273", "0.71127117", "0.706749...
0.7162221
17
Determines the initial rows and columns of the fleas.
def initialize_flea_locs(self, flea_rows, flea_cols): # Replace None with center flea_rows = [flea_row if flea_row is not None else self.num_rows // 2 for flea_row in flea_rows] flea_cols = [flea_col if flea_col is not None else self.num_cols // 2 for flea_col in flea_cols] # Replace n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_block():\n final_locs = [[1 for x in range(LOC_SIZE)] for y in range(LOC_SIZE)]\n for a in range(int(LOC_SIZE / 2)):\n for b in range(a, int(LOC_SIZE / 2)):\n # creating and ringing each of the fleas individually\n print(a, b)\n locs = [[1 if x == a and y == b...
[ "0.5747349", "0.55304915", "0.54669744", "0.544392", "0.536384", "0.5329804", "0.5238225", "0.5191042", "0.51660126", "0.51305646", "0.5103158", "0.5083339", "0.5059225", "0.5046582", "0.50390905", "0.5030519", "0.5030001", "0.5018883", "0.5002887", "0.5000909", "0.49926257",...
0.61964476
0
Determines the initial directions of the fleas.
def initialize_flea_directions(self, init_directions): init_directions += ['up'] * (self.num_fleas - len(init_directions)) return init_directions
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_direction(self, feats):\n if feats.name == \"ARNC\":\n if feats[\"z-score\"] < -1.5:\n return Directions.long_dir\n elif feats[\"z-score\"] > 1.5:\n return Directions.short_dir\n elif feats.name == \"UNG\":\n if feats[\"z-scor...
[ "0.577651", "0.5761766", "0.54945475", "0.5401978", "0.5295211", "0.52914995", "0.52668256", "0.5246092", "0.51954025", "0.51931316", "0.5184261", "0.517382", "0.5150054", "0.51456606", "0.5136114", "0.512479", "0.5088317", "0.50830895", "0.5068119", "0.50432193", "0.5039508"...
0.72522104
0
Determine the initial square colors.
def initialize_square_colors(self, square_colors): if square_colors is None: square_colors = [[0] * self.num_cols] * self.num_rows return square_colors
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize_colors(self) -> None:\n curses.init_pair(ColorPair.black_on_white.value, curses.COLOR_BLACK, curses.COLOR_WHITE)\n curses.init_pair(ColorPair.red_on_black.value, curses.COLOR_RED, curses.COLOR_BLACK)\n curses.init_pair(ColorPair.blue_on_black.value, curses.COLOR_BLUE, curses.COL...
[ "0.65205836", "0.64879256", "0.64560956", "0.64264864", "0.6399936", "0.6295429", "0.61141825", "0.60455334", "0.6031279", "0.60079896", "0.6003107", "0.59678465", "0.5959027", "0.59578264", "0.59552187", "0.59532493", "0.5947528", "0.59200263", "0.59002054", "0.5895776", "0....
0.73408926
0
Gets the Square in a given row and column.
def get_square(self, row, col): return self.board[row][col]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def square(self, row, col):\n return self.board[row][col]", "def square(self, row, col):\n return self._board[row][col]", "def square(self, row, col):\n if 0 == row:\n if 0 == col:\n return self.tl\n elif 1 == col:\n return self.tc\n ...
[ "0.8541956", "0.8489466", "0.8139662", "0.76062024", "0.7603011", "0.73756915", "0.72731274", "0.722714", "0.722714", "0.7216884", "0.7193437", "0.71650165", "0.71462554", "0.70792747", "0.7056047", "0.69592404", "0.69378346", "0.68022996", "0.6793762", "0.6790237", "0.678944...
0.8849575
0
Changes the color of the Squares under the Fleas.
def change_square_colors(self): for flea in self.fleas.sprites(): flea.square.change_color()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def changeColor( self ):\n\t\t\n\t\tx, y = self.position.xy\n\t\tself.color = ( int((x / WINDOW_X) * 128), int((x / WINDOW_X) * 128) + int((y / WINDOW_Y) * 128 ), int((y / WINDOW_Y) * 128))", "def update_color(self):\n self.plot(update_traces=False, update_waveforms=True)", "def update_colourin(self):\n...
[ "0.69831204", "0.63404846", "0.6302929", "0.6261795", "0.6195861", "0.619493", "0.61861604", "0.6058782", "0.60587114", "0.6052671", "0.60500383", "0.6008667", "0.59344876", "0.59155804", "0.5906455", "0.58579266", "0.57919824", "0.5791351", "0.57853216", "0.57681215", "0.573...
0.7049206
0
Draws a grid of lines to visualize separate the Squares.
def draw_grid(self): # Draw horizontal lines for row in range(self.num_rows + 1): left = row_column_to_pixels(row, 0) right = row_column_to_pixels(row, self.num_cols) pygame.draw.line(self.screen, COLOR_MAP['gray'], left, right) # Draw vertical lines ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_grid(self):\n for square in range(COLS+1):\n #vertical lines\n start_pos = (helpers.get_col_left_p(square),helpers.get_row_top_p(0))\n end_pos = (helpers.get_col_left_p(square),helpers.get_row_top_p(ROWS))\n pygame.draw.line(g.screen,WHITE,start_pos,end_p...
[ "0.8216474", "0.808419", "0.8041982", "0.77832127", "0.7648283", "0.7604516", "0.7541168", "0.75036514", "0.74366957", "0.7394856", "0.7374004", "0.73558646", "0.72848505", "0.72743", "0.7202921", "0.7139773", "0.71055603", "0.7104149", "0.709945", "0.70826256", "0.70656776",...
0.7936204
3
Draws the Board including the Squares, grid, and Fleas.
def draw(self): self.squares.draw(self.screen) if not self.hide_grid: self.draw_grid() self.fleas.draw(self.screen) pygame.display.flip()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def drawBoard(self):\r\n self.outer.draw(self.surface)\r\n self.background.draw(self.surface)\r\n for point in self.points:\r\n point.draw(self.surface)\r\n point.drawCheckers(self.surface)\r\n self.dice.draw(self.surface)\r\n self.message.draw(self.surface)...
[ "0.801158", "0.78360367", "0.7729371", "0.76840204", "0.76215035", "0.7590688", "0.73918694", "0.7307775", "0.7303027", "0.7246071", "0.7245624", "0.7224394", "0.71885425", "0.7174259", "0.7136953", "0.71274716", "0.70800877", "0.7012581", "0.69895095", "0.69768536", "0.69735...
0.74167717
6
Create secondary features. At least one keyword argument must be provided.
def featurize( self, meta_df: Optional[pd.DataFrame] = None, test_meta_df: Optional[pd.DataFrame] = None, ) -> None: if meta_df is None and test_meta_df is None: raise ValueError("At least one keyword argument must be provided.") if meta_df is not None: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_new_features(self):\n train = self.train\n \n train['is_context'] = train['context_type'].isin(CONTEXT_TYPE_TEST)\n train['is_context_flow'] = train['listen_type'] * train['is_context']\n \n train['is_listened_context'] = train['is_listened'] * train['is_context...
[ "0.57953346", "0.5540945", "0.5539418", "0.55321926", "0.5357207", "0.5354252", "0.53519714", "0.5343687", "0.5321349", "0.53048503", "0.5271115", "0.52576053", "0.5232943", "0.5215288", "0.5207234", "0.51544017", "0.5153577", "0.5147574", "0.51334405", "0.50996745", "0.50892...
0.54937667
4
Build a MetaDataSetFeaturizerViaLambda based on supplied keyword arguments.
def __call__( self, method: str, callable_: Callable[[pd.DataFrame], Union[pd.DataFrame, pd.Series]], normalizable: bool, **_ignore ): return MetaDataSetFeaturizerViaLambda( method=method, callable_=callable_, normalizable=normalizable )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply(self, func):\r\n return func(**self.kwargs)", "def lambda_fn(ds, fn):\n logger.info(\"Applying function '%s' on dataset.\", str(fn))\n return fn(ds)", "def factory(*args):\n\n def wrapper(dataset):\n return Factory(dataset, *args)\n\n return wrapper", "def function_maker(s...
[ "0.521316", "0.5161827", "0.5130045", "0.5062305", "0.50407004", "0.49847677", "0.4981667", "0.4978922", "0.48902628", "0.48765245", "0.4872106", "0.48687008", "0.48558855", "0.48554668", "0.48479384", "0.4819062", "0.48036474", "0.48031783", "0.4770191", "0.4765676", "0.4764...
0.7124045
0
Set up market parameters. All parameters are scalars. See
def __init__(self, r, r_2, pie_d, pie_d_2, lmb_d, lmb_d_2, pie_s, pie_s_2, b_s, b_s_2): lma_d=(pie_d-(1+r)) lma_d_2=(pie_d_2-(1+r_2)) a_s=((1+r)-pie_s) a_s_2=((1+r_2)-pie_s_2) self.lma_d, self.lma_d_2, self.lmb_d, self.lmb_d_2, self.a_s, self.a_s_2, self.b_s, self.b_s_2 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_params(self, **kwargs):\n\n kw_keys = list(kwargs)\n\n if 'alpha' in kw_keys:\n self.alpha = kwargs['alpha']\n\n if 'beta' in kw_keys:\n self.beta = kwargs['beta']\n\n if 'gamma' in kw_keys: \n \tself.gamma = kwargs['gamma']\n\n if 'epsilon' i...
[ "0.6921982", "0.67677104", "0.6565057", "0.6549596", "0.650122", "0.6495121", "0.64377415", "0.6433998", "0.6406836", "0.6391233", "0.6386938", "0.63773566", "0.63642573", "0.62875944", "0.6272724", "0.6261374", "0.62600845", "0.6248021", "0.6233617", "0.6227204", "0.6205617"...
0.0
-1
Identify interface residues between two chains at a given distance cutoff.
def identify_contacts(chain_A, chain_B, solute_reference_openmm, trajectory, frame, cutoff): # Get trajectory frame traj = trajectory[frame] # Create dict mapping residue indexes to residue id's in PDB d_res = {} for chain in solute_reference_openmm.topology.chains(): for res in chain....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def identify_interface_residues_12(reference_pdb, reference_withH_pdb, trajectory, cutoffs, frames):\n\n # Load reference PDB\n forcefield = ForceField('amber14-all.xml', 'amber14/tip3pfb.xml')\n pdb = PDBFile(reference_pdb)\n modeller = Modeller(pdb.topology, pdb.positions)\n modeller.addHydrogens(...
[ "0.5814534", "0.56723017", "0.56133354", "0.5265103", "0.5181596", "0.50566536", "0.5001008", "0.491961", "0.49137068", "0.49137068", "0.48926866", "0.48706847", "0.4851041", "0.48194987", "0.4812039", "0.48093337", "0.4809159", "0.47935218", "0.47512582", "0.47310477", "0.47...
0.54563504
3
Identify the interface residues for all pairs of chains involved in the interface.
def identify_interface_residues_4(reference_pdb, reference_withH_pdb, trajectory, cutoffs, frames, is_5udc=False): # Load reference PDB forcefield = ForceField('amber14-all.xml', 'amber14/tip3pfb.xml') pdb = PDBFile(reference_pdb) modeller = Modeller(pdb.topology, pdb.positions) modeller.addHydroge...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def residues(self, chain_id, model_num = 0, include_alt = False):\n resi = []\n for res in self.chain(chain_id, model_num):\n res.chain_id = chain_id\n if res.id[0] ==' ':\n resi.append(res)\n elif include_alt:\n resi.append(res)\n ...
[ "0.6352576", "0.5909955", "0.5489757", "0.53997153", "0.53572285", "0.5353771", "0.53379476", "0.5298372", "0.52637863", "0.52098495", "0.5159685", "0.51538616", "0.5131051", "0.5125846", "0.51236707", "0.5099968", "0.5090912", "0.5074676", "0.5062754", "0.50619", "0.50596076...
0.57994956
2
Identify the interface residues for all pairs of chains involved in the interface.
def identify_interface_residues_12(reference_pdb, reference_withH_pdb, trajectory, cutoffs, frames): # Load reference PDB forcefield = ForceField('amber14-all.xml', 'amber14/tip3pfb.xml') pdb = PDBFile(reference_pdb) modeller = Modeller(pdb.topology, pdb.positions) modeller.addHydrogens(forcefield,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def residues(self, chain_id, model_num = 0, include_alt = False):\n resi = []\n for res in self.chain(chain_id, model_num):\n res.chain_id = chain_id\n if res.id[0] ==' ':\n resi.append(res)\n elif include_alt:\n resi.append(res)\n ...
[ "0.63490707", "0.57995063", "0.549096", "0.5399745", "0.53579885", "0.5353315", "0.5337845", "0.5297717", "0.52630556", "0.52081615", "0.5159576", "0.51541764", "0.5130359", "0.5124876", "0.5121439", "0.5100151", "0.50913095", "0.50734675", "0.50631887", "0.5062796", "0.50600...
0.59105253
1
t1, t2 are non empty
def always_sunny(t1, t2): sun = ("sunny","sun") first = t1[0] + t2[0] return (sun[0], first)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _test_empty(t):\n return t.is_empty()", "def empty(self):\r\n if len(self.s1)==0 and len(self.s2)==0:\r\n return True", "def test_dtm_not_equal(self):\n new_dtm = self.dtm1.copy()\n new_dtm.final_states.add('q2')\n nose.assert_true(self.dtm1 != new_dtm, 'DTMs are e...
[ "0.5986555", "0.59421563", "0.58333683", "0.5785593", "0.5780122", "0.5758743", "0.57342875", "0.5723197", "0.57114446", "0.5694139", "0.5657635", "0.5646962", "0.5632908", "0.56024885", "0.55924153", "0.5591492", "0.55658567", "0.5531688", "0.5517331", "0.5495071", "0.547345...
0.5031999
99
new branching cone name for the new branch cone
def branching_decision(cod_obj, force_drift, force_struc, view, new_cod, new_nod, new_edd, eddp, nodp, ed_namesp, no_namesp, co_namesp, flavourp): cone1 = co_namesp.pop(0) a = cod_obj.branching(cone1) splitting_mother_cone(cod_obj, new_nod, new_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def branch_name(self):\n return f'phab-diff-{self.diff_id}'", "def unique_branch_name(base_name):\n repo = git.repo()\n branches = repo.branches()\n collision = True\n count = 1\n while collision:\n new_branch = base_name + \"-bak-\" +str(count)\n collision = next((x for x in ...
[ "0.70662946", "0.65689903", "0.6210586", "0.6210586", "0.62018585", "0.5930595", "0.5845", "0.5817794", "0.56846833", "0.56834936", "0.5624811", "0.5614766", "0.55923414", "0.5575148", "0.5570589", "0.55602694", "0.5525928", "0.55247796", "0.55173403", "0.5500877", "0.5493756...
0.52397233
49
put listener in listening mode and wait for incoming connections.
async def listen(self, maddr: Multiaddr) -> bool:
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def listen(self):\n self.can_listen = True\n threading.Thread(target=self._listen).start()", "def listen(self):\n self.socket.listen(6)", "def listen_connections(self):\n self.MAIN_CONNECTION.listen(server.MAX_CONNECTIONS)", "def listen(self):\n pass", "def open_listener(...
[ "0.77136636", "0.7363863", "0.7359952", "0.7318734", "0.73166144", "0.71989334", "0.7141114", "0.70626956", "0.70605063", "0.7045739", "0.70408773", "0.7027022", "0.7010702", "0.700512", "0.6979281", "0.6974525", "0.6969262", "0.69281256", "0.68991166", "0.68212086", "0.68148...
0.6793263
21
retrieve list of addresses the listener is listening on.
def get_addrs(self) -> List[Multiaddr]:
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def address(self):\n addrlist = []\n for s in self.srv_socks:\n addrlist.append(s.getsockname())\n return addrlist", "def get_addrs(self):\n # TODO check if server is listening\n return self.multiaddrs", "def get_supervisor_addresses(self) -> List[str]:", ...
[ "0.7614805", "0.76038516", "0.69983035", "0.6990682", "0.6919074", "0.68086815", "0.68086815", "0.68086815", "0.67372423", "0.6467846", "0.64236337", "0.63805145", "0.63112867", "0.624012", "0.6133103", "0.61057365", "0.6101257", "0.60780704", "0.6058948", "0.6032824", "0.602...
0.7419669
2
close the listener such that no more connections can be open on this transport instance.
async def close(self) -> None:
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close(self):\n log.info(\"Closing listener from %s on port %s.\",\n self.address, self.port)\n self._server.stop()\n self._server = None\n self._address = \"\"\n self._port = 0", "def close(self):\n if self._closed:\n return\n\n self...
[ "0.81969666", "0.7580352", "0.7559147", "0.7079218", "0.70395863", "0.7024379", "0.7014757", "0.69295055", "0.69295055", "0.69295055", "0.69295055", "0.69295055", "0.69295055", "0.6902617", "0.68785983", "0.6869464", "0.68604946", "0.68221366", "0.68221366", "0.6735415", "0.6...
0.0
-1
Add the mask to the provided face, and return the face with mask.
def apply_mask(face: np.array, mask: np.array) -> np.array: mask_h, mask_w, _ = mask.shape face_h, face_w, _ = face.shape # Resize the mask to fit on face factor = min(face_h / mask_h, face_w / mask_w) new_mask_w = int(factor * mask_w) new_mask_h = int(factor * mask_h) new_mask_shape = (new...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_face(self, face):\n try:\n face_idx = self.faces.index(face)\n return self.faces[face_idx]\n except Exception:\n self.faces.append(face)\n return face", "def add_mask(self, bg, mask):\n # if mask is to tall for the background image, decreas...
[ "0.68112254", "0.61941063", "0.61160135", "0.5863433", "0.5680295", "0.56591696", "0.5506171", "0.5495523", "0.5465617", "0.54287475", "0.540982", "0.5407283", "0.5399397", "0.53711027", "0.53566027", "0.52766466", "0.5251095", "0.52477425", "0.5221825", "0.521897", "0.516831...
0.7651554
0
Receive yaml string, update instance state with its value
def post_exec_command(self, env_out): env_at_footer = yaml.safe_load(env_out) newdir = env_at_footer["pwd"] newenv = env_at_footer["env"] self.update_workdir(newdir) self.update_env(newenv) if "code" in env_at_footer: return env_at_footer["code"] els...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __setstate__(self, d):\n self.temp_yaml = None\n self.__dict__.update(d)", "def from_yaml(self, yaml):\n self.hwAddress = yaml.get('hwAddress')\n if self.hwAddress:\n self.hwAddress = self.hwAddress.lower()\n self.ip = yaml.get('IP')\n self.formulas = {}\n...
[ "0.61438406", "0.6056736", "0.5877559", "0.5833056", "0.58151037", "0.5771336", "0.5758185", "0.5707733", "0.56915504", "0.5662397", "0.5634253", "0.5543256", "0.5499675", "0.5443834", "0.5396185", "0.5373637", "0.534983", "0.5343931", "0.53255194", "0.5319177", "0.5310332", ...
0.0
-1
Append header/footer to `cmd`.
def append_footer(cmd, marker): header = "" footer = """ EXIT_CODE=$? echo {marker}code: ${{EXIT_CODE}}{marker} echo {marker}pwd: $(pwd){marker} echo {marker}env: $(cat -v <(env -0)){marker} """.format( marker=marker ) full_command = "\n".join([header, cmd, footer]) return full_command
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tprint_raw(self, cmd, end='\\n'):\n self.fileHandle.write(cmd + end)", "def _build_command(self, cmd, unit):\n return '#' + unit + cmd + NEWLINE", "def add_header(force=False):\n print_debug_info()\n if not force:\n if not should_do_write():\n return\n\n on_ente...
[ "0.5938615", "0.5770663", "0.56236213", "0.5596925", "0.5524238", "0.55135214", "0.54929286", "0.5477096", "0.5441686", "0.53585064", "0.53575087", "0.53523684", "0.5345566", "0.53223354", "0.5313103", "0.5260496", "0.52242094", "0.5208714", "0.52053946", "0.52005076", "0.518...
0.7447718
0
Merge two iterators returned by Popen.communicate()
def merge_stdout_stderr(iterator): for (stdout, stderr) in iterator: if stdout: yield stdout else: yield stderr
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pipemeter(cmd1, cmd2):\n\n proc1 = subprocess.Popen(cmd1, bufsize=0, shell=True, stdout=subprocess.PIPE)\n proc2 = subprocess.Popen(cmd2, bufsize=0, shell=True, stdin=subprocess.PIPE)\n bytes_piped = 0\n\n while True:\n data = proc1.stdout.read(CHUNKSIZE)\n length = len(data)\n ...
[ "0.66606086", "0.6126606", "0.58850574", "0.5624073", "0.5607234", "0.551958", "0.54522693", "0.54313684", "0.5363718", "0.53104246", "0.53101385", "0.5266014", "0.52605325", "0.5257359", "0.5249061", "0.5244659", "0.52373624", "0.5161998", "0.51599884", "0.5159055", "0.51327...
0.58755404
3
Process iterator which is return of Popen.communicate() For normal lines, call callback printfn.
def process_output(tuple_iterator, marker, print_function): iterator = merge_stdout_stderr(tuple_iterator) env_out = "" for line in iterator: if line.endswith(marker + "\n"): if not line.startswith(marker): # The `line` contains 2 markers and trailing newline ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __iter__(self):\n p = subprocess.Popen(self.comm, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)\n while True:\n line = p.stdout.readline()\n if not line:\n\t\t break\n line = line.strip()\n yield line", "def run(self):\n ...
[ "0.6762434", "0.65452737", "0.64996916", "0.6360212", "0.6091779", "0.606308", "0.59477913", "0.5908305", "0.5880744", "0.5825736", "0.574949", "0.5631919", "0.5621603", "0.56201273", "0.56054807", "0.5584007", "0.5553441", "0.5513236", "0.55101407", "0.5414936", "0.53892183"...
0.57843137
10
Parse and postprocess ssh_config and rename some keys for plumbum.ParamikoMachine.__init__()
def load_ssh_config_for_plumbum(filename, host): conf = paramiko.config.SSHConfig() expanded_path = os.path.expanduser(filename) username_from_host = None m = re.search("([^@]+)@(.*)", host) if m: username_from_host = m.group(1) host = m.group(2) if os.path.exists(expanded_pat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _parse(self, content):\n result = TincConfParser.conf_file.parseString(to_unicode(content))\n for entry in result.get(\"entries\", []):\n self[entry[0]] = entry[1]\n keys = result.get(\"keys\", [])\n if keys:\n if len(keys) > 1:\n raise ParserErr...
[ "0.6004054", "0.5839919", "0.5825213", "0.5778339", "0.5707421", "0.56640553", "0.5603101", "0.55248064", "0.54654783", "0.5437723", "0.5413477", "0.53898275", "0.5389727", "0.5387925", "0.53728455", "0.53633326", "0.5356791", "0.5346864", "0.53243184", "0.5306002", "0.53013"...
0.58567256
1
always run this method first to evaluate the meta json file. Pass the directory of the corpus (where metafile.json is situated)
def load_json(corpus): global corpus_dir, u_path, candidates, unknowns, encoding, language corpus_dir += corpus m_file = open(os.path.join(corpus_dir, META_FILENAME), "r") meta_json = json.load(m_file) m_file.close() u_path += os.path.join(corpus_dir, meta_json["folder"]) encoding += meta_j...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_corpus_meta_from_dir(filename, corpus_meta, exclude_overall_meta):\n with open(os.path.join(filename, \"corpus.json\"), \"r\") as f:\n for k, v in json.load(f).items():\n if k in exclude_overall_meta: continue\n corpus_meta[k] = v", "def main():\n \n root = Folder(n...
[ "0.7082381", "0.586382", "0.5772098", "0.57677233", "0.5752917", "0.57001966", "0.5661683", "0.5659507", "0.56590486", "0.5642474", "0.5588098", "0.55415887", "0.551891", "0.5513077", "0.54982644", "0.5493433", "0.549307", "0.54841393", "0.5416018", "0.54146445", "0.5410795",...
0.6883183
1
run this method next, if you want to do training (read training files etc)
def load_training(): for can in candidates: trainings[can] = [] for subdir, dirs, files in os.walk(os.path.join(corpus_dir, can)): for doc in files: trainings[can].append(doc)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train():\n pass", "def train(self, trainfile):", "def train(self):\n pass", "def train(self):\n pass", "def train(self):\n pass", "def train(self):\n pass", "def train(self):\n pass", "def train():\n # YOUR TRAINING CODE GOES HERE", "def train_start(...
[ "0.80825347", "0.8008459", "0.7991317", "0.7991317", "0.7991317", "0.7991317", "0.7991317", "0.7725816", "0.77055573", "0.763521", "0.75699675", "0.75522375", "0.7528174", "0.7505932", "0.7492671", "0.74631387", "0.7447466", "0.74104065", "0.7406789", "0.74045306", "0.7386814...
0.0
-1
get training text 'filename' from candidate 'can' (obtain values from 'trainings', see example above)
def get_training_text(can, filename): d_file = codecs.open(os.path.join(corpus_dir, can, filename), "r", "utf-8") s = d_file.read() d_file.close() return s
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_filename():\n dirname = os.path.dirname(__file__)\n return os.path.join(dirname, 'occulttraining.txt')", "def load_training():\n for can in candidates:\n trainings[can] = []\n for subdir, dirs, files in os.walk(os.path.join(corpus_dir, can)):\n for doc in files:\n ...
[ "0.60562044", "0.6041802", "0.6016182", "0.58461756", "0.5826132", "0.5790548", "0.5689206", "0.5469799", "0.54335415", "0.539198", "0.5366164", "0.5323693", "0.52881306", "0.52773625", "0.52503705", "0.5247028", "0.52131414", "0.5187469", "0.51757795", "0.51622295", "0.51342...
0.7263047
0
get training file as bytearray
def get_training_bytes(can, filename): d_file = open(os.path.join(corpus_dir, can, filename), "rb") b = bytearray(d_file.read()) d_file.close() return b
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_sample_binary() -> bytearray:\n full_path = path.abspath(__file__).replace(\n DemoBinaryPuller._MODULE_FILE_NAME,\n DemoBinaryPuller._BIN_FILE_NAME)\n with open(full_path, \"rb\") as bin_file:\n binary_content = bin_file.read()\n return binary_content"...
[ "0.6530316", "0.62942386", "0.6263488", "0.6066596", "0.6008916", "0.5943695", "0.59409225", "0.58880603", "0.58114594", "0.57615244", "0.5689741", "0.5688625", "0.56801695", "0.5667511", "0.56595796", "0.5641395", "0.56238467", "0.56224763", "0.56184244", "0.5617344", "0.560...
0.7570874
0
get unknown text 'filename' (obtain values from 'unknowns', see example above)
def get_unknown_text(filename): d_file = codecs.open(os.path.join(u_path, filename), "r", "utf-8") s = d_file.read() d_file.close() return s
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_filename(f):\n problem = f[2:5]\n extension = f.split('.')[-1]\n if extension not in langs.keys():\n # if the extension isn't in our list we don't care about the file\n return (None, None)\n return (problem, extension)", "def parseOutText(f):\n\n\n f.seek(0) ### go back to...
[ "0.60619533", "0.59448653", "0.5880763", "0.5844294", "0.57835126", "0.57252425", "0.57172376", "0.5701078", "0.5650412", "0.5641387", "0.5602536", "0.55996644", "0.5551253", "0.5534546", "0.55136657", "0.55071455", "0.54930013", "0.5470423", "0.54324615", "0.5426587", "0.542...
0.75179213
0
get unknown file as bytearray
def get_unknown_bytes(filename): d_file = open(os.path.join(u_path, filename), "rb") b = bytearray(d_file.read()) d_file.close() return b
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_as_bytes(filename):\n try:\n with open(filename, \"rb\") as file:\n bytes = array.array(\"B\")\n bytes.frombytes(file.read())\n return bytes\n except FileNotFoundError:\n print(f\"File not found: {filename}\")\n ex...
[ "0.7152647", "0.69215786", "0.6701248", "0.6561615", "0.65179765", "0.650987", "0.64195776", "0.6374897", "0.63348585", "0.6324657", "0.6263759", "0.6194869", "0.61396164", "0.6138177", "0.61314404", "0.6122473", "0.6080764", "0.60445416", "0.60434145", "0.60298926", "0.60172...
0.79798865
0
run this method in the end to store the output in the 'path' directory as OUT_filename pass a list of filenames (you can use 'unknowns'), a list of your predicted authors and optionally a list of the scores (both must of course be in the same order as the 'texts' list)
def store_json(path, texts, cans, scores=None): answers = [] if scores is None: scores = [1 for _ in texts] for i in range(len(texts)): answers.append( {"unknown_text": texts[i], "author": cans[i], "score": scores[i]}) f = open(os.path.join(path, OUT_FILENAME), "w") json....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_pred_kaggle_file(cls, outfname, speech):\n yp = cls.predict(speech.test_doc_vec)\n labels = speech.le.inverse_transform(yp)\n f = codecs.open(outfname, 'w')\n f.write(\"FileIndex,Category\\n\")\n for i in range(len(speech.test_fnames)):\n fname = speech.test_fnames[i]\n f.wri...
[ "0.62999773", "0.59991187", "0.59550965", "0.5944562", "0.59349877", "0.59268004", "0.5834005", "0.5819272", "0.5778378", "0.5764998", "0.5762171", "0.57342887", "0.5728905", "0.57210076", "0.5710357", "0.5702814", "0.5688264", "0.56862724", "0.5659074", "0.56527543", "0.5650...
0.0
-1
if you want to evaluate your answers using the groundtruth.json, load the true authors in 'trueAuthors' using this function
def load_ground_truth(): t_file = open(os.path.join(corpus_dir, GT_FILENAME), "r") t_json = json.load(t_file) t_file.close() global trueAuthors for i in range(len(t_json["ground-truth"])): trueAuthors.append(t_json["ground-truth"][i]["true-author"])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_authors_from_data(self):\n responses.add(\n responses.GET,\n \"https://openlibrary.org/authors/OL382982A\",\n json={\n \"name\": \"George Elliott\",\n \"personal_name\": \"George Elliott\",\n \"last_modified\": {\n ...
[ "0.5868444", "0.57829976", "0.5589759", "0.55294764", "0.5447328", "0.54368585", "0.5414421", "0.5405367", "0.5401354", "0.53672665", "0.53661776", "0.5360875", "0.53598326", "0.5315401", "0.5311761", "0.530894", "0.5297903", "0.5284491", "0.5276247", "0.5260965", "0.5245783"...
0.74645066
0
Perform regridding on an array of data.
def regrid(self, src_array, norm_type="fracarea", mdtol=1): array_shape = src_array.shape main_shape = array_shape[-self.src.dims :] if main_shape != self.src.shape: raise ValueError( f"Expected an array whose shape ends in {self.src.shape}, " f"got an...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def regrid(self, obj, **kwargs):\n if isinstance(obj, xr.Dataset):\n return obj.map(self._regrid_dataarray, keep_attrs=True, **kwargs)\n elif isinstance(obj, xr.DataArray):\n return self._regrid_dataarray(obj, **kwargs)\n else:\n raise ValueError('unknown type'...
[ "0.6270635", "0.5646218", "0.5525216", "0.5499714", "0.54920924", "0.54512894", "0.54512894", "0.5364606", "0.5364606", "0.53109187", "0.5242617", "0.5226098", "0.5136758", "0.51108867", "0.50939864", "0.5064222", "0.50586665", "0.5020054", "0.4992338", "0.4978625", "0.496110...
0.0
-1
convert sentence to index array
def padding(sent, sequence_len): if len(sent) > sequence_len: sent = sent[:sequence_len] padding = sequence_len - len(sent) sent2idx = sent + [0]*padding return sent2idx, len(sent)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sentences_to_indices(X, word_to_index, max_len):\n \n m = X.shape[0] # number of training examples\n \n ### START CODE HERE ###\n # Initialize X_indices as a numpy matrix of zeros and the correct shape (≈ 1 line)\n X_indices = np.zeros((m, max_len))\n \n ...
[ "0.7227327", "0.72110087", "0.7196507", "0.7154089", "0.7082231", "0.7068135", "0.69883484", "0.65725946", "0.6530706", "0.64363074", "0.6428371", "0.63868946", "0.63488775", "0.63356364", "0.62344724", "0.62321657", "0.62182313", "0.6209054", "0.6167227", "0.6106061", "0.608...
0.0
-1
Mock the redis pubsub.listen generator Yields the elements of `side_effects`, one at a time. If an element is an exception, it is raised instead of yielded. If the element is a callable, it is called and the return value is yielded.
def redis_listen(*side_effects): for effect in side_effects: if ( isinstance(effect, Exception) or isinstance(effect, type) and issubclass(effect, Exception) ): raise effect elif callable(effect): yield effect() else: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mock_side_effect(self, original_object, attribute_name, side_effect):\n original_function = getattr(original_object, attribute_name)\n def original_with_side_effect(*args, **kwargs):\n side_effect()\n return original_function(*args, **kwargs)\n self.mock(original_object, attribute_name, orig...
[ "0.5850686", "0.55700994", "0.5440504", "0.5365091", "0.5313459", "0.5286434", "0.5244393", "0.5134776", "0.5041271", "0.5028358", "0.4956616", "0.49153754", "0.491494", "0.4888333", "0.48866546", "0.48858225", "0.48772252", "0.48605973", "0.48562133", "0.485331", "0.484318",...
0.7716917
0
Anonymous user can't access the user profile view.
def test_anonymous_cannot_get_userprofileview(dclient): resp = dclient.get("/api/record/profile/", follow=True) assert resp.status_code == 403
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_user_get_profile_not_authorized(self):\n self.client.logout()\n response = self.client.get(CONSTS.USER_PROFILE_URL)\n self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN)", "def test_not_logged_user_cannot_access(self):\n\n utils.test_not_logged_cannot_access(sel...
[ "0.72416484", "0.6976399", "0.6976399", "0.6976399", "0.6976399", "0.6944178", "0.68615055", "0.68094474", "0.67919546", "0.6710337", "0.66798", "0.66781527", "0.664407", "0.66254276", "0.66114944", "0.6598399", "0.6598399", "0.6598399", "0.6598399", "0.6598399", "0.6598399",...
0.7859145
0
A logged in user can access the user profile view.
def test_loggedin_get_userprofileview(admin_client): resp = admin_client.get("/api/record/profile/", follow=True) assert resp.status_code == 200 userdata = resp.data assert "user" in userdata.keys() assert "profile" in userdata.keys()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_view(cls, user, profile):\r\n pass", "def user_view(cls, user, profile):\n pass", "def can_view(self, user):\r\n return True", "def user_profile():\n if CURR_USER_KEY in session:\n return render_template('/profile/detail.html')\n else:\n return redirect('/log...
[ "0.79150033", "0.7914116", "0.752152", "0.75147706", "0.7382388", "0.73471504", "0.7199786", "0.71735126", "0.7023994", "0.6933684", "0.68745196", "0.68414307", "0.68403566", "0.68403566", "0.6839631", "0.6835273", "0.6832623", "0.68008256", "0.6793359", "0.67932135", "0.6789...
0.65807426
35
User can post source records and an empty crecord to the server and receive a crecord with the cases from the source record incorporated.
def test_integrate_sources_with_crecord(dclient, admin_user, example_crecord): dclient.force_authenticate(user=admin_user) docket = os.listdir("tests/data/dockets/")[0] with open(f"tests/data/dockets/{docket}", "rb") as d: doc_1 = SourceRecord.objects.create( caption="Hello v. World", ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_add_flow_request_with_no_sources(self):\n res = self._add_flow_request(flow_request=self.flow_request_without_sources)\n self.assertEqual(res.status_code, 201)\n flow_request = res.json()\n destination = Destination.objects.get(name='Destination 1')\n self.assertEqual(fl...
[ "0.5335964", "0.5273506", "0.5268467", "0.50346047", "0.50232166", "0.50214654", "0.50048697", "0.49723393", "0.4958517", "0.49340504", "0.48781565", "0.48394287", "0.48392814", "0.48148042", "0.48148042", "0.48148042", "0.48148042", "0.48148042", "0.48148042", "0.48148042", ...
0.584946
0
post a couple of documents with urls to the server. Server creates objects to store the downloaded files and then returns uuids of the document objects in the database.
def test_download_ujs_docs(admin_client): doc_1 = { "docket_num": "CP-12345", "court": "CP", "url": "https://ujsportal.pacourts.us/DocketSheets/CPReport.ashx?docketNumber=CP-25-CR-1234567-2010&dnh=12345", "caption": "Comm. v. SillyKitty", "record_type": SourceRecord.RecTypes....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def collection_post(self):\n if 'file' not in self.request.POST:\n self.request.errors.add('body', 'file', 'Not Found')\n self.request.errors.status = 404\n return\n tender = TenderDocument.load(self.db, self.tender_id)\n if not tender:\n self.reques...
[ "0.6769817", "0.6653054", "0.6561942", "0.6291622", "0.6269296", "0.6071196", "0.60429853", "0.6011071", "0.58240336", "0.58195174", "0.57986724", "0.5758155", "0.5755627", "0.5733029", "0.57280797", "0.5722662", "0.5685775", "0.562269", "0.561203", "0.5599596", "0.5592597", ...
0.0
-1
randomly initialize weigts or to zero
def initialize_weights(self, n_features, random=True): if random: limit = 1 / math.sqrt(n_features) self.weights = np.random.uniform(-limit, limit, (n_features, )) else: self.weights = np.zeros(n_features)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def WeightInitializer():\n return np.random.uniform(-1, 1)", "def test_init():\n rng = NonRandom()\n seed = 5\n rng.setSeed(seed)\n wheel = Wheel(rng)\n assert len(wheel.bins) == 38\n assert wheel.rng.value == seed\n assert wheel.rng.choice(range(0, 38)) == range(\n 0, 38)[wheel.rn...
[ "0.7099099", "0.68757343", "0.68296725", "0.6803808", "0.6685831", "0.6591714", "0.6560001", "0.6552778", "0.65211815", "0.65121937", "0.6508242", "0.6505495", "0.6494545", "0.642668", "0.64228153", "0.641944", "0.6410729", "0.6384001", "0.63680696", "0.6353744", "0.6341442",...
0.64542484
13
fitting regression model to the data X and y
def fit(self, X, y): # TODO insert stack of 1 for bias X = np.insert(X, 0, 1, axis=1) self.errors = [] self.initialize_weights(n_features=X.shape[1]) # TODO gradient descent for n_iter for _ in range(self.n_iter): y_pred = X.dot(self.weights) # calculate l2 loss mse = np.mean(0.5 * (y - y_pred)*...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _regress(self, X, y):\n self._model.fit(X, np.ravel(y))\n self._set_attributes(self._model)", "def fit(self, X, y):", "def fit(self, X, y):", "def fit(self, X, y):", "def fit(self, X,y):\n pass", "def fit(self, X, y):\n return BaseRegressor.fit(self, X, y)", "def fit(sel...
[ "0.8087929", "0.7828381", "0.7828381", "0.7828381", "0.7735748", "0.7643866", "0.7512748", "0.7470016", "0.74514323", "0.7443375", "0.7415181", "0.73932964", "0.737425", "0.735379", "0.735379", "0.735379", "0.735379", "0.735379", "0.735379", "0.735379", "0.735379", "0.73537...
0.69014436
49
Add SGE related command line options to an
def add_parser_arguments(parser: argparse.ArgumentParser): parser.add_argument( "-q", "--queues", default="none", help=( "comma separated list of queues for the SGE batch system," ' "none" if you do not want to specify a queue' ), ) parser.add_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_command_line_arguments(self, parser):\n # parser.add_option(...)\n pass", "def modify_commandline_options(parser, is_train=True):\n parser.set_defaults(norm='batch', netG='unet_256', dataset_mode='aligned')\n if is_train:\n parser.set_defaults(pool_size=0, gan_mode=...
[ "0.6667056", "0.6480277", "0.63502276", "0.63308334", "0.6285769", "0.6283014", "0.6282531", "0.6217268", "0.61664003", "0.61360985", "0.6110302", "0.61096555", "0.61047727", "0.61013126", "0.6094607", "0.6094607", "0.6093989", "0.60865587", "0.6085824", "0.6065626", "0.60578...
0.55830103
98
Get the job ids of all jobs in the SGE queue.
def get_jobs_in_queue() -> List[int]: output = subprocess.check_output(["qstat"]).decode().splitlines() job_ids = [] for line in output: m = REGEX_QSTAT.match(line) if m: job_ids.append(int(m.group(1))) return job_ids
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def queue_job_ids(self):\n return list(self.queue.keys())", "def job_ids(self):\n return self.get_job_ids()", "def job_ids(self):\n return self.connection.lrange(self.key, 0, -1)", "def job_ids(self) -> List[str]:\n return self._db_data.job_ids", "def job_ids(config):\n errco...
[ "0.8385078", "0.8187057", "0.80874485", "0.78921986", "0.7101836", "0.69291735", "0.69259614", "0.689238", "0.68702495", "0.6756363", "0.6716455", "0.6708328", "0.6654445", "0.6645604", "0.6645604", "0.6600915", "0.65943897", "0.65570474", "0.6538437", "0.6514417", "0.6512594...
0.73875344
4
Create a jobfile for a command and submit it. This function takes an arbitrary shell command and submits it to SGE.
def submit( command: str, namespace: argparse.Namespace, sge_dir: Path = Path(os.path.curdir), job_name="", ) -> int: id_file = Path("sge.id") job_script = Path("sge_job") stop_script = Path("sge_stop") epilogue_script = Path("sge_epilogue") # check if job is already running if ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def submit_command_to_queue(command, queue=None, max_jobs_in_queue=None, queue_file=None, queue_parameters={'max_mem':5000, 'queue':'short', 'logs_dir':'/tmp', 'modules':['Python/3.6.2']}, dummy_dir=\"/tmp\", script_name=None):\n #if max_jobs_in_queue is not None:\n # while number_of_jobs_in_queue() >= ma...
[ "0.66603345", "0.6486015", "0.6295028", "0.6273452", "0.6230695", "0.62159914", "0.6041481", "0.6036891", "0.59854907", "0.5983392", "0.5968986", "0.5875951", "0.5868986", "0.5732721", "0.56980747", "0.5687351", "0.5685329", "0.5644428", "0.56439567", "0.56382155", "0.5620296...
0.66162074
1
Add a volume object to the database
def database_volume_add(volume_obj): db = database_get() session = db.session() query = session.query(model.Volume) query = query.filter(model.Volume.uuid == volume_obj.uuid) volume = query.first() if not volume: volume = model.Volume() volume.uuid = volume_obj.uuid volum...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def database_volume_snapshot_add(volume_snapshot_obj):\n db = database_get()\n session = db.session()\n query = session.query(model.VolumeSnapshot)\n query = query.filter(model.VolumeSnapshot.uuid == volume_snapshot_obj.uuid)\n volume_snapshot = query.first()\n if not volume_snapshot:\n vo...
[ "0.75710624", "0.7532311", "0.6907653", "0.6772771", "0.66654813", "0.65324235", "0.64125866", "0.6377688", "0.6288482", "0.6157662", "0.61301947", "0.610188", "0.6083926", "0.60792243", "0.6057686", "0.6031038", "0.6029394", "0.6018405", "0.60026425", "0.60026425", "0.600264...
0.86276716
0
Delete a volume object from the database
def database_volume_delete(volume_uuid): db = database_get() session = db.session() query = session.query(model.Volume) query.filter(model.Volume.uuid == volume_uuid).delete() session.commit()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete(self):\r\n return self.connection.delete_volume(self.id)", "def database_volume_snapshot_delete(volume_snapshot_uuid):\n db = database_get()\n session = db.session()\n query = session.query(model.VolumeSnapshot)\n query.filter(model.VolumeSnapshot.uuid == volume_snapshot_uuid).delet...
[ "0.79892504", "0.7345457", "0.7280439", "0.7173193", "0.71207607", "0.70749444", "0.6984302", "0.69721687", "0.69567794", "0.695297", "0.69519734", "0.6908548", "0.6908018", "0.6890436", "0.68565786", "0.6845565", "0.6828146", "0.6813317", "0.68118554", "0.67957896", "0.67940...
0.811518
0
Fetch all the volume objects from the database
def database_volume_get_list(): db = database_get() session = db.session() query = session.query(model.Volume) volume_objs = list() for volume in query.all(): nfvi_volume_data = json.loads(volume.nfvi_volume_data) nfvi_volume = nfvi.objects.v1.Volume(nfvi_volume_data['uuid'], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def database_volume_snapshot_get_list():\n db = database_get()\n\n session = db.session()\n query = session.query(model.VolumeSnapshot)\n\n volume_snapshot_objs = list()\n for volume_snapshot in query.all():\n nfvi_volume_snapshot_data = \\\n json.loads(volume_snapshot.nfvi_volume_...
[ "0.73705924", "0.7112665", "0.6906975", "0.67215234", "0.65297365", "0.65240467", "0.6436968", "0.6402819", "0.6332509", "0.6292779", "0.6251874", "0.6200711", "0.61889696", "0.6147304", "0.61373913", "0.61325896", "0.60601556", "0.60338706", "0.6029828", "0.6019226", "0.6002...
0.83202946
0
Add a volume snapshot object to the database
def database_volume_snapshot_add(volume_snapshot_obj): db = database_get() session = db.session() query = session.query(model.VolumeSnapshot) query = query.filter(model.VolumeSnapshot.uuid == volume_snapshot_obj.uuid) volume_snapshot = query.first() if not volume_snapshot: volume_snapsho...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def database_volume_add(volume_obj):\n db = database_get()\n session = db.session()\n query = session.query(model.Volume)\n query = query.filter(model.Volume.uuid == volume_obj.uuid)\n volume = query.first()\n if not volume:\n volume = model.Volume()\n volume.uuid = volume_obj.uuid\...
[ "0.7482185", "0.7002271", "0.69539315", "0.6797534", "0.67487913", "0.66576785", "0.6618506", "0.6606803", "0.65955716", "0.65905356", "0.6559316", "0.65032834", "0.64993346", "0.6497157", "0.6489921", "0.6484812", "0.64749944", "0.6470906", "0.64646864", "0.6435568", "0.6407...
0.8692387
0
Delete a volume snapshot object from the database
def database_volume_snapshot_delete(volume_snapshot_uuid): db = database_get() session = db.session() query = session.query(model.VolumeSnapshot) query.filter(model.VolumeSnapshot.uuid == volume_snapshot_uuid).delete() session.commit()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_snapshot(self, snapshot):\n aname = \"cinder_v%s.delete_snapshot\" % self.version\n with atomic.ActionTimer(self, aname):\n self._get_client().volume_snapshots.delete(snapshot)\n bench_utils.wait_for_status(\n snapshot,\n ready_statuses=[...
[ "0.7709622", "0.77053", "0.7690059", "0.76509684", "0.7645589", "0.76316714", "0.75801545", "0.75216985", "0.71301407", "0.70789945", "0.7070644", "0.7053744", "0.69826925", "0.68643117", "0.6813923", "0.681291", "0.6803012", "0.6705354", "0.6684261", "0.66091204", "0.6593013...
0.85667115
0
Fetch all the volume snapshot objects from the database
def database_volume_snapshot_get_list(): db = database_get() session = db.session() query = session.query(model.VolumeSnapshot) volume_snapshot_objs = list() for volume_snapshot in query.all(): nfvi_volume_snapshot_data = \ json.loads(volume_snapshot.nfvi_volume_snapshot_data) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def database_volume_get_list():\n db = database_get()\n\n session = db.session()\n query = session.query(model.Volume)\n\n volume_objs = list()\n for volume in query.all():\n nfvi_volume_data = json.loads(volume.nfvi_volume_data)\n nfvi_volume = nfvi.objects.v1.Volume(nfvi_volume_data[...
[ "0.7633621", "0.6984137", "0.6806291", "0.676285", "0.66530216", "0.6551907", "0.6531195", "0.6491406", "0.6482924", "0.63923556", "0.63025755", "0.62802666", "0.62676686", "0.6210009", "0.6184586", "0.61717004", "0.6132653", "0.6115144", "0.6067539", "0.60583323", "0.6047448...
0.8395358
0
Init instance, needed to undo
def create(self, validated_data): ModelClass = self.Meta.model instance = ModelClass() self.instance = instance for key, value in validated_data.items(): setattr(instance, key, value) return super().create(validated_data)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init(self) -> None:", "def _init(self):\n pass", "def init(self):\n pass", "def init(self):\n pass", "def init(self):\n pass", "def init(self):\n pass", "def init(self):\n pass", "def init(self):\n pass", "def init(self):\n pass", "def i...
[ "0.7819323", "0.78072286", "0.78071797", "0.78071797", "0.78071797", "0.78071797", "0.78071797", "0.78071797", "0.78071797", "0.78071797", "0.76847064", "0.7641083", "0.7641083", "0.756993", "0.7538161", "0.7520271", "0.74495345", "0.74403596", "0.7434243", "0.7434243", "0.74...
0.0
-1
Save matplotlib figure to a file
def savefig(fp): try: plt.savefig(fp, dpi=400) _logger.info("...saved figure to %s", fp) except Exception as err: _logger.warning(err) _logger.warning("could not save the figure to %s. i'll just show it to you:", fp) plt.show()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _save_mpl_figure(self, fig, filename, **kwargs):\n\n fig.savefig(filename, **kwargs)\n\n return filename", "def save(file_name):\n setup()\n plt.savefig(file_name)", "def savefig(filename, **options):\n print(\"Saving figure to file\", filename)\n plt.savefig(filename, **options)"...
[ "0.82140446", "0.81954736", "0.7938447", "0.7914869", "0.78761923", "0.786912", "0.7833865", "0.7822658", "0.77871025", "0.7767565", "0.7726329", "0.7709004", "0.7646987", "0.7609973", "0.7455962", "0.74446195", "0.7423176", "0.74201757", "0.7393815", "0.7387586", "0.7368645"...
0.7474395
14
Copy this config, replacing the regions with those in the `regions` parameter.
def copy_with_regions(self, regions): new = copy.deepcopy(self) new.regions = [] for region in regions: new.regions.append(self._parse_region(region)) return new
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def regions(self, regions):\n self._regions = regions", "def copy(self, **kwargs):\n # type: (...) -> SalusConfig\n return deepcopy(self).update(**kwargs)", "def update_region_config(cls, body: CloudAccountRegionConfigurationViewModel) -> Dict:\n\t\tpass", "def __copy__(self):\n r...
[ "0.61411893", "0.6017079", "0.60054064", "0.5572163", "0.5489599", "0.54806817", "0.54680604", "0.54073626", "0.5361858", "0.5301637", "0.5257151", "0.4999279", "0.49944136", "0.49855417", "0.4982498", "0.49822417", "0.49773163", "0.49644902", "0.49597627", "0.49420026", "0.4...
0.728114
0
Build a datastore client.
def _get_client(): return datastore.Client()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, project_id, namespace=None):\n self._client = datastore.Client(project=project_id, namespace=namespace)", "def _generate_client(self):\n mongoConf = self._config.get('Connectivity', 'MongoDB') # type: dict\n if mongoConf.get('username') and mongoConf.get('password'):\n ...
[ "0.65066254", "0.6466267", "0.64521277", "0.6253457", "0.62465185", "0.6241816", "0.6188744", "0.6176696", "0.61699075", "0.6131375", "0.60795176", "0.6067072", "0.6050736", "0.603745", "0.6025112", "0.59992546", "0.5985941", "0.59515315", "0.5943441", "0.58857954", "0.587854...
0.7500386
1
Load a datastore key using a particular client.
def _load_key(client, entity_type, entity_id=None, parent_key=None): key = None if entity_id: key = client.key(entity_type, entity_id, parent=parent_key) else: # this will generate an ID key = client.key(entity_type) return key
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_key(self, type, keyid):\n pass", "def load_key():", "def load_key(self, key):\n self.key = key", "def _load_entity(client, entity_type, entity_id, parent_key=None):\n\n key = _load_key(client, entity_type, entity_id, parent_key)\n entity = client.get(key)\n log('retrieved enti...
[ "0.68274784", "0.6435767", "0.63572484", "0.62927514", "0.6038199", "0.57368225", "0.56166524", "0.55872095", "0.5579193", "0.55307025", "0.5491296", "0.547498", "0.547498", "0.54582745", "0.54403764", "0.5429789", "0.5429789", "0.54016703", "0.53822833", "0.52943665", "0.527...
0.69858867
0
Load a datstore entity using a particular client, and the ID.
def _load_entity(client, entity_type, entity_id, parent_key=None): key = _load_key(client, entity_type, entity_id, parent_key) entity = client.get(key) log('retrieved entity: ' + entity_type + ' for ID: ' + str(entity_id)) return entity
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load(cls, id):\n key = cls.get_key_prefix()+\"#\"+str(id)\n src = dal_get(key)\n logger.debug( \"LOAD %s %s %s\", str(key), str(id), str(src))\n if src == None:\n raise cls.NotExist(\"No instance could be found with ID: \"+str(id))\n result = dal_retrieve(src)\n ...
[ "0.66032004", "0.571891", "0.5601208", "0.54721177", "0.5397103", "0.53937095", "0.5379413", "0.5363272", "0.5350971", "0.5345492", "0.5338532", "0.5322248", "0.52968", "0.5267842", "0.5262351", "0.5257719", "0.52296597", "0.521735", "0.5184554", "0.51640236", "0.51234055", ...
0.7085959
0
Build a new entity of the given type.
def _new_entity(client, entity_type): return datastore.Entity(_load_key(client, entity_type))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_entity_in_domain(entity_type, domain_id):\n if entity_type == 'users':\n new_entity = unit.new_user_ref(domain_id=domain_id)\n new_entity = self.identity_api.create_user(new_entity)\n elif entity_type == 'groups':\n new_entity = unit.ne...
[ "0.6640664", "0.6596463", "0.6416151", "0.6234594", "0.61637956", "0.61633486", "0.6055688", "0.59273124", "0.58544844", "0.58489096", "0.5681009", "0.5670029", "0.5641178", "0.562199", "0.5620456", "0.5573635", "0.5527734", "0.55230725", "0.55120534", "0.55038404", "0.546361...
0.7312703
0
Log a simple message.
def log(msg): print('datastore: %s' % msg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log(self, message: str):", "def log(self, message):", "def log(msg):\n print msg", "def log(message):\n print(\"{0}: {1}\".format(acm.Time.TimeNow(), message))", "def log(self, msg):\n print(msg)", "def log(message):\n if LOGPLEASE:\n logging.info(message)", "def log(msg):\n ...
[ "0.78534085", "0.7699395", "0.74417067", "0.729132", "0.7274844", "0.72511023", "0.72187185", "0.7186877", "0.71487767", "0.7114486", "0.70418835", "0.70299256", "0.7008071", "0.69871724", "0.6926898", "0.6910505", "0.6907022", "0.6893072", "0.6878656", "0.6878376", "0.687529...
0.64976025
68
Read input source files for execution of legacy / decorators.
def process_input_files(inputs): for ifile in inputs: with open(ifile) as fin: exec(compile(fin.read(), ifile, 'exec'))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _read_input_file(self):\n pass", "def walkSource(sourcedir):\n for parent, dnames, fnames in os.walk(sourcedir):\n for fname in fnames:\n if fname not in SKIP_FILES:\n filename = os.path.join(parent, fname)\n if filename.endswith('.java') and os.path....
[ "0.65281004", "0.62655175", "0.6209961", "0.58729976", "0.5674113", "0.56647635", "0.5657191", "0.5642104", "0.56307423", "0.559023", "0.5567687", "0.55624086", "0.5542358", "0.5530092", "0.54682016", "0.54630977", "0.54618365", "0.54535264", "0.54502285", "0.5444807", "0.542...
0.5863827
4
Separate the symbol and functiontype in a a string with "symbol functiontype" (e.g. "mult float(float, float)") Returns (symbol_string, functype_string)
def parse_prototype(text): m = re_symbol.match(text) if not m: raise ValueError("Invalid function name for export prototype") s = m.start(0) e = m.end(0) symbol = text[s:e] functype = text[e + 1:] return symbol, functype
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_fn(fn_string, symbols):\n fn_string = fn_string.replace('^', '**')\n fn = lambdify([sympy.symbols(symbols)], fn_string, 'numpy')\n return fn", "def funcname(funcstr):\n ps = funcstr.find('(')\n return funcstr[:ps]", "def is_function(s):\n return s[0] >= 'f' and s[0] <= 't' and s.i...
[ "0.636994", "0.6213109", "0.61152655", "0.60259014", "0.60193926", "0.59727085", "0.59437835", "0.5887612", "0.5859426", "0.57852936", "0.57704943", "0.5721244", "0.56854355", "0.568241", "0.5677467", "0.5660881", "0.5638788", "0.55202746", "0.54665226", "0.54584044", "0.5458...
0.6176143
2
Heap's Law coefficient K.
def K(self) -> int: return self.params.K
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calc_k(self):\n\t\n\tself.k = -np.array([self.sth*self.cphi, self.sth*self.sphi, self.cth])\n\n\treturn", "def _K(s):\n p = 0\n for k in range(-10, 10, 1):\n p += (-1)**k * np.exp(-2 * k**2 * s**2)\n return p", "def K(self, X, Xstar):\n r = l2norm_(X, Xstar)\n return self.sigm...
[ "0.6776656", "0.6518018", "0.6435173", "0.6414731", "0.63723594", "0.63488007", "0.6319716", "0.6305516", "0.6287949", "0.6285366", "0.6283732", "0.6283732", "0.626956", "0.6251037", "0.6235204", "0.62239546", "0.6171308", "0.61677396", "0.6136487", "0.6133696", "0.61297625",...
0.0
-1
Heap's Law exponent B.
def B(self) -> int: return self.params.B
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scalarmult_B(e: int) -> Point:\n # scalarmult(B, l) is the identity\n e = e % l\n P = ident\n for i in range(253):\n if e & 1:\n P = edwards_add(P, Bpow[i])\n e = e // 2\n assert e == 0, e\n return P", "def powBeta( n ):\n return (1-alphaval)*Fib(n) + Fib(n-1)\n ...
[ "0.644474", "0.6330569", "0.61401194", "0.6129027", "0.6129027", "0.6129027", "0.605208", "0.5996374", "0.5879226", "0.5854087", "0.58396715", "0.5779388", "0.5760062", "0.5754972", "0.57381546", "0.56806064", "0.5677926", "0.5664263", "0.563552", "0.562861", "0.5623061", "...
0.0
-1
Calculate & return n_types = E(m_tokens) = Km^B
def predict(self, m_tokens: np.ndarray, nearest_int: bool = True) -> np.ndarray: # allow scalar return_scalar = np.isscalar(m_tokens) m_tokens = np.array(m_tokens).reshape(-1) # run model K, B = self.params n_types = K * np.power(m_tokens, B) # roundoff ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def M(self) -> int:\n m_tokens = sum(self.values())\n return m_tokens", "def predict(self, m_tokens: np.ndarray, nearest_int: bool = True) -> np.ndarray:\n\n # allow scalar\n return_scalar = np.isscalar(m_tokens)\n m_tokens = np.array(m_tokens).reshape(-1)\n\n # redirect...
[ "0.6336613", "0.6152428", "0.6008679", "0.59152997", "0.5897365", "0.58761245", "0.58518755", "0.5729471", "0.5483581", "0.54251605", "0.5394446", "0.53918296", "0.5376547", "0.5374203", "0.5361404", "0.5334682", "0.5328986", "0.5317697", "0.5310449", "0.5305349", "0.528925",...
0.5752618
7
Equivalent to fit(m_tokens, n_types).predict(m_tokens)
def fit_predict(self, m_tokens: np.ndarray, n_types: np.ndarray) -> np.ndarray: # fit and predict return self.fit(m_tokens, n_types).predict(m_tokens)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predict_tokens(self, tokens):\n return", "def predict(self, m_tokens: np.ndarray, nearest_int: bool = True) -> np.ndarray:\n\n # allow scalar\n return_scalar = np.isscalar(m_tokens)\n m_tokens = np.array(m_tokens).reshape(-1)\n\n # run model\n K, B = self.params\n ...
[ "0.7779649", "0.73221636", "0.70830023", "0.6999615", "0.6885678", "0.6868568", "0.6573257", "0.6553992", "0.6472437", "0.64069986", "0.63722783", "0.63283336", "0.631563", "0.6238089", "0.6219484", "0.6217989", "0.6209873", "0.61776686", "0.61699307", "0.6155449", "0.6138378...
0.86812186
2
The number of tokens in this corpus's optimum sample.
def M_z(self) -> int: return self.params.M_z
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def n_samples(self) -> int: # pragma: no cover\n return self.samples.shape[0]", "def get_num_samples(self):\n return self._num_samples", "def get_number_samples(self):\n return self.samples.shape[0]", "def count_samples(self):\n return sum(SEQ_LENGTHS)", "def corpus_size():\n ...
[ "0.7072977", "0.7060118", "0.7003228", "0.6984528", "0.6974506", "0.69529134", "0.6885456", "0.68401676", "0.68385595", "0.68385595", "0.6838405", "0.6828889", "0.6803548", "0.680313", "0.67857736", "0.6781527", "0.66520417", "0.6604049", "0.6602143", "0.6587367", "0.6578263"...
0.0
-1
The number of types in this corpus's optimum sample.
def N_z(self) -> int: return self.params.N_z
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _number_of_samples(self):\n return len(self._raw_data.samples)", "def get_num_samples(self):\n return self._num_samples", "def get_number_samples(self):\n return self.samples.shape[0]", "def n(self):\n return len(self.genotypes)", "def num_samples(self):\n raise NotImplem...
[ "0.70622724", "0.69946325", "0.69714314", "0.69115615", "0.6901962", "0.6872632", "0.68213123", "0.68171406", "0.6795639", "0.6792166", "0.67827713", "0.67786974", "0.67499924", "0.67159635", "0.67040193", "0.6701999", "0.6662018", "0.66408247", "0.6637646", "0.66172653", "0....
0.0
-1
Predicted number of types not sampled in proportion x of corpus, as a proportion of total types.
def formula_0(x: np.ndarray) -> np.ndarray: logx = np.log(x) denom = x - 1 k0 = (x - logx * x - 1) / denom return k0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predict_types(self, context, filter_types=None):\n ngram_probs = self._get_ngram_probs(context, filter_types)\n type_probs = defaultdict(lambda: 0)\n for probs in ngram_probs:\n for entity_type, prob in probs:\n type_probs[entity_type] += prob/len(ngram_probs)\n\n...
[ "0.6509018", "0.63814545", "0.61504", "0.6143973", "0.6116197", "0.610279", "0.60437423", "0.60072803", "0.5973464", "0.5924148", "0.5911655", "0.59090084", "0.5901668", "0.5899035", "0.58858585", "0.58422124", "0.5826113", "0.58046573", "0.57956547", "0.5781003", "0.5764011"...
0.0
-1
Predicted number of hapax legomena when sampling proportion x of corpus, as a proportion of total types.
def formula_1(x: np.ndarray) -> np.ndarray: logx = np.log(x) x2 = x ** 2 denom = (x - 1) ** 2 k1 = (x2 - logx * x - x) / denom return k1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def percentage_hapaxes(corpus_parts, corpus):\n percentage_h = []\n count = 0\n dv = divide_corpus(corpus, 10)\n hapax_parts = hapaxes_parts(corpus_parts)\n for x in hapax_parts:\n percentage_h.append(percentage(x, len(dv[count])))\n count += 1\n return percentage_h", "def classPr...
[ "0.65043044", "0.63330084", "0.6281049", "0.6209313", "0.6183902", "0.605855", "0.5988587", "0.59786063", "0.59632146", "0.5929213", "0.5865431", "0.5862553", "0.5846947", "0.58393157", "0.57998943", "0.5791255", "0.5790762", "0.5789286", "0.5765929", "0.5745302", "0.5737278"...
0.0
-1
Predicted number of dis legomena when sampling proportion x of corpus, as a proportion of total types.
def formula_2(x: np.ndarray) -> np.ndarray: logx = np.log(x) x2, x3 = x ** 2, x ** 3 denom = 2 * (x - 1) ** 3 k2 = (x3 - 2 * logx * x2 - x) / denom return k2
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predictability(self):\n temp = self.probs\n for n in range(10):\n temp = temp.dot(temp)\n final = temp[0,:]\n #Let's assume that all words have unique initial letters\n probs = map(len, self.words)\n probs = array(probs)\n probs = (probs + self.probs....
[ "0.6285394", "0.6279558", "0.6165673", "0.60929614", "0.6012952", "0.601181", "0.599572", "0.5970498", "0.59479874", "0.58346444", "0.58182454", "0.57931244", "0.5790188", "0.57784945", "0.576298", "0.5754989", "0.5753197", "0.5749118", "0.57417613", "0.57405794", "0.5739538"...
0.0
-1
Predicted number of tris legomena when sampling proportion x of corpus, as a proportion of total types.
def formula_3(x: np.ndarray) -> np.ndarray: logx = np.log(x) x2, x3, x4 = x ** 2, x ** 3, x ** 4 denom = 6 * (x - 1) ** 4 k3 = (2 * x4 - 6 * logx * x3 + 3 * x3 - 6 * x2 + x) / denom return k3
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predictability(self):\n temp = self.probs\n for n in range(10):\n temp = temp.dot(temp)\n final = temp[0,:]\n #Let's assume that all words have unique initial letters\n probs = map(len, self.words)\n probs = array(probs)\n probs = (probs + self.probs....
[ "0.62275267", "0.6199", "0.6191669", "0.60746145", "0.59952843", "0.5994313", "0.59854066", "0.5954453", "0.5899504", "0.58304006", "0.5821493", "0.58011955", "0.5799743", "0.5794811", "0.5784996", "0.5778464", "0.57697695", "0.57539654", "0.57463473", "0.5742822", "0.5737188...
0.0
-1
Predicted number of tetrakis legomena when sampling proportion x of corpus, as a proportion of total types.
def formula_4(x: np.ndarray) -> np.ndarray: logx = np.log(x) x2, x3, x4, x5 = x ** 2, x ** 3, x ** 4, x ** 5 denom = 12 * (x - 1) ** 5 k4 = (3 * x5 - 12 * logx * x4 + 10 * x4 - 18 * x3 + 6 * x2 - x) / denom return k4
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def classProbs(observation, tree, classes):\n res = classify(observation, tree) #res = results\n total = sum(res.values())\n probs = []\n for c in classes:\n if c in res.keys():\n probs.append(float(res[c])/total)\n else:\n probs.append(0)\n return probs", "def ...
[ "0.619389", "0.61533016", "0.61493546", "0.59093535", "0.59038913", "0.5877267", "0.5871601", "0.5856988", "0.5849963", "0.58416474", "0.5785454", "0.5741736", "0.5708042", "0.57025677", "0.56720144", "0.56669366", "0.56575966", "0.5654651", "0.5649423", "0.56467736", "0.5645...
0.0
-1
Predicted number of pentakis legomena when sampling proportion x of corpus, as a proportion of total types.
def formula_5(x: np.ndarray) -> np.ndarray: logx = np.log(x) x2, x3, x4, x5, x6 = x ** 2, x ** 3, x ** 4, x ** 5, x ** 6 k5 = ( (12 * x6 - 60 * logx * x5 + 65 * x5 - 120 * x4 + 60 * x3 - 20 * x2 + 3 * x) / 60 / (x - 1) ** 6 ) return k5
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def classProbs(observation, tree, classes):\n res = classify(observation, tree) #res = results\n total = sum(res.values())\n probs = []\n for c in classes:\n if c in res.keys():\n probs.append(float(res[c])/total)\n else:\n probs.append(0)\n return probs", "def ...
[ "0.621651", "0.61970514", "0.61677283", "0.6166868", "0.6144715", "0.602916", "0.5962149", "0.5951094", "0.59270656", "0.5896963", "0.5896267", "0.588003", "0.5871984", "0.58494425", "0.584683", "0.5827034", "0.57942414", "0.57892025", "0.5773167", "0.5761896", "0.5760057", ...
0.0
-1
Predicted number of nlegomena when sampling proportion x of corpus, as a proportion of total types.
def formula_n(self, n: int, x: np.ndarray) -> np.ndarray: # express x as z = x/(x-1) z = x / (x - 1) # special case @n=0 if n == 0: kn = 1 - self._vlerchphi(1 / z, n + 1) else: kn = 1 / n - self._vzlerchphi(1 / z, n + 1) # return return ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prob_t_N(genotype, base):\n cnter = Counter(genotype)\n return cnter.get(base, 0) * 1/len(genotype)", "def classProbs(observation, tree, classes):\n res = classify(observation, tree) #res = results\n total = sum(res.values())\n probs = []\n for c in classes:\n if c in res.keys():\n ...
[ "0.6403955", "0.63694793", "0.63278425", "0.63226587", "0.6167146", "0.6159531", "0.60451925", "0.6042591", "0.59788597", "0.5936094", "0.59191257", "0.59160334", "0.5901877", "0.58893895", "0.5881279", "0.5878951", "0.58741003", "0.5868883", "0.58646834", "0.58637935", "0.58...
0.0
-1
Vectorized wrapper function for _lerchphi()
def _vlerchphi(self, z: np.ndarray, a: int) -> np.ndarray: return np.array([self._lerchphi(z_, a) for z_ in z])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _vzlerchphi(self, z: np.ndarray, a: int) -> np.ndarray:\n return np.array([self._zlerchphi(z_, a) for z_ in z])", "def eulerphi(n):\r\n\treturn euler_phi(n)", "def eulerphi(n):\n\treturn euler_phi(n)", "def phi_t(self):\n\t\tdim = self.dim\n\t\ttim_all = self.tim_all \n\t\tphi_all = np.zeros((tim_...
[ "0.6796746", "0.6349775", "0.63100874", "0.6223985", "0.61475223", "0.6019182", "0.6001288", "0.59823066", "0.5928675", "0.5911068", "0.58917844", "0.5880426", "0.58690506", "0.58565605", "0.5855527", "0.5853087", "0.58330727", "0.5802594", "0.5786916", "0.57567644", "0.57268...
0.7559975
0
Vectorized wrapper function for _zlerchphi()
def _vzlerchphi(self, z: np.ndarray, a: int) -> np.ndarray: return np.array([self._zlerchphi(z_, a) for z_ in z])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _vlerchphi(self, z: np.ndarray, a: int) -> np.ndarray:\n return np.array([self._lerchphi(z_, a) for z_ in z])", "def get_z(theta, phi):\n return math.cos(phi)/math.tan(theta/2) + 1j*math.sin(phi)/math.tan(theta/2)", "def __phi(x):\n return max([1 - abs(x), 0])", "def Z(phi = None):\n if p...
[ "0.7914443", "0.65681076", "0.6435109", "0.6432777", "0.62693334", "0.6253677", "0.62178755", "0.6203702", "0.6139488", "0.6075881", "0.60546553", "0.5954539", "0.594207", "0.5890718", "0.58856523", "0.58819497", "0.58702683", "0.5864873", "0.5826224", "0.5771205", "0.5769248...
0.78623563
1
Predicts normalized kvector for given proportion of tokens.
def formula(self, x: np.ndarray, dim: int) -> np.ndarray: # coerce into dimensionless array x = np.array(x).reshape(-1) # apply kn formula to each value of n k_frac = np.array([self.formula_n(n, x) for n in range(dim)]) k_frac = k_frac.T # return proportions re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predict_k(\n self,\n m_tokens: np.ndarray,\n dim: int,\n normalize: bool = False,\n nearest_int: bool = True,\n ) -> np.ndarray:\n\n # allow scalar\n return_scalar = np.isscalar(m_tokens)\n m_tokens = np.array(m_tokens).reshape(-1)\n\n # retriev...
[ "0.67134637", "0.63493425", "0.6230027", "0.5937208", "0.5922331", "0.58700496", "0.5865079", "0.5854051", "0.5802165", "0.57681924", "0.57678413", "0.5766189", "0.56813323", "0.5665864", "0.56399745", "0.5591939", "0.55886245", "0.55843544", "0.5583202", "0.5550176", "0.5549...
0.0
-1
Uses scipy.optimize.curve_fit() to fit the log model to typetoken data.
def fit(self, m_tokens: np.ndarray, n_types: np.ndarray): # initial guess: naive fit M, N, H = max(m_tokens), max(n_types), max(n_types) / 2 p0 = self.fit_naive(M, N, H).params # minimize MSE on random perturbations of M_z, N_z # NOTE: y(x) = 1 - k0(x) -> E(m)/Nz = 1 - k0(m/Mz)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fit_exp_data(x_vals, y_vals):\n log_vals = []\n for y in y_vals:\n log_vals.append(math.log(y, 2)) #get log base 2\n fit = np.polyfit(x_vals, log_vals, 1)\n return fit, 2", "def fit(self, X):", "def fit(self, X, y, **fit_params):\n ...", "def _fit_gas_trend(cls, x, y, fit_type=N...
[ "0.6444538", "0.63850284", "0.62057203", "0.6166464", "0.61226857", "0.60739666", "0.60667914", "0.60667914", "0.60667914", "0.60667914", "0.60667914", "0.60667914", "0.60667914", "0.60667914", "0.60667914", "0.60667914", "0.60634655", "0.60511357", "0.6010437", "0.6010437", ...
0.5345078
60
Calculate & return n_types = N_z formula(m_tokens/M_z)
def predict(self, m_tokens: np.ndarray, nearest_int: bool = True) -> np.ndarray: # allow scalar return_scalar = np.isscalar(m_tokens) m_tokens = np.array(m_tokens).reshape(-1) # redirect: E(m) = N_z - k_0(m) k = self.predict_k(m_tokens, dim=1, nearest_int=nearest_int) n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def N_z(self) -> int:\n return self.params.N_z", "def number_types(corpus):\n number_of_types = len(set(corpus))\n return number_of_types", "def u(self, k, m, z):\n result = self.ProfNFW.nfw(k, m, z) * self.Ngal(m) / self.nBarGal(1./(1.+z))\n return result", "def type_count():\n typ...
[ "0.61090994", "0.59217143", "0.57628566", "0.5695817", "0.5647362", "0.5589493", "0.5542256", "0.5515717", "0.5515717", "0.5515717", "0.5515717", "0.549887", "0.5479429", "0.54610664", "0.5381827", "0.5371367", "0.5367791", "0.53463715", "0.5344861", "0.5344521", "0.52981734"...
0.57100254
3
Applies the log formula to model the kvector as a function of tokens.
def predict_k( self, m_tokens: np.ndarray, dim: int, normalize: bool = False, nearest_int: bool = True, ) -> np.ndarray: # allow scalar return_scalar = np.isscalar(m_tokens) m_tokens = np.array(m_tokens).reshape(-1) # retrieve fitting paramet...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_likelihood(self) -> tf.Tensor:\n # K⁻¹ + GᵀΣ⁻¹G = LLᵀ.\n l_post = self._k_inv_post.cholesky\n num_data = self.observations_index.shape[0]\n\n # Hμ [..., num_transitions + 1, output_dim]\n marginal = self.emission.project_state_to_f(self.prior_ssm.marginal_means)\n ...
[ "0.65289325", "0.6476612", "0.61250615", "0.61017054", "0.61012167", "0.60598826", "0.5984382", "0.5947595", "0.5909517", "0.5891789", "0.5878533", "0.5858947", "0.5810042", "0.5801438", "0.5796715", "0.579634", "0.5791101", "0.5778086", "0.576716", "0.5753712", "0.5753575", ...
0.0
-1
Equivalent to fit(m_tokens, n_types).predict(m_tokens)
def fit_predict(self, m_tokens: np.ndarray, n_types: np.ndarray) -> np.ndarray: # fit and predict return self.fit(m_tokens, n_types).predict(m_tokens)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predict_tokens(self, tokens):\n return", "def predict(self, m_tokens: np.ndarray, nearest_int: bool = True) -> np.ndarray:\n\n # allow scalar\n return_scalar = np.isscalar(m_tokens)\n m_tokens = np.array(m_tokens).reshape(-1)\n\n # run model\n K, B = self.params\n ...
[ "0.7779649", "0.73221636", "0.70830023", "0.6999615", "0.6885678", "0.6868568", "0.6573257", "0.6553992", "0.6472437", "0.64069986", "0.63722783", "0.63283336", "0.631563", "0.6238089", "0.6219484", "0.6217989", "0.6209873", "0.61776686", "0.61699307", "0.6155449", "0.6138378...
0.86812186
0
Number of tokens in the corpus.
def M(self) -> int: return self.params.M
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def corpus_size():\n return ix.doc_count()", "def num_tokens(self, index):\r\n raise NotImplementedError", "def n_words(doc_or_tokens: types.DocOrTokens) -> int:\n words = utils.get_words(doc_or_tokens)\n return itertoolz.count(words)", "def get_num_tokens(self, documents=None):\n toke...
[ "0.7875352", "0.77702785", "0.76401025", "0.7619481", "0.76143175", "0.7602757", "0.7565467", "0.7458757", "0.7457123", "0.7383079", "0.7377764", "0.7248463", "0.72327363", "0.71693045", "0.71645564", "0.71645564", "0.71202064", "0.71064943", "0.7100568", "0.69958025", "0.699...
0.0
-1
Number of types in the corpus.
def N(self) -> int: return self.params.N
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def number_types(corpus):\n number_of_types = len(set(corpus))\n return number_of_types", "def corpus_size():\n return ix.doc_count()", "def get_types_count():\n return len(type_dict.keys())", "def N(self) -> int:\n n_types = len(self)\n return n_types", "def corpus_stats(self):\n...
[ "0.8609336", "0.7424365", "0.71177125", "0.7103952", "0.6927904", "0.6823176", "0.67337644", "0.66178495", "0.6582548", "0.6564052", "0.65231293", "0.6488155", "0.6470049", "0.64693904", "0.6457007", "0.642448", "0.6352565", "0.6352565", "0.633555", "0.6325916", "0.62688774",...
0.0
-1
The discrete powerlaw distribution parameter.
def gamma(self) -> int: return self.params.gamma
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def p(self) -> float:\n return self._pwr.real", "def simulate_power(self):\n if self.p_treatment - self.p_control < 0:\n thresh = 1 - self.alpha\n else:\n thresh = self.alpha\n\n try:\n p_crit = self.norm_null.ppf(1 - thresh)\n beta = self.n...
[ "0.6245299", "0.6230578", "0.61405843", "0.61323225", "0.6072418", "0.6042991", "0.6005209", "0.59938747", "0.5953153", "0.5944802", "0.5926701", "0.59120494", "0.5909073", "0.5900675", "0.5881514", "0.58275497", "0.582486", "0.581495", "0.5803767", "0.58021843", "0.5794235",...
0.0
-1
Predicted number of types sampled in proportion x of corpus, as a proportion of total types.
def formula(self, x: np.ndarray, gamma: float = None) -> np.ndarray: gamma = gamma or self.gamma Li = self._vpolylog(gamma, 1 - x) A = 1 / float(zeta(gamma).real) y = 1 - A * Li return y
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predict_types(self, context, filter_types=None):\n ngram_probs = self._get_ngram_probs(context, filter_types)\n type_probs = defaultdict(lambda: 0)\n for probs in ngram_probs:\n for entity_type, prob in probs:\n type_probs[entity_type] += prob/len(ngram_probs)\n\n...
[ "0.65732324", "0.6433997", "0.61022216", "0.60917175", "0.60802555", "0.60519934", "0.60124207", "0.600027", "0.5968741", "0.5959954", "0.59512043", "0.594133", "0.59163195", "0.5904383", "0.58761096", "0.5872507", "0.58418614", "0.5835004", "0.58155614", "0.58092004", "0.577...
0.0
-1
Vectorized wrapper function for mpmath.polylog()
def _vpolylog(self, s: float, z: np.ndarray) -> np.ndarray: def _polylog(s, z_): return float(polylog(s, z_).real) return np.array([_polylog(s, z_) for z_ in z])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loglnumpy(store):\n xbeta = dot(store['xmat'], store['beta'])\n lamb = exp(xbeta)\n return sum(store['yvec'] * xbeta - lamb)", "def IntegratePolynomialPartLogExt(poly, fieldTower):\n #print(poly)\n #print(poly.degree)\n #print(poly.fieldTower)\n if poly == 0 or poly.isZero():\n re...
[ "0.6472516", "0.63923484", "0.6258953", "0.624462", "0.62249404", "0.619804", "0.61791533", "0.61325204", "0.6129933", "0.6125757", "0.608846", "0.6077444", "0.60673094", "0.60201836", "0.598951", "0.5984881", "0.59739053", "0.59476596", "0.59213316", "0.5906993", "0.58948123...
0.6842833
0
Uses scipy.optimize.curve_fit() to fit the model to typetoken data.
def fit( self, m_tokens: np.ndarray, n_types: np.ndarray, M: int = None, N: int = None ): # fix M, N M = M or m_tokens.max() N = N or n_types.max() # initial guess p0 = 2.0 # minimize MSE on random perturbations of gamma xdata = np.array(m_tokens) /...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fit(self, X):", "def fit():\n pass", "def fit(self, X, y=...):\n ...", "def fit(self, X, y=...):\n ...", "def fit(self, X, y=...):\n ...", "def fit(self, X, y=...):\n ...", "def fit(self, X, y=...):\n ...", "def fit(self, X, y=...):\n ...", "def ...
[ "0.676812", "0.66434413", "0.65392", "0.65392", "0.65392", "0.65392", "0.65392", "0.65392", "0.65392", "0.65392", "0.65392", "0.65392", "0.65289134", "0.65289134", "0.65289134", "0.6508119", "0.64726126", "0.6317388", "0.63038385", "0.630345", "0.6261615", "0.6215944", "0...
0.61368084
27