首页
学习
活动
专区
圈层
工具
发布
    • 综合排序
    • 最热优先
    • 最新优先
    时间不限
  • 来自专栏机器视觉工坊

    OpenCV与图像处理(五)

    [0, 0] = src[y - 1, x - 1] neighbours[0, 1] = src[y - 1, x] neighbours[0, 2] = src[y - 1, x + 1] neighbours[0, 3] = src[y, x - 1] neighbours[0, 4] = src[y , x + 1] neighbours[0, 5] = src[y + 1, x - 1] neighbours[0, 6] = src[y + 1, x [0, 0] = src[y - 1, x - 1] neighbours[0, 1] = src[y - 1, x] neighbours[0, 2] = src[y - 1, x + 1] neighbours[0, 3] = src[y, x - 1] neighbours[0, 4] = src[y

    91520发布于 2020-07-28
  • 来自专栏小徐学爬虫

    Regex 无法处理多个模式匹配问题

    ._843_unknown___1278-2120_1_^^neighbours_ID_Bxylanisolvens_NLAE-zl-C182_genome_orf00002_1__ID_Bxylanisolvens_NLAE-zl-C182 ID_Bxylanisolvens_NLAE-zl-G421_genome_orf00003____Bxylanisolvens_NLAE-.._843_unknown___1315-2157_1_^^neighbours_ID_Bxylanisolvens_NLAE-zl-G421 ID_Bxylanisolvens_NLAE-zl-C339_genome_orf00003____Bxylanisolvens_NLAE-.._843_unknown___1084-1926_1_^^neighbours_ID_Bxylanisolvens_NLAE-zl-C339 ID_Bxylanisolvens_NLAE-zl-C182_genome_orf00003____Bxylanisolvens_NLAE-.._843_unknown___1278-2120_1_^^neighbours_ID_Bxylanisolvens_NLAE-zl-C182 ID_Bxylanisolvens_NLAE-zl-G421_genome_orf00003____Bxylanisolvens_NLAE-.._843_unknown___1315-2157_1_^^neighbours_ID_Bxylanisolvens_NLAE-zl-G421

    1K10编辑于 2024-12-05
  • 来自专栏福大大架构师每日一题

    2022-12-18:给定一个长度为n的二维数组graph,代表一张图,graph[i] = {a,b,c,d} 表示i讨厌(a

    Vec<Vec<i32>>) -> bool { let n = graph.len() as i32; let mut uf = UnionFind::new(n); for neighbours in graph.iter() { for i in 1..neighbours.len() as i32 { uf.union(neighbours[(i - 1) as usize], neighbours[i as usize]); } } for i in 0..n { for j in graph[i

    41130编辑于 2023-02-01
  • 来自专栏福大大架构师每日一题

    2022-12-18:给定一个长度为n的二维数组graph,代表一张图, graph[i] = {a,b,c,d} 表示i讨厌(a,b,c,d),讨厌关系为双向

    mut Vec<Vec<i32>>) -> bool { let n = graph.len() as i32; let mut uf = UnionFind::new(n); for neighbours in graph.iter() { for i in 1..neighbours.len() as i32 { uf.union(neighbours[(i - 1 ) as usize], neighbours[i as usize]); } } for i in 0..n { for j in graph[i as usize

    38110编辑于 2022-12-18
  • 来自专栏旅途散记

    Rust vs Go:常用语法对比(七)

    next) seen[next] = true } } } } type Vertex struct { Id int Label string Neighbours : make(map[*Vertex]bool), } } func (v *Vertex) AddNeighbour(w *Vertex) { v.Neighbours[w] = true } (Rc::downgrade(&v2)); v2.borrow_mut().neighbours.push(Rc::downgrade(&v1)); } fn bft( : make(map[*Vertex]bool), } } func (v *Vertex) AddNeighbour(w *Vertex) { v.Neighbours[w] = true } (Rc::downgrade(&v2)); v2.borrow_mut().neighbours.push(Rc::downgrade(&v1)); } fn

    39210编辑于 2023-09-05
  • 来自专栏Python机器学习算法说书人

    用通俗易懂的语言讲解 kNN

    init__(self): self.known_dataset = [] self.unknown_dataset = [] self.nearest_neighbours = [] self.k = 6 self.load() self.find_nearest_neighbours() self.classify def find_nearest_neighbours(self): for unknown_data in self.unknown_dataset: points_and_distances init__(self): self.known_dataset = [] self.unknown_dataset = [] self.nearest_neighbours = [] self.k = 6 self.load() self.find_nearest_neighbours() self.classify

    67610发布于 2019-07-27
  • 来自专栏Dechin的专栏

    Numpy计算近邻表时间对比

    = np.array([], np.int32) else: grid_neighbours = np.array(list(itemgetter _1 = get_neighbours_by_dist(crd, cutoff) time1 = time.time() record_1 = time1 - time0 # Solution 2 time0 = time.time() neighbours_2 = get_neighbours_by_grid(crd, cutoff) time1 = time.time () record_2 = time1 - time0 for pair in neighbours_1: if (np.isin(neighbours_2, pair) .sum(axis=-1) < 2).all(): print (pair) assert neighbours_1.shape == neighbours_2.shape

    40810编辑于 2024-01-10
  • 来自专栏机器学习之旅

    应用:能够快速实现的协同推荐

    操作 #1.1求出目标用户的邻居,及对应的相关程度 def neighbour(userid,user_group = list2user,item_group = list2item): neighbours (): neighbours[user[0]] = 0 neighbours[user[0]] = neighbours[user[0]] + 1 #neighbours = neighbour(userid=2) #1.2就算用户直接的相似程度,这边用的余弦相似度:点积/模的连乘 def similarity(user1,user2): simi = z / math.sqrt(x * y) return simi #1.3计算目标用户与邻居之间的相似度: def N_neighbour(userid,neighbours ,k): neighbour = neighbours.keys() M = [] for user in neighbour: simi = similarity

    44020发布于 2018-08-27
  • 来自专栏技术沉淀

    Numpy模拟生命

    Every cell interacts with its eight neighbours, which are the cells that are directly horizontally, vertically At each step in time, the following transitions occur: Any live cell with fewer than two live neighbours Any live cell with more than three live neighbours dies, as if by overcrowding. Any live cell with two or three live neighbours lives, unchanged, to the next generation. Any dead cell with exactly three live neighbours becomes a live cell.

    54430发布于 2018-06-28
  • 脚本更新--高精度空间转录组cell niches

    Attributes: radius (float): The radius within which neighbours are aggregated. """ def _ Args: radius (float): The distance within which to search for neighbours. geometry from the dataframe multihot = df.drop("geom", axis=1) # Build KDTree to find neighbours within the radius neighbours = KDTree(xy).query_ball_point(xy, r=self.radius) # Aggregate the marks for each point based on its neighbours aggregated = np.stack([multihot.iloc[n].sum(

    20120编辑于 2025-11-05
  • 【POJ】3370 - Halloween treats(抽屉原理 & STL)

    care more about justice than about the number of sweets they get, they want to select a subset of the neighbours test case contains two integers c and n (1 ≤ c ≤ n ≤ 100000), the number of children and the number of neighbours Output For each test case output one line with the indices of the neighbours the children should select

    25810编辑于 2025-08-26
  • 来自专栏运维开发王义杰

    了解有向无环图及其应用

    package main import ( "fmt" ) type Node struct { val int neighbours []*Node } type Graph struct { nodes []*Node } func (g *Graph) AddEdge(from, to *Node) { from.neighbours = append (from.neighbours, to) } func (g *Graph) IsDAG() bool { visited := make(map[*Node]bool) recStack bool) bool { visited[node] = true recStack[node] = true for _, neighbour := range node.neighbours

    2.1K10编辑于 2023-08-10
  • 来自专栏大学生计算机视觉学习DeepLearning

    手指静脉细化算法过程原理解析 以及python实现细化算法

      最后:反复执行 第二步和第四步,不断的进行 左右的细化  直到没有点在可以细化  那么我们就得到了 细化后的骨架结构 现在原理已经解释完毕,那么就来看看python 是如何实现细化算法的 def neighbours (x,y,image): "Return 8-neighbours of image point P1(x,y) img = image x_1, y_1, x1, y1 = x ): n = neighbours + neighbours[0:1] # P2, P3, ... , P8, P9, P2 return sum( (n1, n2) == ( in range(1, columns - 1): # No. of columns P2,P3,P4,P5,P6,P7,P8,P9 = n = neighbours rows - 1): for y in range(1, columns - 1): P2,P3,P4,P5,P6,P7,P8,P9 = n = neighbours

    1.1K40发布于 2018-06-21
  • 来自专栏涛的程序人生

    Go语言生命游戏 GameofLife GOL

    transitions may occur to create the next evolution of the domain: any live cell with fewer than two live neighbours dies any live cell with two or three live neighbours is unaffected any live cell with more than three live neighbours dies any dead cell with exactly three live neighbours becomes alive Consider the image

    1.1K10编辑于 2021-12-06
  • 来自专栏大学生计算机视觉学习DeepLearning

    手指静脉细化算法过程原理解析 以及python实现细化算法

      最后:反复执行 第二步和第四步,不断的进行 左右的细化  直到没有点在可以细化  那么我们就得到了 细化后的骨架结构 现在原理已经解释完毕,那么就来看看python 是如何实现细化算法的 def neighbours (x,y,image): "Return 8-neighbours of image point P1(x,y) img = image x_1, y_1, x1, y1 = x ): n = neighbours + neighbours[0:1] # P2, P3, ... , P8, P9, P2 return sum( (n1, n2) == ( in range(1, columns - 1): # No. of columns P2,P3,P4,P5,P6,P7,P8,P9 = n = neighbours rows - 1): for y in range(1, columns - 1): P2,P3,P4,P5,P6,P7,P8,P9 = n = neighbours

    1.4K50发布于 2018-05-15
  • 来自专栏vincent随笔

    Leetcode 463. Island Perimeter 解题

    ()) return 0; int m = grid.size(); int n = grid[0].size(); int islands = 0, neighbours j] == 1) { islands++; if (i < m - 1 && grid[i + 1][j] == 1) neighbours ++; if (j < n - 1 && grid[i][j + 1] == 1) neighbours++; } return islands * 4 - neighbours * 2; } };

    31610发布于 2021-08-18
  • 来自专栏技术专栏

    2.6 共识机制

    ,要和全网其他同时完成工作量证明的节点竞争最长链,如果发现比自己长的链,则替换掉自己的,基于这个,来完成我们的代码编写 BlockChain def resolve_conflicts(self): neighbours = self.nodes max_len = len(self.chain) new_chain = None for node in neighbours: # 遍历邻居节点,获取他们的链信息

    62610发布于 2018-09-12
  • 来自专栏hsdoifh biuwedsy

    Blockchain and data processing

    If block’s header changes -> block’s ID changes Adding data User’s computer broadcasts data to neighbours it is connected to in the blockchain network Neighbours receive the fact, validate the correctness of its format Neighbours broadcast it to peers they are connected to These peers recursively follow

    51230发布于 2021-05-19
  • 来自专栏拓端tecdat

    Python代码编写辅导:CSC411 Digit Classification

    the characteristics and performance of different classifiers, namely logistic regression, k-nearest neighbours Analysis 作为Machine Learning的三大基础算法 Logistic regression,也就是logistic回归,常用于数据挖掘,疾病自动诊断,经济预测等领域 K-nearest neighbours

    47710编辑于 2022-10-26
  • 来自专栏算法和应用

    泛洪算法过程的终端

    A node begins the process by sending a message to all its neighbours and the neighbours, in the next round forward the message to all the neighbours they did not receive the message from and so on.

    66840发布于 2019-07-18
领券