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
Return a number of bins for this dataset using the FreedmanDiaconis rule.
def binning(data, low, high): if len(data) == 0: return 1 mask1 = (data >= low) mask2 = (data < high) mask3 = numpy.logical_and(mask1, mask2) data = data[mask3] if len(data) == 0: return 10 data.sort() q1 = data[int(math.floor(0.25*len(data)))] q3 = data[int(math.floor(0.75*len(da...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def freedman_diaconis_bins(self, arr):\n # From https://stats.stackexchange.com/questions/798/\n if len(arr) < 2:\n return 1\n # Calculate the iqr ranges.\n self.iqr(arr)\n # Calculate the h\n h = 2 * (self.q3 - self.q1) / (len(arr) ** (1 / 3))\n # fall b...
[ "0.69271", "0.6696379", "0.6671535", "0.6590386", "0.6581825", "0.65656954", "0.6553514", "0.6543408", "0.6536041", "0.6536041", "0.65276605", "0.6514374", "0.6472568", "0.6446772", "0.64086914", "0.6390756", "0.6386423", "0.6348384", "0.6332559", "0.6332559", "0.6318721", ...
0.0
-1
Quickly obtain a number of seconds from the current time or a given time.
def timesec(year=None, month=None, day=None, hour=None, min=None, sec=None): seconds, subsecs = divmod(time.time(), 1) now = time.gmtime(int(seconds)) if year is None: year = now.tm_year if month is None: month = now.tm_mon if day is None: day = now.tm_mday if hour is None: hour = now.tm_hour ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def SECOND(time):\n\n return _make_datetime(time).second", "def currentTimeSecs():\n return time.time()", "def _current_time_seconds(self):\n return int(round(time.time()))", "def get_time_ms():\n return int(round(time.time() * 1000))", "def current_time_seconds(self):\n return int(rou...
[ "0.737952", "0.7302293", "0.72305924", "0.72084624", "0.7106146", "0.70204425", "0.6925001", "0.6913195", "0.6887243", "0.67612076", "0.6753471", "0.67462283", "0.6736127", "0.6720788", "0.6720726", "0.67097896", "0.6701813", "0.6694461", "0.6694461", "0.6694461", "0.6694461"...
0.5976235
85
Convert a time string or many time strings into a number(s) of seconds.
def fromtimestring(timestrings, format, subseconds=False, t0=0.): if isinstance(t0, (numbers.Number, numpy.number)) or format is None: t0 = float(t0) else: if subseconds: pytimestring, subsecs = t0.split(".") subsecs = float("0." + subsecs) else: pyti...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def str2seconds(strtime):\n\n result = 0\n\n for i in re.split(r\"([0-9]+[a-z]+)\", strtime):\n\n stri = i.strip().lower() # Case insensitive\n if not stri:\n continue\n\n digits = \"\".join([i for i in stri if i.isdigit()])\n\n if len(stri) == len(digits): # Without ...
[ "0.790042", "0.77960193", "0.7617983", "0.75185776", "0.7437581", "0.7420613", "0.735528", "0.731489", "0.72933215", "0.72796965", "0.72436625", "0.7190395", "0.71774894", "0.7173548", "0.7173548", "0.71201843", "0.7105515", "0.7100587", "0.70640224", "0.70492315", "0.7029429...
0.0
-1
Convert a number of seconds or a list of numbers into time string(s).
def totimestring(timenumbers, format, subseconds=False, t0=0.): if isinstance(t0, (numbers.Number, numpy.number)): t0 = float(t0) else: if subseconds: pytimestring, subsecs = t0.split(".") subsecs = float("0." + subsecs) else: pytimestring, subsecs = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def time_str(num):\n if num > 3600:\n return \"%0.2f hrs\" % (num / 3600)\n elif num > 60:\n return \"%0.2f mins\" % (num / 60)\n else:\n return \"%d seconds\" % num", "def format_seconds(num_seconds: Union[int, float]) -> str:\n # todo: maybe negative numbers should be in bracke...
[ "0.7215992", "0.6938643", "0.6798597", "0.6684981", "0.65917695", "0.6566157", "0.65319616", "0.6497229", "0.64805907", "0.6471903", "0.6455611", "0.6445046", "0.6428167", "0.63516116", "0.6350956", "0.6350658", "0.63335466", "0.6327067", "0.6322626", "0.63068676", "0.6297793...
0.65031767
7
Set x tickmarks to temporally meaningful values.
def timeticks(major, minor, format="%Y-%m-%d %H:%M:%S", subseconds=False, t0=0., start=None): if start is None: start = t0 if isinstance(start, basestring): start = fromtimestring(start, format, subseconds, t0) def timeticks(low, high): newstart = math.ceil((low - start)/major) * major + start ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_integer_xticks(self, set_ticks = False):\n self._x_integer_ticks = True", "def py_apply_ticks(self, plot):\n if self.x_ticks is not None:\n plot.set_xticks(self.x_ticks)\n if self.x_labels is not None:\n plot.set_xticklabels(self.x_labels)\n if self.y_tic...
[ "0.7056864", "0.6957497", "0.6462958", "0.61831015", "0.6142413", "0.60997754", "0.6065084", "0.6055155", "0.60530174", "0.597969", "0.5962037", "0.59546316", "0.5927258", "0.5920369", "0.5879339", "0.58592063", "0.5858137", "0.5835507", "0.5826103", "0.58144534", "0.5717638"...
0.0
-1
This function includes all of the measurements and variables for the bricks
def __init__(self, width, height, color, main_surface): self.main_surface = main_surface self.width = width self.height = height self.color = color
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getBarySamples(self):\n self.XC1Fields = np.zeros([self.nSample, self.nCell_cfd])\n self.XC2Fields = np.zeros([self.nSample, self.nCell_cfd])\n self.c1Fields = np.zeros([self.nSample, self.nCell_cfd])\n self.c2Fields = np.zeros([self.nSample, self.nCell_cfd])\n self.c3Fields ...
[ "0.59622735", "0.5801456", "0.5714045", "0.56901675", "0.567993", "0.5640426", "0.5636425", "0.56289315", "0.55658686", "0.5565351", "0.55215836", "0.55199933", "0.54793805", "0.54666305", "0.54627633", "0.5459547", "0.54510325", "0.5426512", "0.5420701", "0.542021", "0.54160...
0.0
-1
This function draws the bricks
def draw_brick(self, x, y): pygame.draw.rect(self.main_surface, self.color, (x, y, self.width, self.height), 0) pygame.display.update()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def drawBricks(self, view):\n for a in self._bricks:\n a.draw(view)", "def newBricks(self, view):\n self.__init__()\n for i in range(BRICK_ROWS):\n self._bricks.extend(create_brick_row(i))\n for brick in self._bricks:\n brick.draw(view)\n self.d...
[ "0.7610794", "0.70125526", "0.6783159", "0.6544072", "0.6480906", "0.6443306", "0.63650465", "0.6316012", "0.6291486", "0.62352437", "0.62313396", "0.62061805", "0.6197166", "0.61571187", "0.6140718", "0.61333686", "0.6110781", "0.60986227", "0.6045685", "0.5935241", "0.59336...
0.6807062
2
Load the ui file for the applet drawer, which we own.
def initAppletDrawerUic(self): with Tracer(traceLogger): # Load the ui file (find it in our own directory) localDir = os.path.split(__file__)[0]+'/' # (We don't pass self here because we keep the drawer ui in a separate object.) self.drawer = uic.loadUi(localDir+"...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_gui():\r\n\r\n print(\"\\nLoading graphical user interface...\\n\")\r\n SongStorageGUI().mainloop()", "def loadUI(self,factory={'GLOB':Glob,'BOOK':Book,'SCPT':Scpt,'CELL':Cell}):\n FileRep.loadUI(self,factory)", "def loadForm(self):\n\n formUI = os.path.join(sys.path[0], 'views/acq...
[ "0.63236564", "0.60985297", "0.6043393", "0.6038417", "0.5976114", "0.5816129", "0.57881004", "0.5724756", "0.57222754", "0.5704641", "0.5683649", "0.5668115", "0.56456685", "0.56370246", "0.5625678", "0.5599373", "0.5575998", "0.55754936", "0.5525895", "0.5523762", "0.551148...
0.7867472
0
Load the GUI from the ui file into this class and connect it with event handlers.
def initCentralUic(self): self.initFileTableWidget() self.initViewerStack() self.splitter.setSizes([150, 850])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_gui():\r\n\r\n print(\"\\nLoading graphical user interface...\\n\")\r\n SongStorageGUI().mainloop()", "def InitUI(self):\n\t\tself._initMenuBar()\n\t\tself._initLayout()\n\t\t\n\t\t# Bindings\n\t\tself.Bind(wx.EVT_BUTTON, self.OnButtonClicked)\n\t\t\n\t\t# We can't even start without an input file...
[ "0.74387133", "0.73665154", "0.7134974", "0.7073232", "0.70021194", "0.6954133", "0.6943297", "0.6935844", "0.69270736", "0.691732", "0.68945724", "0.68652666", "0.68619984", "0.6795575", "0.67894846", "0.6788402", "0.6769412", "0.6755813", "0.6755813", "0.67467767", "0.66974...
0.0
-1
The user clicked the "Add File" button. Ask him to choose a file (or several) and add them to both the GUI table and the toplevel operator inputs.
def handleAddFileButtonClicked(self): # Find the directory of the most recently opened image file mostRecentImageFile = PreferencesManager().get( 'DataSelection', 'recent image' ) if mostRecentImageFile is not None: defaultDirectory = os.path.split(mostRecentImageFile)[0] els...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_file_input(\n self,\n name: str,\n label: Optional[str] = None,\n source: Optional[str] = None,\n file_type: Optional[str] = None,\n multiple: bool = False,\n ) -> None:\n\n def on_pick_result(event: FilePickerResultEvent):\n if event.files:\n ...
[ "0.64918983", "0.6431509", "0.6418309", "0.6305412", "0.61918384", "0.61420715", "0.610769", "0.60797346", "0.6059743", "0.6056999", "0.60375744", "0.59630734", "0.5940347", "0.5890774", "0.5878446", "0.5872943", "0.5860542", "0.58562905", "0.5852387", "0.5851146", "0.5833489...
0.69240236
0
The user clicked the "Import Stack Directory" button.
def handleAddStackButtonClicked(self): # Find the directory of the most recently opened image file mostRecentStackDirectory = PreferencesManager().get( 'DataSelection', 'recent stack directory' ) if mostRecentStackDirectory is not None: defaultDirectory = os.path.split(mostRecentStac...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handleAddStackFilesButtonClicked(self):\n # Find the directory of the most recently opened image file\n mostRecentStackImageFile = PreferencesManager().get( 'DataSelection', 'recent stack image' )\n if mostRecentStackImageFile is not None:\n defaultDirectory = os.path.split(most...
[ "0.63807386", "0.60662997", "0.596505", "0.59516096", "0.59324336", "0.5866149", "0.5780327", "0.5672773", "0.5672773", "0.5672773", "0.5588122", "0.55458176", "0.5526395", "0.5451664", "0.53536344", "0.5325478", "0.53163785", "0.52934563", "0.5268285", "0.52584463", "0.51927...
0.7046417
0
The user clicked the "Import Stack Files" button.
def handleAddStackFilesButtonClicked(self): # Find the directory of the most recently opened image file mostRecentStackImageFile = PreferencesManager().get( 'DataSelection', 'recent stack image' ) if mostRecentStackImageFile is not None: defaultDirectory = os.path.split(mostRecentSta...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handleAddStackButtonClicked(self):\n # Find the directory of the most recently opened image file\n mostRecentStackDirectory = PreferencesManager().get( 'DataSelection', 'recent stack directory' )\n if mostRecentStackDirectory is not None:\n defaultDirectory = os.path.split(mostR...
[ "0.7401952", "0.60361826", "0.5968294", "0.5963187", "0.5903095", "0.5903095", "0.5903095", "0.5888331", "0.58152413", "0.57804424", "0.5680004", "0.56641406", "0.5612863", "0.55243236", "0.54665464", "0.5428981", "0.54050756", "0.53769785", "0.5372776", "0.53452855", "0.5321...
0.7355732
1
Launch an "Open File" dialog to ask the user for one or more image files.
def getImageFileNamesToOpen(self, defaultDirectory): extensions = OpDataSelection.SupportedExtensions filt = "Image files (" + ' '.join('*.' + x for x in extensions) + ')' options = QFileDialog.Options() if ilastik_config.getboolean("ilastik", "debug"): options |= QFileDialo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def selectFile(title=\"Select image\", initialdir=None, multiple=False):\r\n file = filedialog.askopenfilename(\r\n initialdir=initialdir,\r\n multiple=multiple,\r\n title=title\r\n )\r\n return file", "def open_files():\n import Tkinter\n import tkFileDial...
[ "0.71490604", "0.7085282", "0.70119643", "0.69890976", "0.69593513", "0.6935807", "0.6925271", "0.68205", "0.6623227", "0.6606702", "0.65966076", "0.65714514", "0.65665215", "0.6526502", "0.6515496", "0.6498538", "0.6467295", "0.6463145", "0.64520234", "0.6436567", "0.6420097...
0.6250779
28
The word 'glob' is used loosely here. See the OpStackLoader operator for details.
def importStackFromGlobString(self, globString): globString = globString.replace("\\","/") info = DatasetInfo() info.filePath = globString # Allow labels by default if this gui isn't being used for batch data. info.allowLabels = ( self.guiMode == GuiMode.Normal ) def im...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def locGlob(): \n #glob = \"From Internal Local Name Space\" # Toggle Comment\n print(glob)\n\n return", "def test_glob_pattern(self):\n glob_pattern = GlobPattern()\n det_name = 'R22_S11'\n self.assertEqual(glob_pattern('fe55', det_name),\n 'fe55_fe55_*/*_{}...
[ "0.6904358", "0.62507033", "0.6115817", "0.6093213", "0.5870921", "0.585917", "0.5644251", "0.5596094", "0.55333716", "0.5516278", "0.5372138", "0.5367748", "0.53069293", "0.5204023", "0.519716", "0.5191702", "0.50825864", "0.50751287", "0.5039543", "0.5035867", "0.5022817", ...
0.52720916
13
Add the given filenames to both the GUI table and the toplevel operator inputs.
def addFileNames(self, fileNames): with Tracer(traceLogger): infos = [] oldNumFiles = len(self.topLevelOperator.Dataset) # HACK: If the filePath isn't valid, replace it # This is to work around the scenario where two independent data selection applets are coupled...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_files(self):\n file_paths = tkinter.filedialog.askopenfilenames(parent=self)\n\n if not file_paths:\n return\n for file_path in file_paths:\n self.files_treeview.insert(\"\", \"end\", values=(file_path,))\n self.files_treeview.selection_set(self.files_treev...
[ "0.6075016", "0.6000558", "0.596491", "0.58751535", "0.5829462", "0.57028913", "0.5648508", "0.56384313", "0.56383616", "0.5623524", "0.5554015", "0.55150545", "0.54891205", "0.5437899", "0.53998584", "0.53493977", "0.5336115", "0.5292974", "0.5270632", "0.525856", "0.524532"...
0.6710461
0
Update the given rows using the toplevel operator parameters
def updateTableForSlot(self, slot, *args): with Tracer(traceLogger): # Don't update anything if the slot doesn't have data yet if not slot.connected(): return # Which index is this slot? row = -1 for i in range( len(self.topLevelOpera...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(self, updates, predicate):\n for row in self.rows:\n if predicate(row):\n for column, new_value in updates.items():\n row[column] = new_value", "def updateRow(self, index: int) -> None:\n ...", "def setRow(self, row):\n # Row of the d...
[ "0.62828267", "0.59299856", "0.58693624", "0.58242786", "0.5797138", "0.5753691", "0.5725859", "0.56664556", "0.5620474", "0.55361575", "0.5500609", "0.5478034", "0.5427957", "0.5427957", "0.54237574", "0.5380283", "0.5317558", "0.52668935", "0.5243685", "0.52374893", "0.5236...
0.48500547
55
The user (un)checked the "allow labels" checkbox in one of the table rows. Update the corresponding dataset info in the operator (which is given in the parameter 'slot')
def handleAllowLabelsCheckbox(self, slot, checked): with Tracer(traceLogger): # COPY the dataset so we trigger the slot to be dirty newDatasetInfo = copy.copy(slot.value) newDatasetInfo.allowLabels = ( checked == Qt.Checked ) # Only update if necessary ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def updateTableForSlot(self, slot, *args):\n with Tracer(traceLogger):\n\n # Don't update anything if the slot doesn't have data yet\n if not slot.connected():\n return\n\n # Which index is this slot?\n row = -1\n for i in range( len(self...
[ "0.6179488", "0.5845522", "0.58064353", "0.5581023", "0.55638903", "0.5357033", "0.52947384", "0.5255203", "0.5205964", "0.518046", "0.51680946", "0.5164398", "0.5143642", "0.5132615", "0.5130291", "0.5119018", "0.51143825", "0.50607854", "0.5041646", "0.4999295", "0.4979582"...
0.6519952
0
Create and add the combobox for storage location options
def updateStorageOptionComboBox(self, row, filePath): assert threading.current_thread().name == "MainThread" with Tracer(traceLogger): # Determine the relative path to this file absPath, relPath = getPathVariants(filePath, self.topLevelOperator.WorkingDirectory.value) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_combo_box(self, name, value=None, options=None, label=None, add_indicator=None):\n widget=QtWidgets.QComboBox(self)\n widget.setObjectName(_fromUtf8(self.name+\"_\"+name))\n if options:\n widget.addItems(options)\n if value is not None:\n widget.set...
[ "0.63493586", "0.57815427", "0.5772928", "0.57538795", "0.5747907", "0.5733699", "0.5682541", "0.56459165", "0.5585773", "0.5577615", "0.5562045", "0.55241734", "0.548213", "0.543225", "0.54069054", "0.5350624", "0.53404826", "0.5329477", "0.53247994", "0.5262176", "0.5246481...
0.6170078
1
The user manually edited a file name in the table. Update the operator and other GUI elements with the new file path.
def handleRowDataChange(self, changedItem ): with Tracer(traceLogger): # Figure out which row this widget is in row = changedItem.row() column = changedItem.column() # Can't update until the row is fully initialized needUpdate = True needU...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def updateFilePath(self, index):\n with Tracer(traceLogger):\n oldLocationSetting = self.topLevelOperator.Dataset[index].value.location\n\n # Get the directory by inspecting the original operator path\n oldTotalPath = self.topLevelOperator.Dataset[index].value.filePath.repla...
[ "0.66101885", "0.64000237", "0.64000237", "0.6362748", "0.62647414", "0.62446743", "0.62028664", "0.61208254", "0.6117045", "0.6081102", "0.6037847", "0.60202473", "0.59801805", "0.59678453", "0.5946963", "0.59453547", "0.59417", "0.58884573", "0.5861818", "0.5850862", "0.583...
0.0
-1
Update the operator's filePath input to match the gui
def updateFilePath(self, index): with Tracer(traceLogger): oldLocationSetting = self.topLevelOperator.Dataset[index].value.location # Get the directory by inspecting the original operator path oldTotalPath = self.topLevelOperator.Dataset[index].value.filePath.replace('\\', '...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def input_file_chooser(self):\n filename = tk.filedialog.askopenfilename()\n self._input_path_var.set(filename)", "def browse_files_out(self,*args):\n path_to_data = tkFileDialog.askopenfilename()\n #show chosen value in textframe\n self.docstring_offers.delete(0,tk.END)\n ...
[ "0.7001716", "0.6854931", "0.6504425", "0.6456651", "0.638439", "0.6247839", "0.6225895", "0.6196959", "0.6188512", "0.6188512", "0.617856", "0.6092836", "0.6067322", "0.60563415", "0.60496354", "0.6038306", "0.6024043", "0.5992593", "0.59883094", "0.5973095", "0.59682596", ...
0.66875553
2
The user clicked the "Remove" button. Remove the currently selected row(s) from both the GUI and the toplevel operator.
def handleRemoveButtonClicked(self): with Tracer(traceLogger): # Figure out which dataset to remove rowsToDelete = set() selectedRanges = self.fileInfoTableWidget.selectedRanges() for rng in selectedRanges: for row in range(rng.topRow(), rng.bottom...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_row(self):\n if len(self.columns[\"rows\"].children) > 0:\n self.selects.pop()\n self.button_groups.pop()\n self.buttons[\"edit\"].pop()\n self.columns[\"rows\"].children.pop()", "def removeObject(self):\n\t\tfor SelectedItem in self.objects_lw.select...
[ "0.75775635", "0.73554677", "0.69494325", "0.68314517", "0.6789492", "0.6658385", "0.6601661", "0.6563126", "0.65295523", "0.6529164", "0.6499993", "0.6471326", "0.64638305", "0.6461784", "0.6439678", "0.64392084", "0.63918245", "0.638411", "0.6379691", "0.6368745", "0.635695...
0.7852163
0
Handles changes to any combo change in the table (either external path or internal path)
def handleComboSelectionChanged(self, combo, index): with Tracer(traceLogger): logger.debug("Combo selection changed: " + combo.itemText(1) + str(index)) # Figure out which row this combo is in tableWidget = self.fileInfoTableWidget changedRow = -1 fo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def comboBoxChanged(self):\n new_action = self.ui.comboBoxAction.currentText().lower()\n self.parameters['action'] = new_action\n\n self.changed.emit()", "def _callback_combo_cell(self, cell, path, row, position, treemodel):\r\n\r\n _model = cell.get_property('model')\r\n _text...
[ "0.6172025", "0.5913377", "0.58997405", "0.5888051", "0.58503884", "0.58247435", "0.57801026", "0.57432413", "0.5640571", "0.563494", "0.5616561", "0.56068355", "0.5606437", "0.5573447", "0.5563066", "0.55510837", "0.54804873", "0.54715496", "0.5466768", "0.5444184", "0.54320...
0.60713905
1
Any time the user selects a new item, select the whole row.
def handleTableSelectionChange(self): self.selectEntireRow() self.showSelectedDataset()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def people_item_select(self):\n # Whenever the people table subjects have been selected\n # grey out the checkin button\n self.row_i = self.people_table.currentRow()\n # TODO: okay to return DF of empty?\n # might want to clear other things when no results\n if self.row_i...
[ "0.7052263", "0.70413625", "0.6938748", "0.6933411", "0.6897258", "0.6846295", "0.66692257", "0.66188014", "0.6579844", "0.65542483", "0.65015703", "0.649491", "0.6468015", "0.6384764", "0.63539386", "0.63495123", "0.63334334", "0.63334334", "0.6275927", "0.6255295", "0.62136...
0.72043216
0
Instantiates the Flask instance and associated parameters.
def create_app(config_filename): app = Flask(__name__) app.config.from_object(config_filename) from app import api_bp app.register_blueprint(api_bp, url_prefix='/api') from Model import db with app.app_context(): db.init_app(app) db.create_all([None]) return ap...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize():\n app = Flask(__name__)\n # Load private config at instance/config.py\n config_path = 'instance/config.py'\n if os.path.exists(config_path):\n app.config.from_pyfile(os.path.abspath(config_path))\n\n # Initialize database\n init_db(\n app.config['DB_USERNAME'],\n ...
[ "0.7546474", "0.7465154", "0.7437626", "0.729399", "0.71954864", "0.71917486", "0.71597254", "0.70166236", "0.70074224", "0.69816077", "0.6921856", "0.6921187", "0.69106394", "0.6906584", "0.6897556", "0.6897512", "0.68827015", "0.68768495", "0.68698466", "0.6868935", "0.6865...
0.0
-1
Return a resource instance as an attribute. If the resource hasn't yet been loaded into cache, it will be imported, fetched from the module, and cached. Subsequent attribute fetches for this resource will be returned from the cache.
def __getattr__(self, name): if name.startswith('__'): # Don't attempt to look up any special function/operator names # as modules. This was first noticed as a series of errors caused # by Sphinx's autodoc introspection code. return super(ResourcesRegistry, self)....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __cached(self):\n # already cached stuff\n if self._cached is None:\n self._cached = Cached(self.resource)\n return self._cached", "def __getattr__(self, resource):\n return ResourceManager(self, resource)", "def get(module: str, attribute: str):\n return _manageAt...
[ "0.65890276", "0.6446413", "0.6415658", "0.62708116", "0.6201392", "0.6089802", "0.60478544", "0.6004497", "0.5988703", "0.5988703", "0.5901449", "0.58880585", "0.5815014", "0.58120877", "0.57987595", "0.57940334", "0.5776671", "0.5739819", "0.5716186", "0.5710766", "0.571076...
0.61004335
5
Register model to resource mappings. Subclasses must override this to do any registration they may need.
def register_resources(self): raise NotImplementedError
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register_resource_for_model(model, resource):\n _model_to_resources[model] = resource", "def register_model(self, model):\n\n self._model = model", "def register(cls, model):\n cls.models[model] = True", "def register(self, *model):\n for m in model:\n m.Register()\n self.mo...
[ "0.7501223", "0.6653077", "0.65550554", "0.6108307", "0.6104962", "0.59786534", "0.5913898", "0.58804697", "0.57783335", "0.57450867", "0.5733444", "0.56834364", "0.56577826", "0.5607221", "0.555102", "0.55320704", "0.5526848", "0.5526848", "0.5513127", "0.54973423", "0.54528...
0.6685671
1
Register a resource as the official location for a model.
def register_resource_for_model(model, resource): _model_to_resources[model] = resource
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _register_resource(self, name):\n GlobalClass.register(self)\n tag = self.module.name.lower()\n group = self.config.xpath(self.xpath + \"/\" + tag)[0]\n group_mysql4 = group.tag + \"_mysql4\"\n resource_model = find_or_create(group, \"resourceModel\")\n resource_model....
[ "0.6097805", "0.6078597", "0.6000599", "0.59710836", "0.596382", "0.5836003", "0.58176094", "0.58176094", "0.5783218", "0.5745019", "0.5735456", "0.5614592", "0.5565347", "0.55405563", "0.5499648", "0.5370664", "0.5360497", "0.53290606", "0.52897364", "0.5284575", "0.5260971"...
0.73618525
0
Remove the official location for a model.
def unregister_resource_for_model(model): del _model_to_resources[model]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __location_del(self):\n self.db_location = None\n self.save(update_fields=[\"db_location\"])", "def location(self):\n del self._location", "def remove_location(self, **kwargs):\n \n self.options.update(kwargs)\n self.options['action'] = 'locator.location.remove'\n ...
[ "0.6723639", "0.66767335", "0.6262924", "0.61227584", "0.6120357", "0.6023274", "0.59902483", "0.59236014", "0.58762664", "0.58372384", "0.5804065", "0.57834613", "0.5683986", "0.5682015", "0.5653655", "0.5647387", "0.5603276", "0.5592522", "0.55893296", "0.5589141", "0.55840...
0.56138283
16
Return the resource for an object.
def get_resource_for_object(obj): from djblets.webapi.resources.base import WebAPIResource cls = obj.__class__ # Deferred models are a subclass of the actual model that we want to look # up. if getattr(obj, '_deferred', False): cls = cls.__bases__[0] resource = _model_to_resources.get...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_object ( self, object ):\n return object", "def resource(self):\n return self._resource", "def resource(self):\n return self._resource", "def resource(self):\n return self._resource", "def resource(self):\n return self._resource", "def resource(self):\n r...
[ "0.7132309", "0.70808786", "0.70808786", "0.70808786", "0.70808786", "0.70808786", "0.70808786", "0.70808786", "0.69478905", "0.6892674", "0.6882015", "0.6850975", "0.6826252", "0.680579", "0.6796926", "0.67565787", "0.6696587", "0.66093224", "0.6583387", "0.6565771", "0.6481...
0.7670397
0
Return the resource of the specified name.
def get_resource_from_name(name): return _name_to_resources.get(name, None)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_resource(self, name: str) -> Resource:\n return self.get_session.query(self.resource_model).filter_by(name=name).one_or_none()", "def GetResource(self, name):\r\n matches = [x for x in self.resources if x.name == name]\r\n if len(matches) == 1:\r\n return matches[0]\r\n elif len(matc...
[ "0.82805157", "0.80796313", "0.796345", "0.78018993", "0.7711447", "0.72921443", "0.727059", "0.7054507", "0.7051002", "0.7009372", "0.6961014", "0.69041646", "0.68261045", "0.6757441", "0.67551", "0.67448837", "0.67232054", "0.6704062", "0.6703346", "0.6686181", "0.6673515",...
0.88857186
0
Return the resource with the specified resource class.
def get_resource_from_class(klass): return _class_to_resources.get(klass, None)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resource_class(self):\n resource_module = '.'.join(self.resource_class_path.split('.')[:-1])\n resource_class_name = self.resource_class_path.split('.')[-1]\n return getattr(import_module(resource_module), resource_class_name)", "def resource_class(self):\n resource_module = '.'.j...
[ "0.7832141", "0.7832141", "0.7712705", "0.6950276", "0.68987846", "0.66122043", "0.6541201", "0.6495036", "0.6437813", "0.6411328", "0.6365627", "0.63542414", "0.6345779", "0.63337135", "0.6322805", "0.63152754", "0.62987596", "0.62941813", "0.62185717", "0.6204819", "0.62022...
0.8665222
0
Unregister a resource from the caches.
def unregister_resource(resource): del _name_to_resources[resource.name] del _name_to_resources[resource.name_plural] del _class_to_resources[resource.__class__]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unregister(self, resource):\n for item in self.resources:\n if resource == item[\"resource\"]:\n item[\"status\"] = UNREGISTER", "def unregister(self):\r\n self._unregister()", "def _cache_drop(self, metric_name):\n with self._lock:\n del self.__cac...
[ "0.695629", "0.64772457", "0.6466498", "0.64457786", "0.6288041", "0.6288041", "0.61837035", "0.6126617", "0.6099737", "0.6067333", "0.6057097", "0.6050785", "0.60381985", "0.59959465", "0.59620714", "0.5961482", "0.5955716", "0.59399253", "0.5935144", "0.59329534", "0.586909...
0.7239517
0
Connect to market data server.
def connect_quote(self): try: self.quote_client = QuoteClient(self.client_config) self.symbol_names = dict( self.quote_client.get_symbol_names(lang=Language.zh_CN)) self.query_contract() except ApiException: self.write_log("查询合约失败") ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connect(self):\n self.conn.connect()", "async def _open_market_data_websocket(self):\n market_data_url = self._wss_url_base + \\\n '/v1/marketdata/BTCUSD?heartbeat=true'\n self._market_data_sock_info.ws = await websockets.client.connect(\n market_data_...
[ "0.6758905", "0.6684229", "0.6403466", "0.6322858", "0.62941265", "0.6277353", "0.6262684", "0.615094", "0.6145239", "0.60558206", "0.6024012", "0.601306", "0.6006173", "0.59702605", "0.59702605", "0.59368443", "0.5931306", "0.5895381", "0.5880848", "0.5874744", "0.58643043",...
0.5645965
56
Connect to trade server.
def connect_trade(self): self.trade_client = TradeClient(self.client_config) try: self.add_task(self.query_order) self.add_task(self.query_position) self.add_task(self.query_account) except ApiException: self.write_log("交易接口连接失败") retur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connectToServer(self):\n self.client = Client(base_url = self.server)\n self.ping()", "def connect(self):\n self.conn.connect()", "def connect(self):\n\n symbol = self.order.symbol\n\n if self.test:\n host = 'wss://testnet.bitmex.com/realtime'\n else:\n ...
[ "0.67305315", "0.66895556", "0.6657646", "0.6608166", "0.6548882", "0.6479017", "0.6472146", "0.64224577", "0.63764036", "0.63736725", "0.62640786", "0.6244553", "0.62354064", "0.6216869", "0.6200346", "0.61953896", "0.6190848", "0.61894286", "0.6174592", "0.6170257", "0.6144...
0.7262335
0
Connect to push server.
def connect_push(self): protocol, host, port = self.client_config.socket_host_port self.push_client = PushClient(host, port, (protocol == "ssl")) self.push_client.quote_changed = self.on_quote_change self.push_client.asset_changed = self.on_asset_change self.push_client.position...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _connect(self):\r\n self.sock = socket.socket()\r\n host = \"pubsub.pubnub.com\"\r\n port = 80\r\n if self.use_ssl:\r\n self.sock = ssl.wrap_socket(self.sock)\r\n port = 443\r\n self.sock.connect((host, port))\r\n self.connected = True", "def co...
[ "0.7291151", "0.6847644", "0.67866546", "0.67768633", "0.6661692", "0.6655104", "0.6596576", "0.6536159", "0.65285504", "0.6524723", "0.65192074", "0.65151745", "0.6496408", "0.6478729", "0.6464252", "0.6449753", "0.6418711", "0.6414711", "0.63653946", "0.63524014", "0.635009...
0.79299897
0
Process trade data for both query and update.
def process_deal(self, data): for i in data: if i.status == OrderStatus.PARTIALLY_FILLED or i.status == OrderStatus.FILLED: symbol, exchange = convert_symbol_tiger2vt(str(i.contract)) self.tradeid += 1 trade = TradeData( symbol=sym...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async def process_trade(self, data):\n for item in data:\n symbol = item[\"symbol\"]\n trade = {\n \"platform\": self._platform,\n \"symbol\": symbol,\n \"action\": ORDER_ACTION_BUY if item[\"side\"] == \"Buy\" else ORDER_ACTION_SELL,\n ...
[ "0.68010473", "0.6513125", "0.6495422", "0.6462116", "0.6318342", "0.6311736", "0.63095254", "0.6301807", "0.62855184", "0.6077452", "0.6056953", "0.603197", "0.60087824", "0.59963775", "0.59963775", "0.59963775", "0.59963775", "0.59313375", "0.591776", "0.5892385", "0.588439...
0.6608865
1
Convert symbol from vt to tiger.
def convert_symbol_tiger2vt(symbol): if symbol.encode("UTF-8").isalpha(): exchange = Exchange.SMART else: if len(symbol) < 6: exchange = Exchange.SEHK elif symbol.startswith("6"): exchange = Exchange.SSE elif symbol.endswith(".SH"): exchange = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_symbol_vt2tiger(symbol, exchange):\n if exchange == Exchange.SSE and symbol.startswith(\"0\"):\n symbol = symbol + \".SH\"\n else:\n symbol = symbol\n return symbol", "def to_symbol(text):\n text = text.upper()\n if text in (\"BGM\", \"BANGUMI\"):\n return \"bgm\"\...
[ "0.808804", "0.60368603", "0.5791044", "0.56720763", "0.5637549", "0.55791175", "0.55277675", "0.5505299", "0.5419636", "0.54013735", "0.53962946", "0.5395829", "0.53817433", "0.5333906", "0.5278394", "0.52763736", "0.5265407", "0.5249531", "0.52154344", "0.52097255", "0.5201...
0.81928307
0
Convert symbol from vt to tiger.
def convert_symbol_vt2tiger(symbol, exchange): if exchange == Exchange.SSE and symbol.startswith("0"): symbol = symbol + ".SH" else: symbol = symbol return symbol
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_symbol_tiger2vt(symbol):\n if symbol.encode(\"UTF-8\").isalpha():\n exchange = Exchange.SMART\n else:\n if len(symbol) < 6:\n exchange = Exchange.SEHK\n elif symbol.startswith(\"6\"):\n exchange = Exchange.SSE\n elif symbol.endswith(\".SH\"):\n ...
[ "0.81928307", "0.60368603", "0.5791044", "0.56720763", "0.5637549", "0.55791175", "0.55277675", "0.5505299", "0.5419636", "0.54013735", "0.53962946", "0.5395829", "0.53817433", "0.5333906", "0.5278394", "0.52763736", "0.5265407", "0.5249531", "0.52154344", "0.52097255", "0.52...
0.808804
1
Config symbol to corresponding currency
def config_symbol_currency(symbol): if symbol.encode("UTF-8").isalpha(): currency = Currency.USD else: if len(symbol) < 6: currency = Currency.HKD else: currency = Currency.CNH return currency
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getCurrencySymbol():", "def currency_symbol(self, init):\r\n\r\n c2 = CurrencyCodes()\r\n c_symbol = c2.get_symbol(init)\r\n return c_symbol", "def getCurrencySymbol(id=None):", "def getDefaultCurrency():", "def quote_currencies(self):\n pass", "def currency(self, currency...
[ "0.79462665", "0.74198484", "0.66513836", "0.6561869", "0.64658445", "0.6448337", "0.6419649", "0.6266505", "0.61048144", "0.6058995", "0.60494053", "0.6024492", "0.5996669", "0.5974246", "0.58935475", "0.5873423", "0.5847701", "0.5830133", "0.5808687", "0.58026433", "0.57539...
0.79219276
1
Strip the leading and trailing whitespace of a given text
def strip_whitespace(self, text): return text.strip()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_whitespaces(text: str) -> str:\n return text.lstrip().rstrip()", "def remove_leading_whitespace_and_empty_lines(text: str) -> str:\n # We call lstrip() twice on the same line. This is inefficient but ok for small unit tests.\n # Please change it if you want to.\n return '\\n'.join([lin...
[ "0.80575657", "0.78265435", "0.77780694", "0.7634085", "0.7620508", "0.7521066", "0.7518481", "0.74882275", "0.74422944", "0.73665917", "0.7358045", "0.73027694", "0.7300915", "0.7294546", "0.7215683", "0.71842605", "0.71270746", "0.71270746", "0.709766", "0.7091407", "0.7085...
0.8302335
0
Delete any whitespace in a given string
def del_whitespace(selfs, text): return text.replace(' ', '')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strip_space(string):\n return string.replace(' ', '')", "def _clean(self, string):\n return re.sub('\\s+', ' ', string).strip()", "def remove_white_spaces(input_string):\n return re.sub(r'\\s+', ' ', input_string).strip()", "def _clean(s):\n return re.sub(r'\\s+', ' ', s.strip())", "def...
[ "0.8386853", "0.8282755", "0.8259965", "0.8231743", "0.82165647", "0.81852895", "0.8062439", "0.7945549", "0.79050696", "0.7848309", "0.7831649", "0.7806161", "0.7806161", "0.77685887", "0.77685887", "0.7742288", "0.76699007", "0.7577561", "0.7572943", "0.7553713", "0.7528789...
0.81443447
6
Uppercase all characer in a given string
def to_upper(self, text): return text.upper()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upper(string):\n new_string = '' # Empty string to append to\n for char in string: # Itterate over each character in user's string\n if char.isalpha() and not char.isupper(): # If the character is an alphabet and not already uppercase\n char = (chr(ord(char) - 32)) # Subtract 32 from it...
[ "0.790776", "0.7735673", "0.77356625", "0.7521186", "0.74673855", "0.74584377", "0.7438182", "0.7413072", "0.7411056", "0.73737097", "0.7281533", "0.7273776", "0.7201532", "0.7180221", "0.7129265", "0.70013803", "0.6978227", "0.6964081", "0.69567746", "0.6934419", "0.68477446...
0.7509662
4
Format the output of a course
def format_course_output(self, course, schedule): # handle schedule str_list = schedule.schedule.strip().split(' ') sch_res = '' if (len(str_list) >= 6): val_list = str_list[:6] val_list[5] = val_list[5][:3] # time time = val_list[0] + ' ' + val_list[1] + ' ' + val_list[2] + ' ' + val_list[3]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_output(filtered_courses_list):\n\n if not filtered_courses_list:\n print(\"No courses matched the query.\")\n return\n\n max_name_length = max([len(course.name) for course in filtered_courses_list])\n\n print(\" Sem | Course ID | Pts | \" +\n \" \" * ((max_name_length - 1...
[ "0.6944422", "0.6730091", "0.6578019", "0.6519152", "0.6504523", "0.6474363", "0.642245", "0.6395715", "0.6341537", "0.61744756", "0.6163076", "0.6133065", "0.6130324", "0.6114346", "0.60810196", "0.60802037", "0.59981614", "0.5904079", "0.5876718", "0.5844278", "0.5802319", ...
0.7844055
0
Given the input string (course code), return the course
def get_course_by_code(input): res = None user_input = input input = str(input) # clean input input = util.strip_whitespace(input) input = util.del_whitespace(input) input = util.to_upper(input) print input course = query_cat.filter(Course.course_code == input).first() schedule = query_sch.filter(Schedule...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def course_name(input):\n for course in config.current_courses:\n if strip_string(course) == strip_string(input):\n return course\n\n return input", "def _parse_course_id_from_string(input_str):\r\n m_obj = re.match(r'^/courses/(?P<course_id>[^/]+/[^/]+/[^/]+)', input_str)\r\n if m_...
[ "0.7170098", "0.7058149", "0.70250374", "0.67529607", "0.67248166", "0.6541851", "0.6528558", "0.6477524", "0.64641935", "0.64081264", "0.6382256", "0.6375246", "0.62365013", "0.6080567", "0.60732913", "0.6056371", "0.60557353", "0.6053482", "0.6018583", "0.5958772", "0.59036...
0.76620525
0
Given the input string (key words), return the course
def get_course_by_key_words(input):
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def course_name(input):\n for course in config.current_courses:\n if strip_string(course) == strip_string(input):\n return course\n\n return input", "def _course_key_from_string(self, string):\r\n return self.course_locations[string].course_key", "def get_courses(std):\n retur...
[ "0.693951", "0.6872825", "0.6350646", "0.6082056", "0.60421014", "0.6014495", "0.5844915", "0.57037026", "0.5657913", "0.5654991", "0.5654512", "0.5646173", "0.56458086", "0.56419003", "0.55879545", "0.55596834", "0.55547255", "0.5543785", "0.553146", "0.5529814", "0.5440121"...
0.85511416
0
Run new owl server for given `pipeline` Returns port of the created server
def new_server(self, name, pipeline, port=None): if port is None: port = self.next_port self.next_port += 1 self.servers[name] = port args = ["owl-server","--port", str(port)] + pipeline.split() proc = subprocess.Popen(args) self.processes[port] = proc ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main(port):\n ps = PathologicalServer(\"localhost\", port, _responses)\n ps.start()", "def run(*port):\n print(port)\n if port:\n port = port[0]\n else:\n port = 8000\n external_ip = '0.0.0.0:{}'.format(port)\n _manage('runserver %s' % external_ip)", "async def net_server(pip...
[ "0.6003155", "0.56016594", "0.55983025", "0.5577207", "0.55736977", "0.5468409", "0.5451809", "0.54441744", "0.5419513", "0.5376845", "0.5339203", "0.5296844", "0.5291677", "0.5291677", "0.5290636", "0.5287376", "0.5261708", "0.52436334", "0.5235279", "0.5222004", "0.52121824...
0.79979473
0
Terminate server for listening on given `port`.
def terminate_server(self, port): proc = self.processes.pop(port, None) if proc is None: raise ValueError(f"Server for port {port} does not exists." "It might have been closed already." ) proc.terminate()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def kill_process_by_port(port):\n port = int(port)\n pid = get_pid_by_port(port)\n if pid:\n return kill(pid)", "def stop_echo_server(self, ip_addr='localhost',\n port=zephyr_constants.DEFAULT_ECHO_PORT):\n out = None\n if (port in self.echo_server_procs and\...
[ "0.6641947", "0.6628325", "0.6453124", "0.6397097", "0.63918346", "0.63025546", "0.6299923", "0.6299426", "0.6281496", "0.6214558", "0.6181251", "0.6174334", "0.61625504", "0.6139271", "0.61364913", "0.61274475", "0.6123971", "0.6084454", "0.60776997", "0.60655427", "0.603590...
0.8301901
0
Return all client commands
def print_ports(self, file=None): lines = [] for name, port in self.servers.items(): lines.append(f"{name}:{port}") if file is not None: print("\n".join(lines), file=file) return "\n".join(lines)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_commands(self):\r\n return self._commands", "def commands(self) -> List[Command]:\n return []", "def get_commands(self):\n return list(self.commands.values())", "def list_commands():\n print(' ')\n print('Chat Client Commands')\n print('-----------------------')\n pr...
[ "0.7469627", "0.7433225", "0.73863494", "0.7370501", "0.7369048", "0.7327095", "0.72978747", "0.7268624", "0.7262184", "0.7222672", "0.7217292", "0.7210814", "0.7152034", "0.71388197", "0.7100221", "0.7077035", "0.7048432", "0.6971724", "0.6926512", "0.69023913", "0.6901513",...
0.0
-1
Loads ports from file Loaded servers cannot be terminated
def load_ports_from_file(self, filename): lines = open(filename, "r").readlines() for line in lines: name, port = line.split(":") self.servers[name] = port.rstrip()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load(self):\n\t\tpath = input(\"Please enter the file name, with full path if needed, to load hosts and open ports -> \")\n\t\ttry:\n\t\t\tf = open(path)\n\t\t\tlines = f.read()\n\t\t\tentries = lines.split('\\n\\n')\n\t\t\tfor entry in entries:\n\t\t\t\thost_ports = entry.split('\\n')\n\t\t\t\tif host_ports[0...
[ "0.72574246", "0.67828935", "0.59317714", "0.56775075", "0.56608295", "0.5643025", "0.56103486", "0.56080896", "0.55767304", "0.55763936", "0.54733366", "0.5434388", "0.54177946", "0.5403998", "0.5392675", "0.5375731", "0.5347649", "0.5315801", "0.5302954", "0.52818924", "0.5...
0.78676033
0
Computes the GANnotation encoding for a video.
def compute_video_encoding(video): video_points = [] while True: ret, frame = video.read() if not ret: break # Find landmarks/points in frame. gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) rects = face_detector(gray, 1) if (len(rects) == 0): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main(data_dir):\n\n face2face_dir = '{}/manipulated_sequences/Face2Face/c0/videos'.format(data_dir)\n orig_dir = '{}/original_sequences/c0/videos'.format(data_dir)\n base_dir = '{}/manipulated_sequences/GANnotation'.format(data_dir)\n output_enc_dir = '{}/encodings'.format(base_dir)\n output_vid...
[ "0.6518178", "0.6104392", "0.59964246", "0.5801031", "0.5739885", "0.5585433", "0.55486244", "0.5478121", "0.5309508", "0.53071237", "0.52854246", "0.5283544", "0.5250905", "0.52124584", "0.5192007", "0.5182117", "0.51523244", "0.5151299", "0.5132689", "0.5113917", "0.5107428...
0.64678127
1
Gets a cropped image of a face to the specifications of GANnotation.
def get_gann_cropped_face(image): # Convert image to RGB. rgb = cv2.cvtColor(image, cv2.COLOR_BGR2RGB) # Find landmarks/points in frame. gray = cv2.cvtColor(rgb, cv2.COLOR_RGB2GRAY) rects = face_detector(gray, 1) if (len(rects) == 0): return None # No face found. landmarks = face_p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def crop_face(image,face_rect):\n (x1,y1,x2,y2) = face_rect\n w = abs(x2-x1)\n h = abs(y2-y1)\n return image[y1:y1 + h, x1:x1 + w]", "def crop_face(image):\n gray_image = cv.cvtColor(image, cv.COLOR_BGR2GRAY)\n face_roi_list = face_detector.detectMultiScale(gray_image, scale_factor, min_neighbo...
[ "0.7231581", "0.7134207", "0.7091885", "0.6756536", "0.6668364", "0.6617558", "0.63952774", "0.6262327", "0.6238402", "0.62260556", "0.6155058", "0.61488146", "0.60976815", "0.6077309", "0.6067748", "0.6025078", "0.5959691", "0.5953402", "0.58816946", "0.5860862", "0.58352095...
0.69182104
3
Generates videos with GANnotation using the same driving video and source video combinations used with Face2Face.
def main(data_dir): face2face_dir = '{}/manipulated_sequences/Face2Face/c0/videos'.format(data_dir) orig_dir = '{}/original_sequences/c0/videos'.format(data_dir) base_dir = '{}/manipulated_sequences/GANnotation'.format(data_dir) output_enc_dir = '{}/encodings'.format(base_dir) output_vid_dir = '{}/...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encode_videos(self):\n\t\t\n\t\tself.face_detector = MTCNN()\n\t\tencoder = MyVGGFace(self.vgg_l, self.vgg_v)\n\t\t\n\t\tfolder = self.folders['raw_video_folder']\n\t\t\n\t\tfor (dirpath, _, filenames) in os.walk(folder):\n\t\t\tif platform == 'linux' or platform == 'linux2' or platform == 'darwin':\n\t\t\t\t#...
[ "0.6596629", "0.64612806", "0.63377756", "0.6288337", "0.6274383", "0.6232385", "0.61546236", "0.6031003", "0.6000362", "0.5978761", "0.5973133", "0.59620225", "0.59196764", "0.5911529", "0.5893759", "0.5874103", "0.5867773", "0.58625805", "0.58521277", "0.5817486", "0.580820...
0.7005335
0
A CrossEncoder takes exactly two sentences / texts as input and either predicts a score or label for this sentence pair. It can for example predict the similarity of the sentence pair on a scale of 0 ... 1. It does not yield a sentence embedding and does not work for individually sentences.
def __init__(self, model_name:str, num_labels:int = None, max_length:int = None, device:str = None): self.config = AutoConfig.from_pretrained(model_name) classifier_trained = any([arch.endswith('ForSequenceClassification') for arch in self.config.architectures]) if num_labels is None and not c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predict(self, texts: List[ParsedText]) -> List[ParsedText]:\n self.model.eval()\n texts = copy.deepcopy(texts)\n\n batches = DataLoader(texts=texts,\n batch_size=self.batch_size,\n vocabulary=self.vocabulary,\n ...
[ "0.5809319", "0.5734909", "0.57336724", "0.5707226", "0.5680044", "0.56736326", "0.56652117", "0.56223834", "0.5596532", "0.5593011", "0.5583269", "0.55746573", "0.5567427", "0.55424696", "0.55306464", "0.5463267", "0.54625404", "0.5462516", "0.54495895", "0.5441223", "0.5438...
0.0
-1
Performs predicts with the CrossEncoder on the given sentence pairs.
def predict(self, sentences: List[List[str]], batch_size: int = 32, show_progress_bar: bool = None, num_workers: int = 0, activation_fct = None, convert_to_numpy: bool = True, convert_to_tensor: bool = False ): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predict_tokens(self, tokens):\n return", "def predict(self, texts: List[ParsedText]) -> List[ParsedText]:\n self.model.eval()\n texts = copy.deepcopy(texts)\n\n batches = DataLoader(texts=texts,\n batch_size=self.batch_size,\n ...
[ "0.6495735", "0.6470667", "0.64286774", "0.6404578", "0.63536495", "0.63171744", "0.63171744", "0.6305695", "0.62898153", "0.62898153", "0.62898153", "0.61633193", "0.6158455", "0.6141235", "0.6130706", "0.61170506", "0.6076464", "0.6076464", "0.6076464", "0.607452", "0.60663...
0.5924504
34
Runs evaluation during the training
def _eval_during_training(self, evaluator, output_path, save_best_model, epoch, steps, callback): if evaluator is not None: score = evaluator(self, output_path=output_path, epoch=epoch, steps=steps) if callback is not None: callback(score, epoch, steps) if sco...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate(self):\n self.training = False", "def _evaluate_during_fit(self, test_loader, epoch):", "def eval(self):\n self.train(mode=False)", "def _set_eval(self):\n\n if self.model.__dict__['training']:\n self.model.eval()", "def train_and_evaluate(model, train_dataloade...
[ "0.8004094", "0.7960147", "0.793323", "0.7607203", "0.74450403", "0.7328776", "0.73260754", "0.7320131", "0.72835034", "0.72698236", "0.72638726", "0.7262151", "0.72481006", "0.7229681", "0.72075427", "0.7180608", "0.7169582", "0.71446204", "0.7122053", "0.7110365", "0.708602...
0.7241664
13
Saves all model and tokenizer to path
def save(self, path): if path is None: return logging.info("Save model to {}".format(path)) self.model.save_pretrained(path) self.tokenizer.save_pretrained(path)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save(self, path: utils.URLPath):\n save_somclassifier_config(self.config, path / \"config.json\")\n self.model.save(str(path / \"model.h5\"))\n io_functions.save_joblib(self.binarizer, path / \"binarizer.joblib\")\n\n io_functions.save_json(self.data_ids[\"validation\"], path / \"id...
[ "0.7375198", "0.73201835", "0.7275228", "0.72446775", "0.71978945", "0.7173624", "0.71645725", "0.71221966", "0.71123177", "0.7020637", "0.69833195", "0.6982963", "0.69592774", "0.6959015", "0.690435", "0.68858427", "0.6864155", "0.6848267", "0.684122", "0.6808882", "0.679161...
0.7410444
0
Same function as save
def save_pretrained(self, path): return self.save(path)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save():", "def save():\n pass", "def save(self, obj):", "def save (self):\n pass", "def save(self):\n pass", "def save(self):\n pass", "def save(self):\n pass", "def save(self):\n pass", "def save(self):\n pass", "def save(self):\n # TOD...
[ "0.92170054", "0.8719974", "0.83308494", "0.82889223", "0.8203869", "0.8203869", "0.8203869", "0.8203869", "0.8203869", "0.8168083", "0.80858004", "0.8025579", "0.8005009", "0.7971303", "0.79261404", "0.79261404", "0.79261404", "0.79249805", "0.79249805", "0.79249805", "0.781...
0.0
-1
method to create entries
def creating_entry(self): response = "" today = str(date.today()) curent_time = str(datetime.time(datetime.now())) entry = Diary(self.entry_id, self.title, self.body) lst = {} lst["entry_id"] = entry.entry_id lst["title"] = entry.title lst["date"] = today ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_entry(entry):\n Entry.create(**entry)\n return entry", "def create_and_add_entry(self, **attrs):\n return self.add_entry(self.create_entry(**attrs))", "def create(self):", "def new_entry():\n clear_screen()\n entry = {}\n entry['id'] = get_next_id()\n entry['name'] = input...
[ "0.74073875", "0.7049438", "0.673739", "0.6715712", "0.66536736", "0.66536736", "0.6581046", "0.65393996", "0.6529814", "0.6471664", "0.6468275", "0.6409988", "0.64099157", "0.64099157", "0.64099157", "0.6397284", "0.6391721", "0.6385852", "0.63849086", "0.6370306", "0.634165...
0.717518
1
method to get all entries
def all_entries(cls): info = Diary.entries response = jsonify({"data": info}) response.status_code = 200 return response
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all(self):\n self.scan()\n return self.entries", "def get_entries_all(self):\n if self.database is None:\n raise DatabaseNotOpened('No KeePass Database Opened.')\n else:\n return self.database.find_entries_by_title('.*', \n ...
[ "0.81555045", "0.76694393", "0.76440334", "0.74271727", "0.73591536", "0.73557824", "0.7346058", "0.7323283", "0.7294528", "0.7184737", "0.7123756", "0.7123756", "0.70815015", "0.70392114", "0.70088154", "0.6935079", "0.69260496", "0.692346", "0.6865673", "0.68259686", "0.681...
0.73865086
4
method to get single entry
def single_entry(cls, entryid): data = "invalid URL,Try again" response = jsonify({"data": data}) response.status_code = 404 for info in Diary.entries: if info['entry_id'] == entryid: response = jsonify({"data": info}) response.status_code = 20...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_entry(self, entry_id):\n entry = self.entries.find_one({'id': entry_id}, projection={'_id': 0})\n return entry", "def get(self, id):\n return Entry.query.filter(Entry.id == id).one()", "def fetch_entry(self, entry_id, **args):\n return self.fetch(\"/entry/\" + entry_id, **ar...
[ "0.7979427", "0.7745298", "0.7446515", "0.72231567", "0.71015435", "0.70682955", "0.70370704", "0.69215214", "0.6893759", "0.6842423", "0.6797373", "0.6763553", "0.67345667", "0.6724843", "0.6711598", "0.6514311", "0.64815724", "0.64600176", "0.6412111", "0.6411839", "0.64083...
0.68132854
10
method to update entries
def updating_entry(cls, entryid, data): result = "invalid URL, cannot update" response = jsonify({"data": result}) response.status_code = 404 now = datetime.now() new_date = now.strftime("%c") for info in Diary.entries: if info['entry_id'] == entryid: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_entries(entries: Entries, data: dict) -> None:\n # TODO: Is mutating the list okay, making copies is such a pain in the ass\n for entry in entries:\n entry.update(data)", "def update():", "def update():", "def update( ):\r\n pass", "def update(*args):", "def upd...
[ "0.7209996", "0.7179901", "0.7179901", "0.70360386", "0.7023842", "0.6919768", "0.6919768", "0.6919768", "0.69104016", "0.69077516", "0.68526644", "0.6843436", "0.6821559", "0.68168163", "0.6752249", "0.6726927", "0.66631556", "0.665054", "0.6647949", "0.6647949", "0.6647949"...
0.64974666
49
Takes a naturallanguage sentence and returns a POS tagged version.
def tag(self, text): pass
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_for_pos_tagging(sentence):\n try:\n return \" \".join([token.form + \"/\" + token.upos for token in sentence])\n except TypeError: # if a POS tag is missing\n return \"\"", "def convert_pos_tag(tag):\n # Source: https://www.programcreek.com/python/example/91610/nltk.corpus.wordn...
[ "0.7141937", "0.6886522", "0.66606313", "0.646352", "0.6452857", "0.6313468", "0.6278701", "0.6268843", "0.62244505", "0.6193162", "0.6185941", "0.6173259", "0.61638516", "0.6159604", "0.61551553", "0.6118951", "0.60944736", "0.60944736", "0.60944736", "0.60944736", "0.609447...
0.0
-1
Forward twisted logs to the python stdlib logger.
def twistedLogObserver(eventDict): n = 2 module = 'twisted' while True: try: caller = sys._getframe(n) except ValueError: break name = caller.f_globals.get('__name__') if name not in (None, 'twisted.python.log'): module = name b...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _alter_logger(*args, **kwargs):\n\n # TODO: dress up root logger here under Celery\n # configure_logging()\n pass", "def Log(message):\n log_mod = sys.modules.get('twisted.python.log')\n if log_mod:\n log_mod.msg(message)\n else:\n print message", "def setup_logger():\n root = logging....
[ "0.6573398", "0.6544858", "0.6533331", "0.6466651", "0.6412817", "0.6195713", "0.61682737", "0.61235356", "0.6119762", "0.6104155", "0.60603535", "0.60477364", "0.60468274", "0.6032671", "0.60320276", "0.60292095", "0.60277015", "0.6025815", "0.6004273", "0.60029143", "0.5961...
0.660194
0
Log a Twisted Failure object with traceback. Suitable for use as an errback.
def logFailure(failure, msg='Unhandled exception in deferred:'): logging.error('%s\n%s', msg, failure.getTraceback())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _logError(self, failure):\r\n try:\r\n failure.printTraceback()\r\n except:\r\n print('Could not print traceback of failure, print error '\r\n 'message instead:')\r\n print(failure.getErrorMessage())", "def traceback_hook(type, value, traceback)...
[ "0.6952767", "0.65461653", "0.65011835", "0.63761", "0.6218661", "0.6216443", "0.61358964", "0.6120387", "0.60622317", "0.6036452", "0.6007453", "0.60013145", "0.5989881", "0.5825196", "0.57672983", "0.5751573", "0.5717206", "0.56846493", "0.56739634", "0.5663092", "0.5657386...
0.7511296
0
The differential equation of the Induction Motor.
def electrical_ode(self, state, u_sr_alphabeta, omega, *args): return np.matmul(self._model_constants, np.array([ # omega, i_alpha, i_beta, psi_ralpha, psi_rbeta, omega * psi_ralpha, omega * psi_rbeta, u_salpha, u_sbeta, u_ralpha, u_rbeta, omega, state[self.I_SALPHA_IDX], ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def differential(self):\n return self._differential", "def f( self , x , u , t ):\n \n dx = np.zeros(self.n) # State derivative vector\n \n ################################################\n # Place holder: put the equations of motion here\n raise NotImplementedEr...
[ "0.65110767", "0.6499808", "0.6391697", "0.63783026", "0.6355503", "0.63359916", "0.6332624", "0.6305126", "0.6285576", "0.6285481", "0.62696207", "0.62357086", "0.61858493", "0.6168313", "0.6123732", "0.61195797", "0.61195797", "0.6113994", "0.6054803", "0.6033857", "0.60268...
0.0
-1
Calculate Flux limits for given current and magneticfield angle
def _flux_limit(self, omega=0, eps_mag=0, u_q_max=0.0, u_rq_max=0.0): mp = self.motor_parameter l_s = mp['l_m'] + mp['l_sigs'] l_r = mp['l_m'] + mp['l_sigr'] l_mr = mp['l_m'] / l_r sigma = (l_s * l_r - mp['l_m'] ** 2) / (l_s * l_r) # limiting flux for a low omega ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def magnet_limits(self):\n max_currents = self.pv_monitor.get_max_currents()\n\n strengths = [np.array([max_currents[0],\n -max_currents[1],\n max_currents[2], 0, 0]),\n np.array([0, 0, max_currents[2],\n ...
[ "0.67609036", "0.6139057", "0.6093792", "0.60318834", "0.5932127", "0.5922429", "0.58925015", "0.58271277", "0.57542443", "0.57087165", "0.56882066", "0.5674291", "0.5637041", "0.56301844", "0.559757", "0.5552885", "0.55398893", "0.5495456", "0.5447273", "0.5438389", "0.54375...
0.6304191
1
Loads, scales, add sum and returns the card's ratings per archetype
def get_ratings(self): df = pd.read_csv(IoManager.CARD_RATINGS_FILE_PATH) df = IoManager.scale_ratings(df) df = IoManager.normalize_ratings_per_archetype(df) df = self.add_ratings_sum(df) # print(df[["name", "monogreen", "simic_ramp", "general"]].tail(60)) # print(d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate(self):\n\n rating = 0\n\n props = ['aroma', 'appearance', 'taste', 'palate', 'bottle_style']\n for item in props:\n rating += getattr(self, item, 0)\n\n self.overall = (rating / self.total) / .2", "def normalize_ratings_per_archetype(ratings):\n archety...
[ "0.6380344", "0.61968863", "0.5909384", "0.55840695", "0.5580369", "0.55455184", "0.55112666", "0.5488847", "0.54406595", "0.5376693", "0.5336506", "0.5311914", "0.53039163", "0.5274228", "0.5263589", "0.52398807", "0.5232894", "0.521996", "0.521996", "0.52112716", "0.5173465...
0.6660048
0
The gap between a 3 and a 4 is wider than 1/3 better
def scale_ratings(ratings): mapping = { 2: 3, 3: 8, 4: 30, 5: 60 } ratings = ratings.applymap(lambda e: mapping[e] if e in mapping else e) return ratings
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gap(l):\n if l < 3:\n return 0\n\n # places one person in the middle of the gap,\n # and starts over on the new smaller gaps on either side.\n return gap(int(l / 2)) + 1 + gap(ceil(l / 2) - 1)", "def test_frac_same_gaps(self):\n s1 = self.RNA(\"AAAA\")\n s...
[ "0.6261256", "0.5986721", "0.5811899", "0.5776205", "0.56696147", "0.56601644", "0.5634589", "0.5604828", "0.551467", "0.54931474", "0.5490927", "0.5486282", "0.54767895", "0.54586583", "0.5427611", "0.5420678", "0.5389195", "0.5386266", "0.5353105", "0.5300111", "0.52981627"...
0.0
-1
Divides each rating by a value proportional to the sum of all the ratings in the archetype
def normalize_ratings_per_archetype(ratings): archetype_cols = [c for c in ratings.columns if c != "name"] n_cards = len(ratings["monored"]) for arch_col in archetype_cols: ratings[arch_col] = ratings[arch_col] / (ratings[arch_col].sum() / n_cards) return ratings
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate(self):\n\n rating = 0\n\n props = ['aroma', 'appearance', 'taste', 'palate', 'bottle_style']\n for item in props:\n rating += getattr(self, item, 0)\n\n self.overall = (rating / self.total) / .2", "def average_rating(self):\n return ( self.rating_1 + se...
[ "0.6732126", "0.6466219", "0.6354308", "0.6154052", "0.6071842", "0.60431087", "0.601784", "0.59927374", "0.59915966", "0.59524244", "0.5936136", "0.5898596", "0.58605075", "0.5803156", "0.5800903", "0.5756226", "0.573754", "0.5710812", "0.56885886", "0.56883645", "0.56880826...
0.6568107
1
Returns which cards we have downloaded images for (of the specified language, en or fr)
def get_downloaded_images(lang="en"): path = IoManager.CARD_IMAGES_PATH_EN if lang == "en" else IoManager.CARD_IMAGES_PATH_FR Path(path).mkdir(parents=True, exist_ok=True) file_names_en = [f for f in listdir(path) if isfile(join(path, f))] card_names = [f[:-4] fo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download_card_images(self, card_names, lang=\"en\"):\n for card_name in card_names:\n print(\"Dowloading card imgs for \\'\" + card_name + \"\\' (\" + lang + \")\")\n output_file_name = card_name + \".jpg\"\n output_file_path = IoManager.CARD_IMAGES_PATH_EN + \"/\" + out...
[ "0.6827145", "0.67701286", "0.65849847", "0.5614944", "0.55986357", "0.55533844", "0.5530028", "0.5465683", "0.54479086", "0.5424347", "0.5316803", "0.5239201", "0.5239081", "0.52309775", "0.5227534", "0.519252", "0.51657206", "0.515859", "0.514055", "0.51235837", "0.5105135"...
0.7632202
0
Returns which cards we miss images for
def get_missing_images(self): downloaded_images_en = IoManager.get_downloaded_images(lang="en") downloaded_images_fr = IoManager.get_downloaded_images(lang="fr") complete_list = self.cube_list + IoManager.BASIC_LANDS missing_images_en = [card for card in complete_list if card not in down...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def image_comparison(self):\n for result in self.cards:\n if result.image_status:\n return True\n return False", "def get_images_bytesize_match(self, images):\r\n cnt = 0\r\n MAX_BYTES_SIZE = 15728640\r\n good_images = []\r\n for image in images...
[ "0.6058513", "0.57476836", "0.57151556", "0.5685657", "0.5677294", "0.56010586", "0.55934155", "0.5563497", "0.5537158", "0.55090606", "0.5498323", "0.549093", "0.54860824", "0.5450436", "0.5446004", "0.54443866", "0.5434272", "0.54127556", "0.53991973", "0.53977275", "0.5389...
0.692412
0
Downloads the en and fr card image of each card
def download_card_images(self, card_names, lang="en"): for card_name in card_names: print("Dowloading card imgs for \'" + card_name + "\' (" + lang + ")") output_file_name = card_name + ".jpg" output_file_path = IoManager.CARD_IMAGES_PATH_EN + "/" + output_file_name if lang =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_downloaded_images(lang=\"en\"):\n path = IoManager.CARD_IMAGES_PATH_EN if lang == \"en\" else IoManager.CARD_IMAGES_PATH_FR\n Path(path).mkdir(parents=True, exist_ok=True)\n file_names_en = [f for f in listdir(path) if\n isfile(join(path, f))]\n card_name...
[ "0.6921706", "0.6450962", "0.6377", "0.6337459", "0.60916305", "0.60854703", "0.5967566", "0.5942896", "0.58616376", "0.58562416", "0.5838658", "0.57420564", "0.5741461", "0.57366806", "0.57327133", "0.57137054", "0.56456494", "0.5644481", "0.5608249", "0.56000626", "0.558310...
0.80364513
0
Checks for missing images, and downloads them if any are found
def download_missing_images(self, only_english: bool = True): print("\nChecking for missing images") missing_images_en, missing_images_fr = self.get_missing_images() for card_names, lang in [(missing_images_en, "en"), (missing_images_fr, "fr")]: if card_names and (not only_english or...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def downloadImages(self):\n\t\ti = 0\n\t\tfor im in self.images:\n\t\t\t# Let's get the file extension and file name and make the final file path. \n\t\t\t# We need to do this to slugify the file name and avoid errors when loading images\n\t\t\tfile_name, file_extension = os.path.splitext(im['url'])\n\t\t\tfile_na...
[ "0.7083034", "0.68719465", "0.673285", "0.6715235", "0.6713619", "0.6664665", "0.659402", "0.6578242", "0.652952", "0.6501214", "0.6467159", "0.6465091", "0.6464454", "0.6458772", "0.6445216", "0.6426162", "0.64172775", "0.6410692", "0.6388483", "0.6357596", "0.6347212", "0...
0.6853467
2
Adds the new entries to the db
def save_arch_presence(self, arch_presence_entries): df = IoManager.get_arch_presence() print(len(arch_presence_entries[0])) df2 = pd.DataFrame(data=arch_presence_entries, columns=self.archetypes.get_archetype_names(as_feature_names=True)) new_df = pd.concat([df, df2], sort=False) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_entry_to_db(entry):\n db.session.add(entry)\n db.session.commit()", "def test_new_entries_are_added(db_session):\n for entry in ENTRIES:\n row = Entries(title=entry[\"title\"], creation_date=entry[\"creation_date\"], body=entry[\"body\"])\n db_session.add(row)\n query = db_s...
[ "0.7461566", "0.72153276", "0.7015225", "0.6997762", "0.6925729", "0.68381536", "0.6832269", "0.6737517", "0.6737517", "0.6718508", "0.66478074", "0.66156644", "0.65608704", "0.6548754", "0.65438336", "0.65438336", "0.65438336", "0.6514425", "0.6510781", "0.65020245", "0.6478...
0.0
-1
Pretty prints a dictionary.
def pretty_print(d, indent=0): for key, value in d.items(): print('\t' * indent + str(key) + ":") if isinstance(value, dict): pretty_print(value, indent + 1) else: print('\t' * (indent + 1) + str(value))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pretty_dict(d):\n return '{%s}' % ', '.join('%r: %r' % (k, v)\n for k, v in sorted(d.items(), key=repr))", "def _format_dict(self, dict_, indent=0):\n prefix = indent*\" \"*4\n output = \"{\\n\"\n for key, val in sorted(dict_.items()):\n if isin...
[ "0.8129485", "0.7979403", "0.77767885", "0.77481365", "0.7565762", "0.7528162", "0.7513119", "0.7488116", "0.7456188", "0.74134594", "0.7373054", "0.7295989", "0.7292516", "0.72703886", "0.7220195", "0.71887636", "0.71631026", "0.71572983", "0.7155567", "0.7155567", "0.703044...
0.78974617
2
Instantiates an instance of MyLogisticRegression
def __init__(self, sim_size=20, test_size=0.25): super().__init__(sim_size, test_size) self.setting = 'n neighbors'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n super().__init__()\n import sklearn\n import sklearn.linear_model\n self.model = sklearn.linear_model.LogisticRegression", "def __init__(self, reg_penalty='l2', reg_inv=1.0, k_fold=5, random_state=0):\n print(\"Initialize model Logistic Regression\")\n self.reg_pen...
[ "0.8087153", "0.76647913", "0.76057726", "0.74503815", "0.74361885", "0.7393527", "0.73817176", "0.7339038", "0.7296387", "0.7256845", "0.72353274", "0.7206931", "0.7062444", "0.6916837", "0.6718341", "0.6698887", "0.6692653", "0.6632343", "0.6632128", "0.660655", "0.6558617"...
0.0
-1
Train KNN model Return 2 tuple of pandas DataFrame for train and test accuracy score
def train_model(self, X, y, nlist=None, n_jobs=None): self._X = X self._y = y if nlist is None: nlist = self.nlist else: self.nlist = nlist # Result dataframes self._df_train = pd.DataFrame() self._df_test = pd.DataFrame() with tqdm...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def knn(trainingSetData, testSetData, k):\n trainingSet = trainingSetData.drop([14], axis=1) # drop income\n testSet = testSetData.drop([14], axis=1) # drop income\n\n distances = {}\n # this will store the distances re-sorted in ascending/descending order\n sort = {}\n # income band results (>...
[ "0.6956006", "0.6943758", "0.68212664", "0.681758", "0.67034423", "0.6650995", "0.66190994", "0.6614645", "0.65811896", "0.65773576", "0.6573686", "0.65204805", "0.6511421", "0.6480069", "0.6454889", "0.6438703", "0.6435534", "0.6403415", "0.6373908", "0.63148457", "0.631065"...
0.64175934
17
Return the top predictors, model must be first trained
def get_toppredictors(self, n_neighbors=None): if self._df_test is None: raise RuntimeError('MyKNNClassifier: please train the ' 'model first') elif n_neighbors is None: n = self.get_bestparameter() else: n = n_neighbors ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_top_predictions(preds, top=5):\n results = []\n for pred in preds:\n top_indices = pred.argsort()[-top:][::-1]\n # result = [tuple(CLASS_INDEX[str(i)]) + (pred[i],) for i in top_indices]\n # result.sort(key=lambda x: x[2], reverse=True)\n # results.append(result)\n retu...
[ "0.6860322", "0.66917396", "0.66076756", "0.6452024", "0.6452024", "0.6452024", "0.63425475", "0.6330959", "0.62971634", "0.6219174", "0.6159492", "0.6152109", "0.6101522", "0.6079387", "0.60596144", "0.6025629", "0.6020034", "0.6004894", "0.59797865", "0.59714454", "0.593968...
0.0
-1
Return a confusion matrix, classification report, and matplotlib.axes.Axes of confusion matrix in dictionary form
def get_metric(self, X=None, y=None, random_state=None, n_neighbors=None, ax=None): param = self._set_data(X, y, random_state, n_neighbors) X = param['X'] y = param['y'] ds = train_test_split(X, y, test_size=self.test_size, random_state=ra...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def conf_matrix(model, X_train, y_train, X_test, y_test, train=True):\n from sklearn.metrics import confusion_matrix\n import itertools\n if train==True: \n ypredTrain = model.predict(X_train)\n cm = confusion_matrix(y_train, ypredTrain)\n def plot_conf_matrix(cm, classes, title='C...
[ "0.68781376", "0.68362397", "0.6781775", "0.6672712", "0.66222155", "0.6609204", "0.65948915", "0.6585669", "0.6573767", "0.65571666", "0.65413755", "0.6507808", "0.6453033", "0.64469814", "0.64313364", "0.6412364", "0.63966286", "0.6386278", "0.63823116", "0.6377449", "0.636...
0.0
-1
Return the best parameter
def get_bestparameter(self): if self._df_test is None: raise RuntimeError('get_bestparameter: please the ' 'train model first') mean = self._df_test.mean(axis=1) if len(mean) == 1: result = mean.idxmax() elif len(mean) == 2: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def best_params(self):\n return self.X[np.argmax(self.y.numpy())]", "def _get_lip_best(self) -> float:\n pass", "def best_value(self):\r\n return self._best_value", "def get_optimal_param(data_desc, ml_model_desc):\n if ml_model_desc == 'ANN': \n # return [<num_layers>, <momentum>,...
[ "0.79020077", "0.7498789", "0.7307663", "0.7186653", "0.7182248", "0.7182248", "0.71787816", "0.714562", "0.70670503", "0.7066399", "0.7063416", "0.70483625", "0.69959056", "0.69871986", "0.69608027", "0.6891115", "0.68689346", "0.67962205", "0.6790799", "0.6789823", "0.67789...
0.7805949
2
Generate images using pretrained network pickle.
def generate_images( network_pkl, seeds, truncation_psi, noise_mode, outdir ): print('Loading networks from "%s"...' % network_pkl) # device = torch.device('cuda') device = torch.device('cpu') with dnnlib.util.open_url(network_pkl) as f: G = legacy.load_network_pkl(f)['G_e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_data(self):\n # make sure preprocessing is same as preprocessing as the network\n # reduce mean, and divide by a value to do scaling\n self.train_datagen = ImageDataGenerator(\n rescale=1./ 255,\n shear_range=0.05,\n rotation_range=20, # randomly rota...
[ "0.6521632", "0.64640135", "0.6414876", "0.6319254", "0.62962353", "0.62662005", "0.6203831", "0.61933243", "0.6185996", "0.6172128", "0.61563635", "0.6125293", "0.610219", "0.6065702", "0.60526216", "0.60506034", "0.6046957", "0.6046304", "0.60312176", "0.60269386", "0.60013...
0.6844513
0
Do not return anything, modify nums inplace instead.
def nextPermutation(self, nums: List[int]) -> None: inc_index = len(nums) - 1 for i in range(len(nums)-2, -1,-1): if nums[inc_index] <= nums[i]: inc_index = i else: break if inc_index == 0: self.flip(nums, inc_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fn(i):\n if i == len(nums): ans.append(nums.copy())\n for j in range(i, len(nums)): \n nums[i], nums[j] = nums[j], nums[i]\n fn(i+1)\n nums[i], nums[j] = nums[j], nums[i]", "def double_nums(num_list):", "def remove_dups(nums):\r\n nums[:...
[ "0.70469916", "0.67161703", "0.66934896", "0.6586775", "0.6501143", "0.6482345", "0.6442288", "0.6407945", "0.6376896", "0.6372343", "0.63671577", "0.6365932", "0.63512594", "0.6328759", "0.6298402", "0.62855035", "0.62671727", "0.62472045", "0.62221444", "0.6193869", "0.6188...
0.0
-1
Write the persistant SPET run number.
def write(lock_file): try: run_num = 1 if os.path.isfile(lock_file): current_value = file.read(lock_file) if current_value: run_num = int(current_value) + 1 file.write(lock_file, str(run_num)) except IOError as err: logging.error(err)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_run(run):\n r=Run(run)\n r.write_all()", "def saveseed(self, seed):\n savefile = gettempdir() + '/last_test_seed_fate.tmp'\n if args.verbose:\n print('Saving run into ' + savefile)\n with open(savefile, 'w') as f:\n f.write(str(seed))", "def save(self)...
[ "0.5979915", "0.5911559", "0.57724327", "0.57407415", "0.5733144", "0.57181674", "0.5636713", "0.5612512", "0.5544363", "0.552181", "0.5496353", "0.5488646", "0.54772437", "0.5449901", "0.5441456", "0.5425442", "0.5416367", "0.5415051", "0.5407263", "0.5366748", "0.53615004",...
0.5339735
24
Get the current SPET run number.
def read(lock_file): try: return "{:03d}".format(int(file.read(lock_file).strip())) except IOError as err: logging.error(err)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_number(self):\n return self._runNumber", "def getRunId(self):\n return self.runid", "def run_id(self) -> str:\n return self._step_execution_context.run_id", "def RunNumber(self):\n if self._dataframe is DataframeEnum.SkimmedNtuple:\n return self._event.RunNumber\n elif...
[ "0.81349736", "0.6839166", "0.6824378", "0.67494816", "0.66669965", "0.66590947", "0.6639686", "0.6609071", "0.65797096", "0.6563909", "0.65003437", "0.63520664", "0.63520664", "0.63482714", "0.62824297", "0.6149616", "0.6144756", "0.6078331", "0.603124", "0.5951322", "0.5950...
0.0
-1
Plot the prediction on the training and validation set. Inputs
def plot_predictions(net, x_train, y_train, idx_train, x_val, y_val, idx_val): fig, (ax1, ax2) = plt.subplots(nrows=2, figsize=(20, 30)) pred1 = net.predict(x_val, batch_size=batch_size) # print("pred1.shape:", pred1.shape) ax1.plot(idx_val, y_val, label="Actual Data", marker="+") ax1.plot(idx_val, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_predictions(self):\n\n plt.title(\"Targets vs. Predictions\")\n plt.plot(self.T, label=\"Targets\")\n plt.plot(self.Y, label=\"Predictions\")\n plt.xlabel(\"Sample number\")\n plt.legend()\n plt.show()", "def plot_predictions(\n train_data, train_labels, test...
[ "0.7995283", "0.7779081", "0.7456024", "0.7397582", "0.72995585", "0.7211775", "0.7208045", "0.71841884", "0.7167495", "0.7039762", "0.7039762", "0.7009505", "0.70035166", "0.6922596", "0.69057924", "0.6867257", "0.68447304", "0.6805223", "0.6787511", "0.6778143", "0.67530954...
0.76417714
2
Plot training & validation loss values. Inputs
def plot_loss_vs_epoch(history, var_train, var_val, show=False): plt.figure(figsize=(10, 8)) plt.grid(True) plt.plot(history.history['loss']/var_train, marker="o") plt.plot(history.history['val_loss']/var_val, marker="o") plt.title('Model Loss') plt.ylabel('Loss (Normalised to variance of datase...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_loss(training_errors, validation_errors):\n plt.xscale('Log')\n plt.xlabel('Epochs')\n plt.ylabel('Mean Actual Error')\n plt.plot(training_errors, label = \"Training Error\", \\\n color = 'blue')\n plt.plot(validation_errors, label = \"Validation Error\", \\\n color = 'red')\n...
[ "0.7867429", "0.78592646", "0.7805997", "0.7769233", "0.7716918", "0.76086384", "0.7583472", "0.75043344", "0.7502236", "0.74993914", "0.74954724", "0.7421947", "0.7350023", "0.7309471", "0.7306232", "0.72990686", "0.72583", "0.72438455", "0.7241214", "0.7193638", "0.7188506"...
0.7015908
36
Generates a 'learning curve' i.e. the analysis for each data size 0 to full. Obsolete function.
def learning_curve(): loss = [] val_loss = [] data_size = [] x_slid, y_slid = sliding_window_main(x, y) x_train, y_train, x_val, y_val, x_test, y_test = data_splitting_main(x_slid, y_slid) m_tot = x_train.shape[0] batch_step = 50 try: for m in range(batch_size, m_tot, batch_ste...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def finetune_learningrate_createData():\n acc,auc = [],[]\n for i in tqdm([j*0.005 for j in range(1,31)],desc='Progress(max_depth)',ncols=70,smoothing=0.5):\n X_train, X_test, y_train, y_test, X, y_binary = initializing()\n XGBCla = get_XGBmodel(lr=i)\n XGBCla = XGBCla.fit(X_train, y_tra...
[ "0.65476876", "0.652535", "0.63539034", "0.63355064", "0.62676394", "0.6246775", "0.61720693", "0.6154492", "0.61399", "0.6103736", "0.60872924", "0.60743475", "0.6020889", "0.60129255", "0.6007138", "0.59935564", "0.59641993", "0.5947333", "0.5942775", "0.59299177", "0.59045...
0.66602564
0
Function finds entropy of a given set of class labels
def entropy ( target_array ): return -1 * sum ( [ pipe ( np.sum ( target_array == value ) / len ( target_array ), lambda ratio: ratio * np.log ( ratio ) ) for value in set ( target_array ) ] ) # End entropy()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __entropy(self, labels):\n class_probs = np.unique(labels, return_counts=True)[1] / labels.size\n class_prob_logs = np.log2(class_probs)\n entropy = -np.sum(class_probs * class_prob_logs)\n return entropy", "def get_entropy(*labels):\n entropies = [] #list of entropy values fro...
[ "0.81865084", "0.80822265", "0.77153903", "0.7669256", "0.75980985", "0.75456953", "0.7508981", "0.7403374", "0.73444664", "0.73422587", "0.71964747", "0.7112142", "0.7071382", "0.70541775", "0.7049735", "0.6889866", "0.6841053", "0.6830166", "0.6794126", "0.67489135", "0.673...
0.6390812
39
Function finds the negative mean squared distance from mean for point in Y (variance)
def negative_mse ( target_array ): return -1 * mse ( target_array ) # End negative_mse()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mse(x, y):\n\n return (x - y).pow(2).sum(dim=1, keepdim=True).mean() / x.size(1)", "def rmse(x: np.ndarray, y: np.ndarray):\n x, y = np.copy(x), np.copy(y)\n if x.ndim > 1:\n return np.sqrt(np.nanmean((x-y)**2, axis=1))\n return np.sqrt(np.nanmean((x-y)**2))", "def d_mse(x, y):\n\n re...
[ "0.69241166", "0.69005483", "0.6845944", "0.67627764", "0.67190903", "0.66590434", "0.6627769", "0.6610583", "0.6524916", "0.65237314", "0.65040076", "0.64928967", "0.64775354", "0.64648354", "0.6457528", "0.6452227", "0.6450612", "0.6444482", "0.64413154", "0.64091843", "0.6...
0.0
-1
Function finds mean squared distance from mean for point in Y (variance)
def mse ( target_array ): return np.mean ( ( target_array - np.mean ( target_array ) ) ** 2 ) # End mse()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mse(x, y):\n\n return (x - y).pow(2).sum(dim=1, keepdim=True).mean() / x.size(1)", "def rmse(x: np.ndarray, y: np.ndarray):\n x, y = np.copy(x), np.copy(y)\n if x.ndim > 1:\n return np.sqrt(np.nanmean((x-y)**2, axis=1))\n return np.sqrt(np.nanmean((x-y)**2))", "def d_mean(x, y):\n ret...
[ "0.6901139", "0.6851943", "0.6846584", "0.68131304", "0.67818093", "0.6695487", "0.66594326", "0.6637449", "0.6555009", "0.65388817", "0.65273666", "0.65109974", "0.65004605", "0.6492552", "0.64914644", "0.64914644", "0.6474629", "0.64733547", "0.64600074", "0.638137", "0.636...
0.6005872
94
Function to update the values of a TreeSplits object.
def updateTreeValues ( self, feature_column, feature_value, node_type, nodes, children = [ ] ): self.feature_column = feature_column self.feature_value = feature_value self.node_type = node_type self.nodes = nodes self.children = children # End updateTreeValues()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def SetSplitValues(self, *args):\n return _ShapeUpgrade.ShapeUpgrade_SplitCurve_SetSplitValues(self, *args)", "def split(self):\n pos_median = len(self.keys)/2\n key_median = self.keys[pos_median]\n value_median = self.values[pos_median]\n keys_left = self.keys[:pos_median]\n ...
[ "0.5888695", "0.56457704", "0.5637454", "0.55085474", "0.5473264", "0.54514945", "0.54263914", "0.53565776", "0.53152966", "0.52939975", "0.5229411", "0.5209243", "0.5178123", "0.5173258", "0.5074526", "0.50700766", "0.5065914", "0.5059103", "0.50479466", "0.5044793", "0.5040...
0.57885617
1
Function to determine whether a node is a leaf (i.e., has no children).
def isNodeLeaf ( self ): return self.nodes is None or len ( self.nodes ) == 0 # End isNodeLeaf
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isLeaf(node):\n\n return node.left is None and node.right is None", "def is_leaf(self):\n if len(self.children) == 0: #If the Node has no children, it's a leaf\n return True\n else:\n return False", "def is_leaf(self, node: ...
[ "0.8605668", "0.85680234", "0.853242", "0.849539", "0.84208226", "0.840783", "0.84036934", "0.83483315", "0.83079994", "0.8281862", "0.82678497", "0.82634103", "0.82323253", "0.8224074", "0.8210887", "0.8189795", "0.8183536", "0.8168549", "0.81192285", "0.81134427", "0.810838...
0.8422532
4
Function to get the midpoints between values of the feature array to score in determining best split.
def get_valid_midpoints ( feature_array: np.ndarray, target_array: np.ndarray ): # Get sorted indices indices = np.argsort ( feature_array ) # Get sorted feature array sorted_feature_array = feature_array [ indices ] # Get the differences between adjacent values feature...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def midpoints(self):\n return self.bins[:, 1]", "def split(self, X, y, feature_array):\n n, p = X.shape\n\n best_gain = 0\n best_split_point = 0\n best_feature_id = -1\n for feature_id in feature_array:\n cur_gain, cur_split_point = self.find_best_split(\n ...
[ "0.7009221", "0.66867995", "0.6500667", "0.6397656", "0.6387852", "0.6146362", "0.6117075", "0.6101361", "0.60497683", "0.60440624", "0.6034719", "0.60301876", "0.6004744", "0.59204274", "0.58992785", "0.5869794", "0.5834895", "0.58053046", "0.57847375", "0.5784375", "0.57631...
0.70583206
0
Function to evaluate the goodness of the continuous split value.
def get_split_goodness_fit_continuous ( feature_array: np.ndarray, target_array: np.ndarray, split: float, evaluate_function: Callable ): # Get above and below the split value above = feature_array >= split below = feature_array < split # Get weighted average evaluate_functi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_split_goodness_fit_continuous(\n arr: np.ndarray, y: np.ndarray, split: float, eval_func: Callable\n ):\n # Get above and below the split value\n above = arr >= split\n below = arr < split\n\n # get weighted average eval_func on the splits\n n_above = np.sum(abo...
[ "0.71865433", "0.6572121", "0.6329187", "0.5955071", "0.59270036", "0.5801792", "0.5749482", "0.57275933", "0.5726107", "0.5710863", "0.5676883", "0.5616585", "0.56147176", "0.56091195", "0.5603875", "0.5592451", "0.55882514", "0.5582341", "0.5575127", "0.5549959", "0.5546042...
0.6943928
1
Function to get the best split (i.e., minimum number) across many proposed splits.
def get_min_across_splits_continuous ( feature_array: np.ndarray, target_array: np.ndarray, splits: np.ndarray, evaluate_function: Callable ): n = len ( splits ) if n > 500: # If many split points, use some threading with multiprocessing.Pool ( processes = 8 ) as p: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def best_split(self):\r\n best_splits = [[0, None, None]]\r\n impurity, best_S, best_xj = 0, None, None\r\n \r\n for xj in self.x_names:\r\n for S in self.potential_splits(xj):\r\n ir = float(self.impurity_reduction(xj, S))\r\n if ir > impurity:\...
[ "0.7596094", "0.72380716", "0.7155916", "0.67890745", "0.6748498", "0.6699499", "0.6628864", "0.6618509", "0.6560878", "0.65409684", "0.6411355", "0.6359434", "0.6302224", "0.624653", "0.6240486", "0.62339056", "0.622259", "0.62120956", "0.61381125", "0.6124368", "0.61219037"...
0.6504366
10
Function to get the best continuous split for a column
def get_optimal_continuous_feature_split ( self, feature_matrix: np.ndarray, target_array: np.ndarray, feature_column: int ): midpoints = BaseTree.get_valid_midpoints ( feature_array = feature_matrix [ :, feature_column ], target_array = target_array ) # If midpoints, get the best one ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_optimal_continuous_feature_split(\n self, X: np.ndarray, y: np.ndarray, feature_col: int\n ):\n midpoints = BaseTree.get_valid_midpoints(arr=X[:, feature_col], y=y)\n # If midpoints, get the best one\n if len(midpoints) > 0:\n return BaseTree.get_min_across_splits_...
[ "0.7231365", "0.7075939", "0.68824524", "0.68168825", "0.6810663", "0.67609465", "0.6757198", "0.6710196", "0.6624161", "0.64982873", "0.648198", "0.6418159", "0.64083916", "0.64015394", "0.63641125", "0.63524777", "0.62306863", "0.62056756", "0.61384755", "0.60775584", "0.60...
0.6824757
3
Function to get the value of making a discrete split.
def get_discrete_split_value ( feature_array: np.ndarray, target_array: np.ndarray, evaluate_function: Callable ): # First element is the weighted average evaluate_function of the split # Second term is the intrinsic value to penalize many splits. return ( sum ( [ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_discrete_split_value(arr: np.ndarray, y: np.ndarray, eval_func: Callable):\n\n # First element is the weighted average eval_func of the split\n # Second term is the intrinsic value to penalize many splits.\n return (\n sum(\n [\n eval_func(y...
[ "0.65154564", "0.5932024", "0.5635929", "0.56241894", "0.5608168", "0.5515022", "0.5504383", "0.54864615", "0.53911495", "0.5371303", "0.53537226", "0.5306154", "0.5295001", "0.5242035", "0.5230267", "0.5224207", "0.52195615", "0.52148545", "0.5210651", "0.5210651", "0.521065...
0.64066917
1
Function to get the best split value for a discrete columns
def get_optimal_discrete_feature_split ( self, feature_matrix: np.ndarray, target_array: np.ndarray, feature_column: int ): return BaseTree.get_discrete_split_value ( feature_matrix [ :, feature_column ], target_array, evaluate_function = self.evaluate_function ) # End get_optima...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def determine_best_split(data, potential_splits, mltask):\n\n first_iteration = True\n for column_index in potential_splits:\n for value in potential_splits[column_index]:\n data_below,data_above = split_data(data, column_index, value)\n \n if mltask == 'regression':\n...
[ "0.74880135", "0.7095881", "0.69653386", "0.6910484", "0.68618083", "0.67778367", "0.6647111", "0.65734416", "0.6570264", "0.6497623", "0.6492311", "0.644486", "0.63778055", "0.6318494", "0.63056034", "0.630296", "0.6181761", "0.6156663", "0.6149908", "0.61427826", "0.613402"...
0.58607
29
Function to create a terminal node.
def get_terminal_node ( self, feature_column: int, node: TreeSplits, feature_value: float, feature_matrix: np.ndarray, target_array: np.ndarray, ): # Get the node type node_type = self.map_column_node_type [ feature_column ] if node_type == "c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_terminal() -> str:\n ...", "def terminal_node(\n self,\n expr: Any = None,\n ) -> None:\n self.data.append(\n {\n \"type\": \"TERMINAL\",\n \"expr\": expr,\n \"id\": len(\n self.data,\n ...
[ "0.77555245", "0.7163272", "0.6366092", "0.62840253", "0.6274114", "0.6256749", "0.6191868", "0.61676985", "0.6153323", "0.6140978", "0.6128334", "0.61176777", "0.6109941", "0.6029727", "0.6004716", "0.5998977", "0.5952726", "0.58835274", "0.5871811", "0.5863557", "0.5851825"...
0.0
-1
Function to create a continuous node split.
def get_continuous_node ( self, feature_column: int, feature_value: float, feature_matrix: np.ndarray, target_array: np.ndarray, node: TreeSplits, ): node.updateTreeValues ( feature_column = feature_column, feature_value = feature_value...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_split(self) -> NoReturn:\n raise NotImplementedError", "def _create_split(cls, op, op_t):\n node = cls._common_singa_tensor_to_onnx_node(op, op_t)\n\n node.attribute.extend([\n helper.make_attribute('axis', op.axis),\n helper.make_attribute('split', op.parts)...
[ "0.66962695", "0.65341157", "0.64728427", "0.62156624", "0.6158806", "0.60809195", "0.5970829", "0.5816579", "0.57917887", "0.5685064", "0.5624523", "0.5579703", "0.5562783", "0.55390286", "0.55183446", "0.5501418", "0.5480847", "0.5439089", "0.54173994", "0.540672", "0.54024...
0.5380758
24