query stringlengths 10 2k | document stringlengths 20 51.2k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
checks if the user is admin user | def is_admin(self, username):
con = dbcon()
cur = con.cursor()
cur.execute("SELECT * FROM my_users WHERE username=%(username)s",\
{"username":username})
res = cur.fetchone()
if res[5].lower() == 'admin':
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_admin(user):\n return user.is_authenticated and user.id == app.config.get('ADMIN')",
"def is_admin_user(self):\n if \"is_admin\" in self._properties and self.is_admin == 'YES':\n return True\n return False",
"def user_is_admin(user):\n return user in admins",
"def is... | [
"0.84816617",
"0.846122",
"0.84474593",
"0.8412896",
"0.8309198",
"0.8298666",
"0.82882744",
"0.8285803",
"0.8263293",
"0.8252171",
"0.8246116",
"0.81974447",
"0.81812996",
"0.81782997",
"0.8167891",
"0.8167891",
"0.8163231",
"0.8129034",
"0.81184965",
"0.80910105",
"0.807883... | 0.7789352 | 36 |
Return q^2 = qx^2 + qz^2 using the values of lambda_r, D, and gamma. | def calc_q_square(self):
return self._q_x()**2 + self._q_z()**2 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _q_z(self):\n D = self.latt_par['D'].value\n lambda_r = self.latt_par['lambda_r'].value\n gamma = self.latt_par['gamma'].value\n return 2*np.pi*(self.h/D - self.k/lambda_r/np.tan(gamma))",
"def _q_x(self):\n lambda_r = self.latt_par['lambda_r'].value \n return 2*np.pi*self.k/lambda_r",
"d... | [
"0.66993546",
"0.6396817",
"0.6050414",
"0.5856151",
"0.5855671",
"0.5673174",
"0.5614104",
"0.56067085",
"0.5602657",
"0.5595753",
"0.553491",
"0.5480408",
"0.5465256",
"0.5454602",
"0.53780454",
"0.53327405",
"0.53303933",
"0.5303117",
"0.52838945",
"0.5259786",
"0.5257725"... | 0.54075265 | 14 |
Return qx value in the ripple phase LAXS. | def _q_x(self):
lambda_r = self.latt_par['lambda_r'].value
return 2*np.pi*self.k/lambda_r | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Get_RawOutX_Value(self):\r\n l = self.__readFromRegister(self.__REG_R_OUT_X_L, 0xff)\r\n h_u2 = self.__readFromRegister(self.__REG_R_OUT_X_H, 0xff)\r\n h = bitOps.TwosComplementToByte(h_u2)\r\n if (h < 0):\r\n return (h*256 - l) * self.gain\r\n elif (h >= 0):\r\n ... | [
"0.6028907",
"0.5884649",
"0.56252533",
"0.56252533",
"0.560009",
"0.55444175",
"0.55204695",
"0.5402037",
"0.53938204",
"0.53894913",
"0.537604",
"0.5367031",
"0.53286767",
"0.53286767",
"0.53286767",
"0.53286767",
"0.53286767",
"0.53286767",
"0.53286767",
"0.53286767",
"0.5... | 0.596047 | 1 |
Return the model form factor. The return object is a numpy array with its length equal to the length of qx. | def _model(self):
common_scale = self.edp_par['common_scale'].value
model = self.F_trans() * self.F_cont()
# get F(h=1,k=0), which is used for normalization
# common_scale is a common scaling factor => F(h=1,k=0) = 100*common_scale
F_10 = model[(self.h==1)&(self.k==0)]
model = model / np.absolu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flux(self, q):\n q1, q2 = q\n if q1 > 0:\n u = q2/q1\n else:\n u = 0\n return np.array([q1*u, q1 * u*u + 0.5*9.81 * q1*q1])",
"def M(self, q):\n\n # check for function in dictionary\n if self._M is None:\n self._M = self._calc_M()\n ... | [
"0.5978925",
"0.5451687",
"0.5352919",
"0.53496075",
"0.5293442",
"0.51719415",
"0.51693666",
"0.5152594",
"0.5151816",
"0.5145314",
"0.51254874",
"0.50754434",
"0.50584745",
"0.50459534",
"0.5035384",
"0.5032907",
"0.5031993",
"0.50180006",
"0.5013867",
"0.49922204",
"0.4980... | 0.5330207 | 4 |
Generate the name of the root folder relative to MEDIA_ROOT. Given an AssignmentSubmission object, generate a name for the root folder using the user's username and the current date and time. | def root_folder_name(asmtSubmission):
userID = asmtSubmission.by.djangoUser.username
# If multiple submissions permitted, need to be able to distinguish
# So add the current time down to the second.
# We are not using assignment UUID because that truncates the file name.
userID = userID + "_" + st... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def submission_dir(self):\n submissions_dir = osp.join(self.root, \"submissions\")\n date = '-'.join([\n f'{getattr(datetime.now(), x)}'\n for x in ['year', 'month', 'day']])\n time = '-'.join([\n f'{getattr(datetime.now(), x)}'\n for x in ['hour', '... | [
"0.7093419",
"0.6125912",
"0.60347545",
"0.60086244",
"0.5895359",
"0.5894573",
"0.5825047",
"0.57651573",
"0.5761447",
"0.5696059",
"0.56636024",
"0.56516534",
"0.56287223",
"0.56276387",
"0.5583761",
"0.553818",
"0.55209",
"0.55155706",
"0.5494768",
"0.5483283",
"0.5445865"... | 0.84466034 | 0 |
Get the model's action from an observation | def predict(self, observation, *args, **kwargs):
if self.env is not None and np.random.rand() <= self.epsilon:
action = random.randrange(self.action_size)
else:
act_values = self.policy.predict(observation)
action = np.argmax(act_values[0])
return action, None | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def action(self, observation):\n return self.actor.get_action(observation)",
"def get_action(self, obs=None):\n payload = {}\n payload[\"request_type\"] = \"observation\"\n payload[\"observation\"] = obs\n response = self._realtime_predictor.predict(payload)\n action = r... | [
"0.8626733",
"0.813756",
"0.7632634",
"0.758606",
"0.721022",
"0.71002156",
"0.7078812",
"0.7065855",
"0.69667244",
"0.6959153",
"0.68790996",
"0.6848926",
"0.68192774",
"0.68070865",
"0.67959684",
"0.67877376",
"0.6782953",
"0.67556036",
"0.67497355",
"0.671806",
"0.67147565... | 0.6220476 | 84 |
Returns the element's configuration. | def get_config():
return {'address': ADDRESS, 'https': HTTPS == 'https',
'password': PASSWORD, 'username': USERNAME,
'port': PORT, 'version': VERSION} | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_config(self):\n return self.config",
"def config(self):\r\n return self._config",
"def config(self): # type: () -> t.Dict[str, t.Any]\n return self.inspection['Config']",
"def config(self):\n return self._config",
"def get_configuration(self) -> dict:\n return self.confi... | [
"0.7649635",
"0.7495246",
"0.74918956",
"0.74782217",
"0.74616665",
"0.7421909",
"0.7396741",
"0.73647255",
"0.7359213",
"0.7359213",
"0.7347974",
"0.7335954",
"0.73317575",
"0.73317575",
"0.73317575",
"0.73154885",
"0.7312961",
"0.7312961",
"0.7312961",
"0.7312961",
"0.73129... | 0.0 | -1 |
check if "ip" is valid, raise an exception if not | def __checkIPAddr(self,ip):
if not iplib.checkIPAddrWithoutMask(ip):
raise GeneralException(errorText("GENERAL","INVALID_IP_ADDRESS")%ip) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_valid_ip(ip):\n ...",
"def validateIP():\n try:\n s = socket.inet_aton(args.target)\n except socket.error:\n print(\"\")\n print(f\"{bad_cmd} Bad IP address\")\n print(\"\")\n sys.exit()",
"def validate_ip(ip):\n try:\n ip... | [
"0.87267333",
"0.8418977",
"0.7986335",
"0.79557407",
"0.7935314",
"0.79103106",
"0.7875172",
"0.7860275",
"0.77629644",
"0.7696051",
"0.7672882",
"0.76452315",
"0.7569596",
"0.7543649",
"0.751185",
"0.73795414",
"0.73783475",
"0.73661506",
"0.734101",
"0.73338795",
"0.730596... | 0.82845426 | 2 |
Converts a transaction in hex format to a CTransaction instance. | def parseHexTx (self, txHex):
data = bytes.fromhex (txHex)
tx = CTransaction ()
tx.deserialize (io.BytesIO (data))
return tx | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def signrawtransaction(self, given_transaction):\n if isinstance(given_transaction, str):\n given_bytes = x(given_transaction)\n elif isinstance(given_transaction, CMutableTransaction):\n given_bytes = given_transaction.serialize()\n else:\n raise FakeBitcoinPr... | [
"0.6594948",
"0.6351037",
"0.63114095",
"0.62845767",
"0.5906392",
"0.5868212",
"0.5861152",
"0.5679586",
"0.56339467",
"0.5601631",
"0.55856985",
"0.55589277",
"0.55195695",
"0.5495949",
"0.5471921",
"0.54189104",
"0.5413662",
"0.5368477",
"0.5367904",
"0.53569514",
"0.53487... | 0.8105452 | 0 |
Returns an array with the balances of both nodes. | def getBalances (self):
return [self.nodes[i].getbalance () for i in range (2)] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def returnBalances(self):\n pass",
"def get_balance(self):\n if self.hosting_node == None:\n return None\n user = self.hosting_node\n tx_involving_user = [\n [tx.amount for tx in block.transfers if tx.user == user]\n for block in self.__chain\n ... | [
"0.66924214",
"0.65317154",
"0.6463711",
"0.63751614",
"0.6370377",
"0.6289094",
"0.6182368",
"0.61482555",
"0.6076703",
"0.59894097",
"0.59849405",
"0.5972435",
"0.5955026",
"0.59532285",
"0.5942807",
"0.59072214",
"0.5901105",
"0.5894339",
"0.5856667",
"0.58387864",
"0.5812... | 0.7763869 | 0 |
Return a list containg nonempty terms from after normalization using and . | def normalize(string, stemmer, stopwords_set):
# tokenize using punkt data
dummy_list = nltk.word_tokenize(string)
# remove stopwords
dummy_list = [word for word in dummy_list if word not in stopwords_set]
# split using special characters as delimiters
# example "50,000" -> ["50", "000"]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalize_query(text: str) -> List[str]:\n tokens = nltk.word_tokenize(text.lower())\n return [lemmatizer.lemmatize(w, get_wordnet_pos(w)) for w in tokens if w not in PUNC]",
"def apply_all(text):\n return stem_words(remove_stop_words(initial_clean(text)))",
"def basic_clean(text):\n wnl = nltk... | [
"0.61369944",
"0.5953886",
"0.5891072",
"0.5817164",
"0.5810542",
"0.5786714",
"0.5731686",
"0.5646922",
"0.56409156",
"0.55771405",
"0.5537218",
"0.5532709",
"0.5520142",
"0.54922825",
"0.5490973",
"0.5486361",
"0.54648477",
"0.5458135",
"0.545039",
"0.5444802",
"0.54410326"... | 0.5378795 | 24 |
Creates a new shuffled deck of cards | def reinitDeck(self):
self.deck = range(52)
random.shuffle(self.deck) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_deck(number = 1):\n deck = []\n for suit, face in itertools.product(suit_names, face_names):\n if face == \"Ace\":\n value = 11\n elif face in ['Jack', 'Queen', 'King']:\n value = 10\n else:\n value = int(face)\n img = Image(img_path+su... | [
"0.7792111",
"0.7779718",
"0.7735658",
"0.7624945",
"0.76008815",
"0.7555104",
"0.7552093",
"0.7433978",
"0.7423585",
"0.73638505",
"0.7351276",
"0.7347061",
"0.73327327",
"0.72989666",
"0.7209085",
"0.7193709",
"0.7174153",
"0.716465",
"0.716465",
"0.7159475",
"0.7138722",
... | 0.73283845 | 13 |
Find who has the least amount of money out of all the players and returns the amount that was smallest | def _findSmallestMoney(self):
smallest = 99999999 # Just some high number
for x in self.playerList:
if x != None:
if x.money < smallest:
smallest = x.money
return smallest | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def min_players(self):\n return self._min_players",
"def smallestDrinkAmount(List):\n # 9 is the max amount for a drink\n # serving size\n amount = 9\n \n for d in List:\n if (int(d['amount']) < amount) and (int(d['amount']) > 0):\n amount = int(d['amount'])\n return am... | [
"0.66714364",
"0.6669252",
"0.66355515",
"0.64075524",
"0.637083",
"0.6322782",
"0.6317612",
"0.63001347",
"0.6249267",
"0.6197043",
"0.6150256",
"0.6141012",
"0.61046267",
"0.6095506",
"0.60903805",
"0.60707146",
"0.5982945",
"0.5973139",
"0.59724647",
"0.5955101",
"0.594896... | 0.8404781 | 0 |
Creates unaugmented data generator/loader for testing data Especially useful if testing data does not fit into memory | def get_test_generator(patch_size, batch_size, preprocess_func, output_reshape_func, test_data_dir='data/test/'):
test_paths = util.get_data_list(test_data_dir)
# generate train batch loader
test_data_loader = CTBatchLoader(test_paths, batch_size, patch_size, num_threads_in_multithreaded=1,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_testing_data_generator(self) -> Generator[List[np.ndarray], None, None]:\n return self._load_generator(config.TEST_DIR, False)",
"def test_dataloader(self) -> data.DataLoader:\n return data.DataLoader(dataset=self.datasets['test'], batch_size=self.batch_size,\n ... | [
"0.73282087",
"0.7109705",
"0.70395964",
"0.69731563",
"0.6860191",
"0.6860191",
"0.6860191",
"0.6860191",
"0.6791511",
"0.6774017",
"0.6763412",
"0.67618036",
"0.67522436",
"0.66416335",
"0.65698534",
"0.6545602",
"0.6479093",
"0.64759743",
"0.647028",
"0.6431369",
"0.642317... | 0.62457865 | 38 |
Parses a single tf.Example into image and label tensors. | def parser(serialized_example):
features = tf.parse_single_example(
serialized_example,
features={
"image": tf.FixedLenFeature([], tf.string),
"label": tf.FixedLenFeature([], tf.int64),
})
image = tf.decode_raw(features["image"], tf.uin... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _parse_tfexample(example):\n\n ## parse\n features = tf.parse_single_example(example, KEYS2FEATURES)\n\n image = tf.image.decode_png(features['image/encoded'])\n label = tf.image.decode_png(features['label/encoded'])\n # label is decoded as a 3-D png image\n label = label[..., 0]\n im_path = features['i... | [
"0.8382664",
"0.82293457",
"0.8046346",
"0.80212516",
"0.79226947",
"0.78314084",
"0.77364534",
"0.76416844",
"0.74969023",
"0.7487148",
"0.74796444",
"0.74376816",
"0.743598",
"0.7388846",
"0.7302434",
"0.7254373",
"0.72356325",
"0.7227096",
"0.71793455",
"0.7135345",
"0.711... | 0.78902066 | 5 |
Asks user to specify a city, month, and day to analyze. | def get_filters():
print('Hello! Let\'s explore some US bikeshare data!')
# TO DO: get user input for city (chicago, new york city, washington). HINT: Use a while loop to handle invalid inputs
city_temp = ''
while city_temp.lower() not in CITY_DATA:
city_temp = str(input('For which city would yo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Raw_Data(city,month,day):\n print(\"The city you have entered is: \",city)\n print(\"The month you have entered is: \",month)\n print(\"The day you have entered is: \",day)",
"def get_filters():\n city = None\n month = None\n day = None\n while day == None:\n # TO DO: get user input f... | [
"0.66714007",
"0.65354675",
"0.64593667",
"0.6374057",
"0.6348314",
"0.63097656",
"0.62868035",
"0.6259136",
"0.62316",
"0.62130964",
"0.62050414",
"0.6181105",
"0.6171822",
"0.61686903",
"0.6158568",
"0.61582303",
"0.61532456",
"0.61444426",
"0.6131269",
"0.610484",
"0.61025... | 0.0 | -1 |
Loads data for the specified city and filters by month and day if applicable. | def load_data(city, month, day):
# load datafile into a DataFrame
df = pd.read_csv(CITY_DATA[city])
# convert the Start Time column to Date time
df['Start Time'] = pd.to_datetime(df['Start Time'])
# extracting month and day of the week from Start time
df['month'] = df['Start Time'].dt.month
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_data(city, month, day):\n df = pd.read_csv(CITY_DATA [city])\n \n # convert the Start Time column to datetime\n df['Start Time'] = pd.to_datetime(df['Start Time'])\n \n # extract month and day of week from Start Time to create new columns\n df['month'] = df['Start Time'].dt.month\n ... | [
"0.8133254",
"0.8109751",
"0.8046614",
"0.804365",
"0.8009928",
"0.8008326",
"0.8000499",
"0.7999591",
"0.79899186",
"0.7980696",
"0.7974759",
"0.7962582",
"0.795736",
"0.7948513",
"0.7947427",
"0.79095644",
"0.7909091",
"0.7905773",
"0.7902028",
"0.7890243",
"0.7884111",
"... | 0.7894143 | 19 |
Displays statistics on the most frequent times of travel. | def time_stats(df):
print('\nCalculating The Most Frequent Times of Travel...\n')
start_time = time.time()
# TO DO: display the most common month available
common_month = df['month'].mode()[0]
print('The most common month is', MONTH_DATA[common_month].title())
# TO DO: display the most common... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time_stats(df):\n\n print('\\nDisplaying the statistics on the most frequent times of '\n 'travel...\\n')\n start_time = time.time()\n\n # display the most common month\n most_common_month = df['Month'].mode()[0]\n print('For the selected filter, the month with the most travels is: ' +\... | [
"0.80234134",
"0.80223715",
"0.7914983",
"0.78252095",
"0.7820841",
"0.7812996",
"0.77644646",
"0.7739144",
"0.7734762",
"0.77328056",
"0.7685236",
"0.7667557",
"0.76502746",
"0.7643304",
"0.76385033",
"0.7635647",
"0.7623848",
"0.7622241",
"0.7611794",
"0.75985956",
"0.75820... | 0.7480855 | 36 |
Displays statistics on the most popular stations and trip. | def station_stats(df):
print('\nCalculating The Most Popular Stations and Trip...\n')
start_time = time.time()
# TO DO: display most commonly used start station
common_start_station = df['Start Station'].mode()[0]
print('The most commonly used start station is', common_start_station)
# TO DO:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def station_stats(df):\n\n print('\\nCalculating The Most Popular Stations and Trip...\\n')\n start_time = time.time()\n\n # display most commonly used start station\n print(popular_start_station(df))\n\n # display most commonly used end station\n print(popular_end_station(df))\n\n # display m... | [
"0.78160876",
"0.76626086",
"0.75538874",
"0.7491789",
"0.7475186",
"0.7446511",
"0.74301356",
"0.7424136",
"0.7417956",
"0.7400676",
"0.738748",
"0.7385726",
"0.73651963",
"0.7359407",
"0.73569685",
"0.73552465",
"0.73522156",
"0.7351514",
"0.7350588",
"0.73423624",
"0.73401... | 0.7212254 | 41 |
Displays statistics on the total and average trip duration. | def trip_duration_stats(df):
print('\nCalculating Trip Duration...\n')
start_time = time.time()
# TO DO: display total travel time
total_travel_time = df['Trip Duration'].sum()
print('The total travel time is', total_travel_time)
# TO DO: display mean travel time
mean_travel_time = df['Tr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trip_duration_stats(data):\n print('\\nCalculating Trip Duration...\\n')\n start_time = time.time()\n # display total travel time\n total_trip_time= data['Trip Duration'].sum()\n print('The Total Travel Time is {} Hours'. format(total_trip_time/3600))\n # display mean travel time\n avg_tri... | [
"0.814274",
"0.8025143",
"0.80041367",
"0.79496753",
"0.7937415",
"0.79312176",
"0.7926815",
"0.7915187",
"0.79142886",
"0.7908032",
"0.79055744",
"0.7900715",
"0.7891682",
"0.78894734",
"0.7886722",
"0.78851086",
"0.7884266",
"0.7882474",
"0.78738385",
"0.78686154",
"0.78664... | 0.77744263 | 53 |
Return a JSON list of stations from the dataset. | def stations():
results = session.query(Measurement.station).\
group_by(Measurement.station).all()
return jsonify(results) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stationdata():\n # * Return a JSON list of stations from the dataset.\n # as this should be a list, I'm just grabbing the station name\n session = Session(engine)\n results = session.query(Station.name).all()\n session.close()\n\n stations = list(np.ravel(results))\n return jsonify(stati... | [
"0.8749774",
"0.8711033",
"0.8709707",
"0.83903676",
"0.8385434",
"0.8350107",
"0.83174604",
"0.83126175",
"0.83083683",
"0.82882726",
"0.8284065",
"0.8255833",
"0.8245978",
"0.8236982",
"0.8236486",
"0.8231036",
"0.8187982",
"0.8171461",
"0.8087652",
"0.8064668",
"0.8064305"... | 0.81095815 | 18 |
Save SPN to file by using the JSON format. | def save_spn_json(root: Node, f: Union[IO, os.PathLike, str]):
# Convert the SPN to a NetworkX graph
graph = spn_to_digraph(root)
# Save the NetworkX graph
save_digraph_json(graph, f) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save(self, settings=None):\n json_string = json.dumps(self.variables)\n with open(self.filepath, 'w', encoding='utf-8') as fh:\n fh.write(json_string)",
"def save(self, filename):\n content = self.to_dict()\n with open(filename, 'w') as f:\n json.dump(content... | [
"0.6800713",
"0.67505544",
"0.66242945",
"0.6611657",
"0.6605064",
"0.65620315",
"0.65552056",
"0.65346634",
"0.6520939",
"0.65182996",
"0.65156734",
"0.6505066",
"0.6487146",
"0.6483494",
"0.6481331",
"0.64690006",
"0.6459153",
"0.6439582",
"0.6436715",
"0.64254767",
"0.6403... | 0.7833534 | 0 |
Convert a SPN to a NetworkX directed graph. | def spn_to_digraph(root: Node) -> nx.DiGraph:
# Check the SPN
nodes = topological_order(root)
if nodes is None:
raise ValueError("SPN structure is not a directed acyclic graph (DAG)")
graph = nx.DiGraph()
# Add nodes to the graph
for node in nodes:
if isinstance(node, Sum):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_networkx(self):\n g = nx.Graph()\n for v in self.vs.values():\n g.add_node(v)\n for v in self.fs:\n g.add_node(v)\n for u in v.neighbors:\n g.add_edge(v, u)\n return g",
"def __toNetworkX(self):\n G = nx.Graph()\n G.... | [
"0.6349075",
"0.61509466",
"0.6129539",
"0.59234",
"0.58813685",
"0.58615214",
"0.57295054",
"0.57266587",
"0.5702273",
"0.5696572",
"0.5684306",
"0.5683416",
"0.5663153",
"0.56512684",
"0.5615237",
"0.55715054",
"0.5570513",
"0.5497677",
"0.5465933",
"0.54517037",
"0.5434924... | 0.70595807 | 0 |
Get the front element. | def peek(self):
if len(self.stack2) != 0:
return self.stack2[-1]
else:
while len(self.stack1) != 0:
self.stack2.append(self.stack1.pop())
return self.stack2[-1] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getFront(self):\n\t\tfront = self.queue[self.front]\n\t\treturn front\n\t\tpass",
"def getFront(self):\n if not self.isEmpty():\n return self._data[0]\n else:\n return -1",
"def front(self):\n return self.queue[0] if not self.empty() else None",
"def peek_front(... | [
"0.82009244",
"0.79261875",
"0.7852642",
"0.7791182",
"0.77886623",
"0.75723046",
"0.752337",
"0.7510604",
"0.7478953",
"0.7379256",
"0.7379256",
"0.734284",
"0.7323573",
"0.7320296",
"0.7291721",
"0.72772557",
"0.7269801",
"0.72657627",
"0.7253295",
"0.72355044",
"0.72213495... | 0.0 | -1 |
Returns whether the queue is empty. | def empty(self):
return len(self.stack1) == 0 and len(self.stack2) == 0 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_empty(self):\n return len(self.the_queue) == 0",
"def is_empty(self):\n return len(self.__queue) > 0",
"def is_empty(self):\n return len(self.queue) == 0",
"def is_empty(self):\n return len(self.queue) == 0",
"def is_empty(self):\n return self.queue == []",
"def ... | [
"0.9270249",
"0.92506766",
"0.923635",
"0.923635",
"0.9155843",
"0.9098441",
"0.9095006",
"0.90922606",
"0.90731245",
"0.9053733",
"0.89205354",
"0.89137155",
"0.8877591",
"0.88436323",
"0.88436323",
"0.8835949",
"0.88038146",
"0.8758203",
"0.87577534",
"0.87310195",
"0.86462... | 0.0 | -1 |
The bivariate normal distribution; see | def bivariate_normal(x, mu, sigma, rho):
return (1. / (2. * math.pi * sigma[0] * sigma[1] * math.sqrt(1. - rho * rho))) * \
math.exp( (-1. / (2. * (1. - rho * rho))) * \
( ( math.pow(x[0] - mu[0], 2) / sigma[0] * sigma[0] ) + \
( math.pow(x[1] - mu[1], 2) / sigma[1] * sigma[1] ) - \
( 2. * rho * ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def likelihood_bivariate_normal(X, mu, cov):\n \n dist = multivariate_normal(mu, cov)\n P = dist.pdf(X)\n return P",
"def stdProbabilityNorm(self):\n B = factorial(self.alpha-1)*factorial(self.beta-1)/factorial(self.alpha+self.beta-1)\n norm = 1.0/(2**(self.alpha+self.beta-1)*B)\n return nor... | [
"0.7212869",
"0.6999841",
"0.6831551",
"0.6800969",
"0.6766583",
"0.674288",
"0.6728654",
"0.67150724",
"0.65976673",
"0.657879",
"0.6547529",
"0.6530334",
"0.65013015",
"0.6500912",
"0.645677",
"0.6448818",
"0.6436062",
"0.64231545",
"0.641596",
"0.6410119",
"0.63642097",
... | 0.7646513 | 0 |
set the species this genome belongs to | def set_species(self, species):
self.species = species | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setSpecies(self, *args):\n return _libsbml.SimpleSpeciesReference_setSpecies(self, *args)",
"def setAssociatedSpecies(self, *args):\n return _libsbml.GeneProduct_setAssociatedSpecies(self, *args)",
"def setSpeciesReference(self, *args):\n return _libsbml.MultiASTPlugin_setSpeciesRefere... | [
"0.7362582",
"0.6988594",
"0.6919068",
"0.64908034",
"0.64342415",
"0.64335495",
"0.63813287",
"0.63479364",
"0.6338801",
"0.62353635",
"0.61624813",
"0.60960853",
"0.60937965",
"0.6038975",
"0.60363704",
"0.60217476",
"0.598129",
"0.5935647",
"0.59020984",
"0.5827302",
"0.58... | 0.84561807 | 0 |
Get list of unique objs from sequence, preserving order when the objs first occurred in original sequence. | def unique_objs(objs: List[object], unique_attrs: List[str]) -> List:
seen_obj_footprints = set()
unique = []
footprint_func = attrgetter(*unique_attrs)
for obj in objs:
obj_footprint = footprint_func(obj)
if obj_footprint in seen_obj_footprints:
continue
seen_obj_f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unique_ordered(seq: Iterable) -> list:\n seen = set()\n seen_add = seen.add\n return [x for x in seq if not (x in seen or seen_add(x))]",
"def unique(seq):\n return list(set(seq))",
"def unique_ordered(seq):\n\tvals = set()\n\treturn [x for x in seq if not (x in vals or vals.add(x))]",
"def _... | [
"0.80752546",
"0.788956",
"0.7696945",
"0.76726043",
"0.761767",
"0.7542175",
"0.7520796",
"0.7451894",
"0.7414952",
"0.7200174",
"0.7160656",
"0.7088874",
"0.70348895",
"0.6880896",
"0.6749995",
"0.67395055",
"0.67100364",
"0.6693005",
"0.6682214",
"0.66246635",
"0.6590897",... | 0.58478445 | 55 |
Returns `True` if `s` is a member of this DFA's language, `False` otherwise. `s` must be an iterable that consists entirely of symbols in this DFA's alphabet. | def __call__(self, s):
state = self._initial
try:
for sym in s:
state = self._trans_matrix[state][self._syms_to_indices[sym]]
except KeyError:
raise NotInAlphabetError(sym) from None
return state in self._accepting | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contained(self,s):\n\n if s in self.symbols:\n return True\n else:\n return False",
"def isValid(self, s: str) -> bool:\n st = []\n\n for char in s:\n if (len(st) != 0):\n e = st[-1]\n if (self.isValidPair(e,char)):\n ... | [
"0.68233615",
"0.6435434",
"0.6305838",
"0.62458205",
"0.6225598",
"0.6065426",
"0.6032643",
"0.5963473",
"0.5806204",
"0.5792672",
"0.5777706",
"0.57514954",
"0.5685324",
"0.5683942",
"0.56731945",
"0.5637913",
"0.5636757",
"0.5633067",
"0.56019574",
"0.55999726",
"0.5523817... | 0.7109102 | 0 |
Export a specific vector layer with v.out.ogr using a specific output format The result is stored in a temporary directory that is located in the temporary grass database. The resulting vector file will always be compressed using zip | def _export_vector(self, vector_name,
format="GML",
additional_options=[]):
# Export the layer
prefix = ""
if format == "GML":
prefix = ".gml"
if format == "GeoJSON":
prefix = ".json"
if format == "ESRI_Shapefi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _export_postgis(self, vector_name, dbstring,\n output_layer=None,\n additional_options=[]):\n\n module_name = \"v.out.postgis\"\n args = [\"-l\", \"input=%s\"%vector_name, \"output=%s\"%dbstring]\n\n if output_layer:\n args.append(\"ou... | [
"0.6715556",
"0.6288022",
"0.61783016",
"0.60764974",
"0.6031626",
"0.59132034",
"0.587658",
"0.58502877",
"0.58182114",
"0.5773804",
"0.5757438",
"0.5702609",
"0.5678204",
"0.56742996",
"0.5609391",
"0.56080586",
"0.56079745",
"0.5595418",
"0.55835253",
"0.5571983",
"0.55610... | 0.84601223 | 0 |
Binary operator for comparing NA values. Should return a function of two arguments that returns True if both arguments are (scalar) NA for your type. By default, uses ``operator.is_`` | def na_cmp() -> Callable[[Any, Any], bool]:
def isna(x: Any, y: Any) -> bool:
return (
(x is pandas.NA or all(x.isna()))
and (y is pandas.NA or all(y.isna()))
)
return isna | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def na_cmp() -> Callable[..., bool]:\n def isna(\n x: Union[pandas.NA, FDataGrid],\n y: Union[pandas.NA, FDataGrid],\n ) -> bool:\n return (\n (x is pandas.NA or all(x.isna()))\n and (y is pandas.NA or all(y.isna()))\n )\n\n return isna",
"def na_cmp():\... | [
"0.7526743",
"0.70719373",
"0.64516586",
"0.6426209",
"0.6377945",
"0.63288444",
"0.6269595",
"0.6143029",
"0.61399484",
"0.608681",
"0.6035547",
"0.599907",
"0.5983334",
"0.59427255",
"0.59009826",
"0.5894678",
"0.5875879",
"0.5859563",
"0.583924",
"0.58036435",
"0.57640535"... | 0.7439288 | 1 |
The scalar missing value for this type. Default 'None' | def na_value() -> pandas.NA:
return pandas.NA | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def null_value(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"null_value\")",
"def null_value(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"null_value\")",
"def null_value(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"null_value\")... | [
"0.69538814",
"0.69538814",
"0.69538814",
"0.69538814",
"0.69538814",
"0.69538814",
"0.69538814",
"0.69538814",
"0.69538814",
"0.69538814",
"0.69538814",
"0.69538814",
"0.69538814",
"0.69538814",
"0.69538814",
"0.69538814",
"0.69538814",
"0.69538814",
"0.69538814",
"0.69538814"... | 0.6107708 | 61 |
Parametrized fixture giving method parameters 'ffill' and 'bfill' for Series.fillna(method=) testing. | def fillna_method(request: Any) -> Any:
return request.param | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def FillNA(df, method: str = 'ffill', window: int = 10):\n method = str(method).replace(\" \", \"_\")\n\n if method == 'zero':\n return fill_zero(df)\n\n elif method == 'ffill':\n return fill_forward(df)\n\n elif method == 'mean':\n return fill_mean(df)\n\n elif method == 'media... | [
"0.6720251",
"0.5945117",
"0.5893805",
"0.58704156",
"0.58496404",
"0.57368475",
"0.57272196",
"0.57266414",
"0.5591492",
"0.5501318",
"0.5466099",
"0.536033",
"0.53337777",
"0.5330839",
"0.5329566",
"0.53243375",
"0.53170425",
"0.5271406",
"0.5267842",
"0.5240679",
"0.523318... | 0.47189316 | 53 |
Check if there is an edge only adjacent to one triangle. | def _is_screen(grid):
for e in range(grid.edges.shape[1]):
if len([j for i in grid.element_edges for j in i if j == e]) < 2:
return True
return False | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_edge(self):\n if self._row == 0 or self._row == 9 or self._column == 0 or self._column == 9:\n # check that the edge is not actually a corner square\n if not self.is_corner():\n # If not a corner and in a border row return True\n return True\n\n ... | [
"0.7013844",
"0.695749",
"0.683657",
"0.671938",
"0.66945475",
"0.663851",
"0.6533669",
"0.6521401",
"0.650758",
"0.6453306",
"0.645095",
"0.64494604",
"0.64414227",
"0.6441229",
"0.6421818",
"0.6411013",
"0.6335813",
"0.63320404",
"0.63122445",
"0.6305953",
"0.6298199",
"0... | 0.0 | -1 |
Asks user to specify a city, month, and day to analyze. | def get_filters():
while True :
print('Hello! Let\'s explore some US bikeshare data!')
# get user input for city (chicago, new york city, washington). HINT: Use a while loop to handle invalid inputs
city = input('Enter the city you interseted in (chicago, new york city, washington)\n').lower... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Raw_Data(city,month,day):\n print(\"The city you have entered is: \",city)\n print(\"The month you have entered is: \",month)\n print(\"The day you have entered is: \",day)",
"def get_filters():\n city = None\n month = None\n day = None\n while day == None:\n # TO DO: get user input f... | [
"0.66714007",
"0.65354675",
"0.64593667",
"0.6374057",
"0.6348314",
"0.63097656",
"0.62868035",
"0.6259136",
"0.62316",
"0.62130964",
"0.62050414",
"0.6181105",
"0.6171822",
"0.61686903",
"0.6158568",
"0.61582303",
"0.61532456",
"0.61444426",
"0.6131269",
"0.610484",
"0.61025... | 0.0 | -1 |
Loads data for the specified city and filters by month and day if applicable. | def load_data(city, month, day):
file_data = pd.read_csv(CITY_DATA[city])
df = pd.DataFrame(data=file_data)
# weekday and month columns
df['Start Time'] = pd.to_datetime(df['Start Time'])
df['month'] = df['Start Time'].dt.month
df['weekend_day'] = df['Start Time'].dt.weekday
if month != ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_data(city, month, day):\n df = pd.read_csv(CITY_DATA [city])\n \n # convert the Start Time column to datetime\n df['Start Time'] = pd.to_datetime(df['Start Time'])\n \n # extract month and day of week from Start Time to create new columns\n df['month'] = df['Start Time'].dt.month\n ... | [
"0.8133254",
"0.8109751",
"0.8046614",
"0.804365",
"0.8009928",
"0.8008326",
"0.8000499",
"0.7999591",
"0.79899186",
"0.7980696",
"0.7974759",
"0.7962582",
"0.795736",
"0.7948513",
"0.7947427",
"0.79095644",
"0.7909091",
"0.7905773",
"0.7902028",
"0.7894143",
"0.7890243",
"... | 0.74617535 | 91 |
Displays statistics on the most frequent times of travel. | def time_stats(df):
print('\nCalculating The Most Frequent Times of Travel...\n')
start_time = time.time()
# display the most common month
most_common_months = df['month'].value_counts()
print("Most Popular Month : {} , Count: {}".format(Months[most_common_months.index[0] - 1],most_common_months.i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time_stats(df):\n\n print('\\nDisplaying the statistics on the most frequent times of '\n 'travel...\\n')\n start_time = time.time()\n\n # display the most common month\n most_common_month = df['Month'].mode()[0]\n print('For the selected filter, the month with the most travels is: ' +\... | [
"0.80234134",
"0.80223715",
"0.7914983",
"0.78252095",
"0.7820841",
"0.7812996",
"0.77644646",
"0.7739144",
"0.7734762",
"0.77328056",
"0.7685236",
"0.7667557",
"0.76502746",
"0.7643304",
"0.76385033",
"0.7635647",
"0.7623848",
"0.7622241",
"0.7611794",
"0.75985956",
"0.75820... | 0.71923864 | 72 |
Displays statistics on the most popular stations and trip. | def station_stats(df):
print('\nCalculating The Most Popular Stations and Trip...\n')
start_time = time.time()
# display most commonly used start station
most_common_sstations = df['Start Station'].value_counts()
print("Most commonly used start station : {} , Count: {}".format(most_common_sstation... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def station_stats(df):\n\n print('\\nCalculating The Most Popular Stations and Trip...\\n')\n start_time = time.time()\n\n # display most commonly used start station\n print(popular_start_station(df))\n\n # display most commonly used end station\n print(popular_end_station(df))\n\n # display m... | [
"0.78160876",
"0.76626086",
"0.75538874",
"0.7491789",
"0.7475186",
"0.7446511",
"0.74301356",
"0.7424136",
"0.7417956",
"0.7400676",
"0.738748",
"0.7385726",
"0.73651963",
"0.7359407",
"0.73569685",
"0.73552465",
"0.73522156",
"0.7351514",
"0.7350588",
"0.73423624",
"0.73401... | 0.6807783 | 95 |
Displays statistics on the total and average trip duration. | def trip_duration_stats(df):
print('\nCalculating Trip Duration...\n')
start_time = time.time()
# display total travel time
df['travel_time'] = (pd.to_datetime(df['End Time']) - df['Start Time']).dt.total_seconds()
print('total travel time is : {} seconds'.format(df['travel_time'].sum()))
# ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trip_duration_stats(data):\n print('\\nCalculating Trip Duration...\\n')\n start_time = time.time()\n # display total travel time\n total_trip_time= data['Trip Duration'].sum()\n print('The Total Travel Time is {} Hours'. format(total_trip_time/3600))\n # display mean travel time\n avg_tri... | [
"0.814274",
"0.8025143",
"0.80041367",
"0.79496753",
"0.7937415",
"0.79312176",
"0.7926815",
"0.7915187",
"0.79142886",
"0.7908032",
"0.79055744",
"0.7900715",
"0.7891682",
"0.78894734",
"0.7886722",
"0.78851086",
"0.7884266",
"0.7882474",
"0.78738385",
"0.78686154",
"0.78664... | 0.7581611 | 94 |
Evaluate the activation function on the output of the linear layer | def forward(cls, linear_out):
raise Exception("Unimplemented") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def linear_activation_calculation(A, W, b, activation_function):\n\n # Your code here\n return activation_function(linear_forward_calculation(A, W, b))\n # raise NotImplementedError",
"def output_layer_activation(x):\n return x",
"def activation_function(self, X):\n return self.net_input(X)"... | [
"0.7360351",
"0.73166764",
"0.72389793",
"0.72389793",
"0.71669954",
"0.71352863",
"0.70874864",
"0.7063477",
"0.7044605",
"0.7021384",
"0.6936703",
"0.6873371",
"0.6870659",
"0.6838941",
"0.6760565",
"0.6752837",
"0.67506105",
"0.6712749",
"0.666948",
"0.66625756",
"0.665577... | 0.0 | -1 |
Output the linear layer's value if it is positive, and 0 if it is not | def forward(cls, linear_out):
return np.maximum(linear_out, 0) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __relu(x):\n return x if x > 0 else 0",
"def is_zero(self):\n return -0.0001 <= self.l2_norm() <= 0.0001",
"def safe_output(x):\n\n if l['KL'] == 0:\n return 0.0\n else:\n return x",
"def __drelu(x):\n return 0 if x <= 0 else 1",
"def linear(self, X):\n return X"... | [
"0.63820827",
"0.5896879",
"0.5834524",
"0.5818829",
"0.57769406",
"0.5776564",
"0.5736567",
"0.5736567",
"0.5672225",
"0.5662514",
"0.56286675",
"0.56286675",
"0.55760676",
"0.55616474",
"0.55138487",
"0.5512372",
"0.54978806",
"0.5476732",
"0.54328054",
"0.5429797",
"0.5429... | 0.6075494 | 1 |
Clears the gradient wherever the activated_out was 0 | def backward(cls, grad_out, activated_out):
new_grad = grad_out.copy()
new_grad[activated_out == 0] = 0
return new_grad | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zero_grad(self):\n self.grad.zero_()",
"def reset_grad(self):\r\n self.unet.zero_grad()",
"def reset_grad(self):\n self.unet.zero_grad()",
"def reset_grad(self):\r\n self.g_optimizer.zero_grad()",
"def zero_grad(self):\r\n for param in self.params:\r\n para... | [
"0.753574",
"0.7502519",
"0.740048",
"0.72379845",
"0.7229692",
"0.722316",
"0.7200094",
"0.7121828",
"0.71039546",
"0.70705175",
"0.69487256",
"0.69487256",
"0.69487256",
"0.68753266",
"0.68227905",
"0.6744732",
"0.6731705",
"0.67274415",
"0.6672157",
"0.6672157",
"0.6625502... | 0.6739304 | 16 |
Compute the Cross Entropy loss which compares softmax outputs against one hot encoded labels and returns the negative sum of the products | def forward(cls, y, y_hat):
return - np.sum(y * np.ma.log(y_hat).filled(0)) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def loss(params: hk.Params, batch, label) -> jnp.ndarray:\r\n logits = net.apply(params, batch)\r\n labels = jax.nn.one_hot(label, n_classes)\r\n\r\n # Cross Entropy Loss\r\n softmax_xent = -jnp.sum(labels * jax.nn.log_softmax(logits))\r\n softmax_xent /= labels.shape[0]\r\n ... | [
"0.7954483",
"0.76034397",
"0.72830063",
"0.72680175",
"0.7267958",
"0.7241476",
"0.7232265",
"0.72239226",
"0.7205284",
"0.7205106",
"0.7200794",
"0.7180766",
"0.7169477",
"0.7156786",
"0.7101381",
"0.7096276",
"0.7088131",
"0.7076385",
"0.7071077",
"0.7024837",
"0.7018575",... | 0.0 | -1 |
Computes the softmax function on the input | def forward(self, x: np.ndarray) -> np.ndarray:
# Store input and output data for use in backward pass
self.linear_in = x
self.linear_out = x.dot(self.w) + self.b
self.activated_out = self.activation_func.forward(self.linear_out)
return self.activated_out | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def softmax(x):\n \"\"\"\"\"\"\n return exp(x) / sum(exp(x), axis=0)",
"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 return np.exp(x) / np.sum(np.exp(x), axis=0)",
"def softmax(x):\n # ... | [
"0.8896174",
"0.8885356",
"0.88269395",
"0.87906474",
"0.8755426",
"0.8747399",
"0.8747399",
"0.87453884",
"0.87453884",
"0.87453884",
"0.87453884",
"0.87453884",
"0.87453884",
"0.87453884",
"0.87453884",
"0.8740425",
"0.87202954",
"0.8717705",
"0.8710033",
"0.8697286",
"0.86... | 0.0 | -1 |
Initialize the model. Weights are initialized to small random values and biases are initialized to zero. Weights and biases are stored in the variable self.params, which is a dictionary with the following | def __init__(
self,
input_size: int,
hidden_sizes: Sequence[int],
output_size: int,
num_layers: int,
optimizer: Type[Optimizer] = SGD(),
norm_weights: bool = False
):
self.input_size = input_size
self.hidden_sizes = hidden_sizes
self.ou... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_parameters(self):\n stdv = 1. / math.sqrt(self.weight.data.size(1))\n self.weight.data.uniform_(-stdv, stdv)\n if self.bias is not None:\n self.bias.data.uniform_(-stdv, stdv)",
"def __init__(self, input_size, hidden_size, output_size, weight_init_std=0.01):\n\n se... | [
"0.8044727",
"0.7966158",
"0.7549526",
"0.7538452",
"0.7526434",
"0.752365",
"0.751747",
"0.7491857",
"0.74864125",
"0.7483987",
"0.74736595",
"0.74699336",
"0.7462639",
"0.74429905",
"0.74050254",
"0.737822",
"0.7377193",
"0.7366786",
"0.7350121",
"0.7325038",
"0.7321519",
... | 0.0 | -1 |
Method that overrides the standard method to get queryset. | def get_queryset(self) -> object:
category = Category.objects.all().filter(id=self.kwargs['pk'])
return category | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_queryset(self) -> QuerySet:\n raise NotImplementedError()",
"def get_queryset(self, request, queryset):\n\n return queryset",
"def get_queryset(self):\n if self.queryset is None:\n return self.model.objects.all()\n return self.queryset",
"def get_queryset(self):... | [
"0.8480213",
"0.8353936",
"0.8261512",
"0.8257237",
"0.8188679",
"0.806446",
"0.806446",
"0.80180734",
"0.7985771",
"0.7901485",
"0.7866594",
"0.78609824",
"0.7839381",
"0.77821624",
"0.7759085",
"0.7721592",
"0.7670284",
"0.75755626",
"0.7493167",
"0.74579895",
"0.7430191",
... | 0.0 | -1 |
Verify that search method fails when an invalid type is passed. | def test_invalid_search_type(self):
search_args = {"type": "foo", "q": "bar"}
self.assertRaises(
facebook.GraphAPIError, self.graph.search, search_args
) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_search_query_wrongtype(objectsearch):\n with pytest.raises(InvalidSearchParameterError):\n objectsearch.search(query='computer says no')",
"def test_search_no_params_error(self):\n self.assertRaises(\n TypeError,\n lambda: self.t['Scrubs'].search()\n )",
"... | [
"0.7843425",
"0.7586316",
"0.7248402",
"0.70459604",
"0.6815568",
"0.66274345",
"0.660588",
"0.65450114",
"0.648825",
"0.63468504",
"0.6260878",
"0.62543756",
"0.6218087",
"0.62018263",
"0.6181571",
"0.61797565",
"0.61548656",
"0.61412793",
"0.6105548",
"0.6067053",
"0.606573... | 0.77829766 | 1 |
convert_to_vanilla(value) Convert a value into the vanilla PuddleLiquid enum. | def convert_to_vanilla(value: 'CommonPuddleLiquid') -> Union[PuddleLiquid, None]:
if value is None or value == CommonPuddleLiquid.INVALID:
return PuddleLiquid.INVALID
if isinstance(value, PuddleLiquid):
return value
mapping = dict()
if hasattr(PuddleLiquid, 'WATER... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_from_vanilla(value: PuddleLiquid) -> Union['CommonPuddleLiquid', None]:\n if value is None or value == CommonPuddleLiquid.INVALID:\n return PuddleLiquid.INVALID\n if isinstance(value, CommonPuddleLiquid):\n return value\n mapping = dict()\n if hasattr(P... | [
"0.83821905",
"0.6755208",
"0.66513157",
"0.6622176",
"0.65518177",
"0.6455068",
"0.6257175",
"0.5151195",
"0.50550777",
"0.50131303",
"0.48776996",
"0.48711002",
"0.48685738",
"0.4854234",
"0.4843772",
"0.4825535",
"0.48248088",
"0.47057214",
"0.46985084",
"0.46675697",
"0.4... | 0.8217663 | 1 |
Calculate the great circle distance between two points on the earth (specified in decimal degrees) | def haversine(lat1, lat2, lon1, lon2):
# convert decimal degrees to radians
lon1, lat1, lon2, lat2 = map(radians, [float(lon1), float(lat1), float(lon2), float(lat2)])
# haversine formula
dlon = lon2 - lon1
dlat = lat2 - lat1
a = sin(dlat/2)**2 + cos(lat1) * cos(lat2) * sin(dlon/2)**2
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def great_circle(lat_1, long_1, lat_2, long_2):\n long_1 = m.radians(long_1)\n lat_1 = m.radians(lat_1)\n long_2 = m.radians(long_2)\n lat_2 = m.radians(lat_2)\n\n d = 2 * 6367.45 * m.asin(\n m.sqrt(haversine(lat_2 - lat_1)\n + m.cos(lat_1)*m.cos(lat_2) *\n haversine(long... | [
"0.8145943",
"0.786374",
"0.7631911",
"0.7604138",
"0.7595379",
"0.75943846",
"0.75926137",
"0.75699973",
"0.75633204",
"0.7556198",
"0.7528967",
"0.7515343",
"0.7494148",
"0.74658763",
"0.74503314",
"0.7432437",
"0.7391979",
"0.73558265",
"0.7346732",
"0.7329711",
"0.7327623... | 0.0 | -1 |
Asserts that the response errored and contains the message. | def assert_api_error(response, msg: Optional[str] = None) -> None:
assert response.status_code == 200
assert not response.json["success"]
if msg:
assert msg in response.json["error"] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def verify_error_message(self, response, error_message):\n self.assertEqual(response.status_code, 400)\n response = json.loads(response.content.decode('utf-8'))\n self.assertIn('error', response)\n self.assertEqual(response['error'], error_message)",
"def assert_has_valid_error(self, ... | [
"0.7796202",
"0.73218536",
"0.7262208",
"0.7213835",
"0.7126303",
"0.7126101",
"0.70844054",
"0.7075051",
"0.70501643",
"0.69542587",
"0.68557906",
"0.6855305",
"0.6837568",
"0.68247545",
"0.6822646",
"0.6810907",
"0.6719383",
"0.67102385",
"0.6664634",
"0.66415954",
"0.66242... | 0.7490391 | 1 |
This function maps a tense on a color from the d3 color scale. | def get_color(tense, seq=0):
if tense in ['Perfekt', 'present perfect', 'pretérito perfecto compuesto', 'passé composé', 'vtt',
'passato prossimo', 'PresPerf']:
return '#1f77b4'
elif tense in ['Präsens', 'simple present', 'presente', 'présent', 'ott', 'Present', 'present imperfective', ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scale_to_01(color: C3I) -> C3F:\n r, g, b = color\n return r / 255, g / 255, b / 255",
"def color_map(val):\n color_code = remap_interval(val, -1, 1, 0, 255)\n return int(color_code)",
"def map_face2color(face, colormap, scale, vmin, vmax):\n if vmin >= vmax:\n raise exception... | [
"0.595892",
"0.5876344",
"0.58293813",
"0.58171016",
"0.58171016",
"0.58171016",
"0.58171016",
"0.5801031",
"0.5795524",
"0.5721765",
"0.56942636",
"0.564674",
"0.5645443",
"0.56293136",
"0.5609103",
"0.55995244",
"0.55933994",
"0.5559363",
"0.55126584",
"0.55123794",
"0.5507... | 0.53568137 | 42 |
Take signed integer in two's complement form and return it in default form | def decode_signed_integer(num: int, size: int) -> int:
if (num & (1 << (size - 1))) != 0:
num = num - (1 << size)
return num | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def complement(x):\n out = 1 - x\n return out",
"def __neg__(self) -> 'SInt':\r\n return self.complement()",
"def complement(self)->'SInt':\r\n S = SInt(self.nbBytes)\r\n S.binaire = '0' * (len(self) - 1) + '1'\r\n S += super(SInt, self).complement()\r\n return S",
"d... | [
"0.7427205",
"0.72282255",
"0.70883876",
"0.70419073",
"0.7027951",
"0.6901559",
"0.6850059",
"0.68321973",
"0.6772664",
"0.67418087",
"0.66968143",
"0.6645654",
"0.6621137",
"0.66164273",
"0.6525575",
"0.6507741",
"0.65000606",
"0.6463321",
"0.6393746",
"0.63343734",
"0.6332... | 0.5900753 | 48 |
Takes a list of player.PlayerModels, a list of choice.Choices, and a list of | def analyze_trace(models, choices, trace):
choices = {
ch.name: ch
for ch in choices
}
agreements = []
by_cname = {}
for cname, decision in trace:
agreement = {
pm.name: pm.assess_decision(choices[cname], decision)
for pm in models
}
agreements.append(agreement)
if cnam... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main(models_str, choices_str, trace_strings):\n packed_models = json.loads(models_str)\n models = []\n for i, obj in enumerate(packed_models):\n try:\n models.append(unpack(obj, player.PlayerModel))\n except Exception as e:\n raise ValueError(\n \"Failed to unpack player model #{}\".f... | [
"0.5597448",
"0.5447732",
"0.5437981",
"0.54325974",
"0.522951",
"0.51684934",
"0.5160887",
"0.51463705",
"0.51445454",
"0.513613",
"0.51296794",
"0.5114395",
"0.5100854",
"0.50991833",
"0.5088354",
"0.5045493",
"0.5039689",
"0.5037451",
"0.5032952",
"0.5025151",
"0.501991",
... | 0.0 | -1 |
Return whether stack is empty or not | def empty(self) -> bool:
return not self.stack | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_empty(self):\n return len(self.the_stack) == 0",
"def is_empty(self):\n return len(self.stack) == 0",
"def empty(self):\r\n return len(self.stack) == 0",
"def empty_stack(stack):\n if stack.top is None:\n return True\n else:\n return False",
"def empty(self) ... | [
"0.8918691",
"0.88926786",
"0.8870338",
"0.8863726",
"0.88221294",
"0.881949",
"0.8801287",
"0.8801287",
"0.8730322",
"0.86724347",
"0.8612145",
"0.8589158",
"0.8502743",
"0.8488063",
"0.8451904",
"0.84235376",
"0.8422383",
"0.84106773",
"0.84037715",
"0.8365965",
"0.8365965"... | 0.8410158 | 19 |
Return the element on the top of stack | def top(self):
if self.stack:
return self.stack[-1]
raise ValueError | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def top(self):\n\t\tif self.is_empty():\n\t\t\traise Empty('Stack is empty')\n\t\treturn self._head._element",
"def top(self):\n if self.stack == []:\n return None\n return self.stack[-1]",
"def top(self):\n if self.is_empty():\n raise Empty('Stack is empty')\n ... | [
"0.82786185",
"0.8153754",
"0.813856",
"0.7944625",
"0.78376657",
"0.78244823",
"0.7823922",
"0.77824444",
"0.77632505",
"0.77519727",
"0.77500385",
"0.77347344",
"0.7720731",
"0.76871663",
"0.765971",
"0.7620073",
"0.75984776",
"0.7551877",
"0.7545784",
"0.75207865",
"0.7495... | 0.780533 | 7 |
Create instance from dict. | def from_dict(cls, data):
return cls(
filter_id=data["Filter"],
name=data["Name"],
admin=data["Admin"],
action=data["Action"],
input_port=data["Input"],
output_port=data["Output"],
classifiers=dat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _from_dict(cls, _dict):\n return cls.from_dict(_dict)",
"def _from_dict(cls, _dict):\n return cls.from_dict(_dict)",
"def _from_dict(cls, _dict):\n return cls.from_dict(_dict)",
"def _from_dict(cls, _dict):\n return cls.from_dict(_dict)",
"def _from_dict(cls, _dict):\n ... | [
"0.87819976",
"0.87819976",
"0.87819976",
"0.87819976",
"0.87819976",
"0.87819976",
"0.87819976",
"0.87819976",
"0.87819976",
"0.87819976",
"0.87819976",
"0.87819976",
"0.87819976",
"0.87819976",
"0.87819976",
"0.87819976",
"0.87819976",
"0.87819976",
"0.87819976",
"0.87819976"... | 0.0 | -1 |
Write out the contents of this model to a json file | def to_json(self, fname):
fname = enforce_extension(fname, ".json")
write_json(self.as_dict, fname) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write(self):\r\n\r\n with open(self.filename + \".json\", mode='w') as json_file:\r\n json.dump(self.data, json_file, separators=(',', ':'))",
"def _write_json(self):\n with open(self._file_path, 'w') as f:\n json.dump(self._content, f, indent=4, separators=None,\n ... | [
"0.7961105",
"0.7840964",
"0.7810171",
"0.77880335",
"0.769569",
"0.76039356",
"0.758025",
"0.7524808",
"0.7510253",
"0.74576116",
"0.74270254",
"0.7380906",
"0.73539865",
"0.7329881",
"0.73219216",
"0.73211396",
"0.72909564",
"0.7266008",
"0.7252284",
"0.72374636",
"0.722674... | 0.69911695 | 42 |
Creates a test galaxy with fixed, simplified characteristics. | def create_test_galaxy(galname='G1_test',zred=6,R_gal=5):
plt.close('all')
# Default gas parameters
Ngas = 3000
x,y,z,vx,vy,vz = get_rotating_disk(Ngas,R_gal,400)
SFR = np.zeros(Ngas)+1e-3
Z = np.zeros(Ngas)+1.
nH ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_speciesCreation():\n \n sys = LVsystem.Ecosystem()\n sys.addSpecies('rabbit')\n sys.addSpecies('fox')\n sys.setInteraction('rabbit', 'fox', -1)\n sys.setInteraction('fox', 'rabbit', 1)\n sys.setInitialCond('rabbit', 10)\n sys.setInitialCond('fox', 5)\n sys.setGrowthRate('rabbit... | [
"0.5851727",
"0.58377707",
"0.5814944",
"0.57583374",
"0.568699",
"0.568699",
"0.55900025",
"0.5575849",
"0.5545102",
"0.54638445",
"0.5460158",
"0.5397772",
"0.538144",
"0.5358131",
"0.5335686",
"0.52965224",
"0.52670026",
"0.5181837",
"0.5136136",
"0.5134467",
"0.5134388",
... | 0.70218384 | 0 |
Returns the string representation. If GDAL is installed, it will be 'pretty' OGC WKT. | def __unicode__(self):
try:
return unicode(self.srs)
except:
return unicode(self.wkt) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def as_text(self) -> ir.StringValue:\n return ops.GeoAsText(self).to_expr()",
"def to_wkt(self):\n return _property_op(arctern.ST_AsText, self)",
"def getquoted(self):\n if self.is_geometry:\n # Psycopg will figure out whether to use E'\\\\000' or '\\000'.\n return b\... | [
"0.6552069",
"0.65018666",
"0.6494172",
"0.6459161",
"0.6342747",
"0.6119037",
"0.60719615",
"0.6052651",
"0.60497946",
"0.59693104",
"0.59471595",
"0.5929576",
"0.5929315",
"0.59158504",
"0.58987933",
"0.58541113",
"0.5818525",
"0.5795934",
"0.57828623",
"0.577942",
"0.57794... | 0.0 | -1 |
Return the type of chess piece (delegated to piece_behavior object). | def piece_type(self):
return self.piece_behavior.piece_type | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def piece_type(self):\n return self._piece_type",
"def piece_type(self):\n return self._piece_type",
"def piece_type(self):\n return self._piece_type",
"def piece_type(self):\n return self._piece_type",
"def piece_type(self):\n return self._piece_type",
"def piece_type(... | [
"0.8286762",
"0.8286762",
"0.8286762",
"0.8286762",
"0.8286762",
"0.8286762",
"0.76292515",
"0.75342333",
"0.71280307",
"0.684929",
"0.67751276",
"0.6747946",
"0.6562177",
"0.6539379",
"0.6414262",
"0.6408532",
"0.6191068",
"0.60889673",
"0.60821927",
"0.59908503",
"0.5919392... | 0.8567277 | 0 |
Initialize a Queen_Behavior object. | def __init__(self, player):
self._piece_type = 'queen'
self._value = 18 if player == "white" else -18
self._summary = 'W-Qn' if player == "white" else 'B-Qn'
self._directions = []
for _ in range(8):
self._directions.append([])
for i in range(1, 8):
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n # NOTE: DO not modify this method\n self.items = SimpleQueue()",
"def __init__(self, size):\n self.size = size\n self.num_queens_placed = 0\n self.board = self.generate_board()",
"def __init__(self):\n self.que = []\n self.tem_que = []",
... | [
"0.6264889",
"0.61858934",
"0.6137786",
"0.6100414",
"0.6059379",
"0.6047173",
"0.6028289",
"0.593246",
"0.59320015",
"0.5927544",
"0.5909274",
"0.58980596",
"0.58980596",
"0.5881342",
"0.5848176",
"0.58471495",
"0.5815925",
"0.58153385",
"0.58056843",
"0.58056843",
"0.580568... | 0.60372984 | 6 |
Initialize a Pawn_Behavior object. | def __init__(self, player):
self._piece_type = 'pawn'
self._value = 2 if player == "white" else -2
self._summary = 'W-Pw' if player == "white" else 'B-Pw'
self._directions = []
if player == "white":
self._directions.append([(-1, 1)])
self._directions.appe... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __init__(self):\n \n self._wall = BrickWall() \n self._paddle = GRectangle(\n x=GAME_WIDTH/2 - PADDLE_WIDTH/2,\n y=PADDLE_OFFSET,\n width=PADDLE_WIDTH,\n height=PADDLE_HEIGHT,\n fillcolor = PADDLE_COLOR)\n self._clickdist = 0\n... | [
"0.65173364",
"0.6141873",
"0.61060166",
"0.60789603",
"0.6050348",
"0.5948303",
"0.5948303",
"0.591862",
"0.59147483",
"0.5903339",
"0.58915824",
"0.5849741",
"0.5845827",
"0.5811716",
"0.58102083",
"0.5800053",
"0.5794508",
"0.5792774",
"0.5781649",
"0.57756686",
"0.5771907... | 0.59820217 | 5 |
Takes as input a continuous column and returns the column cutted in 10 quantiles. 'Na' are treated as zero if treat_na_as_zero = True; else a 'na' class is created | def quantify_col(cont, treat_na_as_zero = True):
try:
quant = cont.quantile(q=[0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9]).tolist()
except:
pdb.set_trace()
#pdb.set_trace()
#Replace na by 0
if treat_na_as_zero == True:
cont[cont.isnull()] = 0
cont_copy = cont.copy()
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def createQuantile(data, column_name, cut_of_point):\r\n data[data[column_name] > data[column_name].quantile(cut_of_point)] = 0\r\n return data",
"def quantile_transform(X, *, axis=..., n_quantiles=..., output_distribution=..., ignore_implicit_zeros=..., subsample=..., random_state=..., copy=...):\n ...... | [
"0.70278156",
"0.61047965",
"0.5935789",
"0.59229016",
"0.58947587",
"0.5885075",
"0.5850439",
"0.5842737",
"0.5827055",
"0.5787766",
"0.57281697",
"0.57280236",
"0.5705613",
"0.5693906",
"0.56789863",
"0.56634647",
"0.5656985",
"0.56558543",
"0.5646278",
"0.564619",
"0.56361... | 0.64366704 | 1 |
Returns the clients table for the current workspace. | def clients(self):
return ClientsTable(self.rpc, self.name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_client_list(self):\r\n cursor = self.conn.cursor()\r\n cursor.execute(\"\"\"SELECT * FROM CLIENT\"\"\")\r\n return cursor.fetchall()",
"def get_clients():\n data = DataTable(document=ClientDocument, schema=ClientSchema).get_data\n return Response(data=data).send()",
"def list... | [
"0.7288202",
"0.7038157",
"0.68447745",
"0.6314998",
"0.62926424",
"0.6275652",
"0.5976854",
"0.59706676",
"0.590229",
"0.58976775",
"0.58503336",
"0.5848827",
"0.58395594",
"0.57922083",
"0.5729175",
"0.5703656",
"0.5700097",
"0.56843376",
"0.56683946",
"0.5597465",
"0.55963... | 0.7891349 | 0 |
The list of all workspaces in the current msf database. | def list(self):
return self.rpc.call(MsfRpcMethod.DbWorkspaces)['workspaces'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def workspaces(self):\n return WorkspaceCollection(client=self)",
"def list_workspaces(client):\n return client._creoson_post(\"windchill\", \"list_workspaces\", key_data=\"workspaces\")",
"def workspace(self):\n return self.rpc.call(MsfRpcMethod.DbCurrentWorkspace)['workspace']",
"def find_... | [
"0.77265364",
"0.73151606",
"0.7235766",
"0.6992168",
"0.66492295",
"0.6460518",
"0.64589715",
"0.6238313",
"0.61697036",
"0.6128429",
"0.6061488",
"0.6059548",
"0.60529727",
"0.59736943",
"0.5916001",
"0.5914105",
"0.59116054",
"0.5845858",
"0.582106",
"0.57632774",
"0.57584... | 0.8445844 | 0 |
Returns a Workspace object for the given workspace name. | def workspace(self, name='default'):
w = self.list
if name not in w:
self.add(name)
return Workspace(self.rpc, name) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(self, name):\n res = self.rpc.call(MsfRpcMethod.DbGetWorkspace, [name])\n if 'workspace' in res:\n return res['workspace']\n else:\n return",
"def get_workspace(self):\n\n # Our AML config file\n with open(\"/usr/src/api/config.json\", \"r\") as js... | [
"0.7821205",
"0.7301967",
"0.7206432",
"0.6975045",
"0.66939646",
"0.65503573",
"0.6503561",
"0.6497397",
"0.6496252",
"0.6399926",
"0.6243582",
"0.6239364",
"0.6227375",
"0.6227375",
"0.6227375",
"0.6144424",
"0.61405474",
"0.6129577",
"0.6081881",
"0.604126",
"0.59800816",
... | 0.81865823 | 0 |
Get a workspace with the given name. | def get(self, name):
res = self.rpc.call(MsfRpcMethod.DbGetWorkspace, [name])
if 'workspace' in res:
return res['workspace']
else:
return | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def workspace(self, name='default'):\n w = self.list\n if name not in w:\n self.add(name)\n return Workspace(self.rpc, name)",
"def get_workspace(client):\n return client._creoson_post(\"windchill\", \"get_workspace\", key_data=\"workspace\")",
"def get_workspace(self):\n\n ... | [
"0.81628656",
"0.70306754",
"0.689617",
"0.6717713",
"0.6601997",
"0.65639377",
"0.6441299",
"0.64204144",
"0.6299173",
"0.6292328",
"0.6292328",
"0.6292328",
"0.6279216",
"0.6216556",
"0.6202216",
"0.6181608",
"0.61120915",
"0.5996702",
"0.59266585",
"0.5920261",
"0.58799857... | 0.8430495 | 0 |
The current database driver in use. | def driver(self):
return self.rpc.call(MsfRpcMethod.DbDriver, [{}])['driver'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_driver(self):\n\t\treturn self.driver",
"def driver_name(self):\n return self._driver_name",
"def driver(self):\n \n return self.__driver",
"def get_driver(self):\n return self.driver",
"def defaultDriver(self):\n return Enums.SQLite3",
"def _getDriver(self):\n ... | [
"0.75343305",
"0.7438409",
"0.7367394",
"0.7319937",
"0.7312787",
"0.7273201",
"0.7056443",
"0.70134705",
"0.6907783",
"0.68550634",
"0.6703985",
"0.6630689",
"0.66089857",
"0.65820175",
"0.6570382",
"0.6563217",
"0.65606743",
"0.6541269",
"0.6514099",
"0.6504329",
"0.6504047... | 0.82128906 | 0 |
Add a session ID or token. | def add(self, token):
self.rpc.call(MsfRpcMethod.AuthTokenAdd, [token]) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_session(self, session_id):\n sessions = self.get_sessions()\n if session_id not in sessions:\n sessions.append(session_id)\n self.ref_cache.set(self.sid, sessions)",
"def add_session(self, session):\n with self._sessions_lock:\n if session.session_id ... | [
"0.6941528",
"0.69389224",
"0.6578769",
"0.64123523",
"0.6004818",
"0.60013884",
"0.5982965",
"0.5920744",
"0.5827696",
"0.5815967",
"0.57433504",
"0.5742789",
"0.5650182",
"0.56413907",
"0.5627011",
"0.56164163",
"0.5573029",
"0.5573029",
"0.5539498",
"0.5534109",
"0.5518745... | 0.642088 | 3 |
Generate a session ID or token. | def generate(self):
return self.rpc.call(MsfRpcMethod.AuthTokenGenerate)['token'] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __generate_session_token(self):\n\n return get_random_string(length=32)",
"def _generate_token(self):\n return sha1(\"%s#%s\" % (time(),\n self.app.cfg['sessions/secret'])).hexdigest()",
"def generate_session_id():\n return utils.get_32bit_random_num()",
... | [
"0.78672177",
"0.76654154",
"0.75436735",
"0.7464937",
"0.70162916",
"0.6936656",
"0.68979",
"0.68894625",
"0.6799429",
"0.6758413",
"0.6758413",
"0.67269534",
"0.6680905",
"0.6678203",
"0.6655516",
"0.66236365",
"0.6594821",
"0.6590536",
"0.6542596",
"0.65126055",
"0.6505678... | 0.6385688 | 28 |
The current threads running in the core. | def threads(self):
return self.rpc.call(MsfRpcMethod.CoreThreadList) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getThreads():\r\n return multiprocessing.cpu_count()",
"def getThreads():\n if sys.platform == 'win32':\n return int(os.environ['NUMBER_OF_PROCESSORS'])\n else:\n return int(os.popen('grep -c cores /proc/cpuinfo').read())",
"def _get_threads():\n if sys.platform == 'win32':\n ... | [
"0.77744293",
"0.75884444",
"0.74551535",
"0.7101846",
"0.7051548",
"0.7027584",
"0.6991324",
"0.69267064",
"0.69049394",
"0.68486965",
"0.6799773",
"0.67884946",
"0.678532",
"0.6773574",
"0.6732508",
"0.6707622",
"0.66951823",
"0.6596781",
"0.6591976",
"0.6546974",
"0.651595... | 0.7645966 | 1 |
Get the current option value. | def __getitem__(self, item):
if item not in self._moptions:
raise KeyError("Invalid option '%s'." % item)
return self._runopts.get(item) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_value(self):\n return self._get_value(self.optionType, self.value, self.defaultValue)",
"def get_current_option(self) -> str:\n return self.options[self.current_option_index]",
"def selected_value(self):\n option = self.selected_option\n return option.value if option else No... | [
"0.8383057",
"0.81079274",
"0.809335",
"0.80652976",
"0.8029953",
"0.7422446",
"0.7418753",
"0.7143951",
"0.71336275",
"0.70387954",
"0.6955094",
"0.6908267",
"0.68947136",
"0.68749386",
"0.68578357",
"0.68578357",
"0.68578357",
"0.6857745",
"0.68329513",
"0.682755",
"0.68275... | 0.0 | -1 |
A list of platform names. | def platforms(self):
return self.rpc.call(MsfRpcMethod.ModulePlatforms) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_platforms(self):\n if self.platform == 'All':\n return PLATFORMS\n else:\n return self.platform.split(':')",
"def Platforms():\n return platforms",
"def list_platforms(self):\n return self.do_rpc('list_platforms')",
"def platforms(self):\n logger.d... | [
"0.82740295",
"0.818217",
"0.7766882",
"0.74171376",
"0.7383327",
"0.72948956",
"0.7182536",
"0.71105474",
"0.69164336",
"0.6745479",
"0.66848505",
"0.6627692",
"0.6623738",
"0.66083926",
"0.65723544",
"0.6556401",
"0.65547526",
"0.6534272",
"0.6534272",
"0.6470497",
"0.64539... | 0.72543764 | 6 |
Gets the temp directory which we are assuming is writeable | def get_writeable_dir(self):
if self.info['write_dir'] == '':
out = self.run_shell_cmd_with_output('echo %TEMP%', ['>'])
# Example output: 'echo %TEMP%\nC:\\Users\\user\\AppData\\Local\\Temp\r\n\r\nC:\\Windows\\system32>'
write_dir = out.split('\n')[1][:-1] + '\\'
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def temp_directory(self):\n\n return self.get_raw(\"temp_directory\")",
"def get_temp_dir():\n return tempfile.mkdtemp()",
"def tempdir():\n\n # Create a directory and return the path\n return tempfile.mkdtemp()",
"def get_temp_dir():\n return settings.FILE_STORE_TEMP_DIR",
"def sys_... | [
"0.8392767",
"0.8338458",
"0.8137557",
"0.8068244",
"0.7958497",
"0.79522914",
"0.7949855",
"0.79108495",
"0.7872731",
"0.78634834",
"0.7862477",
"0.7843797",
"0.7818468",
"0.7724595",
"0.7722913",
"0.7647437",
"0.76094186",
"0.7606808",
"0.7592792",
"0.7583769",
"0.75545657"... | 0.77546865 | 13 |
Return the znormalized Euclidian distance between the time series ts_a and ts_b | def z_normalize_euclidian(ts_a, ts_b):
if len(ts_a) != len(ts_b):
raise ValueError("ts_a and ts_b must be the same length")
return np.linalg.norm(z_normalize(ts_a.astype("float64")) - z_normalize(ts_b.astype("float64"))) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trame_distance(t1, t2):\n return np.linalg.norm(t1 - t2)",
"def dist(a,b): # compute distance between two points a & b\n return mag(sub(a,b))",
"def _get_distance(a, b):\n return np.sqrt(np.sum((a - b) ** 2))",
"def eucl_dist(a, b):\n return np.sqrt( (a[0]-b[0])** 2 + (a[1]-b[1])** 2)",
... | [
"0.647557",
"0.64527607",
"0.6451201",
"0.6370609",
"0.6343189",
"0.6314626",
"0.6314626",
"0.627296",
"0.6200631",
"0.6196423",
"0.6183729",
"0.61674863",
"0.6166205",
"0.6156507",
"0.61470085",
"0.6145902",
"0.6145443",
"0.61380345",
"0.6122099",
"0.61137974",
"0.6108418",
... | 0.8327526 | 0 |
Makes a plain text file. Returns a hash of the file contents. | def make_dummy_file(path, contents=None):
dirname = op.dirname(path)
if not op.exists(dirname):
os.makedirs(dirname)
if contents is None:
contents = '{}\n'.format(op.basename(path))
with open(path, 'wt') as f:
f.write(contents)
return hash(contents) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash_file(file_to_hash):\n print(\"Hashing \" + file_to_hash + \"...\")\n hash_algorithm = hashlib.sha256()\n file = open(file_to_hash, 'rb')\n while True:\n contents = file.read(65536)\n if not contents:\n break\n hash_algorithm.update(contents)\n hash_str = hash... | [
"0.6548256",
"0.64209574",
"0.6406365",
"0.6386001",
"0.6386001",
"0.63602215",
"0.6358873",
"0.6316422",
"0.6315326",
"0.6312324",
"0.6262778",
"0.62519985",
"0.6233131",
"0.6218264",
"0.6193769",
"0.6153226",
"0.6107376",
"0.60803103",
"0.60672235",
"0.60638404",
"0.6056944... | 0.653055 | 1 |
Returnsa context manager which creates, changes to, and returns a temporary directory, and then deletes it on exit. | def testdir(contents=None, suffix=""):
if contents is not None:
contents = [op.join(*c.split('/')) for c in contents]
class ctx(object):
def __init__(self, contents):
self.contents = contents
def __enter__(self):
self.testdir = tempfile.mkdtemp(suffix=suffix)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tempdir():\n\n class ctx(object):\n\n def __enter__(self):\n self.prevdir = os.getcwd()\n self.tempdir = tempfile.mkdtemp()\n os.chdir(self.tempdir)\n return self.tempdir\n\n def __exit__(self, *a, **kwa):\n os.chdir(self.prevdir)\n ... | [
"0.84647566",
"0.79086393",
"0.78724945",
"0.78173834",
"0.77895975",
"0.77791935",
"0.7721311",
"0.77169573",
"0.7709688",
"0.76674485",
"0.7539041",
"0.7436405",
"0.7423864",
"0.7422459",
"0.7389963",
"0.7382933",
"0.73363405",
"0.7322699",
"0.7293084",
"0.723064",
"0.72203... | 0.0 | -1 |
Calculates distance between two latitudelongitude coordinates. | def distance(self, a, b):
# -----------------------------
# Your code
'''R = 3963 # radius of Earth (miles)
lat1, lon1 = math.radians(a[0]), math.radians(a[1])
lat2, lon2 = math.radians(b[0]), math.radians(b[1])
return math.acos(math.sin(lat1) * math.si... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def distance(gps1, gps2):\n return haversine(gps1.lng, gps1.lat, gps2.lng, gps2.lat)",
"def distance(lat1, lon1, lat2, lon2):\r\n radius = 6373 * 1000\r\n dlon = lon2 - lon1\r\n dlat = lat2 - lat1\r\n a = (math.sin(dlat/2))**2 + math.cos(lat1) * math.cos(lat2) * (math.sin(dlon/2))**2\r\n c = 2 ... | [
"0.7849194",
"0.7702874",
"0.76946914",
"0.7679034",
"0.7660439",
"0.7646004",
"0.7623099",
"0.7604756",
"0.7583335",
"0.7566243",
"0.7481792",
"0.74734247",
"0.7455901",
"0.7451839",
"0.74496955",
"0.74387443",
"0.74357766",
"0.742737",
"0.7424572",
"0.7411749",
"0.74096555"... | 0.7223946 | 39 |
Returns Number of bikes currently at the station. | def bikes(self):
bikes = [1 if dock.bike else 0 for dock in self.docks]
return sum(bikes) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _get_bikes_available(sta):\n # 'num_ebikes_available\" is not part of the GBFS spec, but it appears\n # in the Divvy API response\n return sta['num_bikes_available'] + sta.get('num_ebikes_available', 0)",
"def num_spikes(self):\n return self._num_spikes",
"def n_spikes(self):\n retur... | [
"0.7562642",
"0.75365305",
"0.71774304",
"0.7093625",
"0.68277735",
"0.65048575",
"0.64711446",
"0.6451008",
"0.6414368",
"0.62876534",
"0.6222599",
"0.62162757",
"0.61959684",
"0.61344844",
"0.60800654",
"0.60536623",
"0.60189337",
"0.6013025",
"0.60097414",
"0.60019034",
"0... | 0.739501 | 2 |
This method splits the given dataframe object into train,validation and test dataframes in stratified manner. | def get_train_validation_test_split(dframe):
skf = StratifiedKFold(n_splits=5, shuffle=True, random_state=2)
result = next(skf.split(dframe, get_label(dframe)), None)
train_validation = dframe.iloc[result[0]]
test = dframe.iloc[result[1]]
result = next(skf.split(train_validation, get_label(train_v... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split(df, stratify_by=None):\n \n if stratify_by == None:\n train, test = train_test_split(df, test_size=.3, random_state=123)\n train, validate = train_test_split(df, test_size=.3, random_state=123)\n else:\n train, test = train_test_split(df, test_size=.2, random_state=123, stra... | [
"0.7697991",
"0.7392482",
"0.73063785",
"0.7109365",
"0.7095811",
"0.7081904",
"0.70265526",
"0.7022708",
"0.6961818",
"0.69565237",
"0.69339335",
"0.6932127",
"0.69207805",
"0.6898678",
"0.6888916",
"0.681318",
"0.67641985",
"0.67560416",
"0.6730261",
"0.67217505",
"0.671642... | 0.68839 | 15 |
Plots the prediction and the label next to each other. | def plot_segmentation_prediction(
prediction: ndarray,
label: ndarray,
raw_img: Image,
raw_label: Image,
img_shape: tuple,
img_name: str,
save_path: str,
) -> None:
raw_img = raw_img.resize(img_shape)
final_mask = mark_boundaries(raw_img, prediction == 1, [255, 0, 0])
final_mask... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plot_predictions(self):\n\n plt.title(\"Targets vs. Predictions\")\n plt.plot(self.T, label=\"Targets\")\n plt.plot(self.Y, label=\"Predictions\")\n plt.xlabel(\"Sample number\")\n plt.legend()\n plt.show()",
"def Plot_predict(X,Y,model,X_path): \n labels = ... | [
"0.7855863",
"0.7198525",
"0.71721214",
"0.7134019",
"0.7087913",
"0.7022502",
"0.6964058",
"0.6960429",
"0.69471127",
"0.6902709",
"0.68710065",
"0.6857848",
"0.6854607",
"0.68215245",
"0.68023837",
"0.67971784",
"0.67915255",
"0.67327744",
"0.6728502",
"0.6714703",
"0.66986... | 0.6360386 | 39 |
Depopulate created model instances from test database. | def tearDown(self):
for model in MODELS:
for obj in model.objects.all():
obj.delete() | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tearDownClass(cls):\n del cls.my_model.name\n del cls.my_model.my_number\n del cls.my_model_json\n del cls.my_new_model\n del cls.my_model",
"def tearDown(self):\n\n User.objects.all().delete()\n Movie.objects.all().delete()\n Vote.objects.all().delete(... | [
"0.7579863",
"0.7500367",
"0.7425837",
"0.74165606",
"0.7366364",
"0.7366364",
"0.73618627",
"0.73613447",
"0.73613447",
"0.73613447",
"0.73613447",
"0.73613447",
"0.73613447",
"0.73613447",
"0.73613447",
"0.73613447",
"0.73537236",
"0.73537236",
"0.73537236",
"0.73537236",
"... | 0.77299076 | 0 |
pad all features to the same length | def pad_samples(features, maxlen=50, pad=0):
padded_features = []
for feature in features:
if len(feature) >= maxlen:
padded_feature = feature[:maxlen]
else:
padded_feature = feature
while len(padded_feature) < maxlen:
padded_feature.append(pad... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zero_pad_features(features, depth):\n\n n = int(features.get_shape().dims[-1])\n extra_feature_count = depth - n\n assert n >= 0\n if n > 0:\n padding = tf.tile(features[:, :, :, :1] * 0,\n [1, 1, 1, extra_feature_count])\n features = tf.concat([features, padd... | [
"0.709257",
"0.69305056",
"0.6844535",
"0.6742568",
"0.64841294",
"0.6441648",
"0.64288306",
"0.63929176",
"0.638186",
"0.63184786",
"0.6236169",
"0.6209573",
"0.6131841",
"0.61262465",
"0.61109155",
"0.6101158",
"0.6028776",
"0.60255796",
"0.59667504",
"0.5958954",
"0.594339... | 0.74053144 | 0 |
Create dataset for training. | def create_dataset(base_path, batch_size, is_train):
columns_list = ["feature", "label"]
num_consumer = 4
if is_train:
path = os.path.join(base_path, 'aclImdb_train.mindrecord0')
else:
path = os.path.join(base_path, 'aclImdb_test.mindrecord0')
data_set = ds.MindDataset(path, column... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_dataset():\n\n\tnumberOfTrials = dataset_params.num_of_samples\n\tnumberOfTrials_train = int(numberOfTrials*0.8)\n\tnumberOfTrials_test = int(numberOfTrials*0.2)\n\n\tprint(\"==================================================\")\n\tprint(\"1. Generating Train images ......\")\n\tprint(\"\\nTrain image per... | [
"0.797284",
"0.7821573",
"0.7520786",
"0.7507154",
"0.7468649",
"0.7450104",
"0.7371682",
"0.73470896",
"0.7337984",
"0.73304254",
"0.73287565",
"0.7319614",
"0.7307185",
"0.72988415",
"0.7293643",
"0.7279369",
"0.7273934",
"0.7254393",
"0.7253382",
"0.7245603",
"0.7239909",
... | 0.7463872 | 5 |
Convert a relative import path into an absolute one. | def resolve_relative_name(package, module, relative):
if relative.startswith('.'):
# Add a dummy module onto the end if this is a package. It will be
# pulled off in the loop below.
if package == module:
module += '.dummy'
parts = module.split('.')
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_abs_path(path):\r\n abs_path = lib_path.abspath(path)\r\n return abs_path",
"def absolute_import(file_path):\n\n # module name\n _, name, _ = file_parts(file_path)\n\n # load the spec and module\n spec = importlib.util.spec_from_file_location(name, file_path)\n module = importlib.uti... | [
"0.6973379",
"0.6877666",
"0.67767143",
"0.6715295",
"0.6677648",
"0.6659019",
"0.6655234",
"0.6639675",
"0.6621896",
"0.66096777",
"0.6589261",
"0.65802664",
"0.6555796",
"0.6553052",
"0.6529902",
"0.6511914",
"0.64701015",
"0.6466517",
"0.6397013",
"0.63932705",
"0.6391471"... | 0.5652701 | 89 |
Add a vertex to the graph. | def add_vertex(self, vertex_id):
# add new vertex in vertices
self.vertices[vertex_id] = set()
# increment len
self.len += 1 | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_vertex(self, vertex):\n raise NotImplementedError",
"def add_vertex(self, vertex):\n if isinstance(vertex, Vertex):\n self.vertices.append(vertex)\n return\n raise TypeError('Is not vertex instance!')",
"def add_vertex(self, vertex_name: n):\n new_verte... | [
"0.87015903",
"0.84329987",
"0.8422056",
"0.840923",
"0.83646226",
"0.8317027",
"0.825337",
"0.808519",
"0.8081489",
"0.8038682",
"0.8035422",
"0.78834563",
"0.78711975",
"0.7838118",
"0.7838118",
"0.77608305",
"0.7757061",
"0.77158874",
"0.7711681",
"0.76663774",
"0.76616603... | 0.76356477 | 23 |
Add a directed edge to the graph. | def add_edge(self, v1, v2):
# TODO
# add directed edges
self.vertices[v1].add(v2)
# self.vertices[v2].add(v1) | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_edge(self, edge):\n src = edge.get_source()\n dest = edge.get_destination()\n #weightEdge = WeightedEdge(src, dest, edge.get_total_distance(), edge.get_outdoor_distance())\n if not (src in self.edges and dest in self.edges):\n raise ValueError('Node not in graph')\n ... | [
"0.78169996",
"0.77789694",
"0.7618847",
"0.761851",
"0.75694674",
"0.7547367",
"0.7483565",
"0.7437083",
"0.74284625",
"0.7422367",
"0.741715",
"0.7337182",
"0.73281914",
"0.7266331",
"0.7227267",
"0.7212267",
"0.71977764",
"0.7194343",
"0.71735585",
"0.7168542",
"0.7152955"... | 0.70643336 | 26 |
Get all neighbors (edges) of a vertex. | def get_neighbors(self, vertex_id):
# TODO
return self.vertices[vertex_id] | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def neighbors_in(self, vertex):\n return list(self.neighbor_in_iterator(vertex))",
"def neighbors_out(self, vertex):\n return list(self.neighbor_out_iterator(vertex))",
"def get_neighbours(self, vertex):\n output = []\n \n if vertex in self.adjacency_list:\n for ne... | [
"0.8146008",
"0.78266084",
"0.78112674",
"0.7634123",
"0.76183206",
"0.7559868",
"0.7391218",
"0.73596346",
"0.729323",
"0.729323",
"0.729323",
"0.729323",
"0.729323",
"0.729323",
"0.7279731",
"0.71649474",
"0.7128683",
"0.7083494",
"0.7077735",
"0.7033856",
"0.69887614",
"... | 0.73310196 | 8 |
Parses a single tf.Example into image and label Tensors. | def parser(self, serialized_example):
features = {
'image/height': tf.FixedLenFeature([], tf.int64),
'image/width': tf.FixedLenFeature([], tf.int64),
'image/colorspace': tf.FixedLenFeature([], tf.string),
'image/channels': tf.FixedLenFeature([], tf.int64),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _parse_tfexample(example):\n\n ## parse\n features = tf.parse_single_example(example, KEYS2FEATURES)\n\n image = tf.image.decode_png(features['image/encoded'])\n label = tf.image.decode_png(features['label/encoded'])\n # label is decoded as a 3-D png image\n label = label[..., 0]\n im_path = features['i... | [
"0.8307095",
"0.8225443",
"0.8054484",
"0.7895702",
"0.78724664",
"0.7867238",
"0.7730271",
"0.7609204",
"0.7557796",
"0.7475127",
"0.7442011",
"0.73958135",
"0.7370597",
"0.73020583",
"0.72630876",
"0.7258448",
"0.7225072",
"0.719214",
"0.7178923",
"0.7175657",
"0.7135987",
... | 0.8056955 | 2 |
Parse a single tf.Example into image and label Tensors. | def parser(self, serialized_example):
features = {
'image/height': tf.FixedLenFeature([], tf.int64),
'image/width': tf.FixedLenFeature([], tf.int64),
'image/colorspace': tf.FixedLenFeature([], tf.string),
'image/channels': tf.FixedLenFeature([], tf.int64),
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _parse_tfexample(example):\n\n ## parse\n features = tf.parse_single_example(example, KEYS2FEATURES)\n\n image = tf.image.decode_png(features['image/encoded'])\n label = tf.image.decode_png(features['label/encoded'])\n # label is decoded as a 3-D png image\n label = label[..., 0]\n im_path = features['i... | [
"0.83596814",
"0.80799854",
"0.79846454",
"0.7979362",
"0.7884856",
"0.78392446",
"0.76819575",
"0.76272774",
"0.75874704",
"0.7534791",
"0.7507522",
"0.7502231",
"0.74875385",
"0.7408102",
"0.73418164",
"0.733026",
"0.7326417",
"0.73068714",
"0.72838265",
"0.72823274",
"0.72... | 0.80238867 | 2 |
Get an astropy cosmology from a name. | def get_cosmology_from_name(cosmology):
# This list should be updated when astropy releases the Planck18 cosmology
available_cosmologies = {
"WMAP5": acosmo.WMAP5,
"WMAP7": acosmo.WMAP7,
"WMAP9": acosmo.WMAP9,
"Planck13": acosmo.Planck13,
"Planck15": acosmo.Planck15,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_cosmology(cosmology=conf.cosmology):\n if cosmology.lower() not in available_cosmologies:\n raise ValueError(\n \"Unrecognised cosmology {}. Available cosmologies are {}\".format(\n cosmology, \", \".join(available_cosmologies)\n )\n )\n elif cosmolo... | [
"0.6795616",
"0.5804274",
"0.57137537",
"0.56837",
"0.56650496",
"0.5661337",
"0.55084646",
"0.5342259",
"0.52762514",
"0.5188281",
"0.5176528",
"0.5169667",
"0.5132922",
"0.50550663",
"0.50426495",
"0.50316185",
"0.49275777",
"0.49064732",
"0.48993105",
"0.48828992",
"0.4880... | 0.7153581 | 0 |
Fetches random newsgroups articles of specified categories. categories is a list of valid categories in Newsgroups. n_articles is the number of articles to extract. | def get_newsgroups(categories = None, n_articles = 10):
remove = ('headers', 'footers', 'quotes')
newsgroups = fetch_20newsgroups(subset = 'train', remove = remove, categories = categories)
ind = np.random.choice(len(newsgroups.data), size = n_articles, replace = False)
news = [newsgroups.data... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch_news(n):\n\n # This is the list we will use the pass back the news information.\n data = []\n\n # Get news stories from the MEN RSS feed.\n response = feedparser.parse('https://www.manchestereveningnews.co.uk/?service=rss')\n\n # Loop through the news items, and the pull out the data we ne... | [
"0.62762827",
"0.6031156",
"0.5743372",
"0.56703836",
"0.56342757",
"0.56167805",
"0.5531268",
"0.5372634",
"0.5348539",
"0.5312435",
"0.5308248",
"0.52996963",
"0.5294088",
"0.52907157",
"0.52174467",
"0.51421255",
"0.51415086",
"0.50747275",
"0.50580394",
"0.5041536",
"0.50... | 0.73156595 | 0 |
Returns the error message, which includes the erroneous model's id. | def message(self):
if not python_utils.is_string(self._message):
raise NotImplementedError(
'self.message must be assigned a value in __init__')
return self._message | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def error_message(self) -> str:\n return pulumi.get(self, \"error_message\")",
"def error_message(self) -> str:\n return pulumi.get(self, \"error_message\")",
"def error_message(self) -> str:\n return pulumi.get(self, \"error_message\")",
"def error_message(self) -> str:\n return ... | [
"0.7675787",
"0.7675787",
"0.7675787",
"0.7590794",
"0.7582663",
"0.75458866",
"0.7502257",
"0.7471503",
"0.74615777",
"0.74205375",
"0.7334199",
"0.7334199",
"0.7334199",
"0.7334199",
"0.7334199",
"0.7334199",
"0.7334199",
"0.7273975",
"0.7273975",
"0.7195435",
"0.71380156",... | 0.0 | -1 |
Update priorities of sampled transitions. sets priority of transition at index idxes[i] in buffer to priorities[i]. | def update_priorities(self, idxes, priorities):
assert len(idxes) == len(priorities)
for idx, priority in zip(idxes, priorities):
assert priority > 0
assert 0 <= idx < len(self._storage)
self._it_sum[idx] = priority ** self._alpha
self._it_min[idx] = prior... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_priorities(self, idxes, priorities):\n assert len(idxes) == len(priorities)\n for ndx, priority in zip(idxes, priorities):\n assert priority > 0\n assert 0 <= ndx < len(self.memory)\n self.iter_sum[ndx] = priority ** self.alpha\n self.iter_min[nd... | [
"0.72805375",
"0.71849024",
"0.71653116",
"0.71576166",
"0.71576166",
"0.7021548",
"0.6980055",
"0.6799197",
"0.6607886",
"0.6558007",
"0.6352791",
"0.622759",
"0.6114667",
"0.5843654",
"0.57600236",
"0.5693877",
"0.53503555",
"0.52464247",
"0.52044654",
"0.51429737",
"0.5137... | 0.7075183 | 5 |
Store a single frame in the buffer at the next available index, overwriting old frames if necessary. | def store_frame(self, frame):
if self.obs is None:
self.obs = np.empty([self.size] + list(frame.shape), dtype=np.uint8)
self.action = np.empty([self.size], dtype=np.int32)
self.reward = np.empty([self.size], dtype=np.float32)
self.done = np.empty([self.size], dtyp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"async def put(self, frame: RawArray):\r\n if self.full():\r\n raise IndexError(\"not enough internal buffer\")\r\n self.frames[self._write_index][:] = frame\r\n\r\n self._write_index = (self._write_index + 1) % self.capacity()\r\n self._is_full = self._read_index == self._wri... | [
"0.76445884",
"0.64631253",
"0.6289341",
"0.62700355",
"0.6213401",
"0.6137119",
"0.60684735",
"0.6066631",
"0.6011363",
"0.591171",
"0.5875663",
"0.5838281",
"0.5822907",
"0.5811572",
"0.5713264",
"0.57106537",
"0.5696203",
"0.5679749",
"0.56544995",
"0.5654154",
"0.56294537... | 0.70342267 | 1 |
The email of publisher/company. | def publisher_email(self) -> pulumi.Input[str]:
return pulumi.get(self, "publisher_email") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def publisher_email(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"publisher_email\")",
"def email(self) -> str:\n return pulumi.get(self, \"email\")",
"def email(self) -> str:\n return pulumi.get(self, \"email\")",
"def email(self) -> str:\n return pulumi.get(self, \"em... | [
"0.8418234",
"0.8145944",
"0.8145944",
"0.8145944",
"0.81170917",
"0.8093843",
"0.8018317",
"0.80142",
"0.80142",
"0.80142",
"0.80142",
"0.7830933",
"0.7830933",
"0.7830933",
"0.7830933",
"0.78219426",
"0.7783638",
"0.77834326",
"0.7782989",
"0.7751573",
"0.7746207",
"0.774... | 0.823683 | 1 |
The name of the Resource Group in which the API Management Service should be exist. Changing this forces a new resource to be created. | def resource_group_name(self) -> pulumi.Input[str]:
return pulumi.get(self, "resource_group_name") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resource_group_name(self) -> str:\n return pulumi.get(self, \"resource_group_name\")",
"def resource_group_name(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(self, \"resource_group_name\")",
"def resource_group_name(self) -> Optional[pulumi.Input[str]]:\n return pulumi.get(... | [
"0.7519007",
"0.7252912",
"0.7252912",
"0.7252912",
"0.7252912",
"0.7252912",
"0.7252912",
"0.7252912",
"0.7252912",
"0.7252912",
"0.7252912",
"0.7252912",
"0.7252912",
"0.7252912",
"0.7252912",
"0.7252912",
"0.72377294",
"0.70131713",
"0.7011773",
"0.7011773",
"0.7011773",
... | 0.73299044 | 25 |
Email address from which the notification will be sent. | def notification_sender_email(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "notification_sender_email") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def email_address() -> str:\n\n return os.environ.get(\"EMAIL_NOTIFICATION\", \"\")",
"def notification_sender_email(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"notification_sender_email\")",
"def generate_email_address(self):\n return \"%s.%s@%s\" % (uuid.uuid4(), self.mailbox, \... | [
"0.8191204",
"0.80174744",
"0.7613062",
"0.74585193",
"0.74514425",
"0.74514425",
"0.74514425",
"0.7412389",
"0.72602934",
"0.7259813",
"0.72285235",
"0.72228503",
"0.7219816",
"0.7219816",
"0.7219816",
"0.7219816",
"0.7191841",
"0.7142307",
"0.70599717",
"0.7038014",
"0.7005... | 0.76546335 | 2 |
A mapping of tags assigned to the resource. | def tags(self) -> Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]]:
return pulumi.get(self, "tags") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tags(self) -> Mapping[str, str]:\n return pulumi.get(self, \"tags\")",
"def tags(self) -> Mapping[str, str]:\n return pulumi.get(self, \"tags\")",
"def tags(self) -> Mapping[str, str]:\n return pulumi.get(self, \"tags\")",
"def tags(self) -> Mapping[str, str]:\n return pulumi.... | [
"0.8047764",
"0.8047764",
"0.8047764",
"0.8047764",
"0.7979305",
"0.7979305",
"0.7540683",
"0.7516949",
"0.73094535",
"0.7300278",
"0.7238649",
"0.7197904",
"0.71846336",
"0.71488696",
"0.71181715",
"0.70630586",
"0.7004693",
"0.69596815",
"0.69234526",
"0.69234526",
"0.69234... | 0.0 | -1 |
The URL for the Developer Portal associated with this API Management service. | def developer_portal_url(self) -> Optional[pulumi.Input[str]]:
return pulumi.get(self, "developer_portal_url") | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def developer_portal_url(self) -> pulumi.Output[str]:\n return pulumi.get(self, \"developer_portal_url\")",
"def api_url(self):\n return self.get_api_url()",
"def api_url(self):\n return self._api_url",
"def apiurl(self):\n return self._apiurl",
"def management_api_url(self) -> ... | [
"0.8189453",
"0.7377523",
"0.71191704",
"0.6955641",
"0.69545794",
"0.689547",
"0.68257946",
"0.6691102",
"0.6682509",
"0.6652316",
"0.66401094",
"0.66367257",
"0.6621785",
"0.65991664",
"0.65986437",
"0.657356",
"0.65540826",
"0.654707",
"0.6482262",
"0.64011085",
"0.6363019... | 0.78904295 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.