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
Test if this cart is empty.
def is_empty(self): return self.id is None or self.nb_cart_items == 0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_shopping_cart_is_empty(self):\n response = self.client.get(self.SHOP_CART_URL)\n self.assertEqual(response.status_code, 200)\n self.assertContains(response, \"Your shopping cart is empty.\")\n self.assertQuerysetEqual(response.context['contents'], [])", "def test_shopping_car...
[ "0.8263173", "0.7682502", "0.76717985", "0.7634377", "0.7626435", "0.7626435", "0.76094395", "0.7590669", "0.7586988", "0.75739545", "0.75577635", "0.75392646", "0.7537761", "0.7518471", "0.74757564", "0.74757564", "0.74580145", "0.7455165", "0.7455165", "0.7435698", "0.74259...
0.8744867
0
Yield successive chunks from iterable of length size.
def chunker(iterable, size): for i in range(0, len(iterable), size): yield iterable[i:i + size]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def chunks(iterator, size):\n for index in range(0, len(iterator), size):\n yield iterator[index:index + size]", "def iter_chunks(iterable, size):\n it = iter(iterable)\n while True:\n chunk = tuple(itertools.islice(it, size))\n if len(chunk) == 0:\n break\n yield ...
[ "0.8773219", "0.8520928", "0.8467599", "0.841324", "0.8410151", "0.8247795", "0.8213483", "0.8210779", "0.810383", "0.8072789", "0.8064006", "0.80410075", "0.7970535", "0.79383165", "0.79333675", "0.7927991", "0.7896404", "0.7862617", "0.77980405", "0.7778066", "0.7762152", ...
0.8812423
2
Runs experiment using DP, QL or both. Creates new directory automatically Save result summary to summary file
def run_Experiment(DP = None, QL = None): # Path information output_path, exp_num = create_new_dir() #dirs Exp/1, Exp/2, ... DP_path = join(output_path,'DP') #dirs Exp/1/DP QL_path = join(output_path,'QL') #dirs Exp/1/QL print("************ Exp ", exp_num, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_test(self):\n\n # populate *_ps sets\n self.enter_project_file()\n\n # populate *_dir sets\n self.enter_directories()\n\n # The files in the directories makes up the largest possible set of files\n self.result_files = self.result_files_dir\n self.design_file...
[ "0.6303137", "0.5954984", "0.5947202", "0.5942798", "0.5933814", "0.5922406", "0.58769554", "0.58608824", "0.58519894", "0.5840858", "0.5767799", "0.5748718", "0.5712309", "0.5707479", "0.5706759", "0.56962764", "0.56911665", "0.56899905", "0.56842196", "0.567968", "0.5671062...
0.76796246
0
start point of scraping use urls, pass soup tag to Unvs return a list of 100 unvs(university) object
def scrape(): url_base='https://www.usnews.com/best-colleges/rankings/national-universities' unvss=[] for page in range(N_PAGE): url=url_base+'?_page={}'.format(page+1) soup=get_soup(url) unvs_tags=soup.find_all('li',id=re.compile(r'^view-.*'),class_='block-normal block-loose-for-lar...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_national_university_data(univ_url):\n f_name = 'national_university_html.json'\n base_url = 'https://www.usnews.com'\n html_cache = load_cache(f_name)\n\n if univ_url not in html_cache:\n resp = requests.get(base_url + univ_url, headers=agent)\n html_cache[univ_url] = resp.text\n ...
[ "0.6813396", "0.6677755", "0.6292874", "0.6277937", "0.62407184", "0.6227392", "0.6170943", "0.60358685", "0.6008686", "0.5971656", "0.5971656", "0.5909", "0.5846324", "0.5824053", "0.5823654", "0.5777535", "0.57656276", "0.5758727", "0.5701715", "0.57001144", "0.5692121", ...
0.8051392
0
get a soup tag, scrape the basic info from tag, return a url directing to detailed info call scrpae_detail for the info
def scrape_overview(self,unvs_tag): base='https://www.usnews.com' name_tag=unvs_tag.find('h3',class_='heading-large block-tighter').a assert(name_tag!=None) self.name=name_tag.string.strip() self.page_url=base+name_tag.get('href') assert(self.page_url!=None) self....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scrape_detail(self,url):\n soup=get_soup(url)\n self.zip=soup.find('p',class_='block-normal hide-for-small-only text-small hero-ranking-data-contact').stripped_strings.__next__()[-5::1]\n if self.zip in zips:\n #print('DUPLICATE!')\n zips.append(self.zip)\n info_ta...
[ "0.6728794", "0.622309", "0.61702514", "0.60019004", "0.59169936", "0.5884641", "0.5856371", "0.577665", "0.57433057", "0.5709777", "0.56357557", "0.56332", "0.5629008", "0.56176746", "0.5567721", "0.55604005", "0.5551275", "0.5544126", "0.554374", "0.5476874", "0.54727167", ...
0.54294735
25
use the url to scrape detailed info
def scrape_detail(self,url): soup=get_soup(url) self.zip=soup.find('p',class_='block-normal hide-for-small-only text-small hero-ranking-data-contact').stripped_strings.__next__()[-5::1] if self.zip in zips: #print('DUPLICATE!') zips.append(self.zip) info_tags=soup.fin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_info_of_url(url):\n pass", "def get_details(self):\n # For every URL in our list of links that we got from the parser's\n # 'lookup()' method we get the data from that URL, set it in our\n # parser's buffer, and then let the parser do the rest of the work.\n #\n for ...
[ "0.70981526", "0.6877993", "0.6745803", "0.67396754", "0.66712624", "0.66406703", "0.6620889", "0.6527329", "0.65011233", "0.64701736", "0.6441623", "0.6421658", "0.6386159", "0.63498217", "0.6328521", "0.6304512", "0.62901115", "0.625672", "0.6245974", "0.62436974", "0.62268...
0.7324095
0
This can be done on the fly but I felt like it would be too much nesting.
def filterByCountry(partners) -> dict(): countries = dict() for partner in partners: countries.setdefault(partner['country'],[]).append(partner) return countries
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def less_nested_example_vanilla():\n return", "def wrapup(self):\n pass", "def build_nested_blocks(self):\n pass", "def build(c):", "def less_nested_example_googlestyle(a):\n return a", "def less_nested_example_rst():\n\n return", "def _build(self):", "def _build(self):", "de...
[ "0.56387776", "0.55480915", "0.55267954", "0.5501647", "0.53977764", "0.5364499", "0.5355195", "0.5355195", "0.5338756", "0.51850367", "0.51783925", "0.5156866", "0.5146624", "0.5119881", "0.5119881", "0.5119881", "0.5119881", "0.5119881", "0.5090604", "0.5053077", "0.5051833...
0.0
-1
Yield successive nsized chunks from l.
def chunks(l, n): for i in xrange(0, len(l), n): yield l[i:i+n]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _chunk(self, l, n):\n for i in range(0, len(l) + 1, n):\n yield l[i:i + n]", "def chunks(self, l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]", "def __chunks(l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]", "def get_chunks(self, ...
[ "0.80388075", "0.7924573", "0.79226995", "0.788447", "0.7877021", "0.781505", "0.7764907", "0.77549165", "0.7743869", "0.7731126", "0.77281487", "0.77241385", "0.77024275", "0.7688614", "0.7688614", "0.7663561", "0.7656419", "0.76552874", "0.76552874", "0.76452404", "0.764524...
0.0
-1
Swap the byteordering in a packet with N=4 bytes per word
def byteswap(data, word_size=4): return reduce(lambda x,y: x+''.join(reversed(y)), chunks(data, word_size), '')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def byte_swap(data, word_size):\n \n bs_data = [0]*len(data)\n for ii in range(0, len(data), word_size):\n bs_data[ii:ii+word_size] = data[ii:ii+4][::-1]\n return(bytes(bs_data))", "def swapNibbles(inputByte):\n return (inputByte << 4 | inputByte >> 4) & 0xff", "def swap_bytes(word_val):\...
[ "0.6286982", "0.6104455", "0.57370377", "0.5551212", "0.5419383", "0.541504", "0.5307678", "0.524828", "0.5197568", "0.51582634", "0.5000781", "0.49925607", "0.49657536", "0.49612567", "0.49490094", "0.49409774", "0.49387702", "0.48654178", "0.48503458", "0.48486102", "0.4845...
0.62880516
0
For Cloud Foundry, we need to look in the VCAP_SERVICES environment
def try_atlas(): result = {} try: vcap_services = os.getenv('VCAP_SERVICES') services = json.loads(vcap_services) for service_name in services.keys(): print(f'service_name={service_name}') if service_name == "_": continue credentials = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_get_virtual_service(self):\n pass", "def test_vcap_services(self):\n Pet.init_db()\n self.assertIsNotNone(Pet.redis)", "def test_virtualservice_get(self):\n pass", "def YumGetServiceName(vm):\n raise NotImplementedError", "def test_aws_service_api_vm_get(self):\n ...
[ "0.6299223", "0.5994557", "0.5943203", "0.59000796", "0.56889766", "0.5556806", "0.5556276", "0.5535231", "0.5494093", "0.54824984", "0.5477889", "0.5470114", "0.54561913", "0.54173064", "0.5373834", "0.5360619", "0.53265256", "0.53149337", "0.5297183", "0.52950287", "0.52896...
0.5476052
11
Connects components in UI with their corresponding event handlers in Application Manager
def connectUI(self, obj): self.ui.bt_search.clicked.connect(obj.player_search) self.ui.bt_edit_edit_selected.clicked.connect(obj.player_edit_selected) self.ui.bt_edit_edit_selected.clicked.connect(obj.player_edit_selected) self.ui.bt_edit_saveedit.clicked.connect(obj.player_edit_saveedit) self.ui.bt_edi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connect_event(self):\n self.ui.btn_Open_Image.clicked.connect(self.onclick_open_image)\n self.ui.btn_Home.clicked.connect(self.go_to_home_application)\n self.ui.btn_Open_Cam.clicked.connect(self.onclick_open_camera_button)\n self.ui.btn_Open_Video.clicked.connect(self.onclick_load_v...
[ "0.6218227", "0.6187797", "0.60312563", "0.59892905", "0.5914981", "0.59095055", "0.5853487", "0.57918596", "0.5754873", "0.5754524", "0.5751479", "0.5740638", "0.57377917", "0.57241845", "0.57060283", "0.5671398", "0.5660528", "0.5606709", "0.5601831", "0.5572997", "0.555753...
0.5247654
56
returns true if response is HTML
def is_good_response(self, resp): content_type = resp.headers['Content-Type'].lower() return (resp.status_code == 200 and content_type is not None and content_type.find('html') > -1)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_good_response(self, resp):\r\n\t\tcontent_type = resp.headers['Content-Type'].lower()\r\n\t\treturn (resp.status_code == 200 and content_type is not None and content_type.find('html') > -1)", "def is_html(self):\r\n return self.__content_type == html_ctype", "def is_html(self):\n return se...
[ "0.7978629", "0.7896287", "0.7848669", "0.7823706", "0.78176934", "0.77728", "0.7765719", "0.77475446", "0.7746658", "0.77149415", "0.76882756", "0.76882756", "0.76882756", "0.76882756", "0.7683412", "0.7676108", "0.7676108", "0.7676108", "0.7676108", "0.7676108", "0.7676108"...
0.80010843
0
Attempts to get the content at `url` by making an HTTP GET request. If the contenttype of response is some kind of HTML/XML, return the text content, otherwise return None
def simple_get(self, url): """ The simple_get function accepts a single url argument. It then makes a GET request to that url. If nothing goes wrong, you end up with the raw HTML content for the page you requested. If there were any problems with your request (like the ur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_url_content(url):\n try:\n r = requests.get(url)\n if r.ok:\n return r.text\n else:\n return None\n except Exception:\n return None", "def simple_get(url):\n try:\n with closing(requests.get(url, stream=True)) as resp:\n if(is_...
[ "0.82686275", "0.82643026", "0.82408965", "0.82197744", "0.82143354", "0.80992573", "0.8057474", "0.8057474", "0.8056611", "0.80537915", "0.80537915", "0.80537915", "0.80537915", "0.80537915", "0.80537915", "0.80432236", "0.80328834", "0.80328834", "0.80328834", "0.7998802", ...
0.79634637
20
Save the data for the component to be persisted.
def saveData(self): data = super(SimpleControlComponentGuide, self).saveData() data["ctrlSize"] = self.ctrlSizeInputAttr.getValue() data["ctrlXfo"] = self.mainCtrl.xfo return data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_data(self):\n pass", "def saveData(self):\n pass", "def save(self):\n raise NotImplementedError", "def save(self):\n raise NotImplementedError", "def save(self):\n raise NotImplementedError", "def save(self):\n # TODO (Pierre): code", "def save(self):\...
[ "0.809109", "0.78951603", "0.76420194", "0.76420194", "0.76420194", "0.76066446", "0.76036537", "0.7577322", "0.75646037", "0.75355595", "0.75355595", "0.75355595", "0.75355595", "0.75355595", "0.7532554", "0.7512014", "0.7512014", "0.7512014", "0.7493771", "0.74873805", "0.7...
0.0
-1
Load a saved guide representation from persisted data.
def loadData(self, data): super(SimpleControlComponentGuide, self).loadData( data ) self.ctrlSizeInputAttr.setValue(data["ctrlSize"]) self.mainCtrl.xfo = data["ctrlXfo"] scaleValue = data["ctrlSize"] self.mainCtrl.setShape('square') self.mainCtrl.rotatePoints(90, 0, 0)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loadData(self, data):\n\n #Grab the guide settings in case we want to use them here (and are not stored in data arg)\n existing_data = self.saveData()\n existing_data.update(data)\n data = existing_data\n\n super(OSSMouthGuide, self).loadData( data )\n\n self.loadAllOb...
[ "0.6494611", "0.59344995", "0.5652479", "0.5652479", "0.5652479", "0.5652479", "0.56253165", "0.56253165", "0.562344", "0.5558141", "0.5558141", "0.5526227", "0.55205995", "0.54645044", "0.53951573", "0.53586185", "0.5353325", "0.53121376", "0.5278196", "0.5272028", "0.526720...
0.0
-1
Returns the Guide data used by the Rig Component to define the layout of the final rig.
def getRigBuildData(self): data = super(SimpleControlComponentGuide, self).getRigBuildData() data["ctrlSize"] = self.ctrlSizeInputAttr.getValue() data["ctrlXfo"] = self.mainCtrl.xfo return data
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def saveData(self):\n data = super(SimpleControlComponentGuide, self).saveData()\n\n data[\"ctrlSize\"] = self.ctrlSizeInputAttr.getValue()\n data[\"ctrlXfo\"] = self.mainCtrl.xfo\n\n return data", "def saveData(self):\n\n data = super(OSSMouthGuide, self).saveData()\n\n ...
[ "0.60837376", "0.57267016", "0.5652258", "0.55439556", "0.55439556", "0.5307513", "0.5296474", "0.52579033", "0.52306396", "0.5197011", "0.51202613", "0.5104202", "0.50606996", "0.50557256", "0.5048612", "0.5043005", "0.5043005", "0.50353324", "0.50348055", "0.50302404", "0.5...
0.6716383
0
Enables introspection of the class prior to construction to determine if it is a guide component.
def getComponentType(cls): return 'Guide'
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def abstract(self):\n return self._cls and not self._tool", "def get_guide_type(guide):\n # Maintained by naming convention in the Blender files. Sub-optimal.\n try:\n return guide.name[guide.name.rindex(\".\") + 1:]\n except:\n return None", "def setup_class(cls):\n cls.be...
[ "0.57170075", "0.5539905", "0.5513718", "0.5417464", "0.53752244", "0.5361038", "0.53488845", "0.5335014", "0.5306125", "0.5271901", "0.5271901", "0.5254923", "0.5219103", "0.5219103", "0.5090291", "0.5090291", "0.5021101", "0.5020824", "0.49868792", "0.49730074", "0.49605048...
0.6441624
1
Returns the corresponding rig component class for this guide component class
def getRigComponentClass(cls): return SimpleControlComponentRig
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getComponentType(cls):\n\n return 'Guide'", "def getComponentType(cls):\n\n return 'Guide'", "def getRigComponentClass(cls):\n\n return OSSMouthRig", "def get_class(self):\n\t\treturn self.CLASS", "def component(self):\n return self._component", "def component(self):\n ...
[ "0.72734654", "0.72734654", "0.6762508", "0.6674559", "0.61377406", "0.61377406", "0.61340904", "0.6081116", "0.6031022", "0.59476155", "0.59440464", "0.5913267", "0.59066844", "0.586445", "0.583399", "0.5800438", "0.5774759", "0.5768571", "0.57600415", "0.5756991", "0.575684...
0.74637115
0
Load a saved guide representation from persisted data.
def loadData(self, data=None): super(SimpleControlComponentRig, self).loadData( data ) ctrlSize = data.get('ctrlSize', 1.0) ctrlXfo = data.get('ctrlXfo', Xfo()) # ================ # Resize Controls # ================ self.mainCtrl.setShape('square') sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loadData(self, data):\n\n #Grab the guide settings in case we want to use them here (and are not stored in data arg)\n existing_data = self.saveData()\n existing_data.update(data)\n data = existing_data\n\n super(OSSMouthGuide, self).loadData( data )\n\n self.loadAllOb...
[ "0.6494611", "0.59344995", "0.5652479", "0.5652479", "0.5652479", "0.5652479", "0.56253165", "0.56253165", "0.562344", "0.5558141", "0.5558141", "0.5526227", "0.55205995", "0.54645044", "0.53951573", "0.53586185", "0.5353325", "0.53121376", "0.5278196", "0.5272028", "0.526720...
0.0
-1
Create table with prepared structure
def create_table(drop_if_exists=True) -> None: connection = ConnectDB.connect() additional_types_query = """DO BEGIN IF NOT EXISTS (SELECT 1 FROM pg_type WHERE typname = 'gender') THEN CREATE TYPE Gender AS ENUM ('female', 'man'); END IF; IF NOT...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _create_table(self) :\n\n cur = self.con.cursor()\n delete_sql = 'DROP TABLE IF EXISTS \"%s\"' % self.name\n cur.execute(delete_sql)\n\n col_sql = ','.join(['\"%s\" %s' % (self.cols[i], self.types[i])\n for i in range(len(self.cols))])\n create_sql ...
[ "0.74694735", "0.7446109", "0.7443517", "0.7393832", "0.73920125", "0.73801327", "0.7374949", "0.73692536", "0.7362258", "0.7269887", "0.7257049", "0.723348", "0.7213967", "0.72057986", "0.71917915", "0.71851873", "0.71809405", "0.715922", "0.71443105", "0.71439445", "0.71288...
0.0
-1
Load csv file to database. Add `year` column
def from_csv_to_database(): for year, path in FileNamePath.items(): # load csv files with open(path, encoding='cp1251') as dataset: print(f"Download {year} data") get_curr_data(dataset, year)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_catalog(self):\n self.catalog = pd.read_csv(self.catalog_path, \n index_col=0, parse_dates=True)\n self.unique_years = self.catalog.index.year.unique()\n return", "def load_data(path):\n\n columns = ['Item Year', 'Original Value', 'Standard Value', 'Original Currency',...
[ "0.6482594", "0.6402999", "0.6367218", "0.6283168", "0.62296", "0.6219771", "0.6213001", "0.6185162", "0.6111619", "0.6011145", "0.60105246", "0.5978613", "0.597643", "0.5974852", "0.5945671", "0.59363544", "0.593171", "0.5929072", "0.5925405", "0.5903456", "0.5902019", "0....
0.6820516
0
Save csv file with given header and rows into output folder
def to_csv(header, rows): with open('result.csv', 'w') as result: result_writer = csv.writer(result, delimiter=';') result_writer.writerow(header) result_writer.writerows(rows)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_csv(self, out_file_name, header):\n\n with open(out_file_name, 'wb') as outf:\n writer = csv.writer(outf, quoting=csv.QUOTE_ALL)\n writer.writerow(header)\n writer.writerows(self.records)", "def write_csv(header_row, data_rows, filename, course_id):\n shared.e...
[ "0.73305476", "0.7274633", "0.7113233", "0.69982344", "0.68883383", "0.6880275", "0.68772936", "0.6867271", "0.6855233", "0.68267447", "0.67927784", "0.6781188", "0.67231953", "0.67214197", "0.666982", "0.6666694", "0.663893", "0.6626239", "0.6602342", "0.65913993", "0.657377...
0.74616706
0
Collect the data from files in the imgdata directory.
def get_data(): size, intensity, age = [], [], [] def calculate(data, data_top): """Return age and the averages of size and intensity.""" size, intensity, age = np.array([data["Size"]]), np.array([data["Intensity"]]), data_top.iat[1,0] size_avg, intensity_avg = np.average(size), np.aver...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_data_in_folder(self):\n print('loading files in data folder')\n n = len(self.filenames)\n idx_max = n // self.batch_size\n for idx in range(0, idx_max-1):\n data = []\n for f in self.filenames[idx:idx+64]:\n img = cv2.imread(f, int(self.colo...
[ "0.71007186", "0.70617384", "0.70067984", "0.70027936", "0.6990193", "0.6869805", "0.6833341", "0.6772648", "0.6760607", "0.6757017", "0.6753424", "0.6750051", "0.66493285", "0.6612349", "0.65738165", "0.6558397", "0.6531852", "0.6525636", "0.6473054", "0.6431205", "0.6412979...
0.67055446
12
Return age and the averages of size and intensity.
def calculate(data, data_top): size, intensity, age = np.array([data["Size"]]), np.array([data["Intensity"]]), data_top.iat[1,0] size_avg, intensity_avg = np.average(size), np.average(intensity) return size_avg, intensity_avg, age
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_average_age(self):\n return np.mean([agent.age for agent in self.agents])", "def average_age():\n df = pd.read_csv(config.META_FQN, sep=\"\\t\")\n ages = []\n for _, row in df.iterrows():\n if row[\"asr_test\"]:\n age = row[\"Age_ses1\"]\n if not math.isnan(ag...
[ "0.69467896", "0.6716017", "0.64098644", "0.6313252", "0.62349457", "0.60789764", "0.603415", "0.5983959", "0.5971684", "0.5971354", "0.596329", "0.5948338", "0.59151775", "0.59151775", "0.5871947", "0.5868544", "0.58433545", "0.57856715", "0.5773423", "0.57728165", "0.576568...
0.74258214
0
Locates the flags in the resource Calls the LineFinder class in order
def getting_flags_locations(self): print(self.flags) self.line_finder.find_line(self.html)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _linesearch(self):\n pass", "def setup_flags(self):\n self.io_args.color = self.io_args.color_full\n self.io_args.rig_in = self.io_args.rig\n self.io_args.matches = os.path.join(self.io_args.output_root, \"matches.json\")\n self.io_args.rig_out = os.path.join(self.io_args.o...
[ "0.6099659", "0.573128", "0.5506411", "0.54494226", "0.52455074", "0.52231914", "0.5129431", "0.51100206", "0.5072955", "0.5024129", "0.5009258", "0.4999141", "0.49835676", "0.4975226", "0.49732998", "0.49641412", "0.49461514", "0.4915233", "0.49087882", "0.48647398", "0.4846...
0.76073164
0
Save the dictionary with the serendipity values.
def save_serendipity_dic(y, filename): store = pd.io.pytables.HDFStore(y) mat = store.matrix store.close() n = len(mat.columns) ser = 1 - mat.sum(axis=1) / n f = open(filename, "w") cPickle.dump(ser.to_dict(), f, protocol=2) f.close()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_vals (self):\n raise NotImplementedError", "def save(self) -> None:\n with open(dict_path, 'w', encoding='utf-8') as dictionary_file:\n json.dump(self.data, dictionary_file, indent=2, separators=(',', ':'), ensure_ascii=False)", "def save(self):\n self.wallet.storage.put(\n ...
[ "0.6690913", "0.66228455", "0.6598225", "0.65902627", "0.6570407", "0.65265197", "0.6378944", "0.63679206", "0.6274411", "0.62738395", "0.6251937", "0.624853", "0.6242614", "0.62388796", "0.62336016", "0.62253934", "0.618943", "0.6171405", "0.61166525", "0.61027896", "0.60906...
0.6463705
6
Return the serendipity of a RNA.
def get_serendipity_val(dic, key): # The key was in the training set try: return dic[key] # The key wasn't in the training set, then the serendipity is 1 except KeyError: return 1.0
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_serie(probability_of_using_same_serie=0.1):\n if random() < probability_of_using_same_serie and GraphParameters.SERIE:\n return choice(list(GraphParameters.SERIE))\n serie = \"Alpha-\" + ''.join(choice('0123456789ABCDEF-') for i in range(8)).strip(\"-\")\n GraphParameters.SE...
[ "0.5642784", "0.55564713", "0.5457908", "0.54552877", "0.5367021", "0.5355116", "0.53361696", "0.53177714", "0.52889764", "0.52446175", "0.522932", "0.5206401", "0.51484346", "0.51453054", "0.5136129", "0.5101252", "0.5044812", "0.50340647", "0.5026674", "0.50091314", "0.5003...
0.5497885
2
Add url domain field to each tweet in each user data object. Url domain field contains list of domains corresponding to list of urls.
def modify_user_data(user_d_list): for user in user_d_list: for tweet in user['tweets']: domains = [get_domain_of_url(url) for url in tweet['urls']] tweet['domains'] = domains return
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_domain():\n\n for e in Expr.search() + User.search(): e.set_tld(config.server_name)", "def fixURLS():\n url_re = re.compile(r'http t co \\S+')\n tweets = Tweet.objects.all()\n for tweet in tweets:\n tweet.text = url_re.sub(' ', tweet.text)\n tweet.text = ' '.join(tweet.text.s...
[ "0.5635619", "0.55407476", "0.5532279", "0.5374472", "0.537326", "0.53537875", "0.53423244", "0.53104246", "0.5303713", "0.5294134", "0.52771896", "0.527685", "0.52617246", "0.524754", "0.52349997", "0.52061516", "0.5133119", "0.5130348", "0.5129113", "0.5128528", "0.5121948"...
0.8328926
0
Determine the domain that a url redirects to.
def get_domain_of_url(url): try: request = Request(url) request.add_header('User-Agent', 'Resistance is futile') response = urlopen(request) response_url = response.url domain = urlparse(response_url).hostname return domain.lower() except: return "URL_ERRO...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetDomainName(self):\n return urlparse(self._redirectUrl).netloc", "def get_domain(url):\n parsed_uri = urlparse(url)\n return(parsed_uri.netloc)", "def get_domain(self, response):\n parts = urllib.parse.urlparse(response.url)\n domain = parts.netloc\n return domain", "d...
[ "0.7943847", "0.78226775", "0.7710047", "0.7608279", "0.7555167", "0.75494635", "0.7544284", "0.75333625", "0.7485427", "0.7466769", "0.72855824", "0.7276844", "0.71699125", "0.7098693", "0.70763904", "0.7055416", "0.7030797", "0.6981147", "0.6922646", "0.6882593", "0.6849095...
0.74133736
10
This function takes in all paths that are represented as lists of consecutive nodes [node1, node2,...,nodeN] and converted to paths represented as lists of consecutive relations [rel1, rel2,...,relM] if self.include_entity is false, or as lists of nodes and relations [node1, rel1, node2, rel2,...,relM, nodeN] if self.i...
def expand_paths_by_nodes(self, paths): paths_formatted = set() # Expand each path for path in paths: if len(path) < 2: continue expanded_paths = set() if self.include_entity: relations_for_each_step = [[path[0]]] el...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert_paths(self):\n # convert to node sequences, dropping s'\n self.nodeseq_paths = []\n for path in self.paths:\n node_seq = [] # don't include s'\n for arc in path:\n node_seq.append(self.arc_info[arc]['destin'])\n self.nodeseq_paths.ap...
[ "0.6200332", "0.5851866", "0.571507", "0.56179786", "0.5481076", "0.5464558", "0.5461847", "0.5296667", "0.5288939", "0.5283457", "0.5277893", "0.5269692", "0.52677166", "0.52636945", "0.5238955", "0.5237788", "0.5216618", "0.52149516", "0.5190407", "0.51791054", "0.5176276",...
0.6647005
0
This function is used to write all paths between any two entities that are connected by the input relation to a file. Because this function will go through all paths node by node, this function will also used to filter paths to save computation.
def write_and_filter_paths(self, source, target, relation, label, paths): file_dir = os.path.join(self.save_dir, relation + "_" + str(self.maximum_length) + "_" + str(self.remaining_percentage) + "_" + str(self.random_seed) + ".txt") with open(file_dir, "a") as fh: fh.write(str(label) + "\t"...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def writePathways( self ):\n\n self.logger.info( 'writePathways: START' )\n\n # Generate inserts for meabolic pathways.\n self.importerPathway.writePathways()\n\n self.logger.info( 'writePathways: DONE' )", "def filter_paths(self, paths):\n formatted_paths = set()\n for ...
[ "0.6408844", "0.6286845", "0.62742597", "0.619009", "0.6096018", "0.5878812", "0.5735827", "0.5685394", "0.56852794", "0.5661119", "0.5632934", "0.5616579", "0.5599253", "0.55716807", "0.556647", "0.5563934", "0.5434351", "0.54200315", "0.537365", "0.5366517", "0.53606457", ...
0.74876946
0
This function is used to filter all paths and change paths represented by relation index and entity index to paths represented by relation name and entity name
def filter_paths(self, paths): formatted_paths = set() for path in paths: formatted_path = [] if self.include_entity: if len(path) == 3: continue formatted_path.append(self.idx_to_node[path[0]].get_name()) for rd...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_and_filter_paths(self, source, target, relation, label, paths):\n file_dir = os.path.join(self.save_dir, relation + \"_\" + str(self.maximum_length) + \"_\" + str(self.remaining_percentage) + \"_\" + str(self.random_seed) + \".txt\")\n with open(file_dir, \"a\") as fh:\n fh.write...
[ "0.58268344", "0.52432096", "0.5228353", "0.51687616", "0.5044035", "0.5042572", "0.4956355", "0.49512407", "0.4946628", "0.4930969", "0.49182546", "0.49161366", "0.4869944", "0.48368976", "0.4831286", "0.48303708", "0.48242262", "0.48204356", "0.48135132", "0.48054898", "0.4...
0.6383274
0
Validates if each elements contain the previous and their are equal
def verify_chain(blockchain): for index, block in enumerate(blockchain): if index == 0: continue if block.previous_hash != hash_block(blockchain[index - 1]): return False if not Verification.valid_proof(block.transactions[:-1], block.previous...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allsame(xs):\n assert len(xs) > 0\n return all(x == xs[0] for x in xs[1:])", "def check():\r\n for a in l:\r\n for b in l:\r\n assert not(b in comes_after[a] and a in comes_after[b])", "def all_same(items):\n \n return all(x == items[0] for x in items)", "def ...
[ "0.67529505", "0.6488937", "0.642974", "0.6424669", "0.6401508", "0.63954824", "0.63903385", "0.6365632", "0.6273884", "0.62532556", "0.6236504", "0.61716396", "0.612882", "0.6124451", "0.61181426", "0.61021763", "0.61009073", "0.6067597", "0.60629946", "0.60506934", "0.60454...
0.0
-1
Initialize the state of the filter with a mean and covariance (uncertainty) Docstring
def _init_state(self, init_state=None, init_cov=None): ## Initialize the BMI state, assuming nS = self.n_states if init_state == None: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self):\n self.mean = 0.0\n self.std = 1.0", "def __init__(self, mean, var=2):\n\n self.mean = mean\n self.var = var", "def __init__(self, mean=None, cov=1):\r\n self.dim, self.mean, self.cov = _process_parameters(None, mean, cov)\r\n self.prec_U, self._log...
[ "0.68799675", "0.61874145", "0.6156245", "0.60888946", "0.60776407", "0.60061157", "0.59723383", "0.5936516", "0.58487064", "0.58445746", "0.58444643", "0.57843155", "0.5782224", "0.57818365", "0.5778741", "0.57758945", "0.5774353", "0.5745278", "0.57012343", "0.5694429", "0....
0.5583767
35
Probability of an random event theta given current state s.
def theta_given_s(theta, q): if q == 0: return .3333 else: if theta == 0: return 0.25 elif theta == 1: return 0.25 else: return 0.5
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _starting_prob(self, s):\n return self._starting_state_distribution.pdf(s)", "def compute_probability_of_state(state):\n p = compute_log_probability_of_text(state[\"text\"], state[\"char_to_ix\"], \n state[\"frequency_statistics\"], state[\"transition_matrix\"...
[ "0.67219484", "0.6633048", "0.6455988", "0.64483786", "0.6309092", "0.6300978", "0.62985826", "0.6290623", "0.62792915", "0.62534195", "0.62534195", "0.62534195", "0.62534195", "0.62534195", "0.6252587", "0.62439626", "0.623991", "0.62372935", "0.62270015", "0.62248063", "0.6...
0.579814
59
Multiperiod commitments in the next epoch.
def new_w(w, d): if w.sum() > 0: next_w = w.copy() next_w[next_w > 0] -= 1 return next_w else: if d[0] == 1: return np.array([51,0,0]) elif d[1] == 1: return np.array([0,51,0]) else: return np.array([0,0,51])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _momentum_update_key_encoder(self) -> None:\n momentum = self.encoder_momentum\n for param_q, param_k in zip(self.encoder_q.parameters(), self.encoder_k.parameters()):\n param_k.data = param_k.data * momentum + param_q.data * (1.0 - momentum)", "def bulk_modulus():\n\n return ...
[ "0.5135255", "0.5123099", "0.51157635", "0.50703293", "0.5054246", "0.49106103", "0.4865669", "0.4844311", "0.48381487", "0.48045045", "0.47987068", "0.4731387", "0.4711523", "0.47011307", "0.46949154", "0.4683865", "0.46607396", "0.4658189", "0.46556586", "0.46524188", "0.46...
0.0
-1
Attraction function of resource (h in the paper).
def attraction_h(next_r, a): if a == 0: if next_r == 9: return 0.8 elif next_r == 14: return 0.1 else: return 0.1 elif a == 1: if next_r == 9: return 0.1 elif next_r == 14: return 0.1 else: r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _desc_op(attr_name):", "def attributes(self):\n ...", "def attributes(self):", "def attr(*args, **kwargs):\n return Attr(*args, **kwargs)", "def __getattr__(self, attr):\n for resource in lineage(self):\n if attr in resource.__initial_attrs__:\n value = self._...
[ "0.633073", "0.6253096", "0.62399495", "0.58977604", "0.5896142", "0.58748055", "0.58748055", "0.5810813", "0.57991314", "0.5772088", "0.57460266", "0.5722806", "0.568998", "0.56712985", "0.55946434", "0.55810964", "0.55440104", "0.55188745", "0.5515306", "0.5512768", "0.5506...
0.0
-1
Attraction function of operational conditions (g in the paper).
def attraction_g(next_q, q, d, a): if a == 0: if next_q == 0: xi_D = 8 else: xi_D = 1 elif a == 1: xi_D = 1 elif a == 2: if next_q == 0: xi_D = 1 else: xi_D = 3 elif a == 3: if next_q == 0: xi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Mutation(self, state):\n changed = False;\n #-------------------------------------------------------\n # MUTATE CONDITION\n #-------------------------------------------------------\n for att in range(cons.env.format_data.numb_attributes): #Each condition specifies different ...
[ "0.59705275", "0.59240454", "0.5861633", "0.57576585", "0.5615792", "0.54887545", "0.543721", "0.5429981", "0.5418968", "0.5392196", "0.53746855", "0.5364727", "0.53537273", "0.53473896", "0.5323972", "0.5315444", "0.53144354", "0.52830577", "0.5280386", "0.5256036", "0.52460...
0.54523236
6
Probability of decision d from state s to state next_s
def trans_prob(next_s, q, d): next_q, next_r, next_w = next_s A_actions = [0, 1, 2, 3, 4] prob = 0 for a in A_actions: prob_r = attraction_h(next_r[0], a) q1 = attraction_g(next_q[0], q, d, a) q2 = attraction_g(1-next_q[0], q, d, a) prob_q = q1 / (q1 + q2) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _transition_probability(self, s, a, s1):\n unreachable_states = [4, # F with prod_score == 4\n 5] # M with prod_score == 0\n\n if s1 in unreachable_states:\n return 0\n else:\n return 1 / (self.n_states - len(unreachable_states))", "de...
[ "0.7248015", "0.7077099", "0.69555706", "0.6560675", "0.6411908", "0.6363046", "0.63058686", "0.6260645", "0.6218823", "0.61547095", "0.61078906", "0.60890436", "0.6088", "0.6061975", "0.60540265", "0.6049762", "0.60051227", "0.5988864", "0.59776247", "0.5952194", "0.5938377"...
0.6716084
3
Convert single line in Instruction instance.
def process_line(line: str) -> Instruction: register, op, value, _, base, check, limit = line.split() return Instruction(register, op, int(value), base, check, int(limit))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trans_line(line: str, progname):\r\n splitline = line.split()\r\n command = splitline[0]\r\n if command == 'push':\r\n segment = splitline[1]\r\n index = splitline[2]\r\n out = mem.push(segment, index, progname)\r\n elif command == 'pop':\r\n segment = splitline[1]\r\n ...
[ "0.6149348", "0.60882974", "0.60344046", "0.59739935", "0.5775252", "0.5676443", "0.56726754", "0.56274086", "0.5606504", "0.5577222", "0.55470794", "0.5473916", "0.5454122", "0.54540783", "0.54350394", "0.5411006", "0.5390487", "0.5379209", "0.53752047", "0.53626865", "0.535...
0.6650071
0
Convert raw data in the easytouse list of Instruction instances.
def process_data(data: str) -> list[Instruction]: instructions = [] for line in data.strip().split("\n"): instruction = process_line(line) instructions.append(instruction) return instructions
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract(input_data: str) -> list:\n instructions = list()\n for instruction in input_data.split('\\n'):\n op, arg = instruction.split(' ')\n arg = int(arg)\n assert op in ('acc', 'jmp', 'nop')\n instructions.append(Instruction(op, arg))\n return instructions", "def _perfo...
[ "0.5894083", "0.580195", "0.56562746", "0.5608601", "0.55650634", "0.55505216", "0.55473304", "0.5376276", "0.53636885", "0.5328439", "0.5309102", "0.52925634", "0.52925086", "0.5272285", "0.5267069", "0.5258318", "0.5257359", "0.5243541", "0.5228365", "0.5214779", "0.5211774...
0.63322127
0
Apply all instructions and return registers + the biggest value seen.
def perform_instructions( instructions: list[Instruction], ) -> tuple[DefaultDict[str, int], int]: registers: DefaultDict[str, int] = defaultdict(int) biggest = 0 for instruction in instructions: update = OPERATORS[instruction.op] check = OPERATORS[instruction.check] register = ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_most_valuable(self):\n return self.most_valuable", "def computeActionFromValues(self, state):\n \"*** YOUR CODE HERE ***\"\n maxvalue = -100000000\n bestaction = None\n for action in self.mdp.getPossibleActions(state):\n valueforthisaction = self.getQValue(stat...
[ "0.5996123", "0.5894548", "0.5865219", "0.5787033", "0.5779433", "0.57666355", "0.56985855", "0.56887287", "0.56882644", "0.5670334", "0.56451887", "0.56444883", "0.5636384", "0.56336486", "0.56252307", "0.55974555", "0.55864197", "0.5554566", "0.55422884", "0.5532165", "0.55...
0.65974396
0
Find the biggest register.
def solve(task: str) -> int: instructions = process_data(task) registers, _ = perform_instructions(instructions) return max(registers.values())
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def return_the_maximum(self):\n\n return self.__max_stack[-1]", "def find_max(self):\n if self.right:\n return self.right.find_max()\n return self.data", "def find_max(self):\n return max(self.nodes, key=int)", "def find_max(self):\n\n if self.right:\n ...
[ "0.65381134", "0.6531537", "0.64896965", "0.6431575", "0.6377627", "0.6357117", "0.6151583", "0.60980093", "0.6092156", "0.60648984", "0.60378355", "0.6018988", "0.6000243", "0.5955349", "0.5946053", "0.5944906", "0.59375596", "0.5931247", "0.5931247", "0.5929218", "0.5920487...
0.0
-1
Convert a URL to IDN notation
def _convert_to_idn(url): # this function should only be called with a unicode string # strategy: if the host cannot be encoded in ascii, then # it'll be necessary to encode it in idn form parts = list(urllib.parse.urlsplit(url)) try: parts[1].encode('ascii') except UnicodeEncodeError: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def url_to_doi(url):\n return url[url.index(prefix):].rstrip(url_suffix).rstrip(INT_URL_SUFFIX)", "def iri2uri(uri): \r\n if isinstance(uri ,unicode):\r\n (scheme, authority, path, query, fragment) = urlparse.urlsplit(uri)\r\n authority = authority.encode('idna')\r\n # For each charact...
[ "0.7021145", "0.65356356", "0.6437324", "0.6412383", "0.6395479", "0.6311997", "0.61961514", "0.6158848", "0.61555415", "0.6119481", "0.6110008", "0.61025923", "0.60946435", "0.6066466", "0.6030167", "0.6021279", "0.6020139", "0.6007491", "0.60052556", "0.5983566", "0.5945938...
0.8388875
0
One epoch is a single tournament here
def one_epoch(self, tournament_id: int, epoch=0): # TODO: tournament pre-fetcher tournament = Tournament(tournament_id, cache=self.cache) # Measure correlation before to see whether gradient update took effect correlation_before = self.get_prediction_correlation(tournament) cor...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tournament(self):\n pass", "def train_one_epoch(self):\n raise NotImplementedError", "def train_epoch(self) -> None:\n ct = self.config.training\n total_games = self._get_total_games()\n print(f\"Total Games: {total_games}\")\n train_size = int(0.9 * total_games)\n...
[ "0.6938331", "0.6872798", "0.6221495", "0.61553615", "0.6041733", "0.5884427", "0.58615357", "0.5858718", "0.58503413", "0.584667", "0.58107626", "0.5793915", "0.57814837", "0.5771732", "0.57555825", "0.57402873", "0.5730085", "0.5728672", "0.57039595", "0.57039595", "0.57039...
0.7137898
0
Get scores for all the teams
def get_scores(self, tournament: Tournament): self.model.eval() # collate_fn = lambda x: collate_teams(x, tournament.max_members) dl_rank = DataLoader(tournament.ranking, num_workers=self.jobs, batch_size=self.bs, shuffle=False) iterator = tqdm(dl_rank, position=0, desc=f'{tournament.tou...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_list_team_scores(self):\n scores = defaultdict(lambda: {\n \"scored_xg\": [],\n \"conceded_xg\": [],\n \"home_adv\": 0,\n \"expected_points\": 0\n })\n\n for g in self.games:\n scores[g.HomeTeam][\"scored_xg\"].append(g.FTHG)\n ...
[ "0.77148676", "0.6926027", "0.6908442", "0.6832203", "0.68074715", "0.67282873", "0.67100906", "0.6675928", "0.66030395", "0.6575878", "0.6529839", "0.647783", "0.63599753", "0.63421893", "0.6304855", "0.63044083", "0.62909013", "0.6269161", "0.62505054", "0.62181664", "0.620...
0.7616093
1
suit and value should be integers
def __init__(self, value, suit) -> None: self.value = value self.suit = suit
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __init__(self, value, suit):\n self.value = value # A,2,3,4,5,6,7,8,9,10,J,Q, or K\n self.suit = suit # hearts, diamonds, clubs, spades", "def test_is_suit_integer(self):\n self.assertIsInstance(cardutils.Card(10,1).suit, int)", "def suit(self):\r\n\t\tsuit = self.n // 13\r...
[ "0.7262717", "0.7030172", "0.67238253", "0.66163784", "0.65954757", "0.65391135", "0.6420939", "0.6411027", "0.6410355", "0.6391943", "0.6384562", "0.63782066", "0.63565224", "0.63530475", "0.6339618", "0.63249195", "0.62757915", "0.62429863", "0.6201983", "0.61999196", "0.61...
0.7071617
1
Function to mimic the 'fspecial' gaussian MATLAB function
def _tf_fspecial_gauss(size, sigma): x_data, y_data = np.mgrid[-size//2 + 1:size//2 + 1, -size//2 + 1:size//2 + 1] x_data = np.expand_dims(x_data, axis=-1) x_data = np.expand_dims(x_data, axis=-1) y_data = np.expand_dims(y_data, axis=-1) y_data = np.expand_dims(y_data, axis=-1) x = tf.constant(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gaussian(x, mean, sigma):\n return np.exp(-np.square(x-mean)/(2*np.square(sigma))) / (np.sqrt(2*np.pi*sigma**2))", "def gaussian(x, mu, sigma):\n return (np.exp(-(x - mu)**2 / 2.0 / sigma**2) /\n np.sqrt(2.0 * np.pi) / sigma)", "def _FSpecialGauss(size, sigma):\n radius = size // 2\n ...
[ "0.76750207", "0.7655075", "0.74836683", "0.7482679", "0.74079776", "0.7406864", "0.7400095", "0.7362913", "0.732379", "0.7293053", "0.72702783", "0.72199357", "0.7076322", "0.70740974", "0.70684606", "0.7040425", "0.7029026", "0.7005637", "0.69755626", "0.6971254", "0.693980...
0.6823641
31
Return comments tree by entity or root comment
async def get_comments_tree(request): comment_id = request.match_info.get('comment_id') if comment_id: # valitation was in route (\d+) comment_id = int(comment_id) tree = CommentsTreeDAO.create_by_parent(comment_id) else: entity_type = request.match_info.get('entity_type') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_by_entity(entity_type, entity_id, only_roots=False):\n\n return CommentsTreeDAO(entity_type=entity_type, entity_id=entity_id,\n only_roots=only_roots)", "async def fetch(self, conn, page=None, fdt=None, tdt=None):\n\n sql = \"\"\"SELECT\n ...
[ "0.65842324", "0.63664144", "0.63229674", "0.6065913", "0.6050549", "0.6045573", "0.60114443", "0.5975179", "0.5946544", "0.58939505", "0.587878", "0.58299065", "0.58249295", "0.5780401", "0.57469136", "0.5738545", "0.57361287", "0.57340264", "0.5731925", "0.5722351", "0.5712...
0.7140785
0
Chains together managment commands for procurement work flow python manage.py reset products noinput python manage.py get_products python manage.py reset ordering noinput python manage.py get_orders python manage.py create_procurement_items
def shops_support_commands(request): messages.add_message(request, messages.INFO, 'Starting Procurements. An SMS will be sent to 0402 231 007 when complete.') shops_support_commands_task.delay() return HttpResponseRedirect('/')
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n\n parser = argparse.ArgumentParser(\n description='Manage third-party software.'\n )\n\n parser.add_argument('-d', '--debug', action='store_true',\n help='Enable debug output.')\n parser.add_argument('-v', '--verbose', action='store_true',\n ...
[ "0.587289", "0.5801472", "0.57531935", "0.565767", "0.5591324", "0.5529541", "0.5521418", "0.5504237", "0.54831237", "0.54783577", "0.54764533", "0.54698676", "0.5404664", "0.537019", "0.5349617", "0.53430337", "0.53267956", "0.53138334", "0.52388555", "0.5222266", "0.5183527...
0.52462137
18
A Shortcut View to create procurements for all Shops, resetting and fetching Products & Orders
def shops_procurement_email_csv(request): Order.objects.all().delete() Product.objects.all().delete() procurements = Procurement.objects.all() if procurements: response = HttpResponse(mimetype='text/csv') response['Content-Disposition'] = 'attachment; filename=procurement_%s.csv' % pr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _action_procurement_create(self):\n precision = self.env['decimal.precision'].precision_get('Product Unit of Measure')\n new_procs = self.env['procurement.order'] #Empty recordset\n for line in self:\n if line.state != 'sale' or not line.product_id._need_procurement():\n ...
[ "0.5863821", "0.55736905", "0.54319197", "0.53814894", "0.5258747", "0.5124642", "0.50894547", "0.5081387", "0.5004225", "0.50006837", "0.4986317", "0.49776986", "0.49725434", "0.4958985", "0.49552077", "0.49435654", "0.4941564", "0.4911613", "0.48936176", "0.4875826", "0.484...
0.46033427
53
Yield successive nsized chunks from l.
def chunks(l, n): for i in range(0, len(l), n): yield l[i:i + n]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _chunk(self, l, n):\n for i in range(0, len(l) + 1, n):\n yield l[i:i + n]", "def chunks(self, l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]", "def __chunks(l, n):\n for i in range(0, len(l), n):\n yield l[i:i + n]", "def get_chunks(self, ...
[ "0.80388075", "0.7924573", "0.79226995", "0.788447", "0.7877021", "0.781505", "0.7764907", "0.77549165", "0.7743869", "0.7731126", "0.77281487", "0.77241385", "0.77024275", "0.7688614", "0.7688614", "0.7663561", "0.7656419", "0.76552874", "0.76552874", "0.76452404", "0.764524...
0.7448291
79
read (filename) and build a dictionary that maps from each word to a string that describes its primary pronunciation. Secondary pronunciations are added to the dictionary with a number, in parentheses, at the end of the key, so the key for the second pronunciation of "abdominal" is "abdominal(2)".
def read_dictionary(filename='/Users/Paul/Documents/c06d.txt'): d = dict() fin = open(filename) for line in fin: # skip over the comments if line[0] == '#': continue t = line.split() word = t[0].lower() pron = ' '.join(t[1:]) d[word] = pron return d
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_pronunciation(pronunciation_file):\n # file = open('dictionary.txt', 'r')\n #\n # for line in file:\n # print line\n\n ################# https://m.reddit.com/r/CompSciPortfolio/comments/303fyo/assignment_3_poetry_reader/\n\n pronunciation_dictionary = {}\n line = pronunciation_f...
[ "0.7332753", "0.6848692", "0.6703922", "0.6669032", "0.65965074", "0.6547224", "0.6499856", "0.64841783", "0.62861496", "0.62773955", "0.60968024", "0.60919213", "0.60109735", "0.6004924", "0.5963126", "0.5958272", "0.5946235", "0.5933027", "0.5931318", "0.5922631", "0.590980...
0.65141857
6
Checks to see if two words can be pronounced the same way
def homophones(a, b): if a not in phonetic or b not in phonetic: return False return phonetic[a] == phonetic[b]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def one_away(w1, w2):\n\n if abs(len(w1) - len(w2) > 1):\n return False\n\n # i = 0\n # w1_d = {}\n # w2_d = {}\n\n # for i in w1:\n # w1_d[i] = w1.count(i)\n\n # for j in w2:\n # w2_d[j] = w2.count(j)\n\n # unmatched = set(w1_d.items())^set(w2_d.items())\n \n # ...
[ "0.7271517", "0.71494365", "0.709981", "0.7089381", "0.70110524", "0.6998903", "0.6914212", "0.68869525", "0.68457186", "0.6837668", "0.67831665", "0.667189", "0.65579796", "0.6539876", "0.6532438", "0.6524997", "0.6474966", "0.6412077", "0.6397953", "0.63940746", "0.63526577...
0.59207153
78
checks to see if word is in dictionary, then checks if homophones
def word_check(word): word1 = word[1:] if word1 not in word_dict: return False if not homophones (word, word1): return False word2 = word[0] + word[2:] if word2 not in word_dict: return False if not homophones(word, word2): return False return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def homophone_words(word_one, word_two, pron_dict):\n if word_one not in pron_dict or word_two not in pron_dict:\n return False\n return pron_dict[word_one] == pron_dict[word_two]", "def homophones():\n pron = pronounce.read_dictionary('c06d')\n words = mkwrddct('words.txt')\n\n for word in...
[ "0.7909334", "0.7649232", "0.7379768", "0.70193833", "0.66508675", "0.6501066", "0.64329946", "0.64270467", "0.63939303", "0.63705605", "0.6364078", "0.63594246", "0.6337399", "0.63142025", "0.625433", "0.62256026", "0.6210163", "0.6180701", "0.6136245", "0.6133826", "0.61200...
0.80829525
0
r""" Bayesian Optimizer that uses a neural network employing a MultiLayer Perceptron with Batchnorm layers.
def __init__(self, batch_size=10, mlp_params=None, normalize_input=True, normalize_output=True, rng=None, debug=False, tb_logging=False, tb_log_dir="runs/", tb_exp_name="exp", learn_affines=True, running_stats=True, bn_momentum=0.1): super(BatchNorm, self).__init__( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def perform_bayesian_optimization(self):\n bounds = {'hunits': (self.hunits_lower, self.hunits_upper),\n 'embedding_dim': (self.embedding_dim_lower, self.embedding_dim_upper)}\n optimizer = BayesianOptimization(f=self.lstm_score, pbounds=bounds, random_state=1)\n optimizer.max...
[ "0.71689683", "0.63594383", "0.63594383", "0.62631476", "0.62388253", "0.6200204", "0.6180111", "0.61708254", "0.6165025", "0.6150996", "0.6114282", "0.61016905", "0.60585445", "0.6051677", "0.6002721", "0.5985357", "0.5974796", "0.59617877", "0.59446186", "0.59385335", "0.59...
0.0
-1
r""" Fit the model to the given dataset (X, Y).
def fit(self, X, y, **kwargs): start_time = time.time() self.X = X self.y = y # Normalize inputs and outputs if the respective flags were set self.normalize_data() self.y = self.y[:, None] # Create the neural network # self._init_nn() optimize...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fit(self, X, Y):\n ...", "def fit(self, X, y):", "def fit(self, X, y):", "def fit(self, X, y):", "def fit(self, X,y):\n pass", "def fit(self, X, y=...):\n ...", "def fit(self, X, y=...):\n ...", "def fit(self, X, y=...):\n ...", "def fit(self, X, y=...):\n ...
[ "0.8406436", "0.8188824", "0.8188824", "0.8188824", "0.81622016", "0.80797446", "0.80797446", "0.80797446", "0.80797446", "0.80797446", "0.80797446", "0.80797446", "0.80797446", "0.80797446", "0.80797446", "0.8041557", "0.80190223", "0.7940643", "0.7909361", "0.7909361", "0.7...
0.0
-1
r""" Returns the predicted output for a trained network on the given test set.
def predict(self, X_test, **kwargs): # Normalize inputs if self.normalize_input: X_, _, _ = zero_mean_unit_var_normalization(X_test, self.X_mean, self.X_std) else: X_ = X_test # Sample a number of predictions for each given point # Generate mean and vari...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predict(self, test_set, test_labels):\n\n with tf.Session() as self.tf_session:\n self.tf_saver.restore(self.tf_session, self.models_dir + self.model_name)\n return self.accuracy.eval({self.input_data: test_set, self.input_labels: test_labels})", "def predict(self, X_test):\n ...
[ "0.7535142", "0.74656874", "0.7193928", "0.7173669", "0.7117496", "0.7112967", "0.7091167", "0.708785", "0.7062996", "0.706108", "0.7033131", "0.7005197", "0.6984002", "0.69106984", "0.68712544", "0.67788756", "0.6778434", "0.6761069", "0.6746445", "0.6740832", "0.6730758", ...
0.6451093
43
Generate the positions from trace
def posns_from_trace(trace): posns = [] for i in range((len(trace.variables)-1)//2): var_x = trace.variables[2*i] var_y = trace.variables[2*i+1] car_i = int(var_x.name.split('_')[2]) xy = (var_x.value.item(), var_y.value.item()) if len(posns) <= car_i: pos...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def positions(self, tileID, numSamples):", "def BeamPosition():\n \n XPOS, YPOS = [], []\n\n x=0\n for j in range(0,6,1):\n x += 0.1\n y=0\n for k in range(0,6,1):\n y += 0.2\n XPOS.append(x)\n YPOS.append(y)\n\n return XPOS, YPOS", "def gene...
[ "0.6406588", "0.62758404", "0.62750536", "0.61463076", "0.611264", "0.6014426", "0.6004055", "0.5968917", "0.5884226", "0.5875474", "0.5816131", "0.5784888", "0.5737535", "0.5731324", "0.5729159", "0.5626728", "0.56128687", "0.5607636", "0.5580684", "0.5576681", "0.5570371", ...
0.706652
0
generate the posterior based on an input.
def get_posterior(args, observation): model = models[args.model_name](args) model.load_inference_network(args.loadnetwork) posterior = model.posterior( num_traces=500, inference_engine=pyprob.InferenceEngine.IMPORTANCE_SAMPLING_WITH_INFERENCE_NETWORK, observe={'depth_image_sample':...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_posterior(self):\n raise NotImplementedError('Abstract Method')", "def build_posterior(self):\n # It looks like GPytorch builds posterior every time eval is made.\n pass", "def posterior_sample(self):\n pass", "def build_posterior(self):\n if self.gp_core.alpha is...
[ "0.7398055", "0.7344519", "0.6750742", "0.673047", "0.6572502", "0.6513751", "0.64071006", "0.6303324", "0.6276649", "0.6235326", "0.62301993", "0.621928", "0.6217684", "0.61377573", "0.6078299", "0.60650116", "0.60024667", "0.59992296", "0.59911585", "0.59453493", "0.5909928...
0.6548378
5
make a box for plotting
def get_box(x_tr, y_tr, d=1.): xs = np.array([-1., 1., 1., -1., -1.]) ys = np.array([-1., -1., 1., 1., -1.]) xs = xs*d/2 + x_tr ys = ys*d/2 + y_tr return xs, ys
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plotBox(box):\n plt.plot([box.xll, box.xur, box.xur, box.xll, box.xll]\n ,[box.yll, box.yll, box.yur, box.yur, box.yll]\n , '-'\n )", "def boxPlot(self):\n clf()\n boxplot(self.y,positions=self.x,widths=0.5)\n xlabel('X Label (units)')\n ylabel(...
[ "0.80755407", "0.7761877", "0.74262625", "0.7113986", "0.7050683", "0.69609755", "0.69441116", "0.6927388", "0.6886567", "0.68664503", "0.68428904", "0.6782563", "0.6713756", "0.66915447", "0.66915447", "0.66470635", "0.65735435", "0.6524072", "0.6489653", "0.6466975", "0.645...
0.0
-1
provide a KDE for where the car is
def kde(posterior, kernel=car_kernel): x = np.linspace(-10, 10, 256) y = np.linspace(-10, 10, 256) XX, YY = np.meshgrid(x, y) XX = torch.tensor(XX) YY = torch.tensor(YY) def expectation_func(trace): Z = torch.zeros_like(XX) posns = posns_from_trace(trace) for xy in pos...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _kde_example(data):\n # Plot the data\n ch = chartify.Chart(blank_labels=True, y_axis_type=\"density\")\n ch.set_title(\"KDE plot\")\n ch.plot.kde(data_frame=data, values_column=\"unit_price\", color_column=\"fruit\")\n ch.show(_OUTPUT_FORMAT)", "def _kde_example2(data):\n # Plot the data\n...
[ "0.6838983", "0.62949854", "0.6099632", "0.60312885", "0.5927605", "0.5870046", "0.5711485", "0.5612323", "0.5606829", "0.55595857", "0.5485947", "0.5443569", "0.5423928", "0.54207367", "0.5415106", "0.53608185", "0.5336951", "0.5311593", "0.52499145", "0.5243915", "0.5241838...
0.5098719
34
Create an observation using seed.
def generate_observation(args): model = models[args.model_name](args) pyprob.set_random_seed(args.seed) trace = model.get_trace(generate_samples=True, verbose=True) number_of_vehicles, image_obs = trace.result posns = posns_from_trace(trace) return posns, model.x, model.y, image_obs
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def seed():", "def create_observation(self):\n return self._user_state.create_observation()", "def seed(*args, **kwargs): # real signature unknown\n pass", "def seed():\n pass", "def seed():\n pass", "def seed(self, seed=None):\n raise NotImplementedError()", "def seed(self, seed=Non...
[ "0.70108116", "0.66705865", "0.66530013", "0.6639101", "0.6639101", "0.646656", "0.646656", "0.6427266", "0.6306611", "0.6306611", "0.6264364", "0.61795664", "0.61635995", "0.61292714", "0.61187625", "0.5996392", "0.5968281", "0.59193254", "0.5916746", "0.591524", "0.5906138"...
0.0
-1
This fn prints and plots the confusion matrix. Normalization can be applied by setting 'normalize=True'.
def plot_confusion_matrix(cm, classes, normalize=False, title='Confusion matrix', cmap=plt.cm.Blues): plt.imshow(cm, interpolation='nearest', cmap=cmap) plt.title(title) plt.colorbar() tick_marks = np.arange(len(classes)) plt.xticks(tick_marks, classes, rotation=45) plt.yticks(tick_marks, class...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_confusion_matrix(cm, classes=[0,1], normalize=False, title='Confusion matrix', print_matrix=False):\n\n if normalize:\n cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]\n print(\"Normalized confusion matrix\")\n else:\n print('Confusion matrix, without normalization')\n\n...
[ "0.79747516", "0.7972701", "0.7916397", "0.78010035", "0.77952605", "0.7757487", "0.7756975", "0.775108", "0.77393556", "0.7737718", "0.7737082", "0.7719532", "0.7714036", "0.7700674", "0.7696943", "0.7685643", "0.76693594", "0.76639557", "0.766282", "0.766219", "0.7659201", ...
0.767042
16
Create and show the display on the screen. After that, obtain the positions for all the parts in the display so other mods (namely ClickManager) can figure out where mouse events are.
def pysweep_before_finish_init(self): self.displaycanvas = DisplayCanvas(self.pysweep.master, self.boardsize, self.lcounterlength, self.rcounterlength, self.images) self.displaycanvas.pack() self.pysweep.master.update_idletasks() self.displaycanvas.update_idletasks() # enode = s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open_display (self, *display_args, **kw):\n # first display argument is always rect; crop it to fit on the screen\n rect = pygame.Rect(display_args[0]).clip(self.screen.get_rect())\n if any(rect.colliderect(d.rect) for d in self.displays):\n raise ValueError('rect overlaps other...
[ "0.68203926", "0.6793573", "0.66642714", "0.6488153", "0.64703375", "0.64546627", "0.6423563", "0.6343933", "0.6342656", "0.63396937", "0.6333554", "0.6326806", "0.6315218", "0.6275464", "0.6239657", "0.62251455", "0.62184066", "0.62117213", "0.616774", "0.6149395", "0.614371...
0.0
-1
Parts should call draw on its child parts. It should determine if a change has been made, and if so, make the change and call update. If a part has pasted outside its region, it should return True Parts should not make changes to the display until draw has been called! This is because the order parts are drawn is impor...
def draw(self, force=False): self.display.draw(force)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw(self, force = False):\n\t\tpass", "def _onPaint(self, evt):\n if not self._isRealized:\n self.realize()\n if self._drawn < 2:\n self.draw(repaint = False)\n self._drawn += 1\n self.gui_repaint(drawDC=wx.PaintDC(self))", "def draw(self, force=False)...
[ "0.6380005", "0.593526", "0.5855134", "0.572638", "0.56879467", "0.564566", "0.56153196", "0.5614835", "0.5576688", "0.55423486", "0.5540616", "0.55378747", "0.55355537", "0.5513865", "0.55125195", "0.54864395", "0.5464399", "0.5464399", "0.54607123", "0.5451927", "0.5438394"...
0.5939307
1
Call this to trigger an update (lazily) Call with True to force a redraw of all its children
def draw(self, force=False): for child in self.children.values(): child.draw(force)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(self):\n self.redraw()\n self._changed = False", "def update(self):\n self.redraw()\n self._changed = False", "def redraw(self):\r\n self.c.update()", "def _refresh(self):\n self._need_display_update = True\n self._update()", "def _DoUpdateRedraw(...
[ "0.76514983", "0.76514983", "0.72221994", "0.71962154", "0.71209574", "0.70450413", "0.7022925", "0.7000538", "0.6958265", "0.6921717", "0.69070524", "0.6898503", "0.6888555", "0.68308216", "0.67871916", "0.6729949", "0.67185277", "0.6715382", "0.6713235", "0.66742736", "0.66...
0.6394662
35
Returns True if the coord is in Part or any of its children. May be a better idea to call the get_part_containing function instead though, which returns the lowest level Part that contains the coord (none of its children contain the coord, but the Part does)
def contains(self, coord): # print(coord, self.position, self.size) return (0 <= coord[0] - self.position[0] < self.size[0] and 0 <= coord[1] - self.position[1] < self.size[1])
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_part_containing(self, coord):\n # print('in', self)\n for k, child in self.children.items():\n # print('try', k, child)\n if child.ignore:\n # print('ignore', k, child)\n continue\n if child.contains(coord):\n # pri...
[ "0.75447255", "0.6645123", "0.66114485", "0.6500257", "0.6442654", "0.64163774", "0.6345653", "0.63166255", "0.61932963", "0.6176176", "0.6176057", "0.61623186", "0.61566186", "0.6145891", "0.6117253", "0.60773057", "0.60773057", "0.6069949", "0.6057143", "0.6003461", "0.5990...
0.7134822
1
Returns the lowest Part that contains the coord (a part that contains the coord where none of its children contain the coord) Assumes that self already contains coord! Please check this if you are not sure!
def get_part_containing(self, coord): # print('in', self) for k, child in self.children.items(): # print('try', k, child) if child.ignore: # print('ignore', k, child) continue if child.contains(coord): # print('contained...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def findMin(self):\n curr = self\n while curr.hasLeftChild():\n curr = curr.leftChild\n return curr", "def get_parent_by_coord(x, y, w, h, states: [State]) -> State:\n parents = [state for state in states if is_state_a_child_by_coord(x, y, w, h, state)]\n if not parents:\n ...
[ "0.65753007", "0.64252496", "0.6329845", "0.6284443", "0.6221933", "0.6202329", "0.61960083", "0.61666095", "0.6122884", "0.60579133", "0.601533", "0.59646225", "0.59528434", "0.5939711", "0.58846384", "0.5878549", "0.5874045", "0.5835615", "0.58301", "0.5770619", "0.5761702"...
0.7808834
0
perform splink score histogram calculations / internal function Compute a histogram using the provided buckets.
def _calc_probability_density( df_e: DataFrame, spark: SparkSession, buckets=None, score_colname="match_probability", symmetric=True, ): if score_colname == "match_probability": extent = (0.0, 1.0) else: weight_max = df_e.agg({score_colname: "max"}).collect()[0][0] w...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_histograms_from_assignments(self, funcs, bin_size=1):\n result = defaultdict(lambda: defaultdict(\n lambda: Histogram(bin_size)\n ))\n for assignment in self.get_assignment_reader():\n for name, func in funcs.iteritems():\n value = func(assign...
[ "0.63164794", "0.6300944", "0.6296864", "0.62763315", "0.6250284", "0.6250284", "0.6125742", "0.6084646", "0.6065625", "0.60559726", "0.6052646", "0.60354984", "0.59535027", "0.5911998", "0.58973366", "0.58958775", "0.58551866", "0.5843063", "0.5798115", "0.57924175", "0.5762...
0.5945126
13
splink score histogram diagnostic plot public API function Compute a histogram using the provided buckets and plot the result.
def splink_score_histogram( df_e: DataFrame, spark: SparkSession, buckets=None, score_colname=None, symmetric=True, ): rows = _calc_probability_density( df_e, spark=spark, buckets=buckets, score_colname=score_colname, symmetric=symmetric, ) retur...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def makeHistogram(values, numBins, xLabel, yLabel, title=None):", "def plot_hitstogram_graph(data_values, title,\r\n number_of_keys,\r\n max_val,\r\n file_in):\r\n\r\n # bins = max(data_values)\r\n # pylab.hist(data_values, facecolo...
[ "0.65873337", "0.65499824", "0.6416419", "0.6398828", "0.6303546", "0.6264724", "0.6263202", "0.6211154", "0.6202789", "0.61877424", "0.6169316", "0.6159507", "0.61091715", "0.6084146", "0.60816425", "0.6069394", "0.6049768", "0.603087", "0.60236806", "0.6020201", "0.6001724"...
0.6923532
0
Returns event dictionary for given run, has form
def get_events(fname, x_axis='step'): result = {} events = summary_iterator.summary_iterator(fname) try: for event in events: if x_axis == 'step': x_val = event.step elif x_axis == 'time': x_val = event.wall_time else: assert False, f"Unknown x_axis ({x_axis})" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def event_message(iden: int, event: Any) -> dict[str, Any]:\n return {\"id\": iden, \"type\": \"event\", \"event\": event}", "def create_events():\n events = {}\n events[\"Workers_can_proceed\"] = mp.Event()\n for i in range(NUM_WORKERS):\n events[i] = mp.Event()\n return events", "def ge...
[ "0.5938505", "0.5936111", "0.57033306", "0.5693008", "0.5664735", "0.5663289", "0.562416", "0.559962", "0.55431575", "0.55160534", "0.55051327", "0.54927003", "0.5491153", "0.54728276", "0.54675347", "0.545969", "0.5454533", "0.54335296", "0.54042554", "0.537985", "0.5371194"...
0.0
-1
Convert an ascii format PSD to XML.
def _convert_psd(self, ascii_format, ifo): command = ["convert_psd_ascii2xml", "--fname-psd-ascii", f"{ascii_format}", "--conventional-postfix", "--ifo", f"{ifo}"] pipe = subprocess.Popen(command, std...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exportXml ( w, xml ):\n assert str ( type ( xml ) ) == \"<type 'str'>\"\n rawText = xml\n pattern = re.compile (r'[^\\S ]+')\n text = re.sub ( pattern, \"\", rawText )\n reparsed = MD.parseString ( text )\n w.write ( reparsed.toprettyxml ( indent = \"\\t\", encoding = \"UTF-8\" ) )", "def t...
[ "0.55738395", "0.54602534", "0.54489726", "0.53523225", "0.52660984", "0.52540344", "0.5241616", "0.5230467", "0.5184351", "0.51782966", "0.5153558", "0.51349664", "0.50608534", "0.5040427", "0.50386435", "0.5021166", "0.5018161", "0.49920428", "0.49768257", "0.49715346", "0....
0.6901742
0
Convert the textbased PSD to an XML psd if the xml doesn't exist already.
def before_submit(self): event = self.production.event category = config.get("general", "calibration_directory") current = os.getcwd() if len(self.production.get_psds("xml"))==0: for ifo in self.production.meta['interferometers']: os.chdir(f"{event.re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _convert_psd(self, ascii_format, ifo):\n command = [\"convert_psd_ascii2xml\",\n \"--fname-psd-ascii\", f\"{ascii_format}\",\n \"--conventional-postfix\",\n \"--ifo\", f\"{ifo}\"]\n \n pipe = subprocess.Popen(command, \n ...
[ "0.54699063", "0.54270697", "0.5086973", "0.4949817", "0.49382555", "0.48763314", "0.4858184", "0.48364475", "0.4789056", "0.47216293", "0.46984264", "0.46747768", "0.46554214", "0.46397245", "0.4639464", "0.46221876", "0.46042663", "0.45990068", "0.45884767", "0.4573318", "0...
0.0
-1
Construct a DAG file in order to submit a production to the condor scheduler using util_RIFT_pseudo_pipe.py
def build_dag(self, user=None): cwd = os.getcwd() #os.chdir(self.production.event.meta['working directory']) #os.chdir(os.path.join(self.production.event.repository.directory, # self.category)) if self.production.event.repository: gps_file = self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(\n metadata: ProjectMetadata, pipeline_name, env, target_path\n): # pylint: disable=too-many-locals\n loader = jinja2.FileSystemLoader(str(Path(__file__).parent))\n jinja_env = jinja2.Environment(autoescape=True, loader=loader, lstrip_blocks=True)\n jinja_env.filters[\"slugify\"] = slugify\...
[ "0.6791086", "0.66254175", "0.6543903", "0.6439742", "0.62908417", "0.6201106", "0.5974608", "0.5915672", "0.58422476", "0.57603854", "0.56926197", "0.5625026", "0.5587469", "0.556881", "0.55680734", "0.5542769", "0.54487556", "0.5446099", "0.54422826", "0.5420124", "0.540782...
0.67467165
1
Submit a DAG file to the condor cluster (using the RIFT dag name). This is an overwrite of the near identical parent function submit_dag()
def submit_dag(self): os.chdir(self.production.rundir) os.system("cat *_local.cache > local.cache") for psdfile in self.production.get_psds("xml"): ifo = psdfile.split("/")[-1].split("_")[1].split(".")[0] os.system(f"cp {psdfile} {ifo}-psd.xml.gz") self.before_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def submit_dag(config, dag_file):\n with SUBMIT_LOCK:\n try:\n condor_dag_cmd = osp.join(get_condor_bin_dir(config),\n CONDOR_COMMAND['dag'])\n\n pipe = subprocess.Popen(args=(condor_dag_cmd, '-force', dag_file),\n ...
[ "0.7314224", "0.709528", "0.63085747", "0.6191946", "0.60718346", "0.5973721", "0.59433025", "0.5939774", "0.5474602", "0.5430673", "0.53907543", "0.53773415", "0.5344598", "0.52862775", "0.52801114", "0.52279294", "0.5198155", "0.5184064", "0.5162414", "0.5139023", "0.512411...
0.7345251
0
Attempt to ressurrect a failed job.
def resurrect(self): try: count = self.production.meta['resurrections'] except: count = 0 count = len(glob.glob(os.path.join(self.production.rundir, "marginalize_intrinsic_parameters_BasicIterationWorkflow.dag.rescue*"))) if "allow ressurect" in self.production.me...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fail(self):\n self.cleanup()\n self.runner.report_job_fail(self.id)", "def fail_job( self, job_state ):\n self.stop_job( self.sa_session.query( self.app.model.Job ).get( job_state.job_wrapper.job_id ) )\n job_state.job_wrapper.fail( getattr( job_state, \"fail_message\", GENERIC_RE...
[ "0.67493665", "0.6399685", "0.632808", "0.629788", "0.62523544", "0.6112573", "0.6107305", "0.6102979", "0.6093228", "0.6066026", "0.60121393", "0.600223", "0.5928469", "0.5924552", "0.5916698", "0.5915556", "0.58674157", "0.58567256", "0.58405894", "0.5821266", "0.58085227",...
0.5971702
12
Collect all of the log files which have been produced by this production and return their contents as a dictionary.
def collect_logs(self): logs = glob.glob(f"{self.production.rundir}/*.err") #+ glob.glob(f"{self.production.rundir}/*/logs/*") logs += glob.glob(f"{self.production.rundir}/*.out") messages = {} for log in logs: with open(log, "r") as log_f: message = log_f.rea...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getAllEntries(self):\n \n log_entries_dict = collections.defaultdict(list)\n for logfile in os.listdir(self.log_folder):\n log = os.path.join(self.log_folder, logfile)\n with open(log, 'rb') as l:\n logCSVreader = csv.reader(l, delimiter=\"|\")\n ...
[ "0.7099511", "0.685938", "0.6689108", "0.65805835", "0.654927", "0.65117294", "0.6469987", "0.6433183", "0.6433183", "0.63312954", "0.63312954", "0.6329445", "0.626463", "0.6235582", "0.6214215", "0.61539227", "0.61492366", "0.6038331", "0.60342073", "0.6025179", "0.5985445",...
0.8644327
0
Check for the production of the posterior file to signal that the job has completed.
def detect_completion(self): results_dir = glob.glob(f"{self.production.rundir}") if len(results_dir)>0: # dynesty_merge_result.json if len(glob.glob(os.path.join(results_dir[0], f"extrinsic_posterior_samples.dat"))) > 0: return True else: return F...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _check_for_finished_job(self):\n raise NotImplementedError", "def _check_results(self):\n if not 'EXECUTION OF GAMESS TERMINATED NORMALLY' in self.file_dic['output']:\n print self.job_name + \" didn't finish\"\n raise TypeError('Calculation didn\\'t finish')", "def isFin...
[ "0.61166656", "0.6105869", "0.6094812", "0.6077702", "0.60449344", "0.6024275", "0.5960014", "0.59353745", "0.58733517", "0.5869293", "0.5852132", "0.5831765", "0.58316183", "0.58316183", "0.58316183", "0.57644093", "0.57264334", "0.5707587", "0.5698898", "0.56910706", "0.568...
0.5851303
11
Collect the combined samples file for PESummary.
def samples(self): return glob.glob(os.path.join(self.production.rundir, "extrinsic_posterior_samples.dat"))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gather_sample(self, my_file, collector=None):\n\n pass", "def per_sample_dot_files(self):\n # The output directory #\n directory = DirectoryPath(self.a.out_dir+'per_sample_ontology/')\n directory.create_if_not_exists()\n # Main loop #\n for i, sample in self.df_sampl...
[ "0.6286086", "0.61118436", "0.5901913", "0.5859824", "0.5801021", "0.57871133", "0.57731056", "0.57341135", "0.5628486", "0.5589119", "0.55838966", "0.5580174", "0.55663544", "0.5565593", "0.5554349", "0.5533319", "0.5505845", "0.5455812", "0.54384106", "0.54338044", "0.54219...
0.57615197
7
Builds the sbatch file in order to combine genomics.vcf samples contained in current_batch in a single one.
def build_GenotypeGVCFs_sbatch(working_dir, combined_gvcf_files, scratch=False, interval=None): name_batch1 = os.path.basename([item for item in combined_gvcf_files if "batch1" in item][0]) interval_name = "" #there must be at least one batch so look for it, not elegant but works if name_batch1.s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GenotypeGVCFs():\n #creates sbatch files to merge batches of batch_size genomics vcf\n cwd = os.getcwd()\n sbatch_files = []\n if not os.path.isdir(os.path.join(cwd, \"01_CombineGVCFs\")):\n sys.exit(\"Directory 01_CombineGVCFs does not exits exists, something went wrong here.\")\n if os....
[ "0.672763", "0.58610225", "0.5566432", "0.5434747", "0.5414289", "0.5365546", "0.53649545", "0.5345907", "0.5329101", "0.52768123", "0.52546614", "0.5217361", "0.5212177", "0.5211676", "0.5201498", "0.5170869", "0.5153864", "0.5102112", "0.5095486", "0.509299", "0.5088659", ...
0.7443647
0
Runs GenotypeGVCFs on all combined files produced previosuly (assumes folder structure)
def GenotypeGVCFs(): #creates sbatch files to merge batches of batch_size genomics vcf cwd = os.getcwd() sbatch_files = [] if not os.path.isdir(os.path.join(cwd, "01_CombineGVCFs")): sys.exit("Directory 01_CombineGVCFs does not exits exists, something went wrong here.") if os.path.isdir(os.p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def genotype_gvcfs(gatk, xmx, cores,\n inputs, output,\n reference, bed_file=None):\n commands = []\n command = GENOTYPEGVCFS_TEMPLATE.format(xmx, gatk, reference, output)\n command = command + ' --variant ' + ' --variant '.join(inputs)\n if bed_file is not None:\n command = comma...
[ "0.6848684", "0.6842689", "0.66581684", "0.65295035", "0.6394109", "0.6241394", "0.62080246", "0.6191771", "0.6087738", "0.60208416", "0.5983195", "0.59366655", "0.5929118", "0.5920719", "0.5885988", "0.58807164", "0.5872283", "0.5867078", "0.5824099", "0.5782577", "0.5766673...
0.77105707
0
Returns a duplicate of the profile instance.
def duplicate(self): duplicate = Profile() for i in self.__dict__: if type(getattr(self, i)) is dict: setattr(duplicate, i, getattr(self, i).copy()) else: setattr(duplicate, i, getattr(self, i)) return duplicate
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy(self):\n return Population(self)", "def copy(self):\n return self.__class__(dict(self))", "def copy(self):\n return self.__class__(self)", "def copy(self):\n return self.__class__(self)", "def strip_copy(self):\n return strip_profiles_copy(self)", "def get_full...
[ "0.65038234", "0.6457992", "0.6320341", "0.6320341", "0.6286995", "0.62803096", "0.6278374", "0.62589824", "0.6257265", "0.62398297", "0.62353045", "0.6209959", "0.6207495", "0.61983556", "0.61954135", "0.61781174", "0.61590487", "0.6154005", "0.6154005", "0.6154005", "0.6138...
0.81918967
0
To save this profile intance to xml file using a XmlWriter. xwriter>should be a XmlWriter instance.
def save_to_xml(self, xwriter): xwriter.WriteStartElement("Profile") xwriter.WriteAttributeString("Name", self.Name) xwriter.WriteStartAttribute("Version") xwriter.WriteValue(self.Version) xwriter.WriteEndAttribute() for var_name in self.__dict__: v...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_profile(file_path, profile):\r\n try:\r\n xSettings = XmlWriterSettings()\r\n xSettings.Indent = True\r\n with XmlWriter.Create(file_path, xSettings) as writer:\r\n profile.save_to_xml(writer)\r\n except Exception, ex:\r\n MessageBox.Show(\"An error occured wri...
[ "0.75539035", "0.66137195", "0.6487311", "0.64123094", "0.61329263", "0.6101124", "0.60908806", "0.60279024", "0.60243684", "0.59840643", "0.59765226", "0.58507067", "0.585065", "0.58390087", "0.58205575", "0.58169997", "0.5809403", "0.58001035", "0.56534475", "0.5646809", "0...
0.7909768
0
Writes a dictionary to an xml file in the form of etc. attribute_name>The name of the dictonary attribute to write. xmlwriter>The xml writer to write with. write_empty>A bool of whether to write empty values to the xml file. Default is don't write them.
def write_dict_to_xml(self, attribute_name, xmlwriter, write_empty=False): if attribute_name in ("IllegalCharacters", "Months"): write_empty = True dictionary = getattr(self, attribute_name) xmlwriter.WriteStartElement(attribute_name) for key in dictionary: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def writeDictToXMLFile(outfile, target, dict):\n targetStr = \"\\t\\t<Target>%s</Target>\\n\" % (escape(target),)\n for key in dict.keys():\n outfile.write('\\t<AVU>\\n')\n outfile.write(targetStr)\n outfile.write(\"\\t\\t<Attribute>%s</Attribute>\\n\" % (escape(key),) )\n outfile...
[ "0.6729531", "0.65415585", "0.6262941", "0.6016264", "0.5983849", "0.5939113", "0.58700234", "0.58539236", "0.5813194", "0.5684836", "0.56377923", "0.56335074", "0.5623472", "0.56098765", "0.55822074", "0.5524061", "0.5433924", "0.5403624", "0.5400973", "0.53912425", "0.53563...
0.80239266
0
Writes a list to an xml file in the form of value value etc. attribute_name>The name of the list attribute to write. xmlwriter>The xml writer to write with. write_empty>A bool of whether to write empty values to the xml file. Default is don't write them.
def write_list_to_xml(self, attribute_name, xmlwriter, write_empty=False): attribute_list = getattr(self, attribute_name) xmlwriter.WriteStartElement(attribute_name) for item in attribute_list: if item or write_empty: xmlwriter.WriteElementString("Item", item) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write(lst):\n # TODO", "def write(self, data, filename):\n id_ = 1\n weightlist_el = Element('weight-list')\n for dataset in data:\n weight_el = SubElement(weightlist_el, 'weight')\n id_el = SubElement(weight_el, 'id')\n id_el.text = str(id_)\n ...
[ "0.6497926", "0.6048247", "0.60110986", "0.5987103", "0.59648246", "0.5957363", "0.5939886", "0.57804435", "0.5734696", "0.57158196", "0.5674186", "0.5656518", "0.56491786", "0.55900544", "0.55637085", "0.55263245", "0.546913", "0.54400545", "0.54337585", "0.54084957", "0.539...
0.8491795
0
Writes a string to an xml file in the form of string attribute_name>The name of the string attribute to write. xmlwriter>The xml writer to write with. write_empty>A bool of whether to write empty strings to the xml file. Default is write empty strings.
def write_string_to_xml(self, attribute_name, xmlwriter, write_empty=True): string = getattr(self, attribute_name) if string or write_empty: xmlwriter.WriteElementString(attribute_name, string)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_write_string():\n buf = make_buffer()\n writer = XmlWriter(buf)\n writer.write_element('value', 'myvalue')\n writer.flush()\n assert_equals(decode_buffer(buf), '<value>myvalue</value>')", "def write_dict_to_xml(self, attribute_name, xmlwriter, write_empty=False):\r\n if attribute_n...
[ "0.6247003", "0.58558315", "0.5849161", "0.57865465", "0.5765893", "0.5722448", "0.5617337", "0.5580295", "0.55794567", "0.554683", "0.55136317", "0.55108947", "0.54859346", "0.54719436", "0.5470503", "0.54250485", "0.53961504", "0.5380822", "0.5374993", "0.53526664", "0.5339...
0.8222901
0
Writes a boolean to an xml file in the form of true/false attribute_name>The name of the attribute to write. xmlwriter>The xml writer to write with.
def write_bool_to_xml(self, attribute_name, xmlwriter): xmlwriter.WriteStartElement(attribute_name) xmlwriter.WriteValue(getattr(self, attribute_name)) xmlwriter.WriteEndElement()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def writeAttribute(self, *args):\n if type(args[1]) == type(True): return _libsbml.XMLOutputStream_writeAttributeBool(self, *args)\n\n\n return _libsbml.XMLOutputStream_writeAttribute(self, *args)", "def writeAttributeBool(self, *args):\n return _libsbml.XMLOutputStream_writeAttributeBool(se...
[ "0.74465925", "0.73603874", "0.7117586", "0.67680955", "0.66733044", "0.63848156", "0.62347335", "0.59897983", "0.591663", "0.5848001", "0.57468945", "0.564458", "0.5640521", "0.5636943", "0.561803", "0.5609525", "0.5577795", "0.557284", "0.55520767", "0.5486341", "0.54855955...
0.8478797
0
Loads the profile instance from the Xml. Xml>should be a XmlNode/XmlDocument containing a profile node.
def load_from_xml(self, Xml): try: #Text vars self.Name = Xml.Attributes["Name"].Value if "Version" in Xml.Attributes: self.Version = float(Xml.Attributes["Version"].Value) for var_name in self.__dict__: if type(getattr(s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_profiles_from_file(file_path):\r\n profiles = {}\r\n\r\n lastused = \"\"\r\n\r\n if File.Exists(file_path):\r\n try:\r\n with StreamReader(file_path) as xmlfile:\r\n xmldoc = XmlDocument()\r\n xmldoc.Load(xmlfile)\r\n\r\n if xmldoc.Docume...
[ "0.60300845", "0.5605986", "0.55443424", "0.5518848", "0.5350278", "0.5345203", "0.53076", "0.52905643", "0.5275819", "0.52674824", "0.521211", "0.5208215", "0.5208047", "0.51756513", "0.51629275", "0.51257974", "0.50973666", "0.5068245", "0.50489193", "0.5018405", "0.5017763...
0.5006978
21
Load profiles from a xml file. If no profiles are found it creates a blank profile. file_path>The absolute path to the profile file Returns a dict of the found profiles and a list of the lastused profile(s)
def load_profiles(file_path): profiles, lastused = load_profiles_from_file(file_path) if len(profiles) == 0: #Just in case profiles["Default"] = Profile() profiles["Default"].Name = "Default" #Some default templates profiles["Default"].FileTemplate = "{<series>}{...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_profiles_from_file(file_path):\r\n profiles = {}\r\n\r\n lastused = \"\"\r\n\r\n if File.Exists(file_path):\r\n try:\r\n with StreamReader(file_path) as xmlfile:\r\n xmldoc = XmlDocument()\r\n xmldoc.Load(xmlfile)\r\n\r\n if xmldoc.Docume...
[ "0.81233364", "0.77697146", "0.67844415", "0.6566505", "0.636305", "0.62747896", "0.6168049", "0.6128615", "0.61190236", "0.6096743", "0.5969697", "0.5946075", "0.59331304", "0.5897405", "0.58071595", "0.57577217", "0.5669829", "0.564856", "0.55757815", "0.5557105", "0.553909...
0.7774989
1
Loads profiles from a file. file_path>The absolute path the xml file Returns a dict of the profiles
def load_profiles_from_file(file_path): profiles = {} lastused = "" if File.Exists(file_path): try: with StreamReader(file_path) as xmlfile: xmldoc = XmlDocument() xmldoc.Load(xmlfile) if xmldoc.DocumentElement.Name == "Profiles":...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def import_profiles(file_path):\r\n profiles, lastused = load_profiles_from_file(file_path)\r\n\r\n return profiles", "def load_profiles(file_path):\r\n profiles, lastused = load_profiles_from_file(file_path)\r\n\r\n if len(profiles) == 0:\r\n #Just in case\r\n profiles[\"Default\"] = P...
[ "0.7816373", "0.7494791", "0.69231015", "0.68052244", "0.669596", "0.6337234", "0.6331917", "0.60487854", "0.6018389", "0.59737855", "0.59296596", "0.59177107", "0.57330143", "0.57177866", "0.5666612", "0.5610871", "0.56013894", "0.5478734", "0.54241526", "0.5402424", "0.5382...
0.755472
1
Load profiles from a xml file. If no profiles are found it returns an empty dict. file_path>The absolute path to the profile file Returns a dict of the found profiles.
def import_profiles(file_path): profiles, lastused = load_profiles_from_file(file_path) return profiles
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_profiles_from_file(file_path):\r\n profiles = {}\r\n\r\n lastused = \"\"\r\n\r\n if File.Exists(file_path):\r\n try:\r\n with StreamReader(file_path) as xmlfile:\r\n xmldoc = XmlDocument()\r\n xmldoc.Load(xmlfile)\r\n\r\n if xmldoc.Docume...
[ "0.7626121", "0.73465997", "0.66420317", "0.64548403", "0.6422596", "0.61153334", "0.60498744", "0.59523565", "0.5855331", "0.57868946", "0.5670626", "0.56380814", "0.5517114", "0.5462929", "0.54440254", "0.54290825", "0.5421971", "0.5367816", "0.53443223", "0.53429097", "0.5...
0.74111307
1
Saves the profiles to an xml file.
def save_profiles(file_path, profiles, lastused=""): try: xSettings = XmlWriterSettings() xSettings.Indent = True with XmlWriter.Create(file_path, xSettings) as writer: writer.WriteStartElement("Profiles") if lastused: writer.WriteAttributeStrin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_profile(file_path, profile):\r\n try:\r\n xSettings = XmlWriterSettings()\r\n xSettings.Indent = True\r\n with XmlWriter.Create(file_path, xSettings) as writer:\r\n profile.save_to_xml(writer)\r\n except Exception, ex:\r\n MessageBox.Show(\"An error occured wri...
[ "0.77402055", "0.7153504", "0.68901503", "0.65989304", "0.6585187", "0.6567334", "0.65197617", "0.64477056", "0.6292227", "0.62706214", "0.62006843", "0.61452764", "0.6128959", "0.610915", "0.6092176", "0.6072949", "0.60326505", "0.60216737", "0.5989765", "0.5988323", "0.5958...
0.76685476
1
Saves a single profile to an xml file.
def save_profile(file_path, profile): try: xSettings = XmlWriterSettings() xSettings.Indent = True with XmlWriter.Create(file_path, xSettings) as writer: profile.save_to_xml(writer) except Exception, ex: MessageBox.Show("An error occured writing the settings fi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_profile(self):\n self.save()", "def save_profiles(file_path, profiles, lastused=\"\"):\r\n try:\r\n xSettings = XmlWriterSettings()\r\n xSettings.Indent = True\r\n with XmlWriter.Create(file_path, xSettings) as writer:\r\n writer.WriteStartElement(\"Profiles\")\...
[ "0.720293", "0.71852773", "0.6845692", "0.6742488", "0.6558711", "0.6505063", "0.645329", "0.64384377", "0.6373711", "0.63664985", "0.6296266", "0.6280068", "0.62594324", "0.6223609", "0.6212394", "0.6104943", "0.60820746", "0.60820746", "0.6042483", "0.60255325", "0.60242546...
0.8002179
0
Main program to load data into the db.
def main(): option_parser = optparse.OptionParser(usage='usage: %prog [options] filename') option_parser.add_option('-d', '--debug', dest='debug', default=False, action='store_true', help='E...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main():\n\n\tgdl = TwitterDataLoader()\t\n\tgdl.load_twitter_data_to_db(truncate_table=False, skip_loaded_files=True)", "def populate_db_command():\n print(\"Populating DB with sample data.\")\n populate_db()\n print \"Done\"", "def main():\r\n\r\n # delete the database file if it already exist...
[ "0.7243006", "0.69598734", "0.6931684", "0.68877065", "0.68784547", "0.6848689", "0.6814924", "0.6806881", "0.67778087", "0.6770427", "0.6755996", "0.6755282", "0.6713464", "0.6702432", "0.6670045", "0.6666217", "0.6662877", "0.6647903", "0.6627729", "0.6620025", "0.6592809",...
0.0
-1
This function returns the softmax value for the given input
def softmax(X): if len(X) > 1: expo = np.exp(X) expo_sum = np.sum(np.exp(X)) ret = expo/expo_sum print(f'The softmax result on the given input {ret}') return ret else: raise ValueError("Sorry, lenght of the list should be more than one")
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def softmax(x):\n #pass # TODO: Compute and return softmax(x)\n return np.exp(x) / np.sum(np.exp(x), axis=0)", "def softmax(x):\n \"\"\"\"\"\"\n return exp(x) / sum(exp(x), axis=0)", "def softmax(x): \n e_x = np.exp(x - np.max(x)) \n return e_x / e_x.sum()", "def softmax(x)...
[ "0.85517555", "0.85172", "0.85039085", "0.85021806", "0.8486158", "0.8471101", "0.84642345", "0.84226495", "0.84178317", "0.84178317", "0.84136945", "0.84076935", "0.83944535", "0.8392644", "0.8392644", "0.8392644", "0.8392644", "0.8392644", "0.8392644", "0.8392644", "0.83926...
0.0
-1
This function returns the softmax derivative value for the given input
def softmax_derivative(x): der = derivative(softmax,x,dx=1e-9) return der
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def softmax_derivative(Z):\n\treturn None", "def softmax(x):\n e_x = np.exp(x - np.max(x))\n return e_x / e_x.sum(axis=0) # only difference", "def softmax(x):\r\n e_x = np.exp(x - np.max(x))\r\n return e_x / e_x.sum(axis=0) # only difference\r", "def softmax(x):\r\n e_x = np.exp(x - np...
[ "0.78823423", "0.7861486", "0.7818649", "0.78063107", "0.7801125", "0.7801125", "0.7801125", "0.7801125", "0.77747434", "0.7771414", "0.7755482", "0.7754241", "0.76962405", "0.7687193", "0.7682934", "0.76776224", "0.76399696", "0.7632133", "0.7632133", "0.76276577", "0.762613...
0.8873611
0
pos word id; i embedding dim id; d_model embedding dim
def get_angles(pos, i, d_model): angle_rates = 1 / np.power(10000, (2 * (i // 2)) / np.float32(d_model)) return pos * angle_rates
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_model(allidx,MAX_LENGTH,onlyArg):\n wordidx, labelidx, featuresidx, extraidx=allidx\n posidx, neridx, depidx, distanceidx, chnkidx, wikineridx, dbpedianeridx, subneridx = featuresidx\n\n main_input = Input(shape=(MAX_LENGTH,), name='main_input', dtype='int32')\n inputNodes=[main_input]\n\n ...
[ "0.65528405", "0.644471", "0.62645143", "0.6260667", "0.6213953", "0.605486", "0.6034496", "0.5999264", "0.59976137", "0.59722745", "0.595033", "0.59265804", "0.592424", "0.58655846", "0.58250475", "0.58209103", "0.5806985", "0.5793572", "0.5783189", "0.5767571", "0.57570547"...
0.0
-1
Construct a layernorm module in the TF style (epsilon inside the square root).
def __init__(self, hidden_size, eps=1e-12): super(LayerNorm, self).__init__() self.weight = nn.Parameter(torch.ones(hidden_size)) self.bias = nn.Parameter(torch.zeros(hidden_size)) self.variance_epsilon = eps self.bias.data.zero_() self.weight.data.fill_(1.0)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verhulst(nb_init, t0, tf, eps, methode, gamma, K) :\n f=lambda y,t : gamma*y*(1-y/K)\n Y=meth_epsilon(nb_init, t0, tf, eps, f, methode)\n return Y", "def malthusiens(nb_init, t0, tf, eps, methode, gamma ) :\n\n f=lambda y, t : gamma*y\n Y=meth_epsilon(nb_init, t0, tf, eps, f, methode)\n ...
[ "0.62754345", "0.60140204", "0.5792275", "0.57416606", "0.55366963", "0.55194634", "0.54221153", "0.5412391", "0.5388891", "0.53688395", "0.5351537", "0.5287469", "0.5258017", "0.5232318", "0.5227428", "0.52260095", "0.5220578", "0.5220438", "0.5192999", "0.5192457", "0.51924...
0.0
-1
AppendCols(numCols=1) > bool Exactly the same as AppendRows() but for columns.
def AppendCols(self, numCols=1): # real signature unknown; restored from __doc__ return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_new_cols(cat, prefix=\"\", floatcols=None, boolcols=None):\n\t\n\tif floatcols != None:\n\t\tfor col in floatcols:\n\t\t\tcat.add_column(astropy.table.MaskedColumn(name=prefix+col, dtype=float, length=len(cat)))\n\t\t\tcat[prefix+col].mask = [True] * len(cat)\n\tif boolcols != None:\n\t\tfor col in boolcol...
[ "0.6017477", "0.5631939", "0.55924374", "0.5548952", "0.5529502", "0.5455568", "0.5444327", "0.54101974", "0.53786486", "0.53754896", "0.53557205", "0.5345275", "0.53391767", "0.53190124", "0.5316484", "0.5307784", "0.528852", "0.5280459", "0.5254802", "0.525032", "0.5224798"...
0.89480335
3