sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
c326214a9485967d54bb068cccc82f90711ae0f5aa40303207ee3616d871c3d8 | Python | 10,495 | 261 | """
# 2022-12-23_video-abstract
Using the template @ https://laurentperrinet.github.io/sciblog/posts/2019-09-11_video-abstract-vision.html
and using that @ https://github.com/chloepasturel/AnticipatorySPEM/blob/master/2020-03_video-abstract/2020-03-24_video-abstract.ipynb
cp 2022-12-23_polychrony-review_video-abstr... |
eb6fa3c6a88f93253b385c2a6f00f5496a5247a83ec104794b67144c72736283 | Python | 10,500 | 262 | import math
import random
from copy import deepcopy
import numpy
import torch
from torch import nn
from transformers import BertModel, BertConfig, AutoModel
USE_CUDA = torch.cuda.is_available()
MAX_OUTPUT_LENGTH = 50
class Beam: # the class save the beam node
def __init__(self, score, input_var, ... |
8ea709120debb44d99116d36d5addd04cee3c1a6fc1b3f8b847754f10acad98f | Python | 10,505 | 372 | from datetime import datetime
from typing import (
Literal,
Optional,
Union,
)
from pydantic import (
ConfigDict,
Field,
RootModel,
)
from galaxy.schema.fields import (
DecodedDatabaseIdField,
EncodedDatabaseIdField,
ModelClassField,
)
from galaxy.schema.schema import (
CreateT... |
6f4905992d11f09b3bf0540b6e3283e4bb3258a7361564e0901ad8c00035ab3f | Python | 10,506 | 307 | import pytest
import networkx as nx
from networkx.algorithms import flow
from networkx.algorithms.connectivity import minimum_st_edge_cut, minimum_st_node_cut
flow_funcs = [
flow.boykov_kolmogorov,
flow.dinitz,
flow.edmonds_karp,
flow.preflow_push,
flow.shortest_augmenting_path,
]
interface_funcs... |
44272ff2cda2955d6089f8a35d1e0850447f719332defb09a00bef103234851c | Python | 10,507 | 326 | import copy
from .synaptortask import SynaptorTask
from synaptor import io, chunk_bboxes
def tup2str(t):
return " ".join(map(str, t))
def create_init_db_task(storagestr):
return SynaptorTask(f"init_db {storagestr}")
def create_connected_component_tasks(
descpath, outpath, storagestr, storagedir,
... |
7900202a4fccf1308a028bd7ad1c4aa6bcb02c0c2acf2390c18d506f746a26bc | Python | 10,510 | 317 | import os
import argparse
import random
import psutil
import yaml
import logging
from functools import partial
from tensorboardX import SummaryWriter
import wandb
import numpy as np
import torch
import torch.nn as nn
from torch import optim as optim
from sklearn.decomposition import PCA
from sklearn.manifold import T... |
4d84a6dde95d2c600d9685ca3ec13220cdd7d28164188ca7866205783789d1b4 | Python | 10,512 | 312 | import numpy as np
import matplotlib.pyplot as plt
import sympy as sp
from tqdm import tqdm
import torch
import torch.nn as nn
import snntorch as snn
import snntorch.spikegen as spkgen
sqrtpi = np.sqrt(np.pi)
a = 0.565
class StepFowardEncoder:
def __init__(self, Ic, thr, n_signals):
self.base = torch.ze... |
907e68bdd3c1d972bfcf2a527f459737c2009fe0bc34ab788696b6c52a6de333 | Python | 10,515 | 283 | from __future__ import annotations
import argparse
import json
import time
from pathlib import Path
import torch
import torch.nn as nn
import torch.nn.functional as F
from spikingjelly.activation_based import functional
from spikingjelly.activation_based.ann2snn import ModuleConverter, SpikeZIPTFQANNRecipe
from spik... |
0edd51d479e6e3b6aaffc157f6044575bcb4b15dcec726a9d51e59e1e2b4039a | Python | 10,516 | 316 | import pytest
import networkx as nx
from networkx.generators import line
from networkx.utils import edges_equal
class TestGeneratorLine:
def test_star(self):
G = nx.star_graph(5)
L = nx.line_graph(G)
assert nx.is_isomorphic(L, nx.complete_graph(5))
def test_path(self):
G = nx... |
2fd0c9efa0b20649c97b6773f0b84cb38776f4e1c04696a05ceb1a7c64934df5 | Python | 10,516 | 249 | import os
import warnings
import feather
import numpy as np
import pandas as pd
from alpineer import io_utils, misc_utils
def compute_cell_som_cluster_cols_avg(cell_cluster_data, cell_som_cluster_cols,
cell_cluster_col, keep_count=False):
"""For each cell SOM cluster, comput... |
7541bc104e2f22e94c327d587832f23299b78e15135d4fe5cdd7ca0b57e6cd5f | Python | 10,517 | 380 | # Original author: D. Eppstein, UC Irvine, August 12, 2003.
# The original code at https://www.ics.uci.edu/~eppstein/PADS/ is public domain.
"""Functions for reading and writing graphs in the *sparse6* format.
The *sparse6* file format is a space-efficient format for large sparse
graphs. For small graphs or large dens... |
9401c197345c3238ecd21c0416f47941108132bfe9b4b8cdf8fd8c8ee9a0f762 | Python | 10,517 | 314 | from typing import AbstractSet
from nl_expr.expression_pattern_matching import add_match
from nl_expr.expression_walker import PatternWalker
from nl_expr.expressions import (
Constant,
Definition,
ExpressionBlock,
FunctionApplication,
Symbol,
)
from nl_expr.logic import Implication
from nl_expr.log... |
9d6fc4b0e57e901ac3bf1bd415d031b1e7b5d61806ef0818e4066f2cdc4bd72e | Python | 10,524 | 361 | """
Subraph centrality and communicability betweenness.
"""
import networkx as nx
from networkx.utils import not_implemented_for
__all__ = [
"subgraph_centrality_exp",
"subgraph_centrality",
"communicability_betweenness_centrality",
"estrada_index",
]
@not_implemented_for("directed")
@not_implemente... |
2646d7d85e2d15eb258a0dcd603d1b8d2ed0fa7eacb15cdb43ffe330cc103771 | Python | 10,525 | 294 | #!/usr/bin/env python3
import os
import numpy as np
# -custom-written code
import main_task_free
from utils import checkattr
from params.param_stamp import get_param_stamp_from_args
from params.param_values import check_for_errors,set_default_values
from params import options
from visual import visual_plt
## Function... |
052c5a4c2135fa240f2e60ed1e724a61555c584234937af55a550e0e167fce62 | Python | 10,527 | 292 | import argparse
import os
import numpy as np
import math
import itertools
import datetime
import time
import sys
import torchvision.transforms as transforms
from torchvision.utils import save_image
from torch.utils.data import DataLoader
from torchvision import datasets
from torch.autograd import Variable
from model... |
ceea2f48ddbecf700e8a253d0d65a28345365c0a3dc9f0c62ade462ac37c9aae | Python | 10,528 | 374 | from typing import Optional
import torch
import triton
import triton.language as tl
from ..triton_layout import (
_block_minor,
_neuron_grid,
_neuron_indices,
_spatial_offsets,
_time_offset,
_triton_layout_args,
)
from ..triton_surrogate import _surrogate_gradient
from .autograd import _check,... |
c3bad3d1cf2b7bd0ae68e508ad091fa58473b97dfd05414236cda39080d156f3 | Python | 10,536 | 258 | #!/usr/bin/env python
""" Downloads FaceForensics++ and Deep Fake Detection public data release
Example usage:
see -h or https://github.com/ondyari/FaceForensics
"""
# -*- coding: utf-8 -*-
import argparse
import os
import urllib
import urllib.request
import tempfile
import time
import sys
import json
import random... |
c0763cb430baf5885932561b52717297e535e784afd8422a8aa7af92532b1098 | Python | 10,538 | 290 | import networkx as nx
__all__ = ["convert_node_labels_to_integers", "relabel_nodes"]
@nx._dispatchable(
preserve_all_attrs=True, mutates_input={"not copy": 2}, returns_graph=True
)
def relabel_nodes(G, mapping, copy=True):
"""Relabel the nodes of the graph G according to a given mapping.
The original no... |
b1fdcb5db81c6cb435e464df8106699516810ddf08154de23f425db679c17f23 | Python | 10,539 | 213 | import numpy as np
from ph_calculator import *
def read_file(filepath):
with open(filepath, "r") as f:
return f.read()
class AcidBaseNetwork:
"""" Describes the structure of an acid base network """
def __init__(self, num_neurons=2, weights_per_neuron=64, img_width=8, img_height=8):
self... |
d5535af832f62979283ac653fa5a81c3f5cd4f51730f452f6d6f6e35aa764246 | Python | 10,546 | 257 | # -*- coding:utf-8 -*-
"""
"""
from concurrent.futures import ThreadPoolExecutor
from distutils.version import LooseVersion
from functools import partial
import numpy as np
import tensorflow as tf
# from tensorflow.keras.utils import to_categorical as tf_to_categorical
from keras.api.utils import to_categorical as tf... |
8f7f71798344dbabb7c898fcac7b051d6c471798e165af5653893ec1c4fa2435 | Python | 10,554 | 277 | #emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
#ex: set sts=4 ts=4 sw=4 et:
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
#
# See the COPYING file distributed along with the smile package for the
# copyright and license terms.
#
### ### ### ### ### ### ### ... |
3d0952eed0feb19e1b56e6b67d7ddfb308df5301a56d4e2e1e803a138d79e9bf | Python | 10,565 | 288 | """
Sharing the assistant's answers with a feedback server.
When the ``feedback`` section of the LLM configuration is ``enabled``,
or the environment variable ``NEUROLANG_LLM_FEEDBACK_URL`` gives the
address of a server, each answer of the assistant is posted to that
:mod:`.feedback_server` (:meth:`FeedbackClient.shar... |
3e3acdfe58fe571b046583ddc62111d406656c5d278e40de8ddd0f1ca909107b | Python | 10,566 | 332 | #
# Galaxy documentation build configuration file, created by
# sphinx-quickstart on Tue Mar 6 10:44:44 2012.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values hav... |
4cc4ac9bbf785cd810f823eb14e5d42c5751ee8bec776d3606dd54f4387daae7 | Python | 10,569 | 302 | import logging
from scipy import stats
from maxatac.utilities.system_tools import Mute
with Mute():
import tensorflow as tf
from tensorflow.keras import backend as K
from tensorflow.keras.callbacks import ModelCheckpoint
from tensorflow.keras.layers import (
Input,
Conv1D,
MaxP... |
7ff8c6a5d49c6f125b7a395bb39fba91799c6d472476dfac457df76b72322971 | Python | 10,569 | 416 | import io
from nl_expr import expression_walker as ew
from nl_expr.expression_walker import ReplaceExpressionWalker
from nl_expr.expressions import Constant, ExpressionBlock, Symbol
from nl_expr.logic import (
Conjunction,
ExistentialPredicate,
FunctionApplication,
Implication,
)
from nl_expr.logic.tra... |
1ce1a78f0e7692827e42eaff1ae4d1aba9d4a562921ae43f9ab5a030529eff17 | Python | 10,571 | 301 | from __future__ import annotations
from typing import TYPE_CHECKING, cast, final, overload
import numpy as np
import pandas as pd
from ..compat import CupyArray, CupyCSMatrix
from ..types import SupportsArrayApiBase
from ..utils import asarray
from .aligned_df import _gen_dataframe
from .aligned_mapping import (
... |
e90fd6a6123a19c84423ed34e36c02afe1cc4c8d0a6987c90d186a650ffb23d1 | Python | 10,573 | 281 | # Copyright (c) MONAI Consortium
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, so... |
eb492e8857b196b28ac844e280abbd7a7e62a3af0338a84a6668aefd4887fdf7 | Python | 10,574 | 267 | import anndata
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from statsmodels.stats.multitest import multipletests
def _calculate_enrichment_score(raw_adata, labels):
"""
Calculate enrichment score for methylation fractions.
Enrichment score modified from :c... |
93c4c0c1bb1ecd505760b9b9f4fd123375f7751c8ea15e2b42eb9481263cb268 | Python | 10,580 | 236 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
ad032aec64e833a0955375b02197e6a9af87aea966bc84f50ebc9153b35b53f5 | Python | 10,580 | 307 | import networkx as nx
class TestDFS:
@classmethod
def setup_class(cls):
# simple graph
G = nx.Graph()
G.add_edges_from([(0, 1), (1, 2), (1, 3), (2, 4), (3, 0), (0, 4)])
cls.G = G
# simple graph, disconnected
D = nx.Graph()
D.add_edges_from([(0, 1), (2, 3... |
7bacd08c3179af3631702f8d5f54887da9a4aee547fa62d3e889a8dedd00af1e | Python | 10,581 | 243 | """_stats.py - generic statistics helpers shared by the analysis scripts."""
import numpy as np
from scipy import stats
def fnum(x):
"""Tolerant float coercion: try float(x), return NaN on any failure."""
try:
return float(x)
except (TypeError, ValueError):
return float("nan")
def pct_de... |
8bc9bda0664c07486a8d9aef12316ff4acaaf83daf80dc6d963947850eb11a34 | Python | 10,581 | 303 | # -*- coding: utf-8 -*-
"""
Created on Thu Feb 22 11:38:51 2018
@author: jrosenstein
Functions to read Bruker .d data analysis directories. This uses Windows
Component Object Model (COM) interfaces and will not run on other operating systems.
This requires installing Bruker CompassXtract.
Tested with CompassXtrac... |
e743388cf59291ffcde4cdd1aeaeb2216033176323935c4426845dd6280a8e1b | Python | 10,583 | 272 | import torch
from torch import nn
from torch.nn import functional as F
from torch_geometric.nn import MessagePassing, global_mean_pool
from torch_geometric.utils import degree, dense_to_sparse
from torch_geometric.nn import ECConv
from torch_scatter import scatter_add
def _make_block_diag(mats, mat_sizes):
block_d... |
419364b71953f308417ba17f24247362a6951ff48b556a7657e1a6246bace557 | Python | 10,589 | 220 | """Tests for project serializers."""
import pytest
from django.db import connection
from django.test import TestCase
from django.test.utils import CaptureQueriesContext
from projects.serializers import ControlTagWeightSerializer, ProjectSerializer
from projects.tests.factories import ProjectFactory
from rest_framework... |
d2f1de3a23620678a532bb5d9b4ae77d9eea90b82ed3e300e482896cd8779e6a | Python | 10,598 | 314 | from abc import abstractmethod
from enum import Enum
from typing import (
Any,
Dict,
Optional,
Tuple,
TYPE_CHECKING,
Union,
)
from galaxy.util.dictifiable import UsesDictVisibleKeys
from galaxy.util.odict import odict
from .parser import ensure_tool_conf_item
if TYPE_CHECKING:
from galaxy.... |
5738f31dc4411207e1dfacc9062bde8491171ddd61904be0bf709ceb8d193485 | Python | 10,609 | 262 | # -*- coding:utf-8 -*-
__author__ = 'yangjian'
"""
"""
import random
import numpy as np
import pandas as pd
import pytest
from sklearn import manifold
from sklearn.metrics import roc_auc_score, mean_squared_error, f1_score
from sklearn.model_selection import train_test_split
from deeptables.datasets import dsutils
f... |
221aae1b52f0ed40911b4356e4eae51b990b6dd8b9e4c4c3d60cc1edabec5ea9 | Python | 10,610 | 261 | from __future__ import annotations
from collections.abc import Callable, Sequence
import dask.array as da
import numpy as np
import pytest
from pytest_mock import MockerFixture
from squidpy._constants._pkg_constants import Key
from squidpy.im import (
ImageContainer,
SegmentationCustom,
SegmentationWater... |
c40c1336013fd2254d2b53417c4fd6528d449089c011b9ccf0c414524a627370 | Python | 10,614 | 329 | import pandas as pd
import numpy as np
import os
import shutil
from DL.DNN.DNN import DNN;
from DL.FDR.FDR_control import FDR_control;
from causal.DegenerateGaussianScore import DegenerateGaussianScore
import networkx as nx
import scipy.stats
dataFileName = "MircobiomeBacteriaBMI.txt";
dataFolderPath = "data/BMI";
... |
5d8c8fb839312f80981709e94dd53fa83e06c9da6a8224402093b708740dfe6e | Python | 10,617 | 340 | import pytest
import networkx as nx
from networkx.algorithms.community import (
greedy_modularity_communities,
naive_greedy_modularity_communities,
)
@pytest.mark.parametrize(
"func", (greedy_modularity_communities, naive_greedy_modularity_communities)
)
def test_modularity_communities(func):
G = nx.... |
922d8f1c2e753fb1504a78ebb57ad6a8a59568a6c44477939332bbae4de6844f | Python | 10,619 | 391 | # -*- coding: utf-8 -*-
"""
Post processing used throughout our model building process.
Some of these functions are no longer used for our final model
"""
import cv2 as cv
import numpy as np
from matplotlib import pyplot as plt
from scipy.interpolate import splev, splprep
##############################
def find_are... |
4213524866825269a5db48d24f5d7cc349a0534513cb793861aeb64aacbdbf4e | Python | 10,630 | 242 | # -*- coding: utf-8 -*-
"""
Functions to detect spots in images
The main routine :func:`detectCells` uses a difference of gaussian filter (see
:mod:`~ClearMap.ImageProcessing.Filter`) followed by a peak detection step.
Example:
>>> import os
>>> import ClearMap.IO as io
>>> import ClearMap.Settings as... |
dba8bbd840e0a9be5bb902ea9685a52805d91b985dbc43d5c78eea4dc04dadb5 | Python | 10,630 | 288 | #!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# pyre-strict
from __future__ import annotations
from copy import deepcopy
from typing import TYPE_CHECKING
from a... |
e52676fd7c8c9b9570287132eedeb7f1dbe5d0d9cf7e94e51fd15e38742c393d | Python | 10,631 | 274 | # -*- coding: utf-8 -*-
"""
Created on 2020.05.19
@author: Jiahua Rao, Weiming Li, Hui Yang, Jiancong Xie
Code based on:
Errica et al "A Fair Comparison of Graph Neural Networks for Graph Classification" -> https://github.com/diningphil/gnn-comparison
"""
import os
import pandas as pd
import numpy as np
import copy
... |
733743db95dda98797eaa33bd505c63783a140d9901a5c3ef87e140dc8e78a67 | Python | 10,638 | 217 | import scipy
from similarity_measures import dissimilarity_euclidean, dissimilarity_pearson
import matplotlib.pyplot as plt
# sorted by presentation condition
#classes = ['class-F', 'class-M', 'class-C', 'class-H', 'class-F', 'class-M', 'class-C', 'class-H', 'class-F', 'class-M', 'class-C', 'class-H']
#types = ['type-... |
e70868ea987048e1c04a2721a9e05c3b5ed02ec7ecd9f737146e9b3dbf401889 | Python | 10,643 | 336 | # -*- coding: utf-8 -*-
#
# autoreject documentation build configuration file, created by
# sphinx-quickstart on Mon May 23 16:22:52 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
... |
c73d7ff4e19d1c0d7fd833d0343719597d09cc7a81080fa64bc0959c69699501 | Python | 10,648 | 328 | import pandas as pd
import numpy as np
import os
import shutil
from DL.DNN.DNN import DNN;
from DL.FDR.FDR_control import FDR_control;
from causal.DegenerateGaussianScore import DegenerateGaussianScore
import networkx as nx
import scipy.stats
dataFileName = "BRCADataPM50.txt";
dataFolderPath = "data/BRCA";
# In[3]... |
88d399d2249731a79fb2651e63452d0a0d2d54bbafca2b0b9eef691a8690f851 | Python | 10,654 | 300 | # ## ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
#
# See the COPYING file distributed along with the smile package for the
# copyright and license terms.
#
# ## ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
from .video import WidgetState
from kivy.uix.wid... |
799963d61326f7caac6b8792239c2d96089112a0baf16317029b0e39be9cec50 | Python | 10,658 | 293 | # -*- coding: utf-8 -*-
"""
LocalStatistics
===============
Module provides functions to calculate local data and statistics of an image
and apply a function to those. It is useful for local and adaptive image
processing of large 3d images.
Note
----
The module provides ways to speed up the local statistics by only... |
08552ae42513ec8c0953807e30e5080cd1f806e6b1477b91ff8a88b741fc97e9 | Python | 10,661 | 216 | # -*- coding:utf-8 -*-
import collections
import os
from ..utils import consts
from . import deepnets as deepnets
class ModelConfig(collections.namedtuple('ModelConfig',
['name',
'nets',
'cate... |
bd57a88acc35573c65cb0b42f7908b85ec4a5af8af270f12e32872fccc1cd8e1 | Python | 10,667 | 272 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
c97120cbcfa08820cd4c3afa8d628f140b154684a7c3c4a86c5ae7cb047287d8 | Python | 10,683 | 240 | #!/usr/bin/env python
#
# Copyright (c) 2017 10X Genomics, Inc. All rights reserved.
#
import cellranger.analysis.io as analysis_io
import cellranger.analysis.constants as analysis_constants
import cellranger.matrix as cr_matrix
from cellranger.analysis.bhtsne import TSNE
import cellranger.analysis.clustering as cr_c... |
d9acba6936fbd032191032e941d71511eca59724702162eb40b33197485d8cd3 | Python | 10,691 | 285 | import json
import pytest
from zarr._storage.store import meta_root
from zarr.attrs import Attributes
from zarr.storage import KVStore
from zarr._storage.v3 import KVStoreV3
from zarr.tests.util import CountingDict, CountingDictV3
@pytest.fixture(params=[2, 3])
def zarr_version(request):
return request.param
... |
f162e7e00aa816a43c945b3f3837c99440d5c5c4485ba81a6c4b19a3d58fe2be | Python | 10,691 | 274 | """
Deterministic subqueries of a probabilistic query.
A subquery whose relations are all deterministic is the same relation in
every possible world. It can be replaced by a fresh deterministic
relation, defined by the subquery's relational algebra expression, which
a lifted solver then handles like any other determin... |
5573ad20fb786cdeb0b09bbdaf73fe5782b2289e574a8cbe7116d3bd996c8671 | Python | 10,704 | 324 | import torch.nn as nn
import torch.nn.functional as F
import torch
from torch.autograd import Variable
import numpy as np
def weights_init_normal(m):
classname = m.__class__.__name__
if classname.find("Conv") != -1:
torch.nn.init.normal_(m.weight.data, 0.0, 0.02)
elif classname.find("BatchNorm2d")... |
19038abb3a855fdb1c723844ba1539cef09324e8d5dcb3509441d20bd7dea59e | Python | 10,714 | 283 | # Copyright (c) MONAI Consortium
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, so... |
731a00380fc46a15d01c5b05691a29cfa729de1e6c3270fb0ff8acab8fc4b962 | Python | 10,714 | 340 | from itertools import combinations
import pytest
import networkx as nx
def path_graph():
"""Return a path graph of length three."""
G = nx.path_graph(3, create_using=nx.DiGraph)
G.graph["name"] = "path"
nx.freeze(G)
return G
def fork_graph():
"""Return a three node fork graph."""
G = n... |
ee2b64c34ac1a967abe15fabbaf90d64d028b63a94e278ccb55a3d56297bbfce | Python | 10,716 | 317 | """Optimisers simplifying and pushing column renamings."""
from itertools import chain
from nl_expr import expression_walker as ew
from nl_expr.expressions import Constant
from ..relational_algebra import (
ColumnStr,
ExtendedProjection,
FullOuterNaturalJoin,
FunctionApplicationListMember,
GroupBy... |
cb3f1359bfbb292957bf2ab3a6be204ea325da541e8b43dede815fd2bb2cbb60 | Python | 10,718 | 287 | """
Catalog of the predicates of an engine.
:func:`predicate_catalog` reads the predicates the engine has, each
time it is called, so that the relations and the rules added during the
session are in it as soon as they exist: the relations stored in the
engine, its rules, those of the session, the relations loaded with... |
e30b9565f49c0bd261d1e539fdc9cb6c3968fff9f7dca94c441723039de61c28 | Python | 10,724 | 201 | from data.load import get_context_set
import define_models as define
from utils import checkattr
def visdom_name(args):
'''Get name for graph in visdom from [args].'''
iCaRL = (checkattr(args, 'prototypes') and checkattr(args, 'add_buffer') and checkattr(args, 'bce')
and checkattr(args, 'bce_dist... |
13c470df90564ed7752cffca03e30563fa050333f8b12c4199532c5597c0c1bd | Python | 10,727 | 234 | from __future__ import annotations
from collections.abc import Sequence
import numpy as np
import pandas as pd
import pytest
from anndata import AnnData
from pytest_mock import MockerFixture
from squidpy.im._container import ImageContainer
from squidpy.im._feature import calculate_image_features
from tests.conftest ... |
89f04aceb2a34737cc83683d04a4975582efb846f28103e9f6b5d1e1c2bdf50f | Python | 10,727 | 306 | import pytest
import networkx as nx
from networkx.algorithms.approximation.steinertree import (
_remove_nonterminal_leaves,
metric_closure,
steiner_tree,
)
from networkx.utils import edges_equal
@pytest.fixture(params=["kou", "mehlhorn"])
def method(request):
return request.param
class TestSteinerT... |
ebbf305ccb816024c30659a03d98240ff0eb34a9ac38ab49732cf70a5434b9c1 | Python | 10,729 | 323 | #!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# pyre-strict
from abc import ABC, abstractmethod
from typing import TypeVar
import numpy as np
import numpy.typing... |
cf333205995186a0f73eb590193f75ea4628067e8830c8a380319a38a3b70ffc | Python | 10,731 | 261 | """
This implements reference "metadata" operations for single species and barnyard references.
The names for the contigs in the reference are formated as either: "chr<XXX>" or "<species>_chr<XXX>".
This operates on a file, "contigs.json" found in the reference fasta directory that describes
the layout.
Copyright (c) ... |
8af7fc5aedf4b11bff6bc8fe17a4ef12c13a3393fc331713b95003f8d2de8d80 | Python | 10,737 | 201 | from data.load import get_context_set
from models import define_models as define
from utils import checkattr
def visdom_name(args):
'''Get name for graph in visdom from [args].'''
iCaRL = (checkattr(args, 'prototypes') and checkattr(args, 'add_buffer') and checkattr(args, 'bce')
and checkattr(arg... |
f528bc131c04a6c2fd99bf113ca91905fc1f82f67bcaf871d18892f6e4213992 | Python | 10,738 | 336 | # -*- coding: utf-8 -*-
"""
###################################################################
Design of experiments module for initializing EDBO
###################################################################
Methods are designed to work with the edbo.utils.Data objects.
These objects are created when for examp... |
073548827e64331358884e168908cdc4c81d7dbc1549123d7b3a073eb6be7ab8 | Python | 10,739 | 356 | # test_gapped_kmer.py
# Contact: Jacob Schreiber <jmschreiber91@gmail.com>
import numpy
import scipy.sparse
import pytest
from modiscolite.gapped_kmer import _extract_gkmers
from modiscolite.gapped_kmer import _seqlet_to_gkmers
from modiscolite.core import Seqlet
from .synthetic import random_track_set
from .synthe... |
96fe6b576ef70d7a040b5004fb710689eeb74958c8ab1ec276a51dbf62826b82 | Python | 10,740 | 259 | #!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# pyre-strict
"""
References
.. [Daulton2020qehvi]
S. Daulton, M. Balandat, and E. Bakshy. Differentiable Expec... |
f8200ab0313e59db9b0239414992f1edbd1eed629e9da346c16bc62c3105d533 | Python | 10,746 | 329 | from __future__ import absolute_import
try:
from collections.abc import Mapping, MutableMapping
except ImportError:
from collections import Mapping, MutableMapping
try:
from threading import RLock
except ImportError: # Platform-specific: No threads available
class RLock:
def __enter__(self):
... |
bf8f286e55bda7b78691269bf9879bd30b6db766411925942965dfe81a57aed5 | Python | 10,749 | 257 | #!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# pyre-strict
"""Tests for skip_runners_and_metrics functionality with auxiliary experiments."""
from ax.core.arm i... |
058ca63c076e1989bb0fda049913761e85ecc4b0128685db2f89e5edc21ab121 | Python | 10,752 | 216 | import itertools
import numpy as np
import pandas as pd
pd.set_option("compute.use_numexpr", False)
import tenkit.stats as tk_stats
import sys
import cellranger.feature.utils as feature_utils
import cellranger.stats as cr_stats
UMI_NUM_TRIES = 10 # Number of initial points to try for GMM-fitting
UMI_MIX_INIT_SD = 0.25... |
ee5f6e499c98b6edce89e42335f1cc4d7bde108c66c09fd8bb13341a6f292c3b | Python | 10,757 | 264 | # Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# pyre-strict
import json
import torch
from ax.adapter.registry import Generators
from ax.analysis.plotly.objective_p_feasible_frontier im... |
efef19f41ecbe9d0c72a28c9857661325a31bcd87da63de72140fbd8c52bcfc3 | Python | 10,761 | 272 | import jinja2
import os
import shutil
import numpy as np
from collections import defaultdict
# Import Brian2 modules
from brian2.devices.device import all_devices, Device
from brian2.utils.logger import get_logger
from brian2lava.utils.writer import PyWriter
from weakref import WeakKeyDictionary
import sys
__all__ = ... |
c9e97970e0fd9f89ba8553489b021cbcce4edd7c53a4656ceb23fc82218ba885 | Python | 10,779 | 294 | import argparse
import os
import numpy as np
import math
import itertools
import torchvision.transforms as transforms
from torchvision.utils import save_image
from torch.utils.data import DataLoader
from torchvision import datasets
from torch.autograd import Variable
import torch.nn as nn
import torch.nn.functional ... |
76b103b3f3a7681c7899708396c41fca16f9d8d168ad4563a1b9f0a920496e54 | Python | 10,780 | 287 | #!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# pyre-strict
import warnings
from ax.adapter.registry import Generators
from ax.core.types import TParameterizatio... |
502e4bae49cf04adc7a2fb43b97362e6532c8201c01d6727bb9c48abd6f80b22 | Python | 10,782 | 307 | import ast
import html
import io
import uuid as _uuid
import zipfile
from typing import (
Optional,
)
import yaml
from galaxy.datatypes.binary import CompressedZipArchive
from galaxy.datatypes.metadata import MetadataElement
from galaxy.datatypes.protocols import (
DatasetProtocol,
HasMetadata,
)
from gal... |
05e9f014151463b86012a32b368358b01ccb3a6a2e2ea7d3c7161523af93128b | Python | 10,787 | 325 | from copy import deepcopy
import numpy as np
class AABB(object):
def __init__(self, lb, ub):
self._limits = np.asarray((lb, ub), dtype=float).T
self._limits.setflags(write=False)
self._lb = self._limits[:, 0]
self._ub = self._limits[:, 1]
@property
def lb(self):
... |
a4f378c2e96b225c769403b7616102e33d37a0eae800ffed8134d082ab781fcd | Python | 10,798 | 280 | # Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# pyre-strict
from __future__ import annotations
from collections.abc import Callable
from logging import Logger
from ax.adapter.base imp... |
4c48b80e7df4fb689932b1995916e464352d681ad90ff96258809ac5e6e03a0f | Python | 10,806 | 279 | """This file and its contents are licensed under the Apache License 2.0. Please see the included NOTICE for
copyright information and LICENSE for a copy of the license.
"""
import json
import threading
import zipfile
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
import data_export.mixins
import ... |
cf678926a7eae7f55fb4b2d7807f02b3ed3f21b9b91614a9269a2940d240dff6 | Python | 10,807 | 352 | import enum
from itertools import chain
from typing import List, Set, Tuple, Type
class Entity:
def __init__(self, sent_id: int, start: int, end: int, tag: str):
self.sent_id = sent_id
self.start = start
self.end = end
self.tag = tag
def __repr__(self):
return '({}, {... |
3b1e69777ca828d820e200e531a8cfbc377dabc16d4e6c6b4e5342e2b635b90c | Python | 10,822 | 271 | """Tests for the cache_labels action."""
import pytest
from data_manager.actions.cache_labels import cache_labels_job, extract_labels
from django.contrib.auth import get_user_model
from projects.models import Project
from tasks.models import Annotation, Prediction, Task
@pytest.mark.django_db
@pytest.mark.parametriz... |
8c815d6292616b8bb1192ce481affac3c64065d06842ac40ad2b3095abdd9f41 | Python | 10,823 | 284 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
(probabilistic) Count Factorization.
Essentially a probabilistic version of NMF or factor analysis
Created on Tue Apr 13 17:16:22 2021
@author: townesf
"""
import numpy as np
import tensorflow as tf
import tensorflow_probability as tfp
from os import path
from scipy... |
107f47cfd40bb8758eb73cb68cdd3745034e9a584ab02fca0a58a2e66ab0fd75 | Python | 10,825 | 332 | '''
'''
# Anwar O. Nunez-Elizalde (Jan, 2016)
#
# Updates:
# Anwar O. Nunez-Elizalde (Apr, 2020)
#
#
from PIL import Image
import numpy as np
from moten.utils import iterator_func
from moten.colorspace import rgb2lab
def video_buffer(video_file, nimages=np.inf):
'''Generator for a video file.
Yields individ... |
dadb6c297ac1b4b47b78e26531c8114e234df0baa6798b6590501be037fa129c | Python | 10,828 | 319 | import os
import torch
from ogb.nodeproppred import NodePropPredDataset
from ogb.nodeproppred import Evaluator as NodeEvaluator
from ogb.graphproppred import GraphPropPredDataset
from ogb.linkproppred import LinkPropPredDataset
from cogdl.data import Dataset, Graph, DataLoader
from cogdl.utils import CrossEntropyLoss... |
533be5fb9fcab4e7e81ac85eab4dcdcd1191055c29b28e355a8f21405df8b577 | Python | 10,831 | 309 | """
Shortest augmenting path algorithm for maximum flow problems.
"""
from collections import deque
import networkx as nx
from .edmondskarp import edmonds_karp_core
from .utils import CurrentEdge, build_residual_network
__all__ = ["shortest_augmenting_path"]
def shortest_augmenting_path_impl(G, s, t, capacity, re... |
fb83a8f5d40f791d626f120debd9e290b9abcd9b62e9c9e30c6596f490bf8128 | Python | 10,837 | 290 | # -*- coding: utf-8 -*-
"""
Created on Mon Dec 2 14:28:44 2019
@author: aaussel
"""
from brian2 import *
from scipy import signal
from cells.RS_FEF import *
from cells.FS_FEF import *
from cells.SI_FEF import *
from cells.VIP_FEF import *
def generate_deepSI_and_gran_layers(theta_phase,N_SI,N_RS_gran,N_SI_gran,run... |
0ae0e837336b2f8a63ccf104a34c1b161f15ca639df0c59e937aea984b6b1796 | Python | 10,839 | 268 | # Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
d6eb71fa0ca787d5d68f5211c4ce87d0106edd1330a95cc6b0ce46d1ccef3563 | Python | 10,845 | 234 | import logging
import sys
import timeit
from tensorflow.keras.utils import OrderedEnqueuer
from maxatac.utilities.constants import TRAIN_MONITOR, INPUT_LENGTH
from maxatac.utilities.system_tools import Mute
with Mute():
from maxatac.utilities.callbacks import get_callbacks
from maxatac.utilities.training_too... |
2fed9b31d18d2cf9f6c63c0545c5bb77c66bd9acbcaa5f26003a08d2b91e13b0 | Python | 10,850 | 274 | """This file and its contents are licensed under the Apache License 2.0. Please see the included NOTICE for copyright information and LICENSE for a copy of the license."""
import inspect
import logging
import os
import time
from core.permissions import ViewClassPermission, all_permissions
from core.utils.common impor... |
c52cea4373d953414b078c354f044fb1ed4f0ad496bb962403b43f6116dd1490 | Python | 10,855 | 384 | #!/usr/bin/python
# wilson_cowan.py by Patrick D Roberts (2022)
# Neural mass model of similar to Wilson-Cowan model for 2-state activity:
# Wilson, H., and Cowan, J. (1972). Excitatory and inhibitory interactions in
# localized populations of model neurons. Biophysical Journal 12. doi: 10.1016/S0006-3495(72)86068-5... |
6f5fbe067c00021fae21dbaa453082390f99c7ba23a5df3f25333ac7d7e37c27 | Python | 10,856 | 228 | # Copyright (c) MONAI Consortium
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, so... |
048f1b8e46c8bbb2049e303f5daecb5c8d1b41947ff539a96b6225dc3a9347c4 | Python | 10,862 | 238 | import numpy as np
import pickle
import torch
from torch.utils import data
from torch.utils.data.dataset import TensorDataset
from torch.utils.data import DataLoader
from torch.nn.utils.rnn import pad_sequence
from sklearn.preprocessing import StandardScaler
torch.set_default_dtype(torch.float64)
# used in load_dat... |
bd1fae3d8d1788aa48b52fa1869e4ab9b10fbf15e9cbfad91e232529a1b5d027 | Python | 10,864 | 293 | # Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# pyre-strict
from ax.analysis.plotly.top_surfaces import TopSurfacesAnalysis
from ax.api.client import Client
from ax.api.configs import Ch... |
3bc8433eb9157c1e1717a5273df209ad570b15dc4245b3a4995a17231c1399d4 | Python | 10,869 | 234 | '''
The main script to train PIGNPI, baseline or GN+ to learn pairwise force
'''
import os
os.environ["CUDA_DEVICE_ORDER"]="PCI_BUS_ID"
os.environ["CUDA_VISIBLE_DEVICES"] = "0" # change the GPU ID
import numpy as np
import torch
torch.set_num_threads(2)
import pickle as pkl
from torch.optim import Adam
from tqdm impo... |
842ecce0ebdcacc9b33adf9c187b48b75764e8851b6f0a7f8508bf7c8d992ebd | Python | 10,872 | 503 | import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
data=pd.read_csv('G:\研究生\帅春燕\充电安全识别\程序\current\\test1.csv',engine = 'python')
data1=data.values
(row,col)=data1.shape
# Nsteps length arrays empirical means and standard deviations of both
fig, [[ax0,ax1,ax2,ax3,ax4],[ax5,ax6,ax7,ax8,... |
75cf9f15b26867958ab17ba779dd0fefe6bc9538322b484649d986c69e74be51 | Python | 10,875 | 354 | import warnings
from .backend import get_backend
def l2_neg_loss(y_true, y_pred):
"""L2 negative loss, computed for multiple predictions.
Parameters
----------
y_true : array or Tensor of shape (n_samples, n_targets)
Ground truth.
y_pred : array or Tensor of shape (n_predictions, n_sampl... |
c63fea65a81a6e4f063c1df3ee30c474524a7adf6c594fcf0f4058cacb13e56c | Python | 10,880 | 338 | import abc
import re
import string
from enum import Enum
from typing import (
NamedTuple,
Optional,
Union,
)
from galaxy.util.bunch import Bunch
class ComponentBy(str, Enum):
ID = "id"
XPATH = "xpath"
CSS_SELECTOR = "css selector"
LABEL = "label"
TEXT = "text"
class LocatorT(NamedTu... |
21f73f89cb6aecbc51181d950c03f86b10b363b207fc2d870811e107ae10f554 | Python | 10,893 | 241 | from sklearn.compose import ColumnTransformer
from sklearn.pipeline import _name_estimators
class ColumnTransformerNoStack(ColumnTransformer):
"""Applies transformers to columns of an array, and does not stack them.
This estimator allows different columns or column subsets of the input to
be transformed ... |
b03d75e95119f62d86d7f27db9171b662408bca309cac693ac77a9d14ba634b0 | Python | 10,895 | 257 | # Copyright 2019, Mukesh Mithrakumar. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... |
40c140d3f9a2e28fc2fef6dfebc6fef811822039f33d6204725ddb92e23559dd | Python | 10,898 | 233 | from __future__ import division
from __future__ import print_function
import numpy as np
import scipy.sparse as sp
from ..utility import preprocessing
np.random.seed(123)
class EdgeMinibatchIterator(object):
""" This minibatch iterator iterates over batches of sampled edges or
random pairs of ... |
2f5ced5a38d0c1f6215e5fa0054a09be3bf6fb2caef4da45f22c28a1eee35253 | Python | 10,899 | 304 | """Tests of the tables an engine keeps to start without finding them again."""
import nibabel as nib
import numpy as np
import pytest
from neurolang_apps.utils import engine_cache, engine_registry
PEAKS = [
(6.0, 12.0, 3.0, 7), # the centre of the voxel (2, 4, 1)
(7.0, 12.0, 3.0, 8), # 1 mm from it
(... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.