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
learn novel phrases by looking at cooccurrence of candidate term pairings; docs should be input in tokenized (`tdocs`) and untokenized (`docs`) form
def extract_phrases(tdocs, docs, idf): # Gather existing keyphrases keyphrases = set() for doc in tdocs: for t in doc: if len(t.split(' ')) > 1: keyphrases.add(t) # Count document co-occurrences t_counts = defaultdict(int) pair_docs = defaultdict(list) fo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train(self, documents):\n ###DONE\n\n #entire vocab in document set D\n vocab_sod = set()\n vocab_pop = set()\n \n #Calcuates prior probabilities\n priorSOD = 0 #how many docs are spam\n priorPOP = 0 #how many docs are ham\n \n #Cacluates Tc...
[ "0.6524535", "0.6303925", "0.63031244", "0.6283015", "0.62118506", "0.61696297", "0.6147306", "0.6121404", "0.610831", "0.61022097", "0.6042071", "0.6039818", "0.59821063", "0.5974946", "0.5971", "0.5961817", "0.58901966", "0.58670616", "0.5834076", "0.58197343", "0.58094156"...
0.7074772
0
returns `top_n` keywords for a list of articles. keywords are returned as (keyword, score) tuples.
def keywords(articles, top_n=25): # compute term idfs token_docs = [lemma_tokenize(clean(a.text)) for a in articles] local_term_idf = IDF(token_docs) token_docs, phrases = extract_phrases(token_docs, [a.text for a in articles], global_term_idf) titles = [a.title for a in articles] title_token...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def top_keywords(urls, count=10):\n try:\n res = Counter()\n for url in urls:\n res += Counter(get_keyword_dict(url))\n return [w[0] for w in res.most_common(count)]\n except:\n print('Error finding top keywords')", "def extract_keywords(article_list, n=10):\n vectorizer = TfidfVectorizer()...
[ "0.78360444", "0.7450141", "0.6965421", "0.694177", "0.6873025", "0.68340343", "0.6781121", "0.6672731", "0.66101223", "0.6608954", "0.659795", "0.6593758", "0.6579277", "0.6569332", "0.6565945", "0.65614015", "0.64829606", "0.6468362", "0.64578843", "0.6425248", "0.63832724"...
0.826135
0
Calculate the greatcircle distance bewteen two points on the Earth surface.
def nphaversine(point1, point2, miles=False): # print point1 # print point2 # unpack latitude/longitude if len(point1.shape) == 1: point1 = np.array([point1]) if len(point2.shape) == 1: point2 = np.array([point2]) # print point1 # print point2 point1 = np.r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def great_circle(lat_1, long_1, lat_2, long_2):\n long_1 = m.radians(long_1)\n lat_1 = m.radians(lat_1)\n long_2 = m.radians(long_2)\n lat_2 = m.radians(lat_2)\n\n d = 2 * 6367.45 * m.asin(\n m.sqrt(haversine(lat_2 - lat_1)\n + m.cos(lat_1)*m.cos(lat_2) *\n haversine(long...
[ "0.76110846", "0.75128585", "0.74005204", "0.736278", "0.7334611", "0.7330116", "0.72670156", "0.72396517", "0.722976", "0.7168491", "0.71659577", "0.7156992", "0.71539944", "0.7124056", "0.71109474", "0.71105796", "0.70962393", "0.70885754", "0.70604175", "0.705747", "0.7027...
0.0
-1
invokes gflags.FLAGS() on sys.argv.
def parse_args(): try: FLAGS(sys.argv) except gflags.FlagsError as err: print err print '%s\nUsage: %s ARGS\n%s' % (err, sys.argv[0], FLAGS) sys.exit(1) logging.basicConfig(format = '[%(asctime)s] %(levelname)s: %(message)s', level = logging.INFO)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _ParseFlags(argv=sys.argv):\n try:\n argv = FLAGS(argv)\n logging.debug('Parsed command line flags: {}'.format(FLAGS.input_file))\n except flags.Error as e:\n logging.error(e)\n sys.exit(1)", "def flag(x):\n if x in sys.argv:\n sys.argv.remove(x)\n return True\n else:\n ...
[ "0.66897386", "0.6305905", "0.61846584", "0.6088721", "0.5993747", "0.5950991", "0.5935284", "0.590279", "0.58919764", "0.5862875", "0.586093", "0.5854668", "0.58542633", "0.58532166", "0.58527994", "0.5826487", "0.5826487", "0.5803758", "0.5772526", "0.5766503", "0.5692707",...
0.6167291
3
return current thread name.
def get_threadname(): cur_thread = threading.current_thread() return cur_thread.name
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_thread_name(self) -> Optional[str]:\n return self.thread_name", "def get_name(thread_id):\r\n for thread in threading.enumerate():\r\n if thread.ident == thread_id:\r\n return thread.name", "def get_uname(self):\n return Server.t_usernames.get(threading.ge...
[ "0.80912495", "0.77005726", "0.69585633", "0.6890283", "0.6844813", "0.67890924", "0.674684", "0.670793", "0.6689467", "0.668167", "0.6630126", "0.6606617", "0.6594408", "0.6587215", "0.65800315", "0.65798545", "0.6551568", "0.6512428", "0.6499626", "0.648431", "0.6480289", ...
0.90061885
0
remove duplicate keys while preserving order. optionally return values.
def find_uniq_preserve_order(orig_keys, orig_values=None): seen = {} keys = [] values = [] for i, item in enumerate(orig_keys): if item in seen: continue seen[item] = 1 keys.append(item) if orig_values: values.append(orig_values[i]) return keys, values
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_duplicate(x):\n return list(dict.fromkeys(x))", "def _remove_duplicates(input_list):\n return list(OrderedDict.fromkeys(input_list))", "def remove_duplicates(input_list):\n return list(dict.fromkeys(input_list))", "def removeDups(lst):\n\n return list(dict.fromkeys(lst) )", "...
[ "0.75429296", "0.72203714", "0.7036629", "0.7017405", "0.6760333", "0.6731918", "0.6579014", "0.65164787", "0.64843994", "0.6472747", "0.6425572", "0.6410459", "0.6388204", "0.6381012", "0.63454247", "0.6309064", "0.62704206", "0.62684274", "0.6259605", "0.61603624", "0.61588...
0.775089
0
resets server figure by deleting lines and clearing legend.
def _handle_reset(self): stream_data = self.server.stream_data # remove lines from graph, and reset legends for name in stream_data: stream_data[name]['line'].remove() for name in self.server.axes: self.server.axes[name].legend([]) # TODO: find a better way. stream_data = {}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset(self):\n\n self.fig.clear()\n self.ax = self.fig.add_subplot(111)\n self.hasLegend.set(False)\n self.title(Graph.default_title)\n # Lines is a list of DataSet objects. The user should take care to make\n # DataSet names unique, as there is no error checking done ...
[ "0.7666481", "0.72009104", "0.7048835", "0.7034993", "0.6928158", "0.6892367", "0.6811622", "0.6684505", "0.664847", "0.6554894", "0.65438944", "0.653004", "0.65285474", "0.64676446", "0.6457668", "0.6457389", "0.6455251", "0.6446467", "0.64300036", "0.6376522", "0.63337445",...
0.7724574
0
Updates the legend for single_axes, listing duplicate labels once.
def _handle_update_legend(self, single_axes): # lines are bundled with an axes. # legends are printed per axes. # line data is in stream_data without reference to axes sets. # for each current line, get label, get axes # for unique axes-labels create a list to pass to legend() artists, labels = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def legend (self, **kwargs):\n axes = self.twin_axes or self.axes\n self.mpl_legend = axes.legend (self.mpl_lines, self.labels, **kwargs)", "def legend(self):\n if self.nplots == 1:\n lax = self.ax\n loff = 0.2\n else:\n lax = self.ax1\n lof...
[ "0.663479", "0.6562808", "0.6533729", "0.6064412", "0.60395277", "0.60051537", "0.597655", "0.597276", "0.59519356", "0.5942864", "0.5882607", "0.57779515", "0.57668364", "0.5744277", "0.5723438", "0.5700704", "0.57001144", "0.56860155", "0.5684757", "0.5676725", "0.5665561",...
0.8137135
0
creates a line on the given axes using style_args. returns line_name
def _handle_create_line(self, axes, style_args): stream_data = self.server.stream_data # sample data for initial create x_data = numpy.arange(0, 2, 1) y_data = numpy.array([0]*2) line, = axes.plot(x_data, y_data, '-', **style_args) # NOTE: client may set 'label' line_name = style_args['labe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addLineStyle(dist, focus, axis, pupil):\n r = 0 #focus / 2\n g = 0 #np.log10(dist) / (25 / 3)\n b = 0 #axis / 20\n a = 0.4\n rgb = [r, g, b, a]\n line = {'style': '-', 'color': rgb}\n return line", "def create_line(uniform = True, *args):\n axis = cmds.radioButtonGrp(widgets[\"lineAxi...
[ "0.62994033", "0.6173251", "0.61364174", "0.6051291", "0.5881077", "0.58236307", "0.5810255", "0.58049214", "0.5775597", "0.5750251", "0.5716448", "0.57113814", "0.5684895", "0.5669201", "0.5652392", "0.56158364", "0.5613863", "0.55943674", "0.5562825", "0.55502826", "0.55340...
0.7652667
0
Saves value to data stream.
def _append_value(self, stream, value): if FLAGS.timestamp: x_val = float(time.time()) stream['x'].append(x_val) y_val = float(value) stream['y'].append(y_val)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(datastream):", "def save(self, data):\n self.write(data)", "def save(self, data):\n\t\tif self.value:\n\t\t\tdata['value'] = self.value", "def write_postvalue(self, stream, data):\r\n raise NotImplementedError", "def write(value):\n return value", "def w(self, value):\n ...
[ "0.76401985", "0.7374978", "0.7312911", "0.70859486", "0.69902873", "0.6958337", "0.6917507", "0.6917507", "0.6917507", "0.68231845", "0.67613393", "0.6682821", "0.660767", "0.65658975", "0.65165013", "0.6509562", "0.6507803", "0.6505605", "0.6498451", "0.6474014", "0.6411044...
0.0
-1
Loops reading client data and appending it to stream_data.
def _handle_client_read_data(self, first_value, line_name): stream_data = self.server.stream_data self._append_value(stream_data[line_name], first_value) while True: data = self.rfile.readline().strip() # TODO: add verbose logging #print "value", data if data == "": break ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def onRecv(self, data):\n self.stream += data\n while self.handleStream(): pass", "def data_received(self, data):\n self.log.debug('data_received: {!r}'.format(data))\n self._last_received = datetime.datetime.now()\n for byte in (bytes([value]) for value in data):\n\n ...
[ "0.7126232", "0.6910214", "0.66655576", "0.66544044", "0.6592131", "0.65532523", "0.6494772", "0.6385813", "0.6210289", "0.62013733", "0.6133615", "0.6106816", "0.6097253", "0.6080578", "0.6056107", "0.6037789", "0.59680283", "0.59316283", "0.59163034", "0.59163034", "0.59115...
0.660936
4
Add a new axis, if axis_args are not already created.
def _handle_setup_axis(self, axis_args): axis_name = axis_args['name'] axes_dict = self.server.axes if axis_name not in [name for name, _ in axes_dict.items()]: print "Adding a new axis:", axis_name axis_count = len(axes_dict) newaxis = self.server.figure.add_subplot(axis_count+1, 1, axis...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _appendAxisDefinition(self, axis):\n length = len(axis)\n\n self.na_dict[\"NX\"].append(length)\n self.na_dict[\"XNAME\"].append(xarray_utils.getBestName(axis))\n\n # If only one item in axis values\n if length < 2:\n self.na_dict[\"DX\"].append(0)\n sel...
[ "0.66521394", "0.6354571", "0.62128806", "0.62128806", "0.62128806", "0.6071286", "0.59581596", "0.58640105", "0.5820328", "0.5758695", "0.56854737", "0.5659909", "0.5653431", "0.56397295", "0.5619788", "0.56062645", "0.5583612", "0.5512482", "0.54416555", "0.54299825", "0.54...
0.7232592
0
SocketServer handler, called when clients connect.
def handle(self): thread_name = get_threadname() style_args = {} style_args['label'] = thread_name axis_args = {} axis_args['name'] = 'default' axis_args['x_label'] = '' axis_args['y_label'] = '' # client_init blocks until client sends 'BEGIN' first_value = self._handle_client_ini...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def configure_server(self):\n self.server_socket.setblocking(False)\n self.server_socket.bind(self.server_address)\n self.server_socket.listen(100)\n logging.info(f'Server is listening for incoming connections')\n self.selector.register(self.server_socket,\n ...
[ "0.70631874", "0.70404047", "0.70306087", "0.6992822", "0.69871753", "0.6985686", "0.69482297", "0.6931111", "0.6895321", "0.68076015", "0.67947406", "0.67930865", "0.6785053", "0.67439914", "0.67374337", "0.6722806", "0.66859835", "0.66508716", "0.6639216", "0.6625559", "0.6...
0.0
-1
create instance data for figure, axes, and stream data.
def setup(self, flags): self.figure = pylab.figure(1) self.axes = {} self.stream_data = {} self.flags = flags
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _make_data(self):\n pdf_datasets_all = make_pdf_datasets(self.pdf_list, self.xlims, self.ylims, self.tlims, self.dims, 9)\n self.pdf_dataset = np.concatenate(pdf_datasets_all, axis = 0)\n self.PDE_dataset = make_PDE_dataset(self.num_collocation, self.xlims, self.ylims, self.tlims, self.dim...
[ "0.69154173", "0.6703749", "0.6548121", "0.64630646", "0.63672024", "0.63393867", "0.6333037", "0.63126576", "0.63034093", "0.6290425", "0.6271378", "0.626019", "0.62436026", "0.6238506", "0.6222409", "0.6222409", "0.6222409", "0.6222409", "0.62218726", "0.6218369", "0.621429...
0.67423743
1
setup callbacks, calls pylab.show() which blocks until close or exit.
def pylab_setup(figure, stream_data, original_width, runlimits, runflags): def on_key(event): """on_key""" print('you pressed', event.key, event.xdata, event.ydata) #def diag_event(event): # """diag_event""" # print event.name # if hasattr(event, 'height'): # print event.height, event.width ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show():\n setup()\n plt.show()", "def show_figure(self):\n pylab.show()", "def show():\n plt.show()", "def show():\n plt.show()", "def show():\n plt.show()", "def display(self):\n self.figure, self.axes = self.createFigure()\n\n self.setupLayout()\n self.qui...
[ "0.68718237", "0.660467", "0.64647394", "0.64647394", "0.64647394", "0.63567173", "0.622678", "0.61775273", "0.61592454", "0.6154869", "0.6153393", "0.6111194", "0.60374933", "0.59594923", "0.5936258", "0.59299856", "0.5906489", "0.58567536", "0.58445865", "0.5839884", "0.579...
0.6100546
12
Timer callback for redrawing plots with latest data.
def plot_refresh_handler(args): stream_data, runlimits, runflags = args if runflags.exit: sys.exit(1) for line_name in stream_data: data = stream_data[line_name] curr_data_len = len(data['y']) if curr_data_len == 0: # no data yet continue if data['last_len'] >= curr_data_len: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_redraw_timer(self, event):\n \n if self.sampling_timer.IsRunning():\n self.daq.get_data()\n self.draw_plot()\n else:\n self.control_box.txt_info_box.SetLabel('Measurement complete')\n self.calculate()\n return", "def timer_plot_da...
[ "0.75111294", "0.7481198", "0.7293234", "0.7031069", "0.6835803", "0.6770282", "0.67329353", "0.6688009", "0.6604535", "0.66011137", "0.66011137", "0.66011137", "0.66011137", "0.66011137", "0.65816563", "0.6499807", "0.63863814", "0.63863814", "0.62700325", "0.62205446", "0.6...
0.66992867
7
Return the last 5 published polls(Not including those to be published in the future) that have at least 2 choices
def get_queryset(self): #Old get_queryset() method. #Return last 5 published polls #return Poll.objects.order_by('-pub_date')[:5] #New get_queryset() method. #return Poll.objects.filter(pub_date__lte=timezone.now()).order_by('-pub_date')[:5] return Poll.objects.annotate(num_choices=Count('choic...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_queryset(self):\n #return Poll.objects.filter(pub_date__lte=timezone.now())\n return Poll.objects.annotate(num_choices=Count('choice')).filter(pub_date__lte=timezone.now(), num_choices__gte=2)", "def get_queryset(self):\n #.1 below code was showing future poll/questions\n #.1 return Q...
[ "0.66441554", "0.6153953", "0.61504656", "0.5914476", "0.59008074", "0.5822036", "0.58044267", "0.56992376", "0.5674518", "0.56489867", "0.56489867", "0.5606918", "0.5585309", "0.55579126", "0.55579126", "0.5490999", "0.5477059", "0.5477059", "0.5477059", "0.5477059", "0.5477...
0.64896417
1
Exlcudes any polls that aren't published yet.
def get_queryset(self): #return Poll.objects.filter(pub_date__lte=timezone.now()) return Poll.objects.annotate(num_choices=Count('choice')).filter(pub_date__lte=timezone.now(), num_choices__gte=2)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset():\n global pollResults\n for name in pollResults:\n pollResults[name] = {'state': False, 'mark': False}\n emitResults()\n emit('auth_resp', 'New poll has been started', broadcast=True)", "def unpublishAllServices(self):\n for k in self.published.keys():\n self.unpu...
[ "0.5834915", "0.5771432", "0.5703172", "0.568427", "0.55976146", "0.5476567", "0.540109", "0.5345974", "0.53375113", "0.5329794", "0.53083616", "0.5289076", "0.52400297", "0.5227286", "0.5198362", "0.5192336", "0.5190919", "0.5187333", "0.5181345", "0.5168843", "0.5167521", ...
0.0
-1
Constructor for decisions having just the low and high value
def __init__(self, low, high): self.low = low self.high = high
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, low_score=0, high_score=0):\n self.low_score = low_score\n self.high_score = high_score", "def __init__(self):\n self.low = []\n self.high = []", "def __init__(self):\n self.high_low = []", "def __init__(self, min_val, max_val):\n self.values = (mi...
[ "0.7121283", "0.6842653", "0.6765476", "0.66799957", "0.66799957", "0.66799957", "0.66799957", "0.64936614", "0.6454951", "0.6441182", "0.635217", "0.6306492", "0.6245966", "0.62103117", "0.61977905", "0.61973435", "0.61709034", "0.6144477", "0.61384565", "0.61371243", "0.610...
0.7508133
0
Constructor for model having objectives, constraints and decisions
def __init__(self, objectives, constraints, decisions): self.objectives = objectives self.constraints = constraints self.decisions = decisions
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self.name = \"Osyczka\"\n objectives = [ob_os_1, ob_os_2]\n constraints = [con_os_1, con_os_2, con_os_3, con_os_4, con_os_5, con_os_6]\n decisions = [Decision(0, 10), Decision(0, 10), Decision(1, 5), Decision(0, 6), Decision(1, 5), Decision(0, 10)]\n Model._...
[ "0.8211604", "0.783042", "0.7588628", "0.71783847", "0.711893", "0.71124303", "0.7095124", "0.7054429", "0.67368513", "0.6669032", "0.6669032", "0.6669032", "0.6669032", "0.6669032", "0.66268575", "0.65448666", "0.6534245", "0.6528547", "0.6521854", "0.6510179", "0.64817524",...
0.8309128
0
Evaluates the score for a given solution using all objectives
def evaluate(self, solution, total = 0): for objective in self.objectives: total = total + objective(solution) return total
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_score(self, solution: np.array) -> float:\n pass", "def score_solution(g, s):\n pass", "def scoreEvaluationFunction(currentGameState):\n return currentGameState.getScore()", "def scoreEvaluationFunction(currentGameState):\n return currentGameState.getScore()", "def scoreEvaluationFuncti...
[ "0.6913881", "0.67433435", "0.6517173", "0.6517173", "0.6517173", "0.6517173", "0.6517173", "0.6517173", "0.6514553", "0.65127504", "0.64637536", "0.64637536", "0.64637536", "0.64637536", "0.64637536", "0.64637536", "0.64637536", "0.64637536", "0.64637536", "0.64637536", "0.6...
0.7744005
0
Validates if given solutions is as per the constraints
def ok(self, solution): if self.constraints is not None: for constraint in self.constraints: if not constraint(solution): return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_constraints ( A, S, complete ) :\n\t\n\tok = True\n\t\n\tfor i in range(len(complete)) :\n\t\tif complete[i] :\n\t\t\tif not (dot(A[i],S) == 0) :\n\t\t\t\tok = False\n\t\t\t\tprint '\\n'\n\t\t\t\tprint '*** warning *** constraint %d not verified' % (i)\n\t\t\t\tvars_inds = (where(abs(A[i]) == 1))[0]\n\t\...
[ "0.7118976", "0.7054554", "0.6993789", "0.6782743", "0.66744995", "0.6646843", "0.6623786", "0.66098017", "0.65714705", "0.6541072", "0.6465648", "0.6465648", "0.6367656", "0.6321812", "0.63074505", "0.6303715", "0.62613684", "0.62440664", "0.6223591", "0.62150496", "0.620849...
0.7211056
0
Generates a random solution for the given model
def any(self): valid = False solution = [] while not valid: soln = [] for dec in self.decisions: soln.append(random.randint(dec.low, dec.high)) valid = self.ok(soln) if valid: solution = soln return solution
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_model (d):\n return np.random.rand (d+1, 1)", "def randomSolution(self):\n # seed the random number generator\n random.seed()\n # loop through all the features\n for feature in self.features:\n # pick a random number based on the size of the feature's domain...
[ "0.6604877", "0.6594979", "0.62282896", "0.61203724", "0.6083288", "0.59760904", "0.59651244", "0.5949435", "0.59387463", "0.5937297", "0.59314245", "0.589967", "0.589614", "0.58834136", "0.5844669", "0.58423555", "0.581434", "0.5803791", "0.57688546", "0.5707829", "0.57031",...
0.0
-1
Constructor for Osyczka2 model
def __init__(self): self.name = "Osyczka" objectives = [ob_os_1, ob_os_2] constraints = [con_os_1, con_os_2, con_os_3, con_os_4, con_os_5, con_os_6] decisions = [Decision(0, 10), Decision(0, 10), Decision(1, 5), Decision(0, 6), Decision(1, 5), Decision(0, 10)] Model.__init__(self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self.name = \"Kursawe\"\n objectives = [o_ku_1, o_ku_2]\n decisions = [Decision(-5, 5), Decision(-5, 5), Decision(-5, 5)]\n Model.__init__(self, objectives, None, decisions)", "def __init__(self):\n self.name = \"Schaffer\"\n objectives = [o_sh_1, o...
[ "0.73778796", "0.7025361", "0.6996897", "0.6996897", "0.6996897", "0.6996897", "0.6996897", "0.6893153", "0.656395", "0.6520004", "0.6520004", "0.6498464", "0.64387596", "0.64387596", "0.64387596", "0.64387596", "0.6397256", "0.6388983", "0.63875407", "0.63851994", "0.6379331...
0.7899179
0
Constructor for Schaffer model
def __init__(self): self.name = "Schaffer" objectives = [o_sh_1, o_sh_2] decisions = [Decision(-10 ** 5, 10 ** 5)] Model.__init__(self, objectives, None, decisions)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, model):\n self._model = model", "def __init__(self, model):\n self.model = model", "def __init__(self, model):\n self.model = model", "def __init__(self, model):\n self.model = model", "def __init__(self, model):\n self.model = model", "def __init__(s...
[ "0.7268544", "0.7181175", "0.7181175", "0.7181175", "0.7181175", "0.7096036", "0.707674", "0.70726955", "0.70252573", "0.70025045", "0.6913892", "0.6901609", "0.6901609", "0.68665624", "0.68252325", "0.68252325", "0.68252325", "0.67947894", "0.67506754", "0.67506754", "0.6750...
0.74169093
0
Constructor for Kursawe model
def __init__(self): self.name = "Kursawe" objectives = [o_ku_1, o_ku_2] decisions = [Decision(-5, 5), Decision(-5, 5), Decision(-5, 5)] Model.__init__(self, objectives, None, decisions)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__( self, weights, topics ):\n\n # Number of topics and dictionary size\n self.W, self.K = topics.shape\n assert( self.W > self.K )\n\n self.topics = topics\n MixtureModel.__init__(self, weights, topics)", "def __init__(self, corpus: Corpus):\n\n # the legomena...
[ "0.6457493", "0.6087304", "0.60511214", "0.5994956", "0.5893758", "0.5884114", "0.5880795", "0.5876523", "0.5846621", "0.58328944", "0.5819378", "0.5818917", "0.5792546", "0.5777222", "0.5762234", "0.57456267", "0.5744699", "0.57347846", "0.5731228", "0.572777", "0.5710261", ...
0.67541903
0
Add a phone number as a subscriber to the current Topic
def addSubscriber(self, phoneNumber): if self.topicArn is None: print 'ERROR: Notification topic not set!' return protocol = 'sms' subscribeResponse = self.snsClient.subscribe( TopicArn=self.topicArn, Protocol=protocol, Endpoint=phoneN...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _registerSubscriber(self, callerId, topic, topicType, callerApi):\n if topic not in self.FilterSubscribedTopics:\n self.__docWriter.addSub(callerId, topic, topicType)", "def subscribe(self, subscriber):\n self.subscribers.append(subscriber)", "def subscribe(self, transport, data):\...
[ "0.638156", "0.6316568", "0.6203704", "0.6152549", "0.61257267", "0.5983778", "0.59511983", "0.59360534", "0.59137255", "0.58507955", "0.5845568", "0.58303136", "0.5795692", "0.5792568", "0.57643414", "0.5711302", "0.57093185", "0.5682131", "0.5657824", "0.5638501", "0.563821...
0.76084113
0
Set the current notification Topic to publish to.
def setTopic(self, topicName): self.topicName = topicName topicResponse = self.snsClient.create_topic(Name=topicName) self.topicArn = topicResponse['TopicArn']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def topic(self, topic):\n self.connection.topic(str(self), topic)", "def publish(self, topic, value):\n msg = self.topics[topic]['msg']\n msg.data = value\n self.topics[topic]['publisher'].publish(msg)\n print(\"published \\t{} \\t{}\".format(topic, value))", "def publish(sel...
[ "0.7300295", "0.6720313", "0.6679173", "0.6460135", "0.63635063", "0.63403195", "0.6270205", "0.62209505", "0.61958057", "0.61898136", "0.61469436", "0.61271036", "0.6069072", "0.6053098", "0.6024777", "0.60241127", "0.5992741", "0.5967319", "0.596672", "0.5935147", "0.591739...
0.6317085
6
Send the notification to all subscribers of the topic.
def sendNotification(self, message): if self.topicArn is None: print 'ERROR: Notification topic not set!' return publishResponse = self.snsClient.publish( TopicArn=self.topicArn, Message=message )
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def notify(self) -> None:\n for s in self.subscribers:\n s()", "def publish(self, topic: Hashable, *args, **kwargs):\n for sub in self.subscribers[topic]:\n sub(*args, **kwargs)", "def notifyObservers(self, topic, value):\n for observer in self.observers:\n ...
[ "0.71747625", "0.7128139", "0.6884461", "0.683371", "0.6714019", "0.6492596", "0.64445055", "0.63419384", "0.629108", "0.6211838", "0.61023957", "0.6012947", "0.6004714", "0.5979627", "0.5935483", "0.5925768", "0.5887718", "0.5871885", "0.5865151", "0.5843696", "0.58203524", ...
0.56351554
33
Execute http probe and count metrics
async def exec_probes(self, session: aiohttp.ClientSession, counter: dict): self._logger.debug('Start exec probe %s', self.url) regexp_metrics = [RegexpMetrics(pattern) for pattern in self._patterns] status_code_metrics = StatusCodeMetrics() time_metrics = Time...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def poll_health():\n global timesCalled\n\n # Poll /health\n session = requests.Session()\n retry = Retry(connect=3, backoff_factor=0.5)\n adapter = HTTPAdapter(max_retries=retry)\n session.mount('http://', adapter)\n response = session.get(health_url)\n\n # Check HTTP status code\n stat...
[ "0.623642", "0.5890013", "0.5889076", "0.588622", "0.58364296", "0.58144206", "0.5729184", "0.5712603", "0.57124424", "0.56684583", "0.5641274", "0.5602359", "0.5582319", "0.55592555", "0.55570114", "0.55567306", "0.5549612", "0.55015385", "0.54746914", "0.5471975", "0.547004...
0.636973
0
Method to write the XML file containing the information regarding the stop condition for branching in DET method @ In, filename, string, filename (with absolute path) of the XML file that needs to be printed out @ In, trigger, string, the name of the trigger variable
def writeXmlForDET(filename,trigger,listDict,stopInfo): # trigger == 'variable trigger' # Variables == 'variables changed in the branch control logic block' # associated_pb = 'CDF' in case multibranch needs to be performed # stopInfo {'end_time': end simulation time (already stopped), 'end_ts': end time s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_gen_xml(self, out_file):\n\n param_list = []\n msg = []\n msg_type = []\n dep_node = []\n for line in self.full_ed_lines:\n param_list.append(line.text())\n dep_pkg = param_list[6].split(', ')\n if dep_pkg[len(dep_pkg) - 1] == '':\n ...
[ "0.5683157", "0.5659544", "0.55591834", "0.55065686", "0.5498814", "0.5428093", "0.54104936", "0.5392612", "0.53216076", "0.5316584", "0.5289246", "0.52678", "0.5199608", "0.5194961", "0.51714367", "0.51580346", "0.5156104", "0.5138284", "0.5084493", "0.50813687", "0.5064787"...
0.79320467
0
Draw circle for face, sized relative to window size
def drawFace(win, winW, winH): face = Circle(Point(winW/2, winH/2), min(winW, winH)*11/24) face.setOutline("black") face.setFill("burlywood") face.draw(win)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __drawCircle(self, center, radius, color, drawwidth=1):\n radius *= self.viewZoom\n if radius < 1: radius = 1\n else: radius = int(radius)\n\n pygame.draw.circle(self.screen, color, center, radius, drawwidth)", "def draw(self, window):\n radius = SQUARE_SIZE // 2 - PADDING\...
[ "0.7119598", "0.67873436", "0.67307967", "0.65992916", "0.6582572", "0.65336627", "0.65306664", "0.65284276", "0.6486938", "0.64669365", "0.64669365", "0.6432975", "0.64328283", "0.6406504", "0.6402449", "0.638859", "0.63861144", "0.63558817", "0.6353007", "0.63493526", "0.63...
0.7234741
0
Draws eyes for face
def drawEyes(win, winW, winH): # leftEye = Oval(Point(300-120-40, 300-80-20), Point(300-120+40, 300-80+20)) leftEye = Oval(Point(winW/2-winW/5-winW/15, winH/2-winH/7.5-winH/30), Point(winW/2-winW/5+winW/15, winH/2-winH/7.5+winH/30)) leftEye.setFill("white") leftEye.setOutline("black") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_eyes(self):\n GREEN = (0, 255, 0)\n for eye in self.eyes:\n if eye:\n cv2.circle(self.eyes_frame, eye, 8, GREEN, 1)", "def draw(self, context):\n # TODO: Add this color to Add-on option\n color = (1.0, 1.0, 0.5, 1.0)\n alpha = 2.0 * math.atan(...
[ "0.8009308", "0.6916443", "0.63930106", "0.6312382", "0.6312382", "0.6248364", "0.62259424", "0.61367136", "0.61108315", "0.6107865", "0.60468125", "0.60296154", "0.6011443", "0.59987676", "0.59953946", "0.5938486", "0.58893174", "0.5887674", "0.58734787", "0.5868707", "0.585...
0.7662611
1
Draws arc for mouth
def drawMouth(win, winW, winH): drawArc(win, winW/2, winH/2, winH/4, 60, 1.5) # draw mouth
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_arc(self, center_x, center_y, radius, thickness, start_angle, end_angle, edge_shine=False):\n\n if end_angle >= start_angle:\n pass\n else:\n start_angle, end_angle = end_angle, start_angle\n\n rad = radius\n while rad <= radius + thickness:\n a...
[ "0.7010531", "0.67628413", "0.6670524", "0.646824", "0.644992", "0.6396002", "0.63777846", "0.63353235", "0.6235798", "0.6210867", "0.6182836", "0.61770433", "0.6169239", "0.61444896", "0.6139231", "0.61139756", "0.61103326", "0.60893536", "0.60711163", "0.6058924", "0.604840...
0.73307204
0
Draws arcs for eyebrows
def drawEyebrows(win, winW, winH): drawArc(win, winW/2-winW/5, winH/2-winH/7.5+winH/10, winH/6, 30, 0.5) # left eyebrow drawArc(win, winW/2+winW/5, winH/2-winH/7.5+winH/10, winH/6, 30, 0.5) # right eyebrow
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def horizontal_arcs_iglu():\n arc(screen, BLACK, (50, 560, 300, 20), 3.14, 0)\n arc(screen, BLACK, (60, 510, 280, 20), 3.14, 0)\n arc(screen, BLACK, (80, 460, 240, 20), 3.14, 0)\n arc(screen, BLACK, (120, 420, 160, 20), 3.14, 0)", "def draw_edges():\n\n def bezier(p0, p1, p2, **kwargs):\n ...
[ "0.6601741", "0.62746024", "0.5991124", "0.59876937", "0.5959159", "0.591964", "0.5901125", "0.58788854", "0.58297336", "0.58249354", "0.58104646", "0.5792224", "0.5779965", "0.5762585", "0.5755536", "0.57407904", "0.5722869", "0.5716876", "0.5698326", "0.5696385", "0.5671755...
0.6681989
0
Draws red nose with reflection spot (polygon)
def drawNose(win, winW, winH): noseRad = winW/12 nose = Circle(Point(winW/2, winH/2+winH/15), noseRad) nose.setOutline("red4") nose.setFill("red") nose.draw(win) spot = Polygon(Point(winW/2+noseRad*0.7, winH/2+noseRad*0.6), Point(winW/2+noseRad*0.7, winH/2+noseRad*0.4), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def drawPoles(wn):\n wn.setworldcoordinates(-1, -5, 3, 20)\n t = turtle.Turtle()\n t.speed(0)\n t.pensize(3)\n t.up()\n t.goto(-.5, 0)\n t.down()\n t.goto(2.5, 0)\n t.up()\n for i in range(3):\n t.goto(i, 0)\n t.down()\n t.goto(i, 10)\n t.up()\n t.hidetu...
[ "0.6396361", "0.63340116", "0.6125329", "0.6106198", "0.60511094", "0.6015702", "0.5982887", "0.5980764", "0.59279174", "0.59251344", "0.5907863", "0.59069467", "0.5906906", "0.58955175", "0.5889194", "0.5886915", "0.58502054", "0.58475804", "0.58288246", "0.58231246", "0.581...
0.6485777
0
Parse and convert JSON encoded string to a datetime object Parses a ``str`` and converts it to a ``datetime`` object. If the string is not a valid JSON (JavaScript) encoded datetime object, this function will return the minimum datetime value (``datetime.min``).
def parse_time(value: str) -> datetime: try: return datetime.strptime(value, "%Y-%m-%dT%H:%M:%SZ") except ValueError: return datetime.min
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deserialize_datetime(string):\n try:\n from dateutil.parser import parse\n return parse(string)\n except ImportError:\n return string", "def parse_datetime(date_str: str) -> datetime:\n return dateutil.parser.parse(date_str)", "def parse_datetime(datetime_str: Text) -> datetim...
[ "0.744302", "0.7120194", "0.71064794", "0.6967242", "0.68595725", "0.6754243", "0.67372626", "0.67316836", "0.6660535", "0.6657753", "0.6657753", "0.6628514", "0.6533056", "0.65272737", "0.64970315", "0.6493147", "0.64533705", "0.6433756", "0.6431354", "0.64138556", "0.640424...
0.6557024
12
Convert a ``datetime`` object to a JSON (JavaScript) string Formats the provided datetime object to a ``str`` that is compliant with the
def time_to_str(value: datetime) -> str: if value is None or not isinstance(value, datetime): raise ValueError("provided value is not a valid datetime object") return value.strftime("%Y-%m-%dT%H:%M:%SZ")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def time_to_js(obj):\n if isinstance(obj, (datetime.date, datetime.datetime)):\n return obj.isoformat()", "def json_serial(obj):\n if isinstance(obj, datetime):\n return obj.isoformat()", "def object_to_json(obj):\n if isinstance(obj, (datetime.datetime, datetime.date, datetime.time)):\n...
[ "0.7582491", "0.75781405", "0.74525875", "0.7391628", "0.7342249", "0.7333236", "0.7204316", "0.7185797", "0.7180997", "0.7174835", "0.70906", "0.7060324", "0.70553344", "0.69751024", "0.6969093", "0.6942338", "0.69343144", "0.69328296", "0.6923455", "0.69231457", "0.6921015"...
0.61615
81
Helper function to extract values from a response ``dict`` Allows extraction of nested values from a ``dict`` for convenience. This also allows for type checking and for validating that mandatory properties were supplied.
def read_value( key_path: str, data: dict, data_type: type, mandatory=True ) -> any: # build the path. we expect a ``key_path`` that looks like this: # "key1.key2.key3" -> ["key1", "key2", "key3"] segments = key_path.split(".") # segments should always have at least one...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_nested_values(readable_response: dict, nested_headers: Dict[str, str]) -> None:\n for nested_name, new_name in nested_headers.items():\n nested_name_parts = nested_name.split('.')\n\n nested_value = readable_response\n for index, part in enumerate(nested_name_parts):\n ...
[ "0.6608302", "0.63611734", "0.63242656", "0.6305682", "0.6254108", "0.62369514", "0.62369514", "0.6162515", "0.60944676", "0.600511", "0.5999591", "0.5893009", "0.5866927", "0.58222926", "0.5801373", "0.57999337", "0.5750822", "0.5737354", "0.57366353", "0.5667086", "0.564737...
0.0
-1
Verify a named value for the specified type and convert if necessary Allows type checking of a named value against a provided data type. It also cleans up any type issues that may result from JSON encoding and decoding.
def __convert_value( key: str, value: any, data_type: type ) -> any: if value is None: return None if isinstance(value, data_type): return value # convert any integers if a float is expected. This can happen during # JSON encoding and decoding. if data_type...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _typecheck(name, value, *types):\n if not types:\n raise ValueError('expected one or more types, maybe use _textcheck?')\n if not isinstance(value, types):\n raise TypeError(\"expected %s for %s, got %r\"\n % (\" or \".join([t.__name__ for t in types]),\n ...
[ "0.7434002", "0.7021828", "0.6788915", "0.6678147", "0.65208954", "0.65012234", "0.6500186", "0.64747125", "0.64524627", "0.6403695", "0.63903934", "0.63673615", "0.63105714", "0.6251769", "0.62451476", "0.6240222", "0.62134886", "0.61723894", "0.61700064", "0.6147381", "0.61...
0.6925098
2
Construct a new ``Enum`` from the provided ``str`` value.
def parse( cls, value: str ): if value is None or len(value) == 0: raise ValueError("provided value may not be None or empty") for item in cls: if value == item.value: # found a matching value return item # Fa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_string(cls, name: str) -> Enum:", "def __new__(\n cls: type[_StrEnumT], value: str, *args: Any, **kwargs: Any\n ) -> _StrEnumT:\n if not isinstance(value, str):\n raise TypeError(f\"{value!r} is not a string\")\n return super().__new__(cls, value, *args, **kwargs)", ...
[ "0.82637477", "0.7742584", "0.64777374", "0.6409345", "0.63755476", "0.6329693", "0.6231835", "0.6220948", "0.6143497", "0.61237514", "0.5981851", "0.5909587", "0.58561826", "0.58378655", "0.58049613", "0.57820725", "0.57605124", "0.5752845", "0.5751351", "0.5748314", "0.5747...
0.529642
44
Constructs a new PageInput object. Allows specifying which page to return from the server for API calls that support pagination. It allows to specify the page number and the quantity of items to return in the page. Default values for a page are page number ``1`` and ``100`` items per page.
def __init__( self, page: int = 1, count: int = 100 ): self.__page = page self.__count = count
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_page(self,page):\n params = join_params(self.parameters, \n {\"page\": set_limit(page),\n \"limit\": self._limit,\n \"url_domain\": self.url_domain,\n \"proxies\": self.proxies\n }\...
[ "0.63779694", "0.63287973", "0.6317754", "0.61945075", "0.6193627", "0.60594785", "0.6051231", "0.5969106", "0.5881306", "0.58658224", "0.5864686", "0.58082473", "0.57506007", "0.5701854", "0.56898767", "0.5662524", "0.55980915", "0.55890274", "0.5582403", "0.5581198", "0.554...
0.5945838
8
Specifies the page number to return
def page(self) -> int: return self.__page
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def page(self, number):\n self._page_number = number\n return super().page(number)", "def get_page(self, num):\n return num + 10", "def set_page(self, page):\n self.page = int(page)\n\n if self.page <= 0:\n # set first page, which depends on a maximum set\n ...
[ "0.802013", "0.7974438", "0.7316194", "0.72551", "0.69377774", "0.68448406", "0.678663", "0.6745117", "0.67229915", "0.6713935", "0.66886574", "0.66727835", "0.66701984", "0.666149", "0.66591924", "0.6651029", "0.65630484", "0.65482336", "0.6488619", "0.64811134", "0.6463532"...
0.6897858
5
Specifies the maximum number of items to include per page
def count(self) -> int: return self.__count
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_number_of_extra_items_in_page_with_initially_selected(self):\n return 10", "def paging_results(self):\n\n return 30", "def get_select_all_max_items(self):\n return 1500", "def num_of_pages(self) -> int:\n try:\n return int(round(self.__number_of_items / 48))\n ...
[ "0.6868025", "0.67130053", "0.6613031", "0.6493834", "0.64883125", "0.64483047", "0.64483047", "0.6440758", "0.64371395", "0.6395909", "0.6358825", "0.63505095", "0.63237435", "0.6323642", "0.63033676", "0.63024503", "0.6282856", "0.6256027", "0.6241055", "0.62391776", "0.622...
0.0
-1
Specify a list of `SaveableObject`s to save and restore.
def __init__(self, tensor_slice_dict): self._tensor_slice_dict = tensor_slice_dict
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_all(self, obj_list):\n\n for obj in obj_list:\n self.save(obj)", "def save_objects(*objects: EObject, path: str = \"./out.highlevelnaoapp\") -> None:\n resource = ResourceSet().create_resource(URI(path))\n for obj in objects:\n resource.append(obj)\n resource.save()", ...
[ "0.66502947", "0.5862298", "0.57990265", "0.57858706", "0.57265896", "0.5684352", "0.56591624", "0.56534976", "0.5627812", "0.5593302", "0.5582079", "0.55595666", "0.5555007", "0.55091625", "0.54883957", "0.5468649", "0.54618436", "0.5453097", "0.5452639", "0.54345685", "0.54...
0.0
-1
Save the saveable objects to a checkpoint with `file_prefix`.
def save(self, file_prefix, options=None): options = options or checkpoint_options.CheckpointOptions() tensor_names = [] tensors = [] slice_specs = [] for checkpoint_key, tensor_slices in self._tensor_slice_dict.items(): for slice_spec, tensor in tensor_slices.items(): if isinstance(te...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(self, file_prefix, options=None):\n options = options or checkpoint_options.CheckpointOptions()\n\n # IMPLEMENTATION DETAILS: most clients should skip.\n #\n # Suffix for any well-formed \"checkpoint_prefix\", when sharded.\n # Transformations:\n # * Users pass in \"save_path\" in save()...
[ "0.8050191", "0.72655725", "0.70114654", "0.68767583", "0.6402732", "0.63886064", "0.6338492", "0.6300955", "0.6300955", "0.6300955", "0.62696517", "0.6260468", "0.6259008", "0.62584656", "0.6258426", "0.6252518", "0.6250101", "0.62088394", "0.6168359", "0.6159923", "0.613466...
0.7847717
1
Restore the saveable objects from a checkpoint with `file_prefix`.
def restore(self, file_prefix, options=None): options = options or checkpoint_options.CheckpointOptions() tensor_names = [] tensor_dtypes = [] slice_specs = [] for checkpoint_key, tensor_slices in self._tensor_slice_dict.items(): for slice_spec, tensor in tensor_slices.items(): tensor...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def restore(self, file_prefix, options=None):\n options = options or checkpoint_options.CheckpointOptions()\n\n def restore_fn():\n restore_fn_inputs = {}\n restore_fn_input_count = {\n fn: len(keys) for fn, keys in self._restore_fn_to_keys.items()}\n\n restore_ops = {}\n # Sort ...
[ "0.7489", "0.7427531", "0.71940327", "0.7081849", "0.7081849", "0.7081849", "0.69074863", "0.6745683", "0.6576598", "0.64617085", "0.6417714", "0.63264495", "0.6171721", "0.61581063", "0.61405045", "0.6077467", "0.6041426", "0.60319626", "0.60011774", "0.59856737", "0.5977744...
0.77099335
0
Append sharding information to a filename.
def sharded_filename(filename_tensor, shard, num_shards): return gen_io_ops.sharded_filename(filename_tensor, shard, num_shards)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shard_filename(path, tag, shard_num, total_shards):\n return os.path.join(\n path, \"%s-%s-%.5d-of-%.5d\" % (_PREFIX, tag, shard_num, total_shards))", "def shard_path(self, shard_id, training=True):\n sub_dir = 'train' if training else 'validation'\n fname = 'shard-{}.tfrecord'.format(sha...
[ "0.6643691", "0.5697363", "0.56757563", "0.5666619", "0.54714036", "0.5333628", "0.53004414", "0.5286781", "0.5286214", "0.52476746", "0.5242944", "0.5241004", "0.5194285", "0.5178036", "0.5169993", "0.5164789", "0.51546425", "0.51322526", "0.51283985", "0.5119813", "0.509658...
0.57318276
1
Converts the function to a python or tf.function with a single file arg.
def _get_mapped_registered_save_fn(fn, trackables, call_with_mapped_captures): def save_fn(file_prefix): return fn(trackables=trackables, file_prefix=file_prefix) if call_with_mapped_captures is None: return save_fn else: tf_fn = def_function.function(save_fn, autograph=False) concrete = tf_fn.ge...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_fn(example):\n\n example_fmt = {\n \"image\": tf.FixedLenFeature((), tf.string),\n \"target\": tf.FixedLenFeature((), tf.float32, -1)\n }\n parsed = tf.parse_single_example(example, example_fmt)\n\n if return_full_size_image:\n preprocessed_ima...
[ "0.6461832", "0.6380109", "0.62550557", "0.6169878", "0.61032176", "0.6076619", "0.6076619", "0.6032153", "0.6014612", "0.598684", "0.5922275", "0.59044355", "0.5899847", "0.5873922", "0.58641714", "0.5800746", "0.57925206", "0.5748485", "0.56597507", "0.5626676", "0.56211656...
0.0
-1
Converts the function to a python or tf.function with a single file arg.
def _get_mapped_registered_restore_fn(fn, trackables, call_with_mapped_captures): def restore_fn(merged_prefix): return fn(trackables=trackables, merged_prefix=merged_prefix) if call_with_mapped_captures is None: return restore_fn else: tf_fn = def_function.funct...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_fn(example):\n\n example_fmt = {\n \"image\": tf.FixedLenFeature((), tf.string),\n \"target\": tf.FixedLenFeature((), tf.float32, -1)\n }\n parsed = tf.parse_single_example(example, example_fmt)\n\n if return_full_size_image:\n preprocessed_ima...
[ "0.6461123", "0.6379479", "0.62560844", "0.6169356", "0.6103122", "0.60771304", "0.60771304", "0.6031347", "0.60146964", "0.59866196", "0.5921851", "0.59050757", "0.5899349", "0.58734703", "0.5863908", "0.57994395", "0.57915616", "0.5747556", "0.56598175", "0.5627658", "0.562...
0.0
-1
Specify a list of `SaveableObject`s to save and restore.
def __init__(self, serialized_tensors, registered_savers=None, call_with_mapped_captures=None): # Keep these two data structures so that we can map restored tensors to # the Trackable restore functions. self._keys_to_restore_fn = {} self._restore_fn_to_keys =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_all(self, obj_list):\n\n for obj in obj_list:\n self.save(obj)", "def save_objects(*objects: EObject, path: str = \"./out.highlevelnaoapp\") -> None:\n resource = ResourceSet().create_resource(URI(path))\n for obj in objects:\n resource.append(obj)\n resource.save()", ...
[ "0.6651304", "0.5864228", "0.5798191", "0.5787132", "0.5728009", "0.568617", "0.5660349", "0.5654481", "0.5629186", "0.5594146", "0.55825967", "0.5560329", "0.55546117", "0.5508858", "0.54890144", "0.54680467", "0.546173", "0.54528034", "0.5452184", "0.54338443", "0.54248416"...
0.0
-1
Serializes to a SaverDef referencing the current graph.
def to_proto(self): filename_tensor = array_ops.placeholder( shape=[], dtype=dtypes.string, name="saver_filename") save_tensor = self._traced_save(filename_tensor) restore_op = self._traced_restore(filename_tensor).op return saver_pb2.SaverDef( filename_tensor_name=filename_tensor.name, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_saver_defs(self):\n assert self.savers_constructed\n full_saver_def = self.full_saver.as_saver_def()\n full_file = self.params.save_dir+self.params.model_name+\"_v\"+self.params.version+\".def\"\n with open(full_file, \"wb\") as f:\n f.write(full_saver_def.SerializeToString())\n self....
[ "0.7064961", "0.6515147", "0.650391", "0.59408104", "0.58986694", "0.5875582", "0.5864783", "0.5816778", "0.5780104", "0.5728583", "0.5717031", "0.5703805", "0.5703805", "0.56765556", "0.5646373", "0.5643613", "0.5643265", "0.56159675", "0.561299", "0.5607883", "0.56031144", ...
0.5938409
4
Save the saveable objects to a checkpoint with `file_prefix`.
def save(self, file_prefix, options=None): options = options or checkpoint_options.CheckpointOptions() # IMPLEMENTATION DETAILS: most clients should skip. # # Suffix for any well-formed "checkpoint_prefix", when sharded. # Transformations: # * Users pass in "save_path" in save() and restore(). ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(self, file_prefix, options=None):\n options = options or checkpoint_options.CheckpointOptions()\n tensor_names = []\n tensors = []\n slice_specs = []\n for checkpoint_key, tensor_slices in self._tensor_slice_dict.items():\n for slice_spec, tensor in tensor_slices.items():\n if i...
[ "0.78489673", "0.72668874", "0.70105153", "0.6881262", "0.6406851", "0.6393002", "0.6343004", "0.6299223", "0.6299223", "0.6299223", "0.6275086", "0.62643564", "0.6264212", "0.6264104", "0.62639993", "0.6254322", "0.6253772", "0.62144583", "0.61729413", "0.61586666", "0.61399...
0.80512387
0
Restore the saveable objects from a checkpoint with `file_prefix`.
def restore(self, file_prefix, options=None): options = options or checkpoint_options.CheckpointOptions() def restore_fn(): restore_fn_inputs = {} restore_fn_input_count = { fn: len(keys) for fn, keys in self._restore_fn_to_keys.items()} restore_ops = {} # Sort by device name...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def restore(self, file_prefix, options=None):\n options = options or checkpoint_options.CheckpointOptions()\n tensor_names = []\n tensor_dtypes = []\n slice_specs = []\n\n for checkpoint_key, tensor_slices in self._tensor_slice_dict.items():\n for slice_spec, tensor in tensor_slices.items():\n ...
[ "0.7710502", "0.7426955", "0.71934044", "0.70837396", "0.70837396", "0.70837396", "0.690655", "0.6745984", "0.6577562", "0.646206", "0.6419114", "0.63269955", "0.6172737", "0.61575806", "0.6141102", "0.60786045", "0.60416305", "0.60324484", "0.6001584", "0.59863573", "0.59766...
0.74891186
1
Add original question, related question, comments of related question pairs and original, comments of related question pairs, each having different labels.
def parse2016(filename, qdict, cdict): tree = ET.parse(filename) root = tree.getroot() for child in root: # Each child represents a new (original question, related question) pair orgq_id = child.attrib["ORGQ_ID"] relq_id = child[2].attrib["THREAD_SEQUENCE"] orgq_comment...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _add_descriptors(related):\n\n for r in related:\n r[\"descriptors\"] = []\n for edge in G.edges(data=True):\n sibling_idx = _get_connected(edge, r[\"tokenIndex\"])\n if sibling_idx and (A.lookup[int(sibling_idx)][\"pos\"] == \"JJ\" or edge[2][\"dep\"] in [\"amod\", \"com...
[ "0.5727858", "0.54750276", "0.5441489", "0.5394564", "0.52960277", "0.517159", "0.5138674", "0.5100325", "0.5044202", "0.50028664", "0.50023335", "0.49675927", "0.4959247", "0.4939857", "0.49312538", "0.49292618", "0.49193037", "0.4916655", "0.4898273", "0.48525104", "0.48473...
0.49838543
11
Main entry point for subcommand.
def setup_argparse(parser: argparse.ArgumentParser) -> None: subparsers = parser.add_subparsers(dest="landingzone_cmd") setup_argparse_list(subparsers.add_parser("list", help="List landing zones.")) setup_argparse_retrieve(subparsers.add_parser("retrieve", help="Retrieve landing zone.")) setup_argparse...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cli():\n pass # do nothing here, it just defines the name for other subcommands", "def main():\n\n args = parse_arguments(sys.argv[1:])\n configure_logging(args.debug)\n\n if(args.subcommand):\n logging.debug(\"Executing sub-command \" + args.subcommand)\n\n if(args.subcommand == \"bui...
[ "0.76060915", "0.74839264", "0.7368959", "0.73298484", "0.7241038", "0.7123426", "0.7120817", "0.7120817", "0.7120817", "0.7120817", "0.7120817", "0.7120817", "0.7120817", "0.7120817", "0.7120817", "0.7120817", "0.7120817", "0.7120817", "0.7120817", "0.7120817", "0.7120817", ...
0.0
-1
Main entry point for landing zone command.
def run(config, toml_config, args, parser, subparser): if not args.landingzone_cmd: # pragma: nocover return run_nocmd(config, args, parser, subparser) else: config = LandingZoneConfig.create(args, config, toml_config) return args.landingzone_cmd(config, toml_config, args, parser, subpa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main() -> None:\n\n data = Ground(sys.argv[1])\n DeliveryMan.show_route(data.coordinates)", "def Run(self, args):\n project = properties.VALUES.core.project.Get(required=True)\n zone = {}\n zone['dnsName'] = args.dns_name\n zone['name'] = args.zone\n zone['description'] = args.descriptio...
[ "0.69619477", "0.6414897", "0.6252262", "0.6175504", "0.59503347", "0.59487396", "0.59453166", "0.5835306", "0.58340424", "0.58282", "0.5816947", "0.5801014", "0.5773889", "0.5770805", "0.5750875", "0.5741733", "0.5728984", "0.5725193", "0.5716316", "0.56993407", "0.5698184",...
0.7543086
0
A fast way to calculate the unitary transformation acting on some sites.
def fast_dot(sites, gate, state, N, layer=None): n = len(sites) layer = layer if layer else range(2 ** N) index = [utils.index(i, N, sites) for i in layer] gate = gate.T trans_mat = gate[:, index] v = np.array(layer).reshape(1, len(layer)).repeat(2 ** n, 0) for base in range(2 ** n): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test__inverse_transform_continuous(self):", "def local_basis_transform(basis1, basis0):\n\n U_local = np.conj(basis1).T @ basis0\n return(U_local)\n\n \"\"\"what bases? For each qubit sig_x sig_y sig_z\"\"\"", "def unit_transform(self, x, **kwargs):\n if len(kwargs) > 0:\n self.u...
[ "0.5803933", "0.5576571", "0.55566216", "0.55502826", "0.5536483", "0.55344856", "0.55269116", "0.5491953", "0.5485871", "0.5472698", "0.5464033", "0.5463929", "0.54456025", "0.5408911", "0.54064965", "0.54012805", "0.5370834", "0.5365219", "0.5343112", "0.5342246", "0.533733...
0.0
-1
A fast way to calculate the unitary transformation acting on some sites.
def fast_dot_(sites, gate, state, N, layer=None): n = len(sites) layer = layer if layer else range(2 ** N) index = [utils.index(i, N, sites) for i in layer] trans_mat = gate[:, index] v = np.array(layer).reshape(1, len(layer)).repeat(2 ** n, 0) for base in range(2 ** n): for site in rang...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test__inverse_transform_continuous(self):", "def local_basis_transform(basis1, basis0):\n\n U_local = np.conj(basis1).T @ basis0\n return(U_local)\n\n \"\"\"what bases? For each qubit sig_x sig_y sig_z\"\"\"", "def unit_transform(self, x, **kwargs):\n if len(kwargs) > 0:\n self.u...
[ "0.5804365", "0.55773914", "0.5556903", "0.5551844", "0.5538288", "0.553498", "0.55277705", "0.54923546", "0.54866695", "0.54730195", "0.54644483", "0.54631513", "0.544587", "0.5410014", "0.5406321", "0.540305", "0.53711987", "0.53659594", "0.53433025", "0.5343076", "0.533989...
0.0
-1
A fast way to calculate the unitary transformation acting on some sites.
def fast_dot_2(sites, gate, state, N, layer=None, relation=None): # n = len(sites) layer = layer if layer else range(2 ** N) final_state = dict() for node in layer: index = utils.index(node, N, sites) for v in relation[node]: index1 = utils.index(v, N, sites) fina...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test__inverse_transform_continuous(self):", "def local_basis_transform(basis1, basis0):\n\n U_local = np.conj(basis1).T @ basis0\n return(U_local)\n\n \"\"\"what bases? For each qubit sig_x sig_y sig_z\"\"\"", "def unit_transform(self, x, **kwargs):\n if len(kwargs) > 0:\n self.u...
[ "0.5804814", "0.55764157", "0.5555819", "0.55519205", "0.5538079", "0.5534247", "0.55277663", "0.54914075", "0.5486117", "0.547269", "0.5463509", "0.5463487", "0.54449314", "0.54087836", "0.5406919", "0.54007906", "0.5370393", "0.5365757", "0.5343715", "0.5343085", "0.5337359...
0.0
-1
A fast way to calculate the unitary transformation acting on some sites.
def fast_dot_1(sites, gate, state, N, layer=None, relation=None): # n = len(sites) layer = layer if layer else range(2 ** N) final_state = dict() for node in layer: index = utils.index(node, N, sites) for v in relation[node]: index1 = utils.index(v, N, sites) fina...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test__inverse_transform_continuous(self):", "def local_basis_transform(basis1, basis0):\n\n U_local = np.conj(basis1).T @ basis0\n return(U_local)\n\n \"\"\"what bases? For each qubit sig_x sig_y sig_z\"\"\"", "def unit_transform(self, x, **kwargs):\n if len(kwargs) > 0:\n self.u...
[ "0.5804814", "0.55764157", "0.5555819", "0.55519205", "0.5538079", "0.5534247", "0.55277663", "0.54914075", "0.5486117", "0.547269", "0.5463509", "0.5463487", "0.54449314", "0.54087836", "0.5406919", "0.54007906", "0.5370393", "0.5365757", "0.5343715", "0.5343085", "0.5337359...
0.0
-1
Method determine current user
def get_queryset(self): return Event.objects.all().filter(user_id=self.request.user)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_current_user(self):\n return None", "def get_current_user(self):\n return self.current_user", "def current_user_info():\n\n return current_user", "def get_current_user(self):\r\n return self.jira.current_user()", "def get_user(self):\n return None", "def _get_current_us...
[ "0.81373155", "0.79817206", "0.77589864", "0.76861507", "0.76659864", "0.7654069", "0.7632394", "0.7624174", "0.7571075", "0.753077", "0.7523433", "0.75145435", "0.7431494", "0.73773813", "0.7372881", "0.7333388", "0.7333388", "0.732928", "0.7328477", "0.73091877", "0.7307454...
0.0
-1
Override method from djrestauth library to login with username or email
def login(self): self.user = self.serializer.validated_data['user'] or self.serializer.validated_data['email']
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_login(request):\n if \"email\" in request.DATA and \"password\" in request.DATA:\n user = authenticate(\n request,\n username=request.DATA[\"email\"],\n password=request.DATA[\"password\"],\n )\n if user is not None:\n login(request, user...
[ "0.68783975", "0.66309136", "0.66066015", "0.66062045", "0.6598922", "0.6579894", "0.6574915", "0.6515354", "0.65140116", "0.65127194", "0.65111333", "0.6499497", "0.6488138", "0.646653", "0.6461104", "0.64396834", "0.64242405", "0.6423767", "0.6421206", "0.64155567", "0.6401...
0.68613046
1
Convert numpy array of noisy coefs to dataframe for plotting.
def arr_to_df(coefs_noisy, n_arr, coefs_id): out = pd.DataFrame(coefs_noisy, columns=n_arr) out = pd.DataFrame(out.stack()).reset_index() out.columns = ['component', 'n', 'value'] out = out.assign(id=coefs_id) return out
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vec_to_df(coefs, n_arr, coefs_id):\n out = pd.DataFrame({'component': 'L2_dist', 'n': n_arr, 'value': coefs,\n 'id': coefs_id})\n return out", "def as_DF(self):\n\n gs_df = pd.DataFrame(self.P, columns=self.xvec, index=self.yvec)\n gs_df.columns.name = 'x'\n ...
[ "0.5676058", "0.5650214", "0.5565525", "0.55317235", "0.55146766", "0.5458486", "0.5452004", "0.54493064", "0.54056114", "0.539738", "0.5363231", "0.5359971", "0.5354889", "0.5327784", "0.5323152", "0.5283996", "0.5249769", "0.52473086", "0.52459276", "0.5223076", "0.52193254...
0.7141686
0
Convert 1d numpy array to dataframe for plotting.
def vec_to_df(coefs, n_arr, coefs_id): out = pd.DataFrame({'component': 'L2_dist', 'n': n_arr, 'value': coefs, 'id': coefs_id}) return out
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_nparray_to_df(nparray: np.ndarray) -> pd.DataFrame:\n return pd.DataFrame(data=nparray[1:, 1:],\n index=nparray[1:, 0],\n columns=nparray[0, 1:])", "def xarray_to_df(file_path):\n df = xr.open_dataset(file_path).to_dataframe()\n df = df.reset_index(...
[ "0.7372338", "0.6829325", "0.67939925", "0.67582446", "0.6741496", "0.6593171", "0.65855", "0.6417954", "0.6330275", "0.6313056", "0.6305333", "0.6293269", "0.62197083", "0.6147745", "0.6120145", "0.6108317", "0.6108003", "0.6107391", "0.609676", "0.6074362", "0.6046519", "...
0.54785275
95
Combine LP coefficients from simulation output into a dataframe.
def combine_coefs(results, n_arr): obj = pd.DataFrame( {'component': 'L2', 'n': n_arr, 'value': res['dist_obj'], 'id': 'obj'}) coefs_noisy = pd.concat([ to_df(results['obj_noisy'], n_arr, 'obj'), to_df(results['pos_noisy'], n_arr, 'pos'), to_df(results['neg_noisy'], n_arr, 'neg'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_output_df(self):\n df = pd.concat([pd.DataFrame(dat) for dat in [self.qdata, self.pdata]], axis=1)\n columns = np.hstack(([['{}{}'.format(x, c) for c in self.actions] for x in ['q', 'p']]))\n df.columns = columns\n df.insert(0, 'trial', np.arange(1, df.shape[0]+1))\n df[...
[ "0.6021868", "0.5933591", "0.5704054", "0.5667305", "0.5621852", "0.55554664", "0.5448244", "0.54471153", "0.54371923", "0.5428466", "0.5423558", "0.5409512", "0.537702", "0.5357138", "0.5353326", "0.53367823", "0.5335095", "0.52969015", "0.52878666", "0.52795756", "0.5275073...
0.0
-1
Plot 'true' and noisy coefficients.
def plot_coefs(results): coefs_noisy = pd.concat([ arr_to_df(results['obj_noisy'], n_arr, 'obj'), vec_to_df(results['dist_obj'], n_arr, 'obj'), arr_to_df(results['pos_noisy'], n_arr, 'pos'), vec_to_df(results['dist_pos'], n_arr, 'pos'), arr_to_df(results['neg_noisy'], n_arr, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_true(self, ax):\n t = self.t\n x_true = self.x_true\n b = self.b\n\n ax.plot(t, x_true, 'k-', label='true image', lw=1.5)\n ax.plot(t, b, 'ro', label='blurred')\n ax.set_title(r'True')\n ax.set_xlabel(r'$t$')\n ax.set_ylabel(r'$x$')\n leg = ax.legend(loc='upper le...
[ "0.71557194", "0.6376786", "0.6281781", "0.62380886", "0.6158362", "0.6118943", "0.61107737", "0.6098007", "0.60626245", "0.6027678", "0.59956294", "0.5971492", "0.5943495", "0.59327364", "0.5911246", "0.5910142", "0.5910142", "0.5910142", "0.5909054", "0.59012383", "0.587855...
0.6278804
3
Plot risk and fairness gaps.
def plot_metrics(results, epsilon_pos, epsilon_neg): ## Plot risk and fairness gaps as a function of sample size, ## with true minimum risk and true fairness gaps for reference. metrics_Y0 = pd.concat(results['metrics_Y0_noisy'], keys=n_arr) metrics_Y0 = metrics_Y0.reset_index().drop(columns='level_1')...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_scenario_distribution(self):\n x = self.arms\n\n y = self.df.groupby('price').mean().Converted[x]\n y_sex_0 = self.df[self.df.Sex == 0].groupby('price').mean().Converted[x]\n y_sex_1 = self.df[self.df.Sex == 1].groupby('price').mean().Converted[x]\n y_age_0 = self.df[sel...
[ "0.62412286", "0.6003811", "0.5952074", "0.59471977", "0.5879272", "0.5722639", "0.55827194", "0.5509448", "0.54747474", "0.54674083", "0.5467399", "0.54673696", "0.54360753", "0.5435962", "0.5407168", "0.540194", "0.5389398", "0.53769875", "0.537178", "0.53634727", "0.535109...
0.6439876
0
Plot metrics for Task (1) simulations. Need to be able to accommodate either one or multiple settings of the epsilons.
def plot_metrics2(df, n_arr, risk_best, epsilon_pos, epsilon_neg, row, col, **kwargs): xlim = (min(n_arr), max(n_arr)) # g = sns.FacetGrid(df, row = row, col = col, # col_order = ['risk', 'gap_FPR', 'gap_FNR'], xlim = xlim, # ylim = (0, 1)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_fig2(tables_task_ids):\n from snep.tables.experiment import ExperimentTables\n\n tables, task_ids = tables_task_ids['test0']\n assert isinstance(tables, ExperimentTables) # This allows PyCharm to autocomplete method names for tables\n params = tables.get_general_params(True)\n param_ranges...
[ "0.6807533", "0.64400905", "0.6324308", "0.62633353", "0.62393457", "0.622306", "0.6177711", "0.6104051", "0.60436475", "0.60030115", "0.5995861", "0.5978587", "0.5964551", "0.5948441", "0.5945955", "0.5935974", "0.5909216", "0.59056044", "0.5893692", "0.58903974", "0.5884194...
0.0
-1
Plot metrics for Task (1) simulations. Need to be able to accommodate either one or multiple settings of the epsilons.
def plot_metrics3(df, n_arr, risk_best, epsilon_pos, epsilon_neg, row, col, **kwargs): xlim = (min(n_arr), max(n_arr)) # g = sns.FacetGrid(df, row = row, col = col, # col_order = ['risk', 'gap_FPR', 'gap_FNR'], xlim = xlim, # ylim = (0, 1)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_fig2(tables_task_ids):\n from snep.tables.experiment import ExperimentTables\n\n tables, task_ids = tables_task_ids['test0']\n assert isinstance(tables, ExperimentTables) # This allows PyCharm to autocomplete method names for tables\n params = tables.get_general_params(True)\n param_ranges...
[ "0.6807081", "0.64391947", "0.6323594", "0.62626004", "0.62387973", "0.62216854", "0.6178396", "0.61032397", "0.60428965", "0.6003009", "0.59949005", "0.59768206", "0.5963889", "0.59477186", "0.59443283", "0.5934731", "0.5910518", "0.59052545", "0.5892568", "0.5889081", "0.58...
0.0
-1
'Center' and scale the raw values.
def transform_metrics(res, risk, risk_change, epsilon_pos, epsilon_neg, scale=0.5, id_vars=['mc_iter', 'n']): settings = res.scenario.unique() out = res.pivot_table(index=id_vars, columns=['metric', 'scenario'], values='value') mult = np...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scale(self):", "def _center_scale_xy(X, Y, scale=True):\n # center\n x_mean = torch.mean(X, axis=0)\n X -= x_mean\n y_mean = torch.mean(Y, axis=0)\n Y -= y_mean\n # scale\n if scale:\n x_std = torch.std(X, dim = 0)\n x_std[x_std == 0.0] = 1.0\n X = X/x_std\n y...
[ "0.6877017", "0.68567073", "0.68347275", "0.6381293", "0.63585526", "0.6344079", "0.6343077", "0.6312164", "0.62491274", "0.6248472", "0.6201068", "0.61851996", "0.61619717", "0.6146685", "0.61427844", "0.61366594", "0.6111361", "0.60955715", "0.6092616", "0.60897845", "0.608...
0.0
-1
Plot metrics for Task (2) simulations. Need to be able to accommodate either one or multiple settings of the epsilons.
def plot_metrics_est(df, metrics_pre, metrics_post, n_arr, row='scenario', col='metric', **kwargs): risk_pre = metrics_pre.query("metric=='risk'")['value'].values[0] risk_post = metrics_post.query("metric=='risk'")['value'].values[0] risk_change = metrics_post.query("metric=='risk_chang...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_fig2(tables_task_ids):\n from snep.tables.experiment import ExperimentTables\n\n tables, task_ids = tables_task_ids['test0']\n assert isinstance(tables, ExperimentTables) # This allows PyCharm to autocomplete method names for tables\n params = tables.get_general_params(True)\n param_ranges...
[ "0.7029315", "0.6479961", "0.6431651", "0.6284009", "0.61860913", "0.6135593", "0.6135398", "0.6085464", "0.60504955", "0.602548", "0.6021803", "0.60100317", "0.6005149", "0.599966", "0.59906054", "0.59872437", "0.59871036", "0.59864694", "0.59782356", "0.5970009", "0.5963065...
0.0
-1
Validate the value looks like an IP address.
def is_ip_address(value, messages=None): if value is None: return _messages = { 'type-string': "must be a string", 'invalid': "is invalid", } if messages: _messages.update(messages) if not isinstance(value, basestring): raise Invalid(_messages['type-string']) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_ip_address(value):\r\n # IPv6 added with Django 1.4\r\n from django.core.validators import validate_ipv46_address as ip_validator\r\n\r\n try:\r\n ip_validator(value)\r\n except ValidationError:\r\n return False\r\n return True", "def is_ip(value):\n try:\n IP(value)...
[ "0.83473444", "0.8229147", "0.7918661", "0.76669145", "0.75844365", "0.7565428", "0.7476944", "0.7373973", "0.7367211", "0.73561", "0.73054147", "0.72608477", "0.7196808", "0.7177064", "0.71617794", "0.7145235", "0.71355194", "0.7122413", "0.71152747", "0.70877236", "0.708139...
0.7694819
3
Plot the residuals between measured and predicted values.
def residuals(y_true, y_pred, ax=None): _check_parameter_validity(y_true, y_pred) if ax is None: ax = plt.gca() # horizontal line for residual=0 ax.axhline(y=0) ax.scatter(y_pred, y_true - y_pred) _set_ax_settings(ax, "Predicted Value", "Residuals", "Residuals Plot") return ax
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _plot_resid_vs_fitted(self, ax):\n\n res = self._model.fit()\n\n ax.plot(res.fittedvalues, res.resid, '.')\n ax.set_xlabel('Fitted ' + self._model.endog_names)\n ax.set_ylabel('Raw residual')\n plt.sca(ax)\n plt.axhline(color='k')", "def residual_plot(targets, predic...
[ "0.76177293", "0.74306864", "0.73046005", "0.7271648", "0.71746546", "0.70974493", "0.70785415", "0.7046744", "0.70070755", "0.69879323", "0.68859196", "0.6638787", "0.6637704", "0.65629137", "0.6533907", "0.6488404", "0.64341474", "0.64010227", "0.63988537", "0.63487905", "0...
0.7854943
0
Plot the scatter plot of measured values v. predicted values, with an identity line and a best fitted line to show the prediction difference.
def prediction_error(y_true, y_pred, ax=None): _check_parameter_validity(y_true, y_pred) if ax is None: ax = plt.gca() model = LinearRegression() if isinstance(y_true, pd.Series): y_true = y_true.values y_reshaped = y_true.reshape((-1, 1)) # it is necessary to fit the model wi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_actual_predicted(self):\n predicted = [self.f(x, self.coefficients) for x in self.x_values]\n\n plt.scatter(self.x_values, self.y_values, label = \"Actual data\", c = 'b')\n plt.plot(self.x_values, predicted, label = \"Predicted data\", c = 'r')\n plt.title(f\"Graph of Prediec...
[ "0.7619803", "0.73825103", "0.6910162", "0.6828525", "0.6798043", "0.67719805", "0.6752657", "0.6736895", "0.6719012", "0.6635017", "0.6582754", "0.65477663", "0.646825", "0.6449293", "0.6447603", "0.6417375", "0.64155245", "0.64023745", "0.6390852", "0.6390345", "0.6378697",...
0.60029083
47
Complete the images table of the database with the relevant values of the directory images.
def complete_images_table(self, table): # Variable initialization cmp_double = 0 cmp_img = 0 # Connection to database conn, cursor = connection_database(self.db_name, self.host, self.user, self.password, self.local, self.ssl_ca) # Get images paths image...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_images(image_filename):\n\n # Write code here to loop over image data and populate DB.", "def show_images(images, db):\n images = [int(image) for image in images]\n files = get_img_files(images, db)\n show_files(files)", "def add_images(imagefiles, description, tags, users_r, \n ...
[ "0.6612568", "0.65215194", "0.6491594", "0.6421915", "0.6367421", "0.62234783", "0.61760515", "0.61658376", "0.6102105", "0.6085422", "0.5987134", "0.59791154", "0.5875186", "0.58479464", "0.5841986", "0.583527", "0.5827648", "0.5797089", "0.578143", "0.57734877", "0.57726663...
0.77361715
0
Connects to the SQL server and stores the results of the comparisons in a csv.
def get_duels(self, csv_file, table): conn, curs = connection_database(self.db_name, self.host, self.user, self.password, self.local, self.ssl_ca) query = "SELECT * FROM {};".format(table) curs.execute(query) result = curs.fetchall() end_connection(conn, curs) # W...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_sql_to_csv():\n csv_outfile = 'optwrf_database.csv'\n db_conn = conn_to_db('optwrf.db')\n sql_to_csv(csv_outfile, db_conn)\n close_conn_to_db(db_conn)\n assert os.path.exists(csv_outfile) == 1", "def main():\n #use automationassets to get credentials \n cred = automationassets.get_a...
[ "0.60724294", "0.5836433", "0.56998223", "0.5647265", "0.55306256", "0.55271506", "0.551484", "0.54908764", "0.53698635", "0.5367699", "0.5367317", "0.5350177", "0.53416455", "0.53352654", "0.5332152", "0.53131926", "0.52831393", "0.52660966", "0.52494246", "0.5238187", "0.51...
0.5951407
1
Creates mysql.connector object to connect to a mysql database.
def connection_database(db_name, host, user, password, local, ssl_ca): if local: conn = mysql.connector.connect( host=host, user=user, passwd=password, database=db_name ) else: conn = mysql.connector.connect( host=host...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getConnection(self):\n if (not self.initialized):\n logging.error(\"Module is not initialized\")\n \n conn_options = {\n 'user': self.user,\n 'password' : self.password,\n 'host' : self.host,\n 'port' : self.port,\n 'databas...
[ "0.7507807", "0.7188535", "0.7169623", "0.7144462", "0.71245915", "0.70902425", "0.7044684", "0.70395124", "0.6949333", "0.6933126", "0.68984056", "0.6884161", "0.68438727", "0.68037325", "0.67965716", "0.6786419", "0.67676234", "0.6756724", "0.67451376", "0.6741216", "0.6731...
0.684107
13
Commit queries of a connect instance.
def commit_query(conn): conn.commit()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def commitQuery(self):\r\n\t\tself.session.commit()", "def commit(self):\n self.conn.commit()", "def commit(self):\n self.__connection.commit()", "def commit(self):\n self._connection.execute_nonquery(\"sql\", \"COMMIT\", True)", "def commit(self) -> None:\n self._connector.comm...
[ "0.7059963", "0.69966274", "0.6971735", "0.6961581", "0.6949486", "0.6940861", "0.6940398", "0.6907652", "0.6823024", "0.681941", "0.67607075", "0.6757692", "0.6726335", "0.6708127", "0.6663223", "0.66234124", "0.6611488", "0.65827453", "0.6555924", "0.65552056", "0.65522164"...
0.7103915
0
Closes connection to a database of a connect instance.
def end_connection(conn, cur): cur.close() conn.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disconnect_from_db(self):\n self.db_cur.close()\n self.db_conn.close()", "def close_db_connection(cls):\n db.close()", "def close_connection(exception):\n db = database()\n\n if db is not None:\n db.close()", "def close_db(error):\n debug(\"Disconnecting FROM DB.\")\n...
[ "0.7725617", "0.767785", "0.76573586", "0.7654208", "0.75856876", "0.7571304", "0.7563883", "0.7534314", "0.75241053", "0.7508918", "0.74842125", "0.74418056", "0.7412428", "0.73263425", "0.73207086", "0.7296465", "0.7273986", "0.72537464", "0.7222091", "0.71770734", "0.71610...
0.0
-1
Execute a SQL INSERT INTO queries
def insert_into(cursor, table, columns, values): columns_str = columns[0] values_str = "%s" for col in columns[1:]: columns_str += ", " + col values_str += ", %s" query = "INSERT INTO {} ({}) VALUES ({})".format(table, columns_str, values_str) cursor.execute(query, values)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert_into_tables(cur, conn):\n for query in insert_table_queries:\n cur.execute(query)\n conn.commit()", "def _query_insert(self, sql, data=None):\n\n conn = psycopg2.connect(self.connect_args)\n cur = conn.cursor()\n cur.execute(sql, data)\n conn.commit()\n ...
[ "0.7637414", "0.75174606", "0.73767686", "0.736977", "0.7310605", "0.7295746", "0.72917", "0.7261612", "0.72264344", "0.72264344", "0.72264344", "0.72264344", "0.7150109", "0.70023865", "0.6999856", "0.69421756", "0.6873257", "0.68696296", "0.6832881", "0.6804258", "0.6792568...
0.6529839
34
x_min(need to be assigned) x_max(need to be assigned) y_min(need to be assigned) y_max(need to be assigned) path_loss_factor(4.0) small_fade("Rayleigh") noise("Gaussian") big_fade("no_big_fade") bs_number(need to be assigned) layer(1) power(1.0) distribution("uniform") ue_number(need to be assigned) distribution("unifo...
def __init__(self, x_min, x_max, y_min, y_max, bs_number, ue_number, layer=1, power=1.0, bs_distribution="square_grid", ue_distribution="gaussian", ue_sigma=0, if_fix_bs=True, bs_radius_1=50, grid_l_1=10, grid_l_2=10):...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, min_value=0.0, max_value=1.0, input_name=\"image\", output_name=\"image\"):\n super().__init__(input_name=input_name, output_names=[output_name])\n self.min_value = min_value\n self.max_value = max_value", "def __init__(self, color=1, minsize=24, maxsize=160):\n\tself.colo...
[ "0.5757932", "0.56693465", "0.56529826", "0.55947787", "0.55721635", "0.55641013", "0.5559697", "0.55596286", "0.55449086", "0.5539916", "0.55334955", "0.5533059", "0.5527372", "0.55137396", "0.5499857", "0.5478546", "0.5448861", "0.543818", "0.5419141", "0.5394803", "0.53944...
0.56655514
2
move this dice towered north
def move_south(self): self.vertical = (self.vertical * 2)[3:7] self.horizontal[1] = self.vertical[0] self.horizontal[3] = self.vertical[2]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move(self):\n \n self.position = self.wander()", "def turn(self):\r\n # 1 throw the dice\r\n if (\r\n not self.player_list[self.current_player].is_in_jail()\r\n or self.try_leave_jail()\r\n ):\r\n thr = Throw()\r\n while thr is not No...
[ "0.6586231", "0.65356094", "0.6503337", "0.6497301", "0.63757825", "0.6351679", "0.63349146", "0.622529", "0.62203085", "0.6209833", "0.6152489", "0.6142059", "0.6119466", "0.61022717", "0.6097013", "0.6093029", "0.60713977", "0.60547554", "0.60496265", "0.60490745", "0.60181...
0.0
-1
move this dice towered south
def move_north(self): self.vertical = (self.vertical * 2)[1:5] self.horizontal[1] = self.vertical[0] self.horizontal[3] = self.vertical[2]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shift_board(self, dx, dy):\n super().shift_board(dx, dy)\n self.goals = np.roll(self.goals, dy, axis=0)\n self.goals = np.roll(self.goals, dx, axis=1)", "def moveSouth(self):\n self._move('s', Tile.VerticalDifference)", "def move(self):\n \n self.position = self.wander...
[ "0.6450135", "0.6440476", "0.6399554", "0.6394947", "0.63425684", "0.6298838", "0.6269156", "0.620099", "0.61914253", "0.618724", "0.61674786", "0.61603296", "0.6153434", "0.61458814", "0.6130453", "0.61232764", "0.61162215", "0.6090203", "0.60896474", "0.6066804", "0.5977515...
0.0
-1
move this dice towered east
def move_east(self): self.horizontal = (self.horizontal * 2)[3:7] self.vertical[0] = self.horizontal[1] self.vertical[2] = self.horizontal[3]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_east(self):\r\n self.move(dx=1, dy=0)", "def move(self):\n \n self.position = self.wander()", "def move(self):\r\n if self.d == 'NORTH' and (self.y + 1) <= table_max_y:\r\n self.y += 1\r\n elif self.d == 'EAST' and (self.x + 1) <= table_max_x:\r\n s...
[ "0.66633594", "0.64686203", "0.63465816", "0.62308586", "0.62223876", "0.6176462", "0.6172353", "0.6140096", "0.6131063", "0.61120415", "0.60808563", "0.6079689", "0.6059594", "0.6036895", "0.6030891", "0.60288024", "0.5989185", "0.5989185", "0.5975611", "0.59711283", "0.5944...
0.63600254
2
move this dice towered west
def move_west(self): self.horizontal = (self.horizontal * 2)[1:5] self.vertical[0] = self.horizontal[1] self.vertical[2] = self.horizontal[3]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def throw(self, move):\n for dice_index in move:\n self.dice[dice_index - 1] = random.randint(1,6)", "def shift_board(self, dx, dy):\n super().shift_board(dx, dy)\n self.goals = np.roll(self.goals, dy, axis=0)\n self.goals = np.roll(self.goals, dx, axis=1)", "def do_west(...
[ "0.6295337", "0.6271478", "0.624435", "0.6226867", "0.6214748", "0.61201197", "0.609256", "0.6080956", "0.60585946", "0.5984114", "0.5926466", "0.59259015", "0.59212625", "0.59097594", "0.5907559", "0.5906178", "0.5894441", "0.58633", "0.58610564", "0.58604693", "0.5820033", ...
0.61474174
5
Takes in a dataframe and generates an interactive figure in plotly and exports it as an SVG file in the figures folder.
def visualize_count(df: pd.DataFrame = None, small_data: bool = False): if df is None: df = data_cleaning.pd_load_data(small_data) df = df.reset_index() df = df[['STATE', 'FPA_ID']] count_df = df.groupby('STATE').count() count_df = count_df.rename(columns={'FPA_ID': 'Count'}) fig = go.Fi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def showPlotlyScatter(self, DataFrame, x_axis, y_axis, saving_directory):\r\n fig = px.scatter(DataFrame, x = x_axis, y=y_axis, hover_name= DataFrame.index, color= 'Lib_Tag_contour_ratio',\r\n hover_data= ['Contour_soma_ratio_Lib', 'Lib_Tag_contour_ratio', 'ImgNameInfor_Lib'], width=...
[ "0.6491675", "0.6076382", "0.59671855", "0.59521836", "0.592906", "0.5924873", "0.588453", "0.5880291", "0.5853218", "0.5849005", "0.5834654", "0.5828318", "0.5821972", "0.5789379", "0.57887715", "0.5768348", "0.5747316", "0.57470936", "0.5695773", "0.56733716", "0.5663988", ...
0.0
-1
nice_name tag returns the username when the full name is not available
def test_nice_name_returns_username(self): class UserNoName(): username = 'my_username' def get_full_name(self): return None rendered = self.render_nice_name(UserNoName()) self.assertEquals(rendered, 'my_username')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nice_name(self):\n if self.first_name or self.last_name:\n return \"%s %s\" % (self.first_name, self.last_name)\n else:\n key = \"profile.nice_name\"\n cache_key = \"%s.%s.%s\" % (settings.SITE_CACHE_KEY, key, self.pk) \n cached = cache.get(cache_key)\n...
[ "0.75342166", "0.73341274", "0.7307055", "0.7307055", "0.7300437", "0.7300437", "0.72588587", "0.7255315", "0.7189447", "0.7167019", "0.71295244", "0.71295244", "0.71295244", "0.7097332", "0.70863456", "0.70732045", "0.7000764", "0.69829106", "0.69238865", "0.6918486", "0.690...
0.7638717
0
nice_name tag returns the full name when is available
def test_nice_name_returns_full_namename(self): class User(): username = 'my_username' def get_full_name(self): return 'my_full_name' rendered = self.render_nice_name(User()) self.assertEquals(rendered, 'my_full_name')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nice_name():\n\n pass", "def test_nice_name_returns_username(self):\n\n class UserNoName():\n username = 'my_username'\n\n def get_full_name(self):\n return None\n\n rendered = self.render_nice_name(UserNoName())\n\n self.assertEquals(rendered, 'my...
[ "0.7759537", "0.7210823", "0.71292967", "0.7072953", "0.70387155", "0.69336873", "0.688742", "0.67883503", "0.6753615", "0.67322063", "0.6729379", "0.67096", "0.67054737", "0.6651297", "0.66264844", "0.6609411", "0.6609411", "0.6609411", "0.6609411", "0.6609411", "0.6609411",...
0.73069805
1
Download the system log of the type specified in log_type POST param This calls the /sys_log via an http request on that node to get the info
def download_log(request): return_dict = {} try: form = log_management_forms.DownloadLogsForm(request.POST or None) if request.method == 'POST': if form.is_valid(): cd = form.cleaned_data log_type = cd['log_type'] response = django.h...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def logType(log):\n filename = log_dir\n if log == \"general\":\n filename += \"openvpn.log\"\n elif log == \"status\":\n filename += \"openvpn-status.log\"\n else:\n abort(404)\n \n return jsonify({\"logData\" : hl.getLog(filename)})", "def download_log(request):\n\n re...
[ "0.67096645", "0.65055877", "0.6106368", "0.58931", "0.58395517", "0.5779254", "0.56427187", "0.5483352", "0.544234", "0.5432902", "0.5360811", "0.53573716", "0.534782", "0.5324201", "0.5309597", "0.5293043", "0.5293043", "0.5286416", "0.5264758", "0.5244137", "0.5232413", ...
0.635149
2
Dumps the log from the ismartalarm
def dump_log(ip, verbose=False): # Force ip to str (if eg. ip == ipaddress class) ip = str(ip) # Getting Auth Key s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((ip, TCP_PORT_AUTH)) s.send(GET_AUTH_KEY) data = s.recv(BUFFER_SIZE) s.close() auth_key = data[16:32] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dump_to_log(self):\n # self._send_request(\"/dumpToLog\")\n pass", "def dump(self):\n self.logger.debug(self)", "def getLogs():", "def getLogs():", "def _dump_test_parser_log(self):\n\t\tFileSystem.dump_to(self._result_directory_name + \"/\" + \"Test_Parser.log\", self._form_test_p...
[ "0.80328393", "0.67299455", "0.66159296", "0.66159296", "0.64298815", "0.6289178", "0.6266176", "0.61912405", "0.61626637", "0.6018673", "0.59994423", "0.5962766", "0.5931081", "0.5912171", "0.59048337", "0.58585835", "0.5848837", "0.58444375", "0.5830088", "0.58018595", "0.5...
0.624021
7
Cosine similarity and then binary cross entropy.
def _cosine_and_bce(preds: Tensor, pseudo_label: Tensor, mask: Tensor) -> Tensor: # cosine similarity cosine_sim = dot_product(preds[:, None, :], preds).clamp(min=0, max=1) # binary cross entropy unreduced_loss = F.binary_cross_entropy(cosine_sim, pseudo_label, reduction="none") return torch.mean(un...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_cosine_similarity(self):\n cos_matrix = []\n for i in range(len(self.train_vec)):\n val = self.vec1 * self.train_vec[i]\n cos_matrix.append(val[0])\n out = np.argmax(cos_matrix)\n print(self.train_output[out])", "def calculate_cosine_similarity(self):...
[ "0.72706926", "0.68317753", "0.66812646", "0.66766757", "0.66006863", "0.65620357", "0.65540147", "0.6513036", "0.64433026", "0.64406836", "0.64259344", "0.641402", "0.6411648", "0.6321563", "0.63186157", "0.6316714", "0.63073885", "0.63004255", "0.6289717", "0.628617", "0.62...
0.64782894
8
Forwards output, extracts Thonny message, replaces normal prompts with raw prompts. This is executed when some code is running or just after requesting raw prompt. After submitting commands to the raw REPL, the output should be like {stdout}\x04\{stderr}\x04\n\> In the end of {stdout} there may be \x02{valueforthonny} ...
def _process_until_raw_prompt(self, capture_output=False): # TODO: experiment with Ctrl+C, Ctrl+D, reset eot_count = 0 value = None done = False out = b"" err = b"" while not done: if (self._connection.num_bytes_received == 0 and time....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_prompt(self, timeout=30):\n #self.tc.expect(self.tool_prompt, timeout=timeout)\n #self.tf = self.tc.after.split()\n #return {'status': int(self.tf[self.tool_status_index]), 'output': self.tc.before}\n output = \"\"\n # Loop until we receive the special spt prompt while in...
[ "0.59774065", "0.59364516", "0.5923323", "0.5923323", "0.5696055", "0.56759435", "0.56740737", "0.562927", "0.55930865", "0.5571562", "0.5549954", "0.55442077", "0.55442077", "0.5541861", "0.5516136", "0.55004907", "0.54771006", "0.5472862", "0.54632956", "0.5442928", "0.5430...
0.6925466
0
parse the config file to produce a dict of absorbers, parameters and allowed ranges
def configure(config_file): Config.config_file = config_file config = ConfigParser() config.optionxform = str config.read(config_file) dct = {} for item in list(config.sections()): dct[item] = dict(config.items(item)) for item in dct.keys(): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parseConfig(self, filename):\n parameters = {}\n try:\n f = open(filename)\n except Exception as inst:\n print(type(inst))\n print(inst.args)\n print(inst)\n print('cannot open', filename)\n raise\n else:\n ...
[ "0.68742883", "0.64713717", "0.6406853", "0.62929416", "0.6131319", "0.6128549", "0.6108708", "0.60788536", "0.60567814", "0.6043409", "0.6009234", "0.5997987", "0.5957832", "0.5894876", "0.58923626", "0.5883574", "0.5866653", "0.5864182", "0.58620304", "0.58604765", "0.58544...
0.5695767
35
given a file of predictions and a file of targets compute evaluation metrics and return dict containing results (including a sum of squared errors so that errors can be added across multiple chromosomes) metrics can be computed on gene/enhancer/promoter subsets by passing lists of bin ids matching these subsets (option...
def evaluate_predictions(unfiltered_preds, unfiltered_targets, gene_bins=None, enhancer_bins=None, promoter_bins=None, retain_bins=None): unfiltered_errors = np.square(unfiltered_preds-unfiltered_targets) if retain_bins is None: retain_bins = np.arange(unfiltered_errors.shape[0]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eval(\n task1_prediction_filename: str,\n task2_prediction_filename: str,\n target_filename: str,\n output_dir: str,\n case_ids_source: Optional[Union[str, List[str]]] = \"target\",\n) -> Tuple[OrderedDict, str]:\n create_dir(output_dir)\n\n # eval task1, task2 or both\n task1 = task1_p...
[ "0.622663", "0.6073436", "0.58134985", "0.5804928", "0.5719069", "0.5711731", "0.5710975", "0.568237", "0.5680572", "0.5669467", "0.5663991", "0.5612322", "0.5609203", "0.5606721", "0.55780536", "0.5572466", "0.55717826", "0.55348396", "0.54948217", "0.548214", "0.5472467", ...
0.62762123
0
N.B. be very careful with this...it simply can't work for batched evaluation can it?
def correlation_coefficient_loss_rowwise(y_true, y_pred): x = y_true y = y_pred mx = K.mean(x, axis=0) my = K.mean(y, axis=0) xm, ym = x-mx, y-my r_num = K.sum(tf.multiply(xm,ym), axis=0) r_den = K.sqrt(tf.multiply(K.sum(K.square(xm), axis=0), K.sum(K.square(ym), axis=0))) r = r_num / r_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def multiple_eval_for_loops_v2():", "def multiple_eval_for_loops_v1():", "def evaluate_batch(self, pipelines):", "def reduce_run():", "def _batching_call(self, *args, **kw):\n b_start = kw.pop('b_start', None)\n b_size = kw.pop('b_size', None)\n results = list(self._original_call(*args, **kw))\n\n...
[ "0.6869179", "0.67925566", "0.6759077", "0.67315304", "0.5874977", "0.57868266", "0.56216645", "0.54925203", "0.547827", "0.54709744", "0.54341394", "0.54341394", "0.54228586", "0.54214734", "0.5414435", "0.54052544", "0.5348475", "0.5341137", "0.53396255", "0.53319865", "0.5...
0.0
-1
Calculates the MSE weighted by the crosscelltype variance.
def msevar(y_true, y_pred, y_all=None, var=None): if var is None and y_all is None: return 0.0 if var is None: var = np.std(y_all, axis=0) ** 2 return ((y_true - y_pred) ** 2).dot(var)/var.sum()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rmse(self):\n lam = self.lam()\n weights = lam / lam.sum()\n weighted_var = self.var() * weights\n rmse = np.sqrt(weighted_var.sum())\n return rmse", "def _mse(self):\n error = self._input * self._weights - self._label\n sum_ = 0.0\n for i in range(self...
[ "0.68916774", "0.68723106", "0.6812043", "0.6696123", "0.6679333", "0.66682017", "0.6649163", "0.6577138", "0.6400805", "0.63694525", "0.63601", "0.63601", "0.6322204", "0.6321516", "0.6321516", "0.6274082", "0.6248884", "0.6246755", "0.62400144", "0.6237504", "0.6237504", ...
0.6078163
33
Assumption is that bins which when sorted lie outside top_bottom_bin_range are outliers and the relevant 'robust' minimum and maximum are percentiles within the top_bottom_bin_range This is a bit lie the scikitlearn robust scaler idea; though not exactly
def find_robust_min_max(x, pct_thresh=0.05, top_bottom_bin_range=2000000): y = x[x > 0] idxs = np.argsort(y) abs_max = y[idxs[-1]] abs_min = y[idxs[0]] robust_max = y[idxs[-int(pct_thresh * top_bottom_bin_range)]] robust_min = y[idxs[int(pct_thresh * top_bottom_bin_range)]] log.info('Array l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def binning(data, low, high):\n if len(data) == 0: return 1\n\n mask1 = (data >= low)\n mask2 = (data < high)\n mask3 = numpy.logical_and(mask1, mask2)\n data = data[mask3]\n\n if len(data) == 0: return 10\n\n data.sort()\n q1 = data[int(math.floor(0.25*len(data)))]\n q3 = data[int(math....
[ "0.6620887", "0.6594978", "0.62357104", "0.6183821", "0.61543703", "0.61226857", "0.61187845", "0.6117019", "0.61008453", "0.6096406", "0.6086877", "0.6066685", "0.60292286", "0.6000606", "0.5948171", "0.5942545", "0.59317714", "0.5907111", "0.59046483", "0.58851564", "0.5880...
0.7037333
0
Convert all characters to lowercase from list of tokenized words
def to_lowercase(words): new_words = [] for word in words: new_word = word.lower() new_words.append(new_word) return(new_words)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lowercase(tokens):\n if not lowercase_activated:\n return tokens\n output = [token.lower() for token in tokens]\n return output", "def preprocess(tokens):\n result = []\n for token in tokens:\n result.append(token.lower())\n return result", "def lowercase(tokens):\n return [token.lower(...
[ "0.825361", "0.81953853", "0.79781765", "0.781734", "0.7800716", "0.7751302", "0.7673937", "0.76445544", "0.76206166", "0.76206166", "0.76206166", "0.76206166", "0.76206166", "0.76206166", "0.76206166", "0.7522023", "0.74568486", "0.7307557", "0.71714586", "0.7123188", "0.698...
0.75346315
15
Remove punctuation from list of tokenized words
def remove_punctuation(words): new_words = [] for word in words: new_word = re.sub(r'[^\w\s]', '', word) if new_word != '': new_words.append(new_word) return(new_words)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_punctuations(tokenized_word_list):\n puncuations = set(string.punctuation)\n\n double_quote = '\\'\\''\n double_sign = '``'\n\n puncuations.add(double_quote)\n puncuations.add(double_sign)\n\n filtered_tokens = [word for word in tokenized_word_list if word not in puncuations]\n retu...
[ "0.8443081", "0.8359836", "0.83513975", "0.83284754", "0.82877874", "0.82877874", "0.82877874", "0.82877874", "0.82877874", "0.82877874", "0.82532126", "0.8141095", "0.8114269", "0.8062185", "0.79808336", "0.7978225", "0.79177517", "0.7864343", "0.7798762", "0.77926224", "0.7...
0.8250404
11