query
stringlengths
9
9.05k
document
stringlengths
10
222k
metadata
dict
negatives
listlengths
30
30
negative_scores
listlengths
30
30
document_score
stringlengths
4
10
document_rank
stringclasses
2 values
Check to make sure sklearn's UMAP doesn't use the title param
def test_sklearn_umap_title(self): # In TSNEVisualizer, the internal sklearn UMAP transform consumes # some but not all kwargs passed in by user. Those not in get_params(), # like title, are passed through to YB's finalize method. This test should # notify us if UMAP's params change on ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_custom_title_umap(self):\n umap = UMAPVisualizer(title=\"custom_title\")\n\n assert umap.title == \"custom_title\"", "def test_umap_mismtached_labels(self):\n ## produce random data\n X, y = make_classification(\n n_samples=200,\n n_features=100,\n ...
[ "0.66912156", "0.64914465", "0.61412466", "0.5810493", "0.57012737", "0.56671464", "0.5628206", "0.5620812", "0.5620812", "0.5588849", "0.5584933", "0.5557151", "0.55520403", "0.5547825", "0.5476415", "0.54417104", "0.54199195", "0.53977454", "0.5372286", "0.53333205", "0.533...
0.8391244
0
Check UMAP can accept a custom title (string) from the user
def test_custom_title_umap(self): umap = UMAPVisualizer(title="custom_title") assert umap.title == "custom_title"
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_title(self, title):\n if title in self.timers.keys() and isinstance(title, str) and self.timers[title]['count']>0:\n return True\n else:\n return False", "def validate_title_input(title):\n if len(title) != 0:\n clear()\n return True\n\n else:\n ...
[ "0.6321018", "0.6244966", "0.6110215", "0.6049247", "0.6036075", "0.5973084", "0.5953221", "0.5953062", "0.5943151", "0.5932759", "0.5906794", "0.5882811", "0.5789171", "0.5764922", "0.5761954", "0.5761824", "0.5754397", "0.5731467", "0.57234776", "0.56962955", "0.5676605", ...
0.67318124
0
Check UMAP can accept a custom size (tuple of pixels) from the user
def test_custom_size_umap(self): umap = UMAPVisualizer(size=(100, 50)) assert umap._size == (100, 50)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_size(self,x,y):\n assert(x <= 10**3), 'Width larger than 1000' \n assert(y <= 10**3), 'Height larger than 1000' \n assert(x*y <= 3*(10**5)), 'Resolution larger than 300000'", "def test_sklearn_umap_size(self):\n # In UMAPVisualizer, the internal sklearn UMAP t...
[ "0.6711422", "0.6630726", "0.62506163", "0.62452865", "0.6196343", "0.6094031", "0.60335875", "0.60198134", "0.59973264", "0.5955764", "0.58968693", "0.5896098", "0.5810795", "0.5778206", "0.5754338", "0.5711507", "0.57061523", "0.56949794", "0.5684642", "0.5682231", "0.56752...
0.77458096
0
Check UMAP accepts and properly handles custom colors from user
def test_custom_colors_umap(self): ## produce random data X, y = make_classification( n_samples=200, n_features=100, n_informative=20, n_redundant=10, n_classes=5, random_state=42, ) ## specify a list of custom colo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_colorstr(arg):\n try:\n assert len(arg) == 6\n for c in arg:\n assert c in COLORMAP\n except AssertionError:\n raise argparse.ArgumentTypeError('%s is not a valid color string' % arg)\n return arg", "def test_is_valid_color_name(self):\n...
[ "0.61849034", "0.6094498", "0.60621583", "0.60231525", "0.60187125", "0.5935084", "0.5925285", "0.5918845", "0.5859132", "0.5766543", "0.57401425", "0.57124156", "0.57018787", "0.56962585", "0.56811154", "0.56695724", "0.5624193", "0.5616206", "0.56129676", "0.55991244", "0.5...
0.68729633
0
Test UMAP integrated visualization on a sklearn classifier dataset
def test_make_classification_umap(self): ## produce random data X, y = make_classification( n_samples=200, n_features=100, n_informative=20, n_redundant=10, n_classes=3, random_state=42, ) ## visualize data with UM...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_make_classification_umap_class_labels(self):\n\n ## produce random data\n X, y = make_classification(\n n_samples=200,\n n_features=100,\n n_informative=20,\n n_redundant=10,\n n_classes=3,\n random_state=42,\n )\n\n ...
[ "0.7237436", "0.69271594", "0.6770888", "0.6631627", "0.6620112", "0.6457081", "0.64443177", "0.63267493", "0.626038", "0.6186775", "0.59111714", "0.5845833", "0.5778432", "0.57569915", "0.5749673", "0.5714801", "0.564882", "0.5628666", "0.5620671", "0.55739444", "0.55627376"...
0.7453398
0
Test UMAP integrated visualization with class labels specified
def test_make_classification_umap_class_labels(self): ## produce random data X, y = make_classification( n_samples=200, n_features=100, n_informative=20, n_redundant=10, n_classes=3, random_state=42, ) ## visualize...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_make_classification_umap(self):\n\n ## produce random data\n X, y = make_classification(\n n_samples=200,\n n_features=100,\n n_informative=20,\n n_redundant=10,\n n_classes=3,\n random_state=42,\n )\n\n ## visua...
[ "0.68238217", "0.67836696", "0.63707215", "0.6301605", "0.6257042", "0.613644", "0.60741764", "0.59136367", "0.5912499", "0.5887305", "0.5873073", "0.5842747", "0.5841711", "0.58411485", "0.5811801", "0.5750405", "0.5730497", "0.57265025", "0.5669417", "0.5630759", "0.562077"...
0.75628173
0
Test UMAP when no target or classes are specified
def test_no_target_umap(self): ## produce random data X, y = make_classification( n_samples=200, n_features=100, n_informative=20, n_redundant=10, n_classes=3, random_state=6897, ) ## visualize data with UMAP ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_umap_mismtached_labels(self):\n ## produce random data\n X, y = make_classification(\n n_samples=200,\n n_features=100,\n n_informative=20,\n n_redundant=10,\n n_classes=3,\n random_state=42,\n )\n\n ## fewer lab...
[ "0.63227683", "0.62847257", "0.6214535", "0.60885245", "0.58001065", "0.57032645", "0.55417573", "0.5501365", "0.5477659", "0.54495037", "0.5408545", "0.53191584", "0.5308243", "0.52774423", "0.5270059", "0.5262288", "0.52073884", "0.51964533", "0.5167412", "0.5149407", "0.51...
0.713948
0
Test that the user can supply an alpha param on instantiation
def test_alpha_param(self): ## produce random data X, y = make_classification( n_samples=200, n_features=100, n_informative=20, n_redundant=10, n_classes=3, random_state=42, ) ## Instantiate a UMAPVisualizer, provid...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_valid_alpha(alpha: Any) -> None:\n check_alpha(alpha=alpha)", "def test_ALPHA(self):\n self.assertIsInstance(constants.ALPHA, int,\n \"constants.ALPHA must be an integer.\")", "def test_invalid_alpha(alpha: Any) -> None:\n with pytest.raises(ValueError, match=...
[ "0.77863246", "0.6957073", "0.694851", "0.6797293", "0.6712802", "0.66309685", "0.65371954", "0.6380201", "0.62434375", "0.6134172", "0.6118963", "0.61111933", "0.60929245", "0.6078673", "0.60731035", "0.6065588", "0.60491043", "0.6048345", "0.6028508", "0.60014725", "0.59808...
0.7568995
1
Test for umap quick method with hobbies dataset
def test_quick_method(self): corpus = load_hobbies() tfidf = TfidfVectorizer() X = tfidf.fit_transform(corpus.data) y = corpus.target viz = umap(X, y, show=False) assert isinstance(viz, UMAPVisualizer) self.assert_images_similar(viz, tol=50)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test02Something(self):\n\n summaryFile = re.sub(\"\\.csv\",\"\",self.parsedFile)+\"_summary.csv\"\n bmap = self.bm.load_summary(summaryFile,taxaList=[\"10090\"])\n self.assertEqual(bmap['GG11117|c2_g1_i1'][0],'INT1_MOUSE')\n self.assertEqual(bmap['GG11117|c2_g1_i1'][1],'68510')\n ...
[ "0.590538", "0.58260053", "0.5768046", "0.57615876", "0.56201154", "0.5576002", "0.5468112", "0.5445976", "0.5409438", "0.5399367", "0.53626776", "0.5362031", "0.53528714", "0.5347987", "0.5343849", "0.531972", "0.5312878", "0.5309637", "0.53079206", "0.5297613", "0.5290937",...
0.699782
0
A wrapper that does dot for a multidimensional image that is often used in the pipeline. The input image should be Ccontiguous.
def dot_image(image, B): imshape = image.shape if not image.flags['C_CONTIGUOUS']: raise TypeError, 'Error: cannot deal with non-C-contiguous image' output = gemm(1.0, image.reshape((np.prod(imshape[:-1]), imshape[-1])), B) return output.reshape(imshape[:-1] + (B.shape[1],))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dot(self):\n self.img[self.l_i / 2, self.l_i / 2] = 1.", "def dot(self, vec):\n pass", "def dot(a, b, out=None):\n\n if len(a.shape) != 2 or len(b.shape) != 2:\n raise (ValueError, \"only 2-D matrices supported\")\n\n if a.shape[1] != b.shape[0]:\n raise (ValueError,\n ...
[ "0.6049258", "0.5814721", "0.5721821", "0.57042724", "0.5681423", "0.567958", "0.564207", "0.5631767", "0.5609443", "0.5586889", "0.5583641", "0.55492735", "0.54939", "0.54839337", "0.54573774", "0.5454269", "0.5454269", "0.5454269", "0.5454269", "0.54445654", "0.5423928", ...
0.69416124
0
An mpi implementation of the mean over different nodes.
def mpi_mean(data): s_local = data.sum(0) m = np.empty_like(s_local) mpi.COMM.Allreduce(s_local, m) num_data = mpi.COMM.allreduce(data.shape[0]) m /= float(num_data) return m
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mean_photon_v(pk1,pk2,pk3,mu1,mu2,mu3):\n return pk1*mu1 + pk2*mu2 + pk3*mu3", "def mpi_avg_grads(module):\n if num_procs()==1:\n return\n for p in module.parameters():\n p_grad = p.grad.cpu()\n p_grad_numpy = p_grad.numpy() # numpy view of tensor data\n avg_p_grad = mp...
[ "0.6522529", "0.63845176", "0.6283875", "0.62613827", "0.61774707", "0.6149247", "0.6097366", "0.60199577", "0.6002639", "0.5977115", "0.5977115", "0.5977115", "0.5977115", "0.5977115", "0.58853865", "0.5786438", "0.5728149", "0.5728149", "0.5717552", "0.5708904", "0.5685021"...
0.73965716
0
An mpi implementation of the std over different nodes.
def mpi_std(data): m = mpi_mean(data) data_centered = data - m data_centered **= 2 std_local = data_centered.sum(0) std = np.empty_like(std_local) mpi.COMM.Allreduce(std_local, std) num_data = mpi.COMM.allreduce(data.shape[0]) std /= float(num_data) return std
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parallel_generate_particle_distribution(self, max_loop = np.inf, Ncore = 1, outfile=None):\n \n self.pos = np.zeros((self.N_part, 3))\n self.vel = np.zeros((self.N_part, 3))\n \n \n # start running\n nmax = self.N_part / Ncore\n #po...
[ "0.54028803", "0.5319086", "0.5299202", "0.5285267", "0.52729636", "0.5233467", "0.5097652", "0.5074314", "0.50097334", "0.50081116", "0.49924487", "0.49458593", "0.49275267", "0.490736", "0.489474", "0.4864296", "0.48584995", "0.4855858", "0.4847231", "0.4846435", "0.4841479...
0.7032368
0
An mpi implementation of the covariance matrix over different nodes
def mpi_cov(data): m = mpi_mean(data) data_centered = data - m cov_local = dot(data_centered.T, data_centered) covmat = np.empty_like(cov_local) mpi.COMM.Allreduce(cov_local, covmat) num_data = mpi.COMM.allreduce(data.shape[0]) covmat /= float(num_data) return covmat
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _mn_cov_ ( self , size = -1 , root = False ) :\n #\n if size <= 0 : size = len ( self )\n size = min ( size , len ( self ) ) \n #\n from array import array\n matrix = array ( 'd' , [ 0 for i in range(0, size * size) ] )\n self.mnemat ( matrix , size )\n #\n import ostap.math.linalg\...
[ "0.66558284", "0.63560295", "0.63454884", "0.63399667", "0.62891805", "0.6275255", "0.6123064", "0.60660565", "0.60626185", "0.60455185", "0.6044615", "0.60191244", "0.600188", "0.59990466", "0.59840465", "0.5940753", "0.59398955", "0.5937423", "0.5902132", "0.589381", "0.588...
0.7496815
0
Creates Hypercube objects for every index in the multidimensional self.hypercubes list.
def create_grids_structure(self): for indices, hypercube in np.ndenumerate(self.hypercubes): self.hypercubes[indices] = Hypercube(coords=indices)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_hypercubes_parents_indices(self):\n for hypercube in self.hypercubes.flatten():\n coordinates = []\n for coord in hypercube.coords:\n coordinates.append([2 * coord, 2 * coord + 1])\n for indices in list(itertools.product(*coordinates)):\n ...
[ "0.6719218", "0.6329061", "0.6187306", "0.60999596", "0.5802039", "0.5746891", "0.57240033", "0.56811094", "0.5670855", "0.56600827", "0.5632086", "0.5601353", "0.55559343", "0.5540782", "0.551118", "0.53804505", "0.5376794", "0.53545433", "0.5327541", "0.5314851", "0.530495"...
0.8409945
0
Creates LowerLevelGrid when it is possible level equal to one means that this is the coarsest level.
def create_lower_level_grid(self): if self.level == 1: return False else: return LowerLevelGrid(level=self.level - 1, parent_hypercubes_number=self.hypercubes_number, parent_hypercubes=self.hypercubes, dims=self.dims)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def min_level(self):\n return self.__min", "def grid_levels(self, nlevels):\n for j in np.arange(nlevels):\n if j in self.gridded['levels'].keys():\n continue\n self.gridded['levels'][j] = self.grid_param(self.levels[j])\n self.jmax = max(self.gridded['le...
[ "0.5543817", "0.53682214", "0.5357687", "0.5343803", "0.53416336", "0.52594876", "0.52290356", "0.52202016", "0.5219884", "0.519104", "0.51719373", "0.5154888", "0.51536214", "0.51400846", "0.51250356", "0.51171875", "0.5115629", "0.5093552", "0.5093239", "0.5017504", "0.5011...
0.8483062
0
Given an Example, finds the class of its nearest nonempty Hypercube. First, it gathers the data (center coordinates and the class) of each parent Hypercube which coordinates are listed in parents_indices. Then it returns the class of the nearest nonempty parent Hypercube.
def nearest_neighbours_class(self, example_coords, parents_indices): print("Computing the nearest neighbours class.") parents_data = [(self.hypercubes[parent].center, self.hypercubes[parent].hypercube_class) for parent in parents_indices] distances = sorted([(distance.euc...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def classify(self, example_coords, hypercubes_coords):\n print(\"Classifying an observation with coordinates; \" + str(example_coords))\n hypercubes_coords = tuple([int(x / 2) for x in hypercubes_coords])\n if self.hypercubes[hypercubes_coords].hypercube_class == EMPTY_HYPERCUBE_INDICATOR:\n ...
[ "0.60938364", "0.5795412", "0.5308555", "0.5189766", "0.5157798", "0.50664556", "0.49884278", "0.49517813", "0.48900566", "0.48891792", "0.48850486", "0.48730367", "0.48566884", "0.48272377", "0.48231125", "0.47985056", "0.47855023", "0.47668108", "0.47496378", "0.47456798", ...
0.75999105
0
Adds provided Example to the correct Hypercube in BasicGrid
def add_example_to_grid(self, example): indices = tuple([int(example.coords[x] / self.hypercube_measurements[x]) for x in range(self.dims - 1, -1, -1)]) self.hypercubes[indices].add_example(example)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def example(self, example):\n self._example = example\n return self", "def add(self, sample, **kwargs):\n if not self.samples:\n self.init(sample)\n self.samples.append(sample)", "def batch_update(self, examples):\n print(\"Updating the BaseGrid with a batch of examples\")\n ...
[ "0.6088038", "0.5691631", "0.5638335", "0.5430962", "0.53936327", "0.53669506", "0.5353391", "0.51910037", "0.5160521", "0.5118814", "0.5102909", "0.5083791", "0.50791067", "0.5072332", "0.5069205", "0.50586724", "0.50537837", "0.5049797", "0.50126547", "0.50125664", "0.49871...
0.8240919
0
Sets classes for all hypercubes in self and in its child (LowerLevelGrid).
def set_hypercubes_classes(self): print("Setting the BaseGrid hypercubes' classes.") list_of_all_hc = list(self.hypercubes.flatten()) print("Number of hypercubes: " + str(len(list_of_all_hc))) for hypercube in list_of_all_hc: hypercube.set_hypercube_class() if self.c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_hypercubes_classes(self):\n print(\"Setting the Hypercubes' classes of grid at level: \" + str(self.level))\n for hypercube in self.hypercubes.flatten():\n coordinates = []\n for coord in hypercube.coords:\n coordinates.append([2 * coord, 2 * coord + 1])\n...
[ "0.89251757", "0.6874839", "0.64062953", "0.62887317", "0.5722013", "0.5634838", "0.54932666", "0.54521555", "0.54472536", "0.54459906", "0.5339989", "0.5315919", "0.52430695", "0.52424365", "0.5172487", "0.5148295", "0.51459616", "0.50925523", "0.5066024", "0.5049924", "0.50...
0.8686745
1
Computes every hypercube's center by taking the midpoint between the beginning and the end of hypercube in every dimension.
def compute_centers_of_hypercubes(self): for hc in self.hypercubes.flatten(): for i in range(self.dims - 1, -1, -1): index = self.dims - (i + 1) hc.center[i] = (hc.coords[index] + 0.5) * self.hypercube_measurements[index]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_centers_of_hypercubes(self):\n for hypercube in self.hypercubes.flatten():\n sums = np.zeros((len(hypercube.coords)))\n for coords in hypercube.parent_hypercubes_indices:\n for index, summ in enumerate(sums):\n sums[index] += self.parent_hy...
[ "0.74476457", "0.6830486", "0.67943937", "0.6649868", "0.6605242", "0.6537745", "0.652884", "0.64794374", "0.64205414", "0.64118415", "0.638748", "0.6345151", "0.63197005", "0.63122505", "0.6282437", "0.6226204", "0.6219615", "0.62132144", "0.6184002", "0.61678565", "0.614485...
0.8032393
0
Predicts the class of an observation with given coordinates.
def test(self, example_coords): print("Predicting the class of an observation with coordinates: " + str(example_coords)) hypercubes_coords = tuple( [int(example_coords[i] / self.hypercube_measurements[i]) for i in range(self.dims - 1, -1, -1)]) if self.hypercubes[hypercubes_coords].h...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predict(self, coordinates):\n check_is_fitted(self, [\"force_\"])\n force_east, force_north = self.force_coords\n east, north = n_1d_arrays(coordinates, n=2)\n cast = np.broadcast(*coordinates[:2])\n npoints = cast.size\n components = (\n np.empty(npoints, d...
[ "0.69743305", "0.67340916", "0.6664514", "0.6588236", "0.6583106", "0.65313673", "0.65313673", "0.65313673", "0.6526987", "0.650605", "0.650605", "0.6498759", "0.6485663", "0.64440244", "0.6431313", "0.6431298", "0.6427786", "0.6427786", "0.6427786", "0.6427786", "0.6419594",...
0.67905843
1
Updates the grid with a given Example. If the Grid has a child, it is also forced to update itself with the new observation.
def update(self, example, hypercubes_coords=None): hypercubes_coords = tuple( [int(example.coords[i] / self.hypercube_measurements[i]) for i in range(self.dims - 1, -1, -1)]) new_class = self.hypercubes[hypercubes_coords].update_basic(example_list=[example]) print("Update. Changed cl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def batch_update(self, examples):\n print(\"Updating the BaseGrid with a batch of examples\")\n examples_grouping_dict = {}\n for example in examples:\n hypercubes_coords = tuple(\n [int(example.coords[i] / self.hypercube_measurements[i]) for i in range(self.dims - 1,...
[ "0.6287198", "0.59800756", "0.5757915", "0.54690313", "0.52610976", "0.51572514", "0.5034711", "0.50117636", "0.49751922", "0.48433962", "0.48404443", "0.4838931", "0.47301564", "0.47202694", "0.46636343", "0.46548712", "0.46405032", "0.46102586", "0.46008292", "0.45953625", ...
0.61649644
1
Updates the grid, given the batch_size of Examples. It groups Examples by class_id and by Hypercubes containing these Examples. If the Grid has a child, it is also forced to update itself.
def batch_update(self, examples): print("Updating the BaseGrid with a batch of examples") examples_grouping_dict = {} for example in examples: hypercubes_coords = tuple( [int(example.coords[i] / self.hypercube_measurements[i]) for i in range(self.dims - 1, -1, -1)]) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def batch_update(self, parents_classes_dict):\n print(\"Updating the LowerLevelGrid with a batch of examples\")\n for (class_id, coords), examples in parents_classes_dict.items():\n coords = tuple([int(x / 2) for x in coords])\n self.hypercubes[coords].update_lower_level(example...
[ "0.7303846", "0.6537551", "0.64356464", "0.5361293", "0.52692604", "0.52692604", "0.5262458", "0.523727", "0.5224487", "0.5210136", "0.5149948", "0.5143078", "0.5071514", "0.50149363", "0.5011419", "0.49959013", "0.49740377", "0.48971123", "0.48322254", "0.48213798", "0.47948...
0.8305461
0
Computes coordinates of 2dims parents' Hypercubes for every Hypercube in the grid. Each coarser Hypercube consists of 2dims finer level Hypercubes.
def set_hypercubes_parents_indices(self): for hypercube in self.hypercubes.flatten(): coordinates = [] for coord in hypercube.coords: coordinates.append([2 * coord, 2 * coord + 1]) for indices in list(itertools.product(*coordinates)): hypercube...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_centers_of_hypercubes(self):\n for hypercube in self.hypercubes.flatten():\n sums = np.zeros((len(hypercube.coords)))\n for coords in hypercube.parent_hypercubes_indices:\n for index, summ in enumerate(sums):\n sums[index] += self.parent_hy...
[ "0.68306977", "0.6475379", "0.62905055", "0.58867306", "0.5867285", "0.5828118", "0.56448174", "0.5489253", "0.5457213", "0.54442", "0.54378206", "0.54122716", "0.5392055", "0.5390636", "0.5355757", "0.5286187", "0.5280051", "0.5264198", "0.5259125", "0.5256561", "0.52493584"...
0.7526032
0
Sets classes for all hypercubes in self and in it's child (another LowerLevelGrid) if it exists.
def set_hypercubes_classes(self): print("Setting the Hypercubes' classes of grid at level: " + str(self.level)) for hypercube in self.hypercubes.flatten(): coordinates = [] for coord in hypercube.coords: coordinates.append([2 * coord, 2 * coord + 1]) p...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_hypercubes_classes(self):\n print(\"Setting the BaseGrid hypercubes' classes.\")\n list_of_all_hc = list(self.hypercubes.flatten())\n print(\"Number of hypercubes: \" + str(len(list_of_all_hc)))\n for hypercube in list_of_all_hc:\n hypercube.set_hypercube_class()\n ...
[ "0.8647008", "0.70186275", "0.64768374", "0.6208812", "0.548963", "0.5472785", "0.5408511", "0.5372353", "0.5281182", "0.5218629", "0.5192152", "0.51507455", "0.51295465", "0.5093066", "0.50306475", "0.5026904", "0.49976724", "0.49723232", "0.49324986", "0.49259773", "0.48838...
0.88763803
0
Computes every hypercube's center by taking the midpoint between the beginning and the end of hypercube in every dimension.
def compute_centers_of_hypercubes(self): for hypercube in self.hypercubes.flatten(): sums = np.zeros((len(hypercube.coords))) for coords in hypercube.parent_hypercubes_indices: for index, summ in enumerate(sums): sums[index] += self.parent_hypercubes[c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_centers_of_hypercubes(self):\n for hc in self.hypercubes.flatten():\n for i in range(self.dims - 1, -1, -1):\n index = self.dims - (i + 1)\n hc.center[i] = (hc.coords[index] + 0.5) * self.hypercube_measurements[index]", "def center(box):\n x_center =...
[ "0.8033822", "0.68309146", "0.67945725", "0.6649882", "0.6605336", "0.6538168", "0.6528375", "0.64801854", "0.6419897", "0.6411588", "0.63880193", "0.63441837", "0.63206303", "0.6310798", "0.6282664", "0.6226101", "0.6219449", "0.62121934", "0.61837673", "0.6167192", "0.61442...
0.74494195
1
Classifies observation with given coordinates.
def classify(self, example_coords, hypercubes_coords): print("Classifying an observation with coordinates; " + str(example_coords)) hypercubes_coords = tuple([int(x / 2) for x in hypercubes_coords]) if self.hypercubes[hypercubes_coords].hypercube_class == EMPTY_HYPERCUBE_INDICATOR: r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test(self, example_coords):\n print(\"Predicting the class of an observation with coordinates: \" + str(example_coords))\n hypercubes_coords = tuple(\n [int(example_coords[i] / self.hypercube_measurements[i]) for i in range(self.dims - 1, -1, -1)])\n if self.hypercubes[hypercube...
[ "0.59496695", "0.54452467", "0.5402337", "0.5321679", "0.5184538", "0.5163346", "0.51437443", "0.5075722", "0.5045529", "0.5041442", "0.5035127", "0.5005401", "0.49902293", "0.49848723", "0.49844524", "0.49838632", "0.4979044", "0.49766052", "0.49506316", "0.49488333", "0.493...
0.62354344
0
Tests that adding two users works
def testAdd2(self): self.assertEquals(models.SUCCESS, self.users.add("userC", "password")) self.assertEquals(models.SUCCESS, self.users.add("userD", "password"))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_011_add_same_user(self):\n testflow.step(ADD_USR_MSG, TEST_USER1)\n assert not USER_CLI.run('add', TEST_USER1)[0]", "def testAdd1(self):\n self.assertEquals(models.SUCCESS, self.users.add(\"userA\", \"password\"))", "def test_add_user(self):\n pass", "def testAddExists(se...
[ "0.83015925", "0.7707303", "0.77038246", "0.74918866", "0.73776263", "0.7374491", "0.732083", "0.7282199", "0.72698605", "0.7215631", "0.71915513", "0.7155373", "0.71463656", "0.7135748", "0.71296144", "0.7112154", "0.71116185", "0.71065176", "0.7069175", "0.7047732", "0.6975...
0.8096824
1
Tests that adding an user with empty username fails
def testAddEmptyUsername(self): self.assertEquals(models.ERR_BAD_USERNAME, self.users.add("", "password"))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testAddNoneUsernameAndPassword(self):\n self.assertEquals(models.ERR_BAD_USERNAME, self.users.add(\"\", \"\"))", "def testAddNoneUsername(self):\n self.assertEquals(models.ERR_BAD_USERNAME, self.users.add(None, \"password\"))", "def testAddNoneUsernameAndPassword(self):\n self.assertEq...
[ "0.8778913", "0.87578815", "0.85605466", "0.83670336", "0.81206423", "0.7980297", "0.7915649", "0.775719", "0.7717246", "0.7714081", "0.7688214", "0.7678973", "0.7670885", "0.7654914", "0.7652749", "0.7632635", "0.7626589", "0.7626313", "0.76021594", "0.7547543", "0.7526477",...
0.90195215
0
Tests that adding a user with a None password fails
def testAddNonePassword(self): self.assertEquals(models.ERR_BAD_PASSWORD, self.users.add("userF", None))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testAddNoneUsernameAndPassword(self):\n self.assertEquals(models.ERR_BAD_USERNAME, self.users.add(None, None))", "def testAddNoneUsernameAndPassword(self):\n self.assertEquals(models.ERR_BAD_USERNAME, self.users.add(\"\", \"\"))", "def testAddNoneUsername(self):\n self.assertEquals(mod...
[ "0.8673927", "0.86445725", "0.8449593", "0.8156031", "0.80684835", "0.7944337", "0.772304", "0.77000314", "0.7635938", "0.75678897", "0.7556625", "0.751811", "0.7516171", "0.7498143", "0.74943274", "0.74489343", "0.73932636", "0.73721427", "0.7327254", "0.7301202", "0.7286358...
0.8799864
0
Tests that adding a user with a None username fails
def testAddNoneUsername(self): self.assertEquals(models.ERR_BAD_USERNAME, self.users.add(None, "password"))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testAddNoneUsernameAndPassword(self):\n self.assertEquals(models.ERR_BAD_USERNAME, self.users.add(None, None))", "def testAddNoneUsernameAndPassword(self):\n self.assertEquals(models.ERR_BAD_USERNAME, self.users.add(\"\", \"\"))", "def testAddEmptyUsername(self):\n self.assertEquals(mo...
[ "0.8658032", "0.8558699", "0.83201635", "0.7840982", "0.7833403", "0.77367413", "0.76577866", "0.7565609", "0.749817", "0.746846", "0.74393463", "0.7334507", "0.730809", "0.72923476", "0.72747236", "0.7273885", "0.7257682", "0.72494537", "0.7236431", "0.72091144", "0.7205949"...
0.88843197
0
Tests that adding a user with both username and password as None fails
def testAddNoneUsernameAndPassword(self): self.assertEquals(models.ERR_BAD_USERNAME, self.users.add(None, None))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testAddNoneUsernameAndPassword(self):\n self.assertEquals(models.ERR_BAD_USERNAME, self.users.add(\"\", \"\"))", "def testAddNoneUsername(self):\n self.assertEquals(models.ERR_BAD_USERNAME, self.users.add(None, \"password\"))", "def testAddNonePassword(self):\n self.assertEquals(models...
[ "0.86757123", "0.85757244", "0.82967484", "0.8035735", "0.781305", "0.7600376", "0.752247", "0.74228996", "0.7413409", "0.73913527", "0.7388319", "0.7348273", "0.73237", "0.72724587", "0.7259575", "0.723713", "0.7212342", "0.72081846", "0.71922207", "0.71922207", "0.71922207"...
0.8776377
0
Tests that adding a user with both a blank username and password fails
def testAddNoneUsernameAndPassword(self): self.assertEquals(models.ERR_BAD_USERNAME, self.users.add("", ""))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testAddNoneUsernameAndPassword(self):\n self.assertEquals(models.ERR_BAD_USERNAME, self.users.add(None, None))", "def testAddEmptyUsername(self):\n self.assertEquals(models.ERR_BAD_USERNAME, self.users.add(\"\", \"password\"))", "def testAddNoneUsername(self):\n self.assertEquals(model...
[ "0.8665212", "0.85453916", "0.8401641", "0.81767356", "0.8146304", "0.80946857", "0.80876476", "0.79441357", "0.78285795", "0.7711268", "0.7669809", "0.76175237", "0.7617285", "0.75937957", "0.75469226", "0.75368714", "0.7527013", "0.7497341", "0.7478632", "0.74692166", "0.74...
0.88185066
0
Tests that adding a user with a long username fails
def testAddLongUsername(self): original_username = "thiswillbelong" longer_username = original_username*10 self.assertEquals(models.ERR_BAD_USERNAME, self.users.add(longer_username, "password"))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testAddLongUsernameAndPassword(self):\n original_username = \"thisgonnabelong\"\n longer_username = original_username*10\n original_password = \"thisalsogonnabelong\"\n longer_password = original_password*10\n self.assertEquals(models.ERR_BAD_USERNAME, self.users.add(longer_u...
[ "0.83422065", "0.7946055", "0.78104156", "0.780026", "0.7580546", "0.7476788", "0.74197304", "0.74022245", "0.7361944", "0.73097354", "0.7270362", "0.7230703", "0.7222272", "0.72112274", "0.7194711", "0.718886", "0.71489906", "0.7133822", "0.71329373", "0.71161985", "0.710609...
0.8756425
0
Tests that adding a user with a long password fails
def testAddLongPassword(self): original_password = "thiswillbelong" longer_password = original_password*10 self.assertEquals(models.ERR_BAD_PASSWORD, self.users.add("paulinarocks", longer_password))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testAddLongUsernameAndPassword(self):\n original_username = \"thisgonnabelong\"\n longer_username = original_username*10\n original_password = \"thisalsogonnabelong\"\n longer_password = original_password*10\n self.assertEquals(models.ERR_BAD_USERNAME, self.users.add(longer_u...
[ "0.8364861", "0.81454116", "0.8075492", "0.8066621", "0.8062283", "0.80539316", "0.8046353", "0.80201375", "0.80164695", "0.7999124", "0.7964631", "0.7932641", "0.7927489", "0.78352296", "0.7782757", "0.766781", "0.7564408", "0.7523772", "0.74742943", "0.74702775", "0.7466686...
0.8502937
0
Tests that adding a user with both a long username and long password fails
def testAddLongUsernameAndPassword(self): original_username = "thisgonnabelong" longer_username = original_username*10 original_password = "thisalsogonnabelong" longer_password = original_password*10 self.assertEquals(models.ERR_BAD_USERNAME, self.users.add(longer_username, longe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testAddLongUsername(self):\n original_username = \"thiswillbelong\"\n longer_username = original_username*10\n self.assertEquals(models.ERR_BAD_USERNAME, self.users.add(longer_username, \"password\"))", "def testAddLongPassword(self):\n original_password = \"thiswillbelong\"\n ...
[ "0.8243537", "0.7912154", "0.7906771", "0.78553146", "0.7854444", "0.7844873", "0.7770756", "0.77600276", "0.7758058", "0.7728684", "0.77277994", "0.7720663", "0.7621893", "0.7594183", "0.7564204", "0.7557341", "0.7486266", "0.74427015", "0.7390739", "0.7349027", "0.7303733",...
0.8709033
0
Tests that logging in with both an invalid username and invalid password fails
def testLoginBadUsernameAndPassword(self): self.assertEquals(models.SUCCESS, self.users.add("userJ", "password")) self.assertEquals(models.ERR_BAD_CREDENTIALS, self.users.login("nobody_user", "nobody_password"))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_wrong_login_input(self):\n self.user.list_of_accounts = [{'username': 'dalton',\n 'pwd': 'chromelegend',\n 'email': 'legionless@yahoo.com'}]\n msg = self.user.login(\"legionless@yahoo.com\", \"legendchrome\")\n ...
[ "0.82186335", "0.81208724", "0.80137014", "0.8002412", "0.7950306", "0.791697", "0.7853422", "0.78504646", "0.7841491", "0.7744492", "0.7737247", "0.7733766", "0.7724799", "0.7675062", "0.7597364", "0.7575842", "0.75734806", "0.7559961", "0.755887", "0.7550253", "0.7546143", ...
0.8395619
0
Constructs a master spec graph.
def master_spec_graph(master_spec): if not isinstance(master_spec, spec_pb2.MasterSpec): raise TypeError("master_spec_graph() expects a MasterSpec input.") graph = pygraphviz.AGraph(directed=True) graph.node_attr.update(shape="box", style="filled", fillcolor="white", fontname="roboto, helvetica, arial", fontsize=1...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _createMaster(self, *args, **kwds):\n raise NotImplementedError", "def construct_master(self, master_scenarios):\n lr_instance = self.tsdro.lr_instance\n\n self.master, self.stage1_vars = lr_instance.construct_stage1()\n if self.method == \"RO\":\n self.wass_mult = 0\n ...
[ "0.5888808", "0.57467175", "0.57278377", "0.5650693", "0.55837756", "0.5575762", "0.5521239", "0.5461212", "0.54128194", "0.53838843", "0.5381022", "0.5381022", "0.53774726", "0.53684235", "0.53078026", "0.5304308", "0.5303614", "0.5298643", "0.52795887", "0.52760595", "0.523...
0.7268906
0
Fetch child nodes for a given Zookeeper path.
def _get_zk_path_children(self, zk_conn, zk_path, name_for_error): children = [] try: children = zk_conn.get_children(zk_path) except NoNodeError: self.log.info('No zookeeper node at %s', zk_path) except Exception: self.log.exception('Could not read %s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_child_znodes(cluster_name, path):\n zoo_client = ZookeeperService.get_zoo_client(cluster_name)\n child_znodes = []\n\n children = zoo_client.get_children(path)\n # iter child nodes and convert to dict with extra info\n for child in children:\n child_path = os.path.join(path, child)\n ...
[ "0.75089127", "0.7355353", "0.6786223", "0.6630263", "0.6162781", "0.59692436", "0.59392494", "0.5907962", "0.58292747", "0.5684854", "0.5647041", "0.5617625", "0.5610342", "0.56037736", "0.55999404", "0.55986404", "0.5597942", "0.5592955", "0.55828", "0.5567267", "0.5557384"...
0.75423163
1
Fetch Consumer Group offsets from Zookeeper. Also fetch consumer_groups, topics, and partitions if not already specified in consumer_groups.
def _get_zk_consumer_offsets(self, zk_hosts_ports, consumer_groups=None, zk_prefix=''): zk_consumer_offsets = {} # Construct the Zookeeper path pattern # /consumers/[groupId]/offsets/[topic]/[partitionId] zk_path_consumer = zk_prefix + '/consumers/' zk_path_topic_tmpl = zk_path_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_zk_consumer_offsets(self, zk_hosts_ports, consumer_groups=None, zk_prefix=''):\n zk_consumer_offsets = {}\n\n # Construct the Zookeeper path pattern\n # /consumers/[groupId]/offsets/[topic]/[partitionId]\n zk_path_consumer = zk_prefix + '/consumers/'\n zk_path_topic_tmpl...
[ "0.7943811", "0.7267268", "0.7246765", "0.71853805", "0.71067864", "0.67003626", "0.663087", "0.6584401", "0.62624973", "0.6203875", "0.6060059", "0.6012397", "0.5937667", "0.5835406", "0.57882696", "0.57616556", "0.56687766", "0.56449854", "0.5552708", "0.5517917", "0.548761...
0.79819244
0
Widget specific css class
def css_class(self): css_type = self.widget_type css_title = normalizer.normalize(self.data.title) return ('faceted-checkboxtree-widget ' 'faceted-{0}-widget section-{1}').format(css_type, css_title)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def style_widget( self, a_widget ):\n widget_type = type( a_widget )\n\n if widget_type == Tk.Label:\n self.style_label( a_widget )\n # elif widget_type == class( 'tkinter.Button' ):\n\n elif widget_type == Tk.Button:\n #rint( \" type widget Tk.Button\" )\n ...
[ "0.6704201", "0.6648001", "0.6635693", "0.65978724", "0.65335196", "0.6479021", "0.64238656", "0.6410524", "0.63951045", "0.6247971", "0.6211813", "0.6205558", "0.6154018", "0.6119156", "0.60828286", "0.6058856", "0.5991134", "0.5858697", "0.5830774", "0.5830671", "0.58251435...
0.7314865
1
Return True if key in self.default
def selected(self, key): default = self.default if not default: return False for item in default: if compare(key, item) == 0: return True return False
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_key(self, key):\n return key in self", "def has(self, key):", "def __contains__(self, key):\n return self._lookup(key).value is not None", "def __contains__(self, key):\n found = True\n try:\n self.__getitem__(key)\n except:\n found = False\n ...
[ "0.7080448", "0.6991802", "0.6945687", "0.693497", "0.69090164", "0.6869424", "0.6864009", "0.6844763", "0.68307567", "0.6808193", "0.68030185", "0.68011004", "0.6780968", "0.67448217", "0.6737738", "0.6706005", "0.6704852", "0.6698478", "0.66980475", "0.6686528", "0.6682971"...
0.8206618
1
Get value from form and return a catalog dict query
def query(self, form): query = {} index = self.data.get('index', '') index = index.encode('utf-8', 'replace') if not self.operator_visible: operator = self.operator else: operator = form.get(self.data.getId() + '-operator', self.operator) operato...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def query(self, form):\n query = {}\n index = self.data.get('index', '')\n index = index.encode('utf-8', 'replace')\n\n if not self.operator_visible:\n operator = self.operator\n else:\n operator = form.get(self.data.getId() + '-operator', self.operator)\n\n...
[ "0.659652", "0.59559315", "0.5930462", "0.5637737", "0.5619595", "0.559166", "0.5567393", "0.556528", "0.5523497", "0.5457537", "0.543612", "0.5396403", "0.5385721", "0.536719", "0.5355745", "0.5342777", "0.5341243", "0.5340816", "0.53347945", "0.5322574", "0.5317065", "0.5...
0.65017927
1
Predicts whether examples are anomalies.
def predict(X, epsilon, gaussian, **kwargs): p = gaussian(X=X, **kwargs) return is_anomaly(p, threshold=epsilon)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predict_evidences(self, X):", "def predictFailures (self) :\n \n while self.traceData :\n\n if self.traceData [0] == self.traceType :\n\n self.totalEvents += 1\n\n if random.random () < self.recall :\n\n self.predictedEvents += 1\n self.pTraceHandle.write ...
[ "0.6425468", "0.6234993", "0.6177747", "0.61675006", "0.61499196", "0.6123187", "0.6110093", "0.61028236", "0.6091568", "0.6053405", "0.6050498", "0.60391706", "0.6036215", "0.60330534", "0.6031875", "0.59863746", "0.5979558", "0.5956812", "0.5931241", "0.5925367", "0.5891033...
0.6635491
0
register requirement syntax for later use returns an ID for retrieving the syntax
def _register_requirement_syntax(self, syntax): syntaxId = self.nextSyntaxId self.nextSyntaxId += 1 return syntaxId
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def interpret_requirement(string):\n string_list = split(string, sep=' ')\n \n requirement = Requirement(points, degree, majors, levels, max_non_degree)\n return requirement", "def syntax_text():", "def reqid(self) -> str:", "def reqid(self) -> str:", "def identifier(self):", "def instruction...
[ "0.5907982", "0.5524388", "0.5376405", "0.5376405", "0.5335209", "0.5323732", "0.52494186", "0.5154274", "0.5144197", "0.51264733", "0.50688785", "0.5062202", "0.5050767", "0.5009953", "0.50040245", "0.49779958", "0.49704483", "0.4951111", "0.49311674", "0.49255788", "0.48836...
0.7798727
0
Given an expression, create an atomic proposition factory.
def _create_atomic_proposition_factory(self, node): lineNum = ast.Constant(node.lineno) ast.copy_location(lineNum, node) closure = ast.Lambda(noArgs, node) ast.copy_location(closure, node) syntaxId = self._register_requirement_syntax(node) syntaxIdConst = ast.Constant(s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_expr(self, exprcls, ast, params=None, nopush=False):\n if params is None:\n expr = exprcls(self.current_parent, ast=ast)\n else:\n expr = exprcls(self.current_parent, ast=ast, **params)\n if not nopush:\n self.push_state(expr)\n return expr", ...
[ "0.5734446", "0.5312159", "0.5248564", "0.5139162", "0.5127595", "0.51051027", "0.5091432", "0.5089576", "0.49904886", "0.49830782", "0.49765256", "0.49529302", "0.49464598", "0.4907458", "0.485304", "0.485304", "0.48462987", "0.4785017", "0.47622085", "0.47553635", "0.474862...
0.7372538
0
Convert a BoolOp node (`and`, `or`) to a corresponding proposition factory
def visit_BoolOp(self, node: ast.BoolOp) -> ast.AST: # 1. wrap each operand with a lambda function operands = [] for operand in node.values: o = self.visit(operand) if self.is_proposition_factory(o): # if the operand is already an temporal requirement fact...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def constraint_from_bool_op(self, node):\n is_and = isinstance(node.op, ast.And)\n out_constraints = []\n with self.scope.subscope():\n values = []\n left = node.values[:-1]\n for condition in left:\n new_value, constraint = self.constraint_from_...
[ "0.7032627", "0.6538599", "0.6263333", "0.62044555", "0.58645797", "0.58232236", "0.58098066", "0.57785386", "0.56813306", "0.56503755", "0.5618404", "0.55552155", "0.55338264", "0.54900324", "0.5486236", "0.5473619", "0.54251933", "0.5424429", "0.54230464", "0.53802073", "0....
0.7547726
0
Create a list of statements that defines precondition and invariant checker
def makeGuardCheckers( self, args: ast.arguments, preconditions: List[s.Precondition], invariants: List[s.Invariant], ) -> List[ast.AST]: # Statements that check preconditions are satisfied preconditionChecks = [] for precondition in preconditions: ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def conditions():\n pass", "def separatePreconditionsAndInvariants(\n self, header: List[Union[s.Precondition, s.Invariant]]\n ) -> Tuple[List[s.Precondition], List[s.Invariant]]:\n preconditions: List[s.Precondition] = []\n invariants: List[s.Invariant] = []\n for n in header:\...
[ "0.5991565", "0.58791965", "0.5860759", "0.5577513", "0.55355036", "0.54914343", "0.5464114", "0.54137397", "0.53726864", "0.5349494", "0.5334554", "0.53180647", "0.53053993", "0.5299661", "0.5256091", "0.52218145", "0.5217142", "0.5212644", "0.52015454", "0.5174639", "0.5165...
0.7096544
0
Given a list of preconditions and invariants, separate items into the list of preconditions and list of invariants
def separatePreconditionsAndInvariants( self, header: List[Union[s.Precondition, s.Invariant]] ) -> Tuple[List[s.Precondition], List[s.Invariant]]: preconditions: List[s.Precondition] = [] invariants: List[s.Invariant] = [] for n in header: if isinstance(n, s.Precondition...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def makeGuardCheckers(\n self,\n args: ast.arguments,\n preconditions: List[s.Precondition],\n invariants: List[s.Invariant],\n ) -> List[ast.AST]:\n\n # Statements that check preconditions are satisfied\n preconditionChecks = []\n for precondition in preconditio...
[ "0.6050532", "0.53167266", "0.5286975", "0.52497184", "0.51461506", "0.5131494", "0.505154", "0.49972683", "0.49794406", "0.4918598", "0.48932764", "0.4883346", "0.48719564", "0.48354745", "0.480938", "0.4780705", "0.47786057", "0.47761136", "0.47605288", "0.47526938", "0.474...
0.7246501
0
Generate an invocation of an action, behavior, or scenario.
def generateInvocation(self, node: ast.AST, actionlike, invoker=ast.Yield): invokeAction = ast.Expr(invoker(actionlike)) checker = ast.Attribute( ast.Name(behaviorArgName, loadCtx), checkInvariantsName, loadCtx ) args = ast.Starred( ast.Attribute(ast.Name(behavior...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def take_action(self, action):\n getattr(self, action['func'])(\n *action.get('args', ()), \n **action.get('kwargs', {})\n )", "def call_action(self, action):\n pass", "def KB_AgentProgram(KB):\n steps = itertools.count()\n\n def program(percept):\n t = s...
[ "0.60873693", "0.59453475", "0.5931221", "0.5755276", "0.5755276", "0.5754673", "0.5716948", "0.57143855", "0.5706276", "0.56706935", "0.5670493", "0.5641106", "0.5600258", "0.5600258", "0.55860025", "0.55815315", "0.5568558", "0.5566936", "0.5542704", "0.55235267", "0.550357...
0.6997138
0
Returns the metacontroller state. Concatenatates vector representation of the largest selected primitive action with the tried constraints vector.
def get_meta_controller_state(self): state = np.zeros(self._num_primitive_actions) if len(self._selected_primitive_actions): selected_primitive_actions = np.array(self._selected_primitive_actions) max_primtive_action = np.max(selected_primitive_actions) state[max_pri...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _get_current_state(self):\n\n # One hot encoding of illegal actions\n illegal_actions_one_hot = np.ones(len(self.vehicle_data[0]))\n if len(self.possible_actions) != 0:\n illegal_actions_one_hot[self.possible_actions] = 0\n\n # Calculate mandatory vehicles left to load\n ...
[ "0.6379533", "0.6109914", "0.60754544", "0.6071877", "0.6062136", "0.6062136", "0.5973997", "0.5971481", "0.5957208", "0.5934242", "0.5891367", "0.5885219", "0.583377", "0.5827091", "0.5804313", "0.5786684", "0.57818174", "0.57702297", "0.5767344", "0.57548946", "0.5747696", ...
0.81656325
0
Returns an array of controller environment states.
def get_controller_environment_states(env_state): controller_environment_states = np.split(env_state, self._num_controllers) return controller_environment_states
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def envs():\n\n # update and grab the envs from the metadata keys\n metadata = _init()\n return list(metadata.keys())", "def get_states(self):\n for model_name in self.model_names:\n if model_name == \"cube\":\n data = self.get_model_state(\n model_nam...
[ "0.6854194", "0.68268436", "0.6735878", "0.6734534", "0.67082626", "0.66963553", "0.6675871", "0.6657624", "0.66188204", "0.6608691", "0.6592775", "0.6592281", "0.65800303", "0.65366554", "0.6533935", "0.65275776", "0.65239054", "0.6520074", "0.64688414", "0.6431106", "0.6427...
0.8024106
0
Returns the controller state containing the controller's environment state, constraint, ordering vector, and received communication vectors.
def get_controller_state(self, env_state, constraint, ordering, comm_turn, communication_vector=None): controller_state = np.zeros(self._controller_state_size) # Apply the constraint to the environment state. env_state_plus_constraint = np.logical_and(env_state, constraint).astype(int) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def controller_bookkeeping_vars(self):\n # Keeps track of all the controller states.\n controller_states = np.zeros(\n self._num_communication_turns + 1, self._num_controllers, self._controller_state_size)\n # Keeps track of all controllers' selected actions (communication + output)...
[ "0.72435206", "0.6839589", "0.67760944", "0.6572749", "0.63595426", "0.63493794", "0.6297692", "0.62836903", "0.6233724", "0.61903673", "0.61850005", "0.61357987", "0.61350757", "0.6120478", "0.6109083", "0.6104067", "0.60701954", "0.6047435", "0.60060453", "0.59885216", "0.5...
0.6928261
1
Intrinsically rewards a subset of controllers using the provided critic function.
def intrinsic_reward(self, env_states, constraints, orderings, selected_actions): return self._critic_fn( controller_states, constraints, orderings, selected_actions)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def critic(self, critic: CriticType) -> None:\n self._critic = critic", "def update_critic_weights(self, states, actions, new_states, dones, rewards):\n with tf.GradientTape(True) as tape:\n noise = (\n tf.random.normal(\n (self.buffers[0].batch_size * s...
[ "0.53727496", "0.52645314", "0.5157133", "0.49841082", "0.49510542", "0.4925426", "0.49011576", "0.48871118", "0.48354113", "0.48184738", "0.47840136", "0.47807923", "0.47687817", "0.4744988", "0.47337708", "0.47337708", "0.47306305", "0.47026968", "0.46788028", "0.46617597", ...
0.5285151
1
Returns initilizations for controller states, actions, communications, and outputs.
def controller_bookkeeping_vars(self): # Keeps track of all the controller states. controller_states = np.zeros( self._num_communication_turns + 1, self._num_controllers, self._controller_state_size) # Keeps track of all controllers' selected actions (communication + output). ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getInitParams(self):\n return {}", "def get_initial_state(self, **kwargs):\n return {'successes': np.ones(self.env.nA, dtype=np.int32),\n 'failures': np.ones(self.env.nA, dtype=np.int32)}", "def _get_controller_parameters(self):\n pass", "def initialise(self):\n self...
[ "0.6425426", "0.6151258", "0.6135855", "0.60412157", "0.59889364", "0.59743536", "0.5963586", "0.59514403", "0.5904424", "0.58903825", "0.5870927", "0.58576226", "0.5829913", "0.5769961", "0.5758137", "0.57319695", "0.5729912", "0.57269716", "0.5722204", "0.5721112", "0.57179...
0.7170085
0
Splits data frame into trainingvalidationtest data frames. This also calibrates scaling object, and transforms data for each split.
def split_data(self, df, valid_boundary=2016, test_boundary=2018): stock_count = len(self.sl) test_ratio = 0.2 print('Stock count:%d'% stock_count) train_x = [] test_x = [] for label_, d_ in enumerate(self.sl): stock_train_len = int(len(d_.train_y) * (1 - tes...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train_val_test_split(df):\n from sklearn.model_selction import train_test_split\n train, test = train_test_split(df, train_size = 0.80, test_size=0.20,\n random_state = 42)\n train, val = train_test_split(train, train_size = 0.70, val_size=0.30)\n print(train.shape, val.shape, test.shape)\n\n ...
[ "0.69305676", "0.68500185", "0.6825401", "0.6820178", "0.6819639", "0.6806733", "0.67640877", "0.67156935", "0.6681609", "0.6675585", "0.6672727", "0.6662629", "0.6619539", "0.661847", "0.6615578", "0.6607513", "0.65914935", "0.6542333", "0.65270346", "0.6515594", "0.6490784"...
0.70878667
0
Calibrates scalers using the data supplied.
def set_scalers(self, df): print('Setting scalers with training data...') column_definitions = self.get_column_definition() id_column = utils.get_single_col_by_input_type(InputTypes.ID, column_definitions) target_column = utils.get_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main(light_graph,\n calibration_data,\n hw_specs,\n sw_config,\n sim_params,\n nodes_to_calibrate):\n with graph_collection.GraphCollection() as graph_coll:\n # Create calibration graph\n hist_coll = graph_coll.histogram_collection()\n convert_to_...
[ "0.55551463", "0.55168366", "0.5510334", "0.54566354", "0.54343325", "0.5372346", "0.52166396", "0.5209569", "0.5180968", "0.5142922", "0.5126212", "0.5119817", "0.5116321", "0.5078507", "0.5077397", "0.5049095", "0.50360376", "0.50137097", "0.500637", "0.49929506", "0.499055...
0.55441695
1
Returns fixed model parameters for experiments.
def get_fixed_params(self): fixed_params = { 'total_time_steps': 40, 'num_encoder_steps': 39, 'num_epochs': 100, 'early_stopping_patience': 10, 'multiprocessing_workers': 2, } return fixed_params
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_fixed_params():\n fixed_params = {\n 'total_time_steps': 8 * 24,\n 'num_encoder_steps': 7 * 24,\n 'num_epochs': 100,\n 'early_stopping_patience': 5,\n 'multiprocessing_workers': 5\n }\n return fixed_params", "def params():\n return utils.Params('../experimen...
[ "0.7432524", "0.680208", "0.65654784", "0.649133", "0.6464081", "0.64224565", "0.61998606", "0.6116676", "0.6029708", "0.6024388", "0.59877205", "0.59875476", "0.59871364", "0.59819573", "0.59542567", "0.5951514", "0.59463716", "0.5937351", "0.5936956", "0.59318024", "0.59103...
0.7252054
1
Returns default optimised model parameters.
def get_default_model_params(self): model_params = { 'dropout_rate': 0.3, 'hidden_layer_size': 160, 'learning_rate': 0.01, 'minibatch_size': 64, 'max_gradient_norm': 0.01, 'num_heads': 1, 'stack_size': 1 } retu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _default_params(self) -> Dict[str, Any]:\n normal_params = {\n \"temperature\": self.temperature,\n \"max_tokens\": self.max_tokens,\n \"top_p\": self.top_p,\n \"frequency_penalty\": self.frequency_penalty,\n \"presence_penalty\": self.presence_pena...
[ "0.786182", "0.7648742", "0.74824107", "0.74050725", "0.7169978", "0.7132334", "0.71250355", "0.712289", "0.7111139", "0.69280326", "0.6880837", "0.6880837", "0.6880837", "0.6879771", "0.68396217", "0.67895633", "0.6772952", "0.67317784", "0.6703785", "0.6703785", "0.6691981"...
0.81408334
0
sum of all the values from one prop of fund daily report, of coures many of the props make no sense to sum
def tot(self, prop="基金现值", date=yesterdayobj()): res = 0 for fund in self.fundtradeobj: res += fund.dailyreport(date).iloc[0][prop] return res
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def SumaryPresupuesto(vj):\n\n sumaUSD = sumaCUC = totalUSD = totalCUC = 0.0\n\n for row in vj.tbPresupesto.rows.values():\n cambio = row.cambio\n moneda = row.moneda\n value = row.value\n\n if moneda == MD.Usd:\n sumaUSD += value\n totalUSD += value\n ...
[ "0.6597488", "0.64506793", "0.64362556", "0.62868077", "0.62868077", "0.6221355", "0.61697733", "0.615913", "0.6102456", "0.6087261", "0.6078752", "0.6066523", "0.60638386", "0.6062406", "0.6061726", "0.60488385", "0.6031776", "0.60287493", "0.59733987", "0.5963322", "0.59592...
0.73464024
0
merge the different cftable for different funds into one table
def _mergecftb(self): dtlist = [] for fund in self.fundtradeobj: dtlist2 = [] for _, row in fund.cftable.iterrows(): dtlist2.append((row["date"], row["cash"])) dtlist.extend(dtlist2) nndtlist = set([item[0] for item in dtlist]) nndtlis...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def combine_tables():\n ranked = unicef_data()\n cpi_table = cpi_data()\n cpi_and_cl = cpi_table.join(ranked, 'Country / Territory',\n 'Countries and areas', inner=True)\n return cpi_and_cl", "def transferfunds(self):", "def merge_table(t1, t2):\r\n input1 = pd.mer...
[ "0.5947118", "0.57218575", "0.56129074", "0.5611306", "0.5544104", "0.5530321", "0.54318535", "0.53656286", "0.53199464", "0.52788687", "0.51809466", "0.51803374", "0.51164687", "0.50988007", "0.50969416", "0.5092525", "0.50831497", "0.50804347", "0.5064814", "0.5063479", "0....
0.75052285
0
return a virtue status table with a mf(cash) column based on the given tot money and cftable
def _vcash(totmoney, totcftable, cashobj): cashl = [] cashl.append(totmoney + totcftable.iloc[0].cash) for i in range(len(totcftable) - 1): date = totcftable.iloc[i + 1].date delta = totcftable.iloc[i + 1].cash if delta < 0: cashl.append( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def combsummary(self, date=yesterdayobj()):\n date = convert_date(date)\n columns = [\n \"基金名称\",\n \"基金代码\",\n \"当日净值\",\n \"单位成本\",\n \"持有份额\",\n \"基金现值\",\n \"基金总申购\",\n \"历史最大占用\",\n \"基金持有成本\",\n ...
[ "0.5609491", "0.56090033", "0.5605382", "0.54486775", "0.5409336", "0.5349029", "0.5310988", "0.5306069", "0.5277752", "0.52737856", "0.52526504", "0.5243906", "0.52153254", "0.52056533", "0.5202589", "0.51329315", "0.51262546", "0.5124966", "0.51038945", "0.51027447", "0.507...
0.76324147
0
Revert the associated document instance back to this revision. Return the document instance.
def revert(self): self.instance.save() return self.instance
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def restore(self):\n documentUrl = self.metaData.graveyard[0].selfLink + \"/restore\"\n response = self._adapter.putRequest(documentUrl, self._baseHeader, \"{}\")\n self.metaData.graveyard.pop()\n\n return Document(self._client, response['Headers']['location'])", "def revert(self, ref...
[ "0.69118136", "0.62749267", "0.6198141", "0.6081206", "0.58588725", "0.58482563", "0.57816803", "0.56374973", "0.556933", "0.55578405", "0.5556515", "0.5501226", "0.5477532", "0.545381", "0.5427725", "0.5415648", "0.54093003", "0.53723705", "0.531905", "0.5276174", "0.5251659...
0.75671864
0
Return the DCTII matrix of order n
def dctmtx(n): x,y = np.meshgrid(range(n), range(n)) D = np.sqrt(2.0/n) * np.cos(np.pi * (2*x+1) * y / (2*n)) D[0] /= np.sqrt(2) return D
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_dct_matrix(N):\r\n dct_m = np.eye(N)\r\n for k in np.arange(N):\r\n for i in np.arange(N):\r\n w = np.sqrt(2 / N)\r\n if k == 0:\r\n w = np.sqrt(1 / N)\r\n dct_m[k, i] = w * np.cos(np.pi * (i + 1 / 2) * k / N)\r\n idct_m = np.linalg.inv(dct_m)...
[ "0.78467476", "0.68740726", "0.67651325", "0.65155023", "0.6344569", "0.63325715", "0.6290011", "0.6210422", "0.61951417", "0.6149881", "0.61017364", "0.6054974", "0.60508734", "0.5981218", "0.5954551", "0.58851784", "0.58829117", "0.5834347", "0.5812427", "0.58059543", "0.57...
0.75993985
1
klUCB index computation for Poisson distributions.
def klucb_poisson(x, d, precision=1e-6): upperbound = x+d+sqrt(d*d+2*x*d) # looks safe, to check: left (Gaussian) tail of Poisson dev return klucb(x, d, kl_poisson, upperbound, precision)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def kl_ucb(self, T, f):\n def index_func(x):\n return x.Sa / x.Na + np.sqrt(f(x.t)*2 / x.Na)\n return self.Index_Policy(T, index_func)", "def kernal_mus(n_kernels):\n l_mu = [1]\n if n_kernels == 1:\n return l_mu\n\n bin_size = 2.0 / (n_kernels - 1) # score range from [-...
[ "0.6288863", "0.58540034", "0.5780807", "0.57525176", "0.56694484", "0.5533527", "0.552716", "0.54448533", "0.54232484", "0.54232484", "0.54122174", "0.54034543", "0.53963554", "0.5395306", "0.5395306", "0.538923", "0.53744537", "0.53612316", "0.53517383", "0.5325024", "0.531...
0.5900849
1
Perform style transfer on a detected class in a frame
def create_stylized_detection(style_transfer_executor, style_transfer_class, frame: np.ndarray, detections: list, resize_factor, labels: dict): for detection in detections: class_idx, box, confidence = [d for d in detection] label = labels[class_idx][0] if label...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_style(self):", "def CSSClasses(self):", "def update_style(self):\n pass", "def detect(self, frame, cur_count):\n self.variables['is_black'] = False\n self.process(frame, cur_count)", "def style_transfer_postprocess(preprocessed_frame: np.ndarray, image_shape: tuple):\n\n pos...
[ "0.555527", "0.55425155", "0.552141", "0.53011477", "0.5250051", "0.5232363", "0.5162412", "0.5114399", "0.5083028", "0.5069768", "0.50682425", "0.5024041", "0.5003642", "0.4973851", "0.49458343", "0.49029955", "0.48944783", "0.48923257", "0.48872736", "0.4868653", "0.4849627...
0.6410726
0
Creates an inference executor for style predict network, style transfer network, list of backends and a style image.
def __init__(self, style_predict_model_path: str, style_transfer_model_path: str, style_image: np.ndarray, backends: list, delegate_path: str): self.style_predict_executor = network_executor_tflite.TFLiteNetworkExecutor(style_predict_model_path, backends, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def construct_graph(network_class: Type[InferenceNetwork],\n config: Path, checkpoint_dir: str,\n batch_size: int,\n batches_per_step: int,\n image_filenames: Tuple[str],\n loop: bool,\n preprocess_fn:...
[ "0.6420253", "0.5924102", "0.580996", "0.57128006", "0.56789887", "0.5605435", "0.5600299", "0.5599023", "0.5588424", "0.5582421", "0.5561573", "0.549888", "0.5475646", "0.54755354", "0.5463997", "0.5414356", "0.5413791", "0.54131633", "0.5407875", "0.5404318", "0.5400513", ...
0.7680035
0
Creates bottleneck tensor for a given style image.
def run_style_predict(self, style_image): # The style image has to be preprocessed to (1, 256, 256, 3) preprocessed_style_image = cv_utils.preprocess(style_image, self.style_predict_executor.get_data_type(), self.style_predict_executor.get_shape(), ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fit_style_transfer(style_image, content_image, style_weight=1e-2, content_weight=1e-4, \n optimizer='adam', epochs=1, steps_per_epoch=1):\n\n images = []\n step = 0\n\n # get the style image features \n style_targets = get_style_image_features(style_image)\n \n # get the content i...
[ "0.59696984", "0.5862865", "0.5862255", "0.581168", "0.5622455", "0.55933154", "0.559133", "0.5581609", "0.54264534", "0.5406123", "0.54025626", "0.53983897", "0.5380382", "0.5368574", "0.53159803", "0.5289746", "0.52772886", "0.52625686", "0.52574396", "0.5250272", "0.522924...
0.6130885
0
Append a string to the self.message string.
def appendMsg(self, msg): # self.message += msg theTime = self.logger.mytime() # self.message += theTime + " " + str( msg ) self.message = str(self.message) + str(theTime) + " " + str(msg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rawAppend(self, data):\n self.message = self.message + data", "def massage_addcontent(self) -> str:\n self.message_str += self.content if len(self.content) <= self.notification_message_max_len else self.content[\n ...
[ "0.69485325", "0.675597", "0.675597", "0.6682592", "0.66123986", "0.6595866", "0.65272105", "0.65110123", "0.65009505", "0.644948", "0.6436071", "0.6379012", "0.6360525", "0.6347536", "0.6322906", "0.62719226", "0.6262143", "0.6243334", "0.62312156", "0.6208512", "0.6207016",...
0.71520525
0
Get the NNNN number from the recvData.
def getMsgNumber(self): wData = self.recvData self.logIt(__name__ + ".getMsgNumber(): wData=" + str(wData) + "\n") msgNum = "" msgNum2 = None for i in range(0, len(str(wData))): if wData is None: break if str(wData[i]).isdigit(): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_NID():\n return NID", "def n(self) :\n\t\ttry :\n\t\t\treturn self._n\n\t\texcept Exception as e:\n\t\t\traise e", "def getN(self)->int:\n return self.n", "def get_neuron_number(self):\n return self.neuronNumber", "def recvnumber(self):\n\n data = self.recvraw()\n try...
[ "0.6444097", "0.61840373", "0.6120752", "0.6090942", "0.6069647", "0.60404944", "0.6036849", "0.60170084", "0.5792893", "0.57422215", "0.56789714", "0.56789714", "0.56575114", "0.5606321", "0.5583389", "0.5574941", "0.55717474", "0.5563853", "0.55533504", "0.55358994", "0.552...
0.66387296
0
Get the file data to be returned to the client. The file is assummed to bi in the current working directory. The file name will be name NNNN.txt where NNNN is the first 4 bytes of the received data. The rest of the received data is ignored.
def getFileData(self): # fileName = "./0000.txt" self.logIt(__name__ + ".getFileData(): data=" + str(self.recvData) + "\n") msgNum = self.getMsgNumber() if msgNum is None: return "" # fileName = "%-04.4d" % (msgNum ) + ".txt" fileName = "./files/" + str(m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file_request(self):\n magic_number = int.to_bytes(int(0x497E), 2, byteorder='big') \n type_bytes = int.to_bytes(1, 1, byteorder='big')\n filename_in_bytes = bytes(self.file_name, 'utf-8') #ENCODE FILENAME IN BYTES\n try:\n filename_len = int.to_bytes(len(filename_in_bytes...
[ "0.69599164", "0.68891335", "0.68286395", "0.6660193", "0.65385926", "0.64575404", "0.644558", "0.6357686", "0.6305093", "0.62702876", "0.6221223", "0.61896163", "0.6177835", "0.61637133", "0.61625874", "0.6144655", "0.6137694", "0.6082975", "0.60770166", "0.60584915", "0.602...
0.7877845
0
Update the counts file.
def updateCounts(self): found = False fileName = "counts" if not os.access(fileName, os.F_OK): try: TFH = open(fileName, "w") TFH.close() except IOError as inst: # @UnusedVariable self.logIt(__name__ + ".updateCounts(): Una...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_count(self):\n pass", "def update_count(self):\n count_metrics = self._fetch_count_metrics_and_clear()\n self._logger.info('update_count. count_metrics = %s',\n build_metrics_counter_data(count_metrics))", "def update_count(self):\n pass # Do not...
[ "0.74021804", "0.73627406", "0.7276364", "0.6980413", "0.6975578", "0.6750909", "0.66988015", "0.66070646", "0.6586439", "0.658481", "0.6576082", "0.6488782", "0.6481709", "0.6444592", "0.64294684", "0.63769114", "0.6369325", "0.63536334", "0.634653", "0.63409024", "0.6326619...
0.8075696
0
Cut the input spectrum to the desired frequency range. It appends zero outside the desired frequency range.
def cut_spectrum(input_spectrum, desired_frequency_range): channels_ip = [] for ip in input_spectrum.GetChannels(): channel_ip = [] channel_op = [] for n, i in enumerate(ip): if n > desired_frequency_range[0] / input_spectrum.GetResolution() and n < desired_frequency_range[1]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def spectrum_cut(spectrum, eVrange=(0.0, 0.0)):\n if eVrange[1] == 0.0:\n return spectrum\n else:\n if spectrum[-1,0] <= eVrange[0] or spectrum[0,0] >= eVrange[1]:\n return np.array([[0, 0]], dtype=np.float)\n else:\n idx1 = np.argmax(spectrum[:,0] >= eVrange[0])\n ...
[ "0.62513006", "0.62132746", "0.60707045", "0.5944", "0.59013665", "0.59013665", "0.58729315", "0.5817833", "0.5806475", "0.5607447", "0.54500735", "0.5449314", "0.54282624", "0.5399753", "0.5364459", "0.53639007", "0.536371", "0.53561896", "0.5348532", "0.53258014", "0.531679...
0.7253377
0
Appends zeros until the signal has the given length. If no length is given, zeros will be appended until the length is a power of 2.
def append_zeros(input_signal, length=None): if length is None: length = 2 ** int(math.ceil(math.log(len(input_signal), 2))) zeros = length - len(input_signal) result = sumpf.Signal(channels=tuple([c + (0.0,) * zeros for c in input_signal.GetChannels()]), samplingrate=input...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pad(signal, new_length, end):\n assert len(signal) > 1 and len(signal[0]) > 1\n signal = np.array(signal)\n if len(signal) < new_length:\n zero_row = np.zeros(len(signal[0]))\n zero_row = np.array([zero_row])\n count = 0\n while len(signal) < new_length:\n if end...
[ "0.7238169", "0.6805896", "0.65239316", "0.62442094", "0.622205", "0.61135155", "0.59153557", "0.5907556", "0.5828405", "0.5755306", "0.57248324", "0.5612285", "0.56056225", "0.56051517", "0.55635965", "0.55608547", "0.5536763", "0.5488493", "0.54597217", "0.5417377", "0.5394...
0.75854605
0
Get the first output signal.
def GetFirstOutput(self): return self.__output_signal1
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetSecondOutput(self):\n return self.__output_signal2", "def get_output(self):\r\n x = self.query('OUTP?')\r\n if x == None: return None\r\n return int(x)", "def first_value(self):\n return self._waveforms[0].first_value", "def output(self):\n try:\n r...
[ "0.72742707", "0.61670125", "0.61595243", "0.60887444", "0.6058285", "0.60497797", "0.6038734", "0.60080075", "0.60080075", "0.5924033", "0.58593434", "0.57831407", "0.57734317", "0.57566434", "0.57046473", "0.56800205", "0.56345075", "0.55731976", "0.5569899", "0.5553696", "...
0.88019943
0
Get the second output signal.
def GetSecondOutput(self): return self.__output_signal2
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetFirstOutput(self):\n return self.__output_signal1", "def test_get_output_signal(network_with_devices):\n network = network_with_devices\n devices = network.devices\n names = devices.names\n\n [OR1_ID] = names.lookup([\"Or1\"])\n\n assert network.get_output_signal(OR1_ID, None) == dev...
[ "0.71854687", "0.63554436", "0.5898584", "0.56793916", "0.5492311", "0.5456946", "0.54538345", "0.542673", "0.5402636", "0.5399631", "0.53979933", "0.53406817", "0.53406817", "0.5319457", "0.5187725", "0.518197", "0.5170489", "0.51457274", "0.5144491", "0.51254064", "0.512031...
0.87862813
0
Set the first input signal.
def SetFirstInput(self, input_signal1): self.__input_signal1 = input_signal1 self._changelength()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_input(self, input):\r\n\r\n self.reset()\r\n self.input = input", "def SetSecondInput(self, input_signal2):\n self.__input_signal2 = input_signal2\n self._changelength()", "def reset(self, signal):\n if not signal.readonly:\n self[signal] = signal.initial_v...
[ "0.6282879", "0.6259233", "0.60873824", "0.6017913", "0.5990884", "0.5875082", "0.58168703", "0.58168703", "0.5788905", "0.57271546", "0.570479", "0.54833364", "0.54585993", "0.5397411", "0.5380954", "0.53617465", "0.5355876", "0.5352071", "0.5284869", "0.52694386", "0.524455...
0.84033006
0
Set the second input signal.
def SetSecondInput(self, input_signal2): self.__input_signal2 = input_signal2 self._changelength()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def SetFirstInput(self, input_signal1):\n self.__input_signal1 = input_signal1\n self._changelength()", "def GetSecondOutput(self):\n return self.__output_signal2", "def reroute_input(ts0, ts1, op1):\n for i, t in enumerate(op1.inputs):\n if t is ts1:\n op1._update_inp...
[ "0.65789753", "0.5970639", "0.54187995", "0.5303401", "0.52545244", "0.524003", "0.5232626", "0.52124405", "0.5209186", "0.5200294", "0.5187235", "0.5162863", "0.5161719", "0.51504976", "0.5139225", "0.51298094", "0.51160574", "0.5103286", "0.50904495", "0.50566167", "0.50540...
0.84657276
0
A function to change the length of signal. If the length of the signal is greater than the length then signal length is truncated, Else zeros are added to the signal.
def change_length_signal(signal, length=None): if length is None: length = len(signal) if len(signal) >= length: signal = sumpf.modules.CutSignal(signal=signal, start=0, stop=length).GetOutput() else: signal = append_zeros(signal, length) return signal
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pad(signal, new_length, end):\n assert len(signal) > 1 and len(signal[0]) > 1\n signal = np.array(signal)\n if len(signal) < new_length:\n zero_row = np.zeros(len(signal[0]))\n zero_row = np.array([zero_row])\n count = 0\n while len(signal) < new_length:\n if end...
[ "0.67467374", "0.65439796", "0.6456528", "0.6441888", "0.6438031", "0.6432366", "0.6301137", "0.62621", "0.6213264", "0.61647", "0.61597764", "0.6120923", "0.6111147", "0.61069745", "0.60383976", "0.60255015", "0.6018112", "0.601324", "0.5869847", "0.58192885", "0.5785484", ...
0.85990524
0
Smooth the spectrum of the filter kernels, to make it suitable for curve fitting algorithm.
def smooth_filter_kernels(kernels=None, window_size=53, polynomial_order=3): kernels_smooth = [] for kernel in kernels: kernel_spec = sumpf.modules.FourierTransform(kernel).GetSpectrum() kernel_spec_channel = kernel_spec.GetChannels()[0] kernel_spec_channel_smooth = savitzky_golay(kernel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def smooth(spectra, filter_win, window_type='flat', mode='reflect'):\n\n if window_type == 'flat':\n window = np.ones(filter_win)\n else:\n window = scipy.signal.windows.get_window(window_type, filter_win)\n window = window / np.sum(window)\n\n for column in range(spectra.shape[1]):\n ...
[ "0.6824938", "0.65886134", "0.6477609", "0.6445923", "0.6416036", "0.64153475", "0.6384642", "0.6355332", "0.6299696", "0.6229597", "0.62203497", "0.6217186", "0.62166554", "0.61390394", "0.61057895", "0.60896516", "0.60855585", "0.607278", "0.6045842", "0.6045842", "0.604326...
0.67573184
1
Compute the linearly weighted spectrum.
def linearweighting(input): if isinstance(input, (sumpf.Signal)): ip = sumpf.modules.FourierTransform(signal=input).GetSpectrum() else: ip = input dummy = 0.0001 while True: dummy = dummy + 0.0001 low = 1 * (dummy ** 1) high = 1 * (dummy ** (len(input) - 1)) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def weightedpower(time, signal, weight, freq):\n\n result = np.zeros(len(freq))\n\n for i in range(len(freq)):\n if (freq[i] != 0.0):\n sine = np.sin(2.0*pi*freq[i]*time)\n cosine = np.cos(2.0*pi*freq[i]*time)\n a11= np.sum(weight*sine*sine)\n a12 = np.sum...
[ "0.63407737", "0.61877424", "0.60627776", "0.6056086", "0.60317564", "0.5951333", "0.5945845", "0.5931498", "0.59037983", "0.5872269", "0.5865271", "0.5779288", "0.5768665", "0.5762712", "0.57522035", "0.5742496", "0.5730954", "0.57047904", "0.5703877", "0.57035995", "0.56820...
0.67521065
0
Split the corpus into k equally sized ranges.
def Split(self, k): n = len(self) start = range(0, n, ceil(n / k)) end = list(start[1:]) + [n] return [range(first, last) for first, last in zip(start, end)]
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_chunks(indivs, k):\r\n\tpair_chunk_collection=[]\r\n\tfor i in xrange(0, len(indivs[0])-k+1, k):\r\n\t\tchunks=[]\r\n\t\tfor x in indivs:\r\n\t\t\tchunks.append(x[i:i+k])\r\n\t\tpartial_phase_pairs=tune_em(chunks, 5)[1]\r\n\t\tprint partial_phase_pairs\r\n\t\tpair_chunk_collection.append(partial_phase_pair...
[ "0.68880534", "0.66759235", "0.6476079", "0.64087355", "0.638673", "0.6291475", "0.6241639", "0.6200349", "0.6170776", "0.6123056", "0.6095629", "0.60687095", "0.60145557", "0.60063714", "0.5977845", "0.59738827", "0.59505767", "0.5923953", "0.58815414", "0.58560884", "0.5847...
0.7745997
0
clean dataframe df_airport_code and return a dataframe
def clean_airport_code(spark, input_data): try: #read file df_airport_code = spark.read.option("header","true").option("recursiveFileLookup","true").parquet(input_data+'airport-codes_csv') # drop columns # filter closed , heliport and seaplace base airport, small_airport # k...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean(df):", "def clean_data(df, start = 1995, stop = 2018):\n country_iso3_code = pd.read_html('https://unstats.un.org/unsd/methodology/m49/')\n country_iso3_code = country_iso3_code[0]['ISO-alpha3 code']\n df = df.loc[df.country_iso3_code.isin(country_iso3_code)]\n df = df.set_index(['indicator...
[ "0.6836619", "0.6605874", "0.6549241", "0.64679146", "0.6422063", "0.6272814", "0.6042544", "0.60288787", "0.60243547", "0.5989035", "0.597916", "0.5965574", "0.5909759", "0.58966345", "0.5879114", "0.58763796", "0.58461595", "0.58415276", "0.5823047", "0.58043087", "0.578519...
0.7142323
0
clean dataframe df_global_airports and return a dataframe
def clean_global_airports(spark, input_data): try: #read file df_global_airports = spark.read.option("header","true").csv(input_data+'airports-extended.csv') drop_cols = ["icao","type", "latitude", "longitude", "altitude", "timezone", "dst", "tz_timezone", "data_source"] newdf = df_g...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean(df):", "def i94_airports(spark, df):\n df.createOrReplaceTempView('i94_airports')\n airports = spark.sql(\"\"\"\n SELECT\n DISTINCT\n STRING(ident) AS airport_id,\n type AS airport_type,\n name AS airpot_name,\n elevation_ft,\n ...
[ "0.6587388", "0.6141118", "0.5938045", "0.5910094", "0.5879471", "0.58774984", "0.58656204", "0.5842229", "0.5795698", "0.57706887", "0.57476074", "0.574605", "0.57356423", "0.56972283", "0.5619846", "0.5593961", "0.5565028", "0.55453414", "0.553814", "0.5526195", "0.55125594...
0.7597343
0
clean dataframe df_iso_country and return a dataframe
def clean_iso_country(spark, input_data): try: #read file df_iso_country = spark.read.option("header","true").csv(input_data+'wikipedia-iso-country-codes.csv') df = (df_iso_country.withColumnRenamed('English short name lower case','country_name') \ .withColumnRena...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean_data(df, start = 1995, stop = 2018):\n country_iso3_code = pd.read_html('https://unstats.un.org/unsd/methodology/m49/')\n country_iso3_code = country_iso3_code[0]['ISO-alpha3 code']\n df = df.loc[df.country_iso3_code.isin(country_iso3_code)]\n df = df.set_index(['indicator', 'country_iso3_cod...
[ "0.7635082", "0.68735754", "0.6863959", "0.6713602", "0.65476346", "0.6416419", "0.62426144", "0.622032", "0.61710155", "0.61320084", "0.6127082", "0.6116876", "0.6109993", "0.6106656", "0.61057997", "0.60770345", "0.60273945", "0.595269", "0.5889864", "0.5830102", "0.5820315...
0.73624325
1
clean dataframe df_demograph and return a dataframe
def clean_demograph(spark, input_data): try: #read file df_demograph = spark.read.option("header","true").option("recursiveFileLookup","true").parquet(input_data+'us-cities-demographics') drop_cols = ["Number_of_Veterans"] newdf = df_demograph.drop(*drop_cols) \ ....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean(df):", "def clean_data():\n pd.set_option('display.max_columns', None)\n try:\n df = pd.read_csv('test1/movie.csv')\n except FileNotFoundError:\n df = pd.read_csv('movie.csv')\n\n df.drop(labels=[\"actor_3_facebook_likes\", \"actor_2_name\",\n \"actor_1_face...
[ "0.7641442", "0.6639029", "0.6506264", "0.65000397", "0.64830804", "0.64705735", "0.6425508", "0.64208907", "0.6354982", "0.63121957", "0.6298637", "0.6252741", "0.6214534", "0.62129265", "0.6210216", "0.6193213", "0.61802834", "0.61434525", "0.6137183", "0.61009353", "0.6073...
0.69470125
1
Computes ``log(exp(x) + exp(y))`` in a numerically stable way.
def logaddexp(x: torch.Tensor, y: torch.Tensor) -> torch.Tensor: return torch.max(x, y) + torch.log(1 + torch.exp(-torch.abs(y - x)))
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _log_add(logx: float, logy: float) -> float:\n a, b = min(logx, logy), max(logx, logy)\n if a == -np.inf: # adding 0\n return b\n # Use exp(a) + exp(b) = (exp(a - b) + 1) * exp(b)\n return math.log1p(math.exp(a - b)) + b # log1p(x) = log(x + 1)", "def log_sum_exp(x):\n # TF ordering\n...
[ "0.7809119", "0.7479544", "0.74780834", "0.744767", "0.74172765", "0.73048776", "0.73048776", "0.7300466", "0.7290193", "0.72830254", "0.72562283", "0.71559936", "0.7111937", "0.7094438", "0.7093719", "0.7079512", "0.70648754", "0.7059741", "0.705626", "0.7040542", "0.702694"...
0.7994726
0
Computes ``tensor.exp().sum(dim, keepdim).log()`` in a numerically stable way.
def logsumexp(tensor: torch.Tensor, dim: Optional[int] = None, keepdim: bool = False) -> torch.Tensor: if dim is None: tensor = tensor.reshape(-1) dim = -1 inputs_max = tensor.max(dim=dim, keepdim=True)[0] tensor = tensor - inputs_max if not keepdim: inputs_max = inputs_max.sque...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_sum_exp(value, dim=None, keepdim=False):\n if dim is not None:\n m, _ = torch.max(value, dim=dim, keepdim=True)\n value0 = value - m\n if keepdim is False:\n m = m.squeeze(dim)\n return m + torch.log(torch.sum(torch.exp(value0), dim=dim, keepdim=keepdim))\n else...
[ "0.817568", "0.81515825", "0.81142867", "0.81142867", "0.8017166", "0.80124635", "0.80124635", "0.793551", "0.7929734", "0.7846384", "0.7771402", "0.7649828", "0.7639434", "0.75482917", "0.75482917", "0.72301334", "0.7201139", "0.71290755", "0.71036375", "0.7100838", "0.70914...
0.8387753
0
Computes ``torch.matmul(mat1.exp(), mat2.exp()).log()`` in a numerically stable way.
def logmatmulexp(mat1: torch.Tensor, mat2: torch.Tensor, use_mm: bool = False) -> torch.Tensor: mat1_shape = mat1.size() mat2_shape = mat2.size() mat1 = mat1.contiguous().view(-1, mat1_shape[-1]) mat2 = move_dim(mat2, 0, -1) mat2 = mat2.contiguous().view(-1, mat2_shape[0]) if use_mm: ma...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def batch_logmatmulexp(mat1: torch.Tensor, mat2: torch.Tensor, use_mm: bool = False) -> torch.Tensor:\n mat1_shape = mat1.size()\n mat2_shape = mat2.size()\n mat1 = mat1.contiguous().view(mat1_shape[0], -1, mat1_shape[-1])\n mat2 = move_dim(mat2, 1, -1)\n mat2 = mat2.contiguous().view(mat2_shape[0],...
[ "0.7710715", "0.69934046", "0.6830569", "0.668147", "0.6496658", "0.6243134", "0.61634815", "0.6114593", "0.598911", "0.5959243", "0.59460145", "0.591172", "0.59081787", "0.5908115", "0.5863151", "0.58574504", "0.58257955", "0.5823142", "0.57903874", "0.57836646", "0.5780225"...
0.8188148
0
Computes ``torch.bmm(mat1.exp(), mat2.exp()).log()`` in a numerically stable way.
def batch_logmatmulexp(mat1: torch.Tensor, mat2: torch.Tensor, use_mm: bool = False) -> torch.Tensor: mat1_shape = mat1.size() mat2_shape = mat2.size() mat1 = mat1.contiguous().view(mat1_shape[0], -1, mat1_shape[-1]) mat2 = move_dim(mat2, 1, -1) mat2 = mat2.contiguous().view(mat2_shape[0], -1, mat2_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def logmatmulexp(mat1: torch.Tensor, mat2: torch.Tensor, use_mm: bool = False) -> torch.Tensor:\n mat1_shape = mat1.size()\n mat2_shape = mat2.size()\n mat1 = mat1.contiguous().view(-1, mat1_shape[-1])\n mat2 = move_dim(mat2, 0, -1)\n mat2 = mat2.contiguous().view(-1, mat2_shape[0])\n\n if use_mm...
[ "0.8067815", "0.6765245", "0.6756691", "0.65030116", "0.65030116", "0.6466798", "0.63860583", "0.62043005", "0.6199516", "0.6040961", "0.6021661", "0.59460133", "0.5943857", "0.58040553", "0.5803235", "0.5770154", "0.57698894", "0.5767673", "0.5760093", "0.5728608", "0.567620...
0.81068563
0
Computes ``log(1 exp(x))`` in a numerically stable way.
def log1mexp(x: torch.Tensor) -> torch.Tensor: mask = (x < _log05).to(x.dtype) impl1 = torch.log1p(-torch.exp(x)) impl2 = torch.log(-torch.expm1(x)) return impl1 * mask + impl2 * (1 - mask)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log1p_exp(x):\n x_ = x * x.ge(0).to(torch.float32)\n res = x_ + torch.log1p(torch.exp(-torch.abs(x)))\n return res", "def log_sum_exp(x):\n x_max = x.max()\n return torch.log(torch.sum(torch.exp(x - x_max), 1, keepdim=True)) + x_max", "def log_sum_exp(self, x):\n b = numpy.max(x[(x<sy...
[ "0.85669684", "0.76878935", "0.768062", "0.7642967", "0.7581363", "0.75357825", "0.75357825", "0.74347", "0.74209934", "0.73896044", "0.738145", "0.7318129", "0.72950226", "0.72420496", "0.7240786", "0.72397685", "0.71956825", "0.7173167", "0.7148945", "0.71363455", "0.712399...
0.8291577
1
Return the malware id
def get_malware_id(self, date, malware_hash): malware_id = self.get_one(""" SELECT M.id FROM malwares M WHERE M.date = %s AND M.hash = %s; """, (date, malware_hash)) if malware_id: return malware_id else: self.insert(""" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_verifier_id():\n cmd = (\"rally verify list-verifiers | awk '/\" +\n getattr(config.CONF, 'tempest_verifier_name') +\n \"/ {print $2}'\")\n with subprocess.Popen(\n cmd, shell=True, stdout=subprocess.PIPE,\n stderr=subprocess.DEVNULL) ...
[ "0.62486625", "0.6210062", "0.61946636", "0.61686426", "0.6033995", "0.60120165", "0.6008355", "0.60002166", "0.5939298", "0.59316343", "0.5922716", "0.5900999", "0.589496", "0.58657694", "0.5857072", "0.58481187", "0.5813568", "0.57995117", "0.5798", "0.5792419", "0.5778246"...
0.6238994
1
Get python library based on sysconfig
def find_python_library(): python_library = sysconfig.get_config_var('LIBRARY') if (not python_library or os.path.splitext(python_library)[1][-2:] == '.a'): candidate_lib_prefixes = ['', 'lib'] candidate_implementations = ['python'] if hasattr(sys, "pypy_version_info"): candi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_python_lib(plat_specific=0, standard_lib=0, prefix=None):\n if prefix is None:\n prefix = PREFIX\n if standard_lib:\n return os.path.join(prefix, \"lib-python\", sys.version[0])\n return os.path.join(prefix, 'site-packages')", "def library():\n finder = LibraryFinder()\n p = ...
[ "0.71885324", "0.66699564", "0.65992355", "0.6495816", "0.6380809", "0.6369318", "0.6262431", "0.616101", "0.61334044", "0.6068237", "0.6055533", "0.59773564", "0.59681046", "0.59629935", "0.5912528", "0.5888469", "0.5869429", "0.5857408", "0.58537686", "0.58526", "0.580894",...
0.7147325
1
Callback function for updating Peloton apps so that we can run integration tests inbetween updates of each app.
def update_callback(app): print("Update callback invoked for %s" % app.name) # TODO: Add integration tests here return True
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_duo_application_update(self):\n pass", "def update_app(self):\n\n param = self.chose_param_value(\"--app\")\n self._check_path_availability([\"get_project_dir\", \"get_project_dir_to\"])\n if self._check_whether_has_params(param):\n self.updater.update_files(\n ...
[ "0.68930477", "0.68622243", "0.67786133", "0.67368746", "0.67218983", "0.6712058", "0.6680836", "0.6652264", "0.64698905", "0.6449498", "0.63019586", "0.63001305", "0.62754816", "0.6259966", "0.625121", "0.618488", "0.6163178", "0.6054064", "0.6050889", "0.60431993", "0.59770...
0.76656497
0
Load the cluster config from a yaml file
def load(cfg_file): with open(cfg_file, "r") as f: try: cfg = yaml.load(f) except yaml.YAMLError as ex: print("Failed to unmarshal cluster config %s" % cfg_file) raise ex return Cluster(cfg_file, **cfg)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_yaml(yaml_name):\n print('training network configuration file is {0}'.format(yaml_name))\n util.check_file_exist(yaml_name)\n config = util.load_yaml_file(yaml_name)\n return config", "def load_cluster_config(path):\n if path:\n path = os.path.join(os.path.dirname(__file__), os.pat...
[ "0.7430753", "0.7339824", "0.7308093", "0.7155157", "0.70941925", "0.7040105", "0.6956988", "0.68890375", "0.68878645", "0.6852141", "0.68291074", "0.68223083", "0.6813968", "0.6801743", "0.6793971", "0.6786656", "0.6752283", "0.67177564", "0.6716593", "0.6700956", "0.6686671...
0.78930426
0
Print the diff between current and desired job config
def diff_config(self, app, verbose=False): print(">>>>>>>> Job config diff for %s <<<<<<<<" % app.name) cfg_dicts = [] factory = TSimpleJSONProtocolFactory() for cfg in app.current_job_config, app.desired_job_config: if cfg: cfg_json = TSerialization.serialize...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compare(self, delay_factor=1):\n delay_factor = self.select_delay_factor(delay_factor)\n compare_command = \"show candidate diff all\"\n no_changes = '% No configuration changes found.'\n self.config_mode()\n output = self.send_command(compare_command, delay_factor=delay_fact...
[ "0.6342718", "0.60944885", "0.5940871", "0.5862255", "0.5860077", "0.5827088", "0.5746669", "0.5744944", "0.56751513", "0.56675583", "0.5650532", "0.5633678", "0.5613628", "0.5562561", "0.550574", "0.54969937", "0.54956335", "0.5475676", "0.5475087", "0.5468679", "0.5431841",...
0.6959558
0
Rolling update the Peloton apps in the cluster
def update(self, force, verbose): # Print the job config diffs print('Update Peloton cluster "%s" to new config: ' % self.name) for app in self.apps: self.diff_config(app, verbose) if not force and not yesno("Proceed with the update ?"): return updated_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upgrade():\n config = ConfigManager()\n apps = config['apps']\n for i, app in progressbar(enumerate(apps), redirect_stdout=True):\n z = Zap(app)\n if i == 0:\n z.update(show_spinner=False)\n else:\n z.update(check_appimage_update=False, show_spinner=False)", ...
[ "0.58729935", "0.5843566", "0.58405876", "0.5839117", "0.57458085", "0.56953675", "0.56308955", "0.55375355", "0.5398979", "0.5395155", "0.537317", "0.53511757", "0.5333919", "0.53233975", "0.53211194", "0.5281121", "0.52565503", "0.52545494", "0.52454", "0.5234684", "0.52275...
0.6399314
0
Rollback the updates to the list of apps in the cluster
def rollback(self, apps): while len(apps) > 0: app = apps.pop() print("Rolling back app %s ..." % app.name) app.rollback_job()
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rollback(self):\n for db in self.values():\n db.rollback()", "def _do_rollback(self):\n self.backend.rollback()", "def rollback(self):\n pass", "def rollback(self):\r\n self.db.rollback()", "def __update_application(self, apps, **extra_args):\n update_on_er...
[ "0.6322182", "0.62385505", "0.6148077", "0.61378366", "0.6104422", "0.607502", "0.5983937", "0.5958292", "0.5950454", "0.5916126", "0.5878117", "0.58364695", "0.5808297", "0.5802136", "0.57791936", "0.57087785", "0.5707182", "0.5705441", "0.5698692", "0.56929046", "0.557553",...
0.8059082
0
Update docstring for constructed method.
def update_docstring(instance): try: docstring = instance.api_map['doc'] except (KeyError, TypeError): docstring = 'No docstring provided.' instance.__class__.__doc__ = docstring instance.__class__.__call__.__signature__ = construct_signature(instance) return docstring
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_doc(self):\n raise NotImplementedError()", "def __init__(self):\n super(MethodInfo, self).__init__()\n self.DocString = None", "def __doc__(self, ???):", "def docstring_hack():\n pass", "def __init__ (self, isInternal, docstring, name, args, isConst):\n\n self.name = n...
[ "0.77076185", "0.75691295", "0.7252381", "0.7235469", "0.7157194", "0.7153221", "0.7153221", "0.7153221", "0.70771676", "0.70201385", "0.7007644", "0.6961431", "0.6957143", "0.6916432", "0.68973947", "0.689267", "0.6856933", "0.68178123", "0.67774934", "0.6775329", "0.6735545...
0.7789328
0
Make a list of valid parameters. This accumulates all known parameters from any keys embedded in _path_, _default_params_, and _valid_params_.
def get_all_valid_params(instance): params = {} path_params = instance.find_path_keys(instance.api_map.get('path', '')) for param in path_params: params[param] = '' # Always make a list of valid parameters from endpoint mapping valid_params = instance.api_map.get('valid_params', []) if...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_path_parameters(self):\n url_params = URL_PARAMS_PATTERN.findall(self.path)\n params = []\n\n for param in url_params:\n params.append({\n 'name': param,\n 'type': 'string',\n 'in': 'path',\n 'required': True\n ...
[ "0.7357251", "0.6719663", "0.650476", "0.6196918", "0.6181368", "0.615529", "0.6153257", "0.6026366", "0.6008636", "0.60070795", "0.59976304", "0.59976304", "0.59857446", "0.5972139", "0.59693515", "0.58892715", "0.5857361", "0.58370304", "0.5835673", "0.5816805", "0.5784921"...
0.74553144
0
Exports a dictionary of inputs to a string. Inputs
def write_config_string(input_dict, entry_char='>', attribution_char='=', usekeys=None): # Selects the desired entries of the input_dict if usekeys is not None: input_dict = {key: input_dict[key] for key in usekeys} result_str = "" for key, value in input_dict.items(): ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_output_data(\n self,\n inputs: Dict[str, Any]) -> Any:\n return inputs", "def write_input_params(file_output,input_params):\r\n\r\n with open(file_output,'w+') as f:\r\n for key in input_params.keys():\r\n f.write( ''.join(key)+','+str(input_params[key])+...
[ "0.6439612", "0.6250485", "0.60094106", "0.5903446", "0.5860807", "0.58248734", "0.5657922", "0.5620445", "0.56183684", "0.56107336", "0.5566386", "0.55293655", "0.55053955", "0.55053955", "0.5470858", "0.5464469", "0.5427735", "0.5419561", "0.5416688", "0.5392507", "0.539018...
0.63496745
1