贪心算法应用:最小反馈顶点集问题详解

article/2025/6/29 7:50:00

在这里插入图片描述

贪心算法应用:最小反馈顶点集问题详解

1. 问题定义与背景

1.1 反馈顶点集定义

反馈顶点集(Feedback Vertex Set, FVS)是指在一个有向图中,删除该集合中的所有顶点后,图中将不再存在任何有向环。换句话说,反馈顶点集是破坏图中所有环所需删除的顶点集合。

1.2 最小反馈顶点集问题

最小反馈顶点集问题是指在一个给定的有向图中,寻找一个最小的反馈顶点集,即包含顶点数量最少的反馈顶点集。这是一个经典的NP难问题,在实际应用中有着广泛的需求。

1.3 应用场景

  • 死锁检测与预防:在操作系统中识别和打破进程间的循环等待
  • 电路设计:避免逻辑电路中的反馈循环
  • 生物信息学:分析基因调控网络
  • 软件工程:分析程序控制流图中的循环结构

2. 贪心算法原理

2.1 贪心算法基本思想

贪心算法是一种在每一步选择中都采取当前状态下最优的选择,从而希望导致结果是全局最优的算法策略。对于最小反馈顶点集问题,贪心算法的基本思路是:

  1. 识别图中最有可能破坏多个环的顶点
  2. 将该顶点加入反馈顶点集
  3. 从图中移除该顶点及其相关边
  4. 重复上述过程直到图中不再有环

2.2 贪心策略选择

常见的贪心策略包括:

  • 最大度数优先:选择当前图中度数最大的顶点
  • 最大环参与度:选择参与最多环的顶点
  • 权重策略:在有顶点权重的情况下,选择权重与度数比最优的顶点

3. Java实现详细解析

3.1 图的数据结构表示

我们首先需要定义图的表示方式。在Java中,可以使用邻接表来表示有向图。

import java.util.*;public class DirectedGraph {private Map<Integer, List<Integer>> adjacencyList;private Set<Integer> vertices;public DirectedGraph() {this.adjacencyList = new HashMap<>();this.vertices = new HashSet<>();}public void addVertex(int vertex) {vertices.add(vertex);adjacencyList.putIfAbsent(vertex, new ArrayList<>());}public void addEdge(int from, int to) {addVertex(from);addVertex(to);adjacencyList.get(from).add(to);}public List<Integer> getNeighbors(int vertex) {return adjacencyList.getOrDefault(vertex, new ArrayList<>());}public Set<Integer> getVertices() {return new HashSet<>(vertices);}public DirectedGraph copy() {DirectedGraph copy = new DirectedGraph();for (int v : vertices) {for (int neighbor : adjacencyList.get(v)) {copy.addEdge(v, neighbor);}}return copy;}public void removeVertex(int vertex) {vertices.remove(vertex);adjacencyList.remove(vertex);for (List<Integer> neighbors : adjacencyList.values()) {neighbors.removeIf(v -> v == vertex);}}
}

3.2 环检测实现

在实现贪心算法前,我们需要能够检测图中是否存在环。这里使用深度优先搜索(DFS)来实现环检测。

public boolean hasCycle() {Set<Integer> visited = new HashSet<>();Set<Integer> recursionStack = new HashSet<>();for (int vertex : vertices) {if (!visited.contains(vertex) && hasCycleUtil(vertex, visited, recursionStack)) {return true;}}return false;
}private boolean hasCycleUtil(int vertex, Set<Integer> visited, Set<Integer> recursionStack) {visited.add(vertex);recursionStack.add(vertex);for (int neighbor : adjacencyList.getOrDefault(vertex, new ArrayList<>())) {if (!visited.contains(neighbor)) {if (hasCycleUtil(neighbor, visited, recursionStack)) {return true;}} else if (recursionStack.contains(neighbor)) {return true;}}recursionStack.remove(vertex);return false;
}

3.3 贪心算法实现

基于最大度数优先策略的贪心算法实现:

public Set<Integer> greedyFVS() {Set<Integer> fvs = new HashSet<>();DirectedGraph graphCopy = this.copy();while (graphCopy.hasCycle()) {// 选择当前图中度数最大的顶点int vertexToRemove = selectVertexWithMaxDegree(graphCopy);// 添加到反馈顶点集fvs.add(vertexToRemove);// 从图中移除该顶点graphCopy.removeVertex(vertexToRemove);}return fvs;
}private int selectVertexWithMaxDegree(DirectedGraph graph) {int maxDegree = -1;int selectedVertex = -1;for (int vertex : graph.getVertices()) {int outDegree = graph.getNeighbors(vertex).size();int inDegree = 0;// 计算入度for (int v : graph.getVertices()) {if (graph.getNeighbors(v).contains(vertex)) {inDegree++;}}int totalDegree = outDegree + inDegree;if (totalDegree > maxDegree) {maxDegree = totalDegree;selectedVertex = vertex;}}return selectedVertex;
}

3.4 改进的贪心策略实现

更复杂的贪心策略可以考虑顶点参与环的数量:

public Set<Integer> improvedGreedyFVS() {Set<Integer> fvs = new HashSet<>();DirectedGraph graphCopy = this.copy();while (graphCopy.hasCycle()) {// 选择参与最多环的顶点int vertexToRemove = selectVertexInMostCycles(graphCopy);fvs.add(vertexToRemove);graphCopy.removeVertex(vertexToRemove);}return fvs;
}private int selectVertexInMostCycles(DirectedGraph graph) {Map<Integer, Integer> cycleCount = new HashMap<>();// 初始化所有顶点的环计数for (int vertex : graph.getVertices()) {cycleCount.put(vertex, 0);}// 使用DFS检测环并计数for (int vertex : graph.getVertices()) {Set<Integer> visited = new HashSet<>();Stack<Integer> path = new Stack<>();countCyclesUtil(graph, vertex, visited, path, cycleCount);}// 选择参与最多环的顶点return Collections.max(cycleCount.entrySet(), Map.Entry.comparingByValue()).getKey();
}private void countCyclesUtil(DirectedGraph graph, int vertex, Set<Integer> visited, Stack<Integer> path, Map<Integer, Integer> cycleCount) {if (path.contains(vertex)) {// 发现环,增加路径上所有顶点的计数int index = path.indexOf(vertex);for (int i = index; i < path.size(); i++) {int v = path.get(i);cycleCount.put(v, cycleCount.get(v) + 1);}return;}if (visited.contains(vertex)) {return;}visited.add(vertex);path.push(vertex);for (int neighbor : graph.getNeighbors(vertex)) {countCyclesUtil(graph, neighbor, visited, path, cycleCount);}path.pop();
}

4. 算法分析与优化

4.1 时间复杂度分析

  • 基本贪心算法:

    • 每次环检测:O(V+E)
    • 每次选择顶点:O(V^2)(因为要计算每个顶点的度数)
    • 最坏情况下需要移除O(V)个顶点
    • 总时间复杂度:O(V^3 + V*E)
  • 改进的贪心算法:

    • 环计数实现较为复杂,最坏情况下为指数时间
    • 实际应用中通常需要限制DFS的深度或使用近似方法

4.2 近似比分析

贪心算法提供的是一种近似解法。对于最小反馈顶点集问题:

  • 基本贪心算法的近似比为O(log n log log n)
  • 更复杂的贪心策略可以达到O(log n)近似比
  • 在特殊类型的图中可能有更好的近似比

4.3 优化策略

  1. 局部搜索优化:在贪心算法得到的解基础上进行局部优化
  2. 混合策略:结合多种贪心策略,选择最优解
  3. 并行计算:并行计算各顶点的环参与度
  4. 启发式剪枝:限制DFS深度或使用随机游走估计环参与度

5. 完整Java实现示例

import java.util.*;
import java.util.stream.Collectors;public class FeedbackVertexSet {public static void main(String[] args) {// 创建示例图DirectedGraph graph = new DirectedGraph();graph.addEdge(1, 2);graph.addEdge(2, 3);graph.addEdge(3, 4);graph.addEdge(4, 1); // 形成环1-2-3-4-1graph.addEdge(2, 5);graph.addEdge(5, 6);graph.addEdge(6, 2); // 形成环2-5-6-2graph.addEdge(7, 8);graph.addEdge(8, 7); // 形成环7-8-7System.out.println("原始图是否有环: " + graph.hasCycle());// 使用基本贪心算法Set<Integer> basicFVS = graph.greedyFVS();System.out.println("基本贪心算法找到的FVS: " + basicFVS);System.out.println("大小: " + basicFVS.size());// 使用改进贪心算法Set<Integer> improvedFVS = graph.improvedGreedyFVS();System.out.println("改进贪心算法找到的FVS: " + improvedFVS);System.out.println("大小: " + improvedFVS.size());// 验证解的正确性DirectedGraph testGraph = graph.copy();for (int v : improvedFVS) {testGraph.removeVertex(v);}System.out.println("移除FVS后图是否有环: " + testGraph.hasCycle());}
}class DirectedGraph {// ... 前面的图实现代码 ...// 添加一个更高效的贪心算法实现public Set<Integer> efficientGreedyFVS() {Set<Integer> fvs = new HashSet<>();DirectedGraph graphCopy = this.copy();// 使用优先队列来高效获取最大度数顶点PriorityQueue<Map.Entry<Integer, Integer>> maxHeap = new PriorityQueue<>((a, b) -> b.getValue() - a.getValue());// 初始化度数表Map<Integer, Integer> degreeMap = new HashMap<>();for (int v : graphCopy.getVertices()) {int degree = graphCopy.getNeighbors(v).size();// 计算入度int inDegree = 0;for (int u : graphCopy.getVertices()) {if (graphCopy.getNeighbors(u).contains(v)) {inDegree++;}}degreeMap.put(v, degree + inDegree);}maxHeap.addAll(degreeMap.entrySet());while (graphCopy.hasCycle()) {if (maxHeap.isEmpty()) break;Map.Entry<Integer, Integer> entry = maxHeap.poll();int vertex = entry.getKey();int currentDegree = degreeMap.getOrDefault(vertex, 0);// 检查度数是否最新(因为图可能已经改变)int actualDegree = graphCopy.getNeighbors(vertex).size();int actualInDegree = 0;for (int u : graphCopy.getVertices()) {if (graphCopy.getNeighbors(u).contains(vertex)) {actualInDegree++;}}int totalDegree = actualDegree + actualInDegree;if (totalDegree < currentDegree) {// 度数已变化,重新插入entry.setValue(totalDegree);maxHeap.add(entry);continue;}// 添加到FVSfvs.add(vertex);// 更新邻居的度数for (int neighbor : graphCopy.getNeighbors(vertex)) {if (degreeMap.containsKey(neighbor)) {degreeMap.put(neighbor, degreeMap.get(neighbor) - 1);}}// 更新指向该顶点的邻居for (int u : graphCopy.getVertices()) {if (graphCopy.getNeighbors(u).contains(vertex)) {if (degreeMap.containsKey(u)) {degreeMap.put(u, degreeMap.get(u) - 1);}}}// 从图中移除顶点graphCopy.removeVertex(vertex);degreeMap.remove(vertex);}return fvs;}// 添加一个基于随机游走的近似环计数方法private int selectVertexInMostCyclesApprox(DirectedGraph graph, int walks, int steps) {Map<Integer, Integer> cycleCount = new HashMap<>();Random random = new Random();List<Integer> vertices = new ArrayList<>(graph.getVertices());for (int v : graph.getVertices()) {cycleCount.put(v, 0);}for (int i = 0; i < walks; i++) {int startVertex = vertices.get(random.nextInt(vertices.size()));int currentVertex = startVertex;Set<Integer> visitedInWalk = new HashSet<>();List<Integer> path = new ArrayList<>();for (int step = 0; step < steps; step++) {List<Integer> neighbors = graph.getNeighbors(currentVertex);if (neighbors.isEmpty()) break;int nextVertex = neighbors.get(random.nextInt(neighbors.size()));if (path.contains(nextVertex)) {// 发现环int index = path.indexOf(nextVertex);for (int j = index; j < path.size(); j++) {int v = path.get(j);cycleCount.put(v, cycleCount.get(v) + 1);}break;}path.add(nextVertex);currentVertex = nextVertex;}}return Collections.max(cycleCount.entrySet(), Map.Entry.comparingByValue()).getKey();}
}

6. 测试与验证

6.1 测试用例设计

为了验证算法的正确性和效率,我们需要设计多种测试用例:

  1. 简单环图:单个环或多个不相交的环
  2. 复杂环图:多个相交的环
  3. 无环图:验证算法不会返回不必要的顶点
  4. 完全图:所有顶点之间都有边
  5. 随机图:随机生成的有向图

6.2 验证方法

  1. 移除返回的反馈顶点集后,检查图中是否确实无环
  2. 比较不同算法得到的解的大小
  3. 测量算法运行时间

6.3 性能测试示例

public class PerformanceTest {public static void main(String[] args) {int[] sizes = {10, 50, 100, 200, 500};for (int size : sizes) {System.out.println("\n测试图大小: " + size);DirectedGraph graph = generateRandomGraph(size, size * 2);long start, end;start = System.currentTimeMillis();Set<Integer> basicFVS = graph.greedyFVS();end = System.currentTimeMillis();System.out.printf("基本贪心算法: %d 顶点, 耗时 %d ms%n", basicFVS.size(), end - start);start = System.currentTimeMillis();Set<Integer> efficientFVS = graph.efficientGreedyFVS();end = System.currentTimeMillis();System.out.printf("高效贪心算法: %d 顶点, 耗时 %d ms%n", efficientFVS.size(), end - start);// 对于大图,改进算法可能太慢,可以跳过if (size <= 100) {start = System.currentTimeMillis();Set<Integer> improvedFVS = graph.improvedGreedyFVS();end = System.currentTimeMillis();System.out.printf("改进贪心算法: %d 顶点, 耗时 %d ms%n", improvedFVS.size(), end - start);}}}private static DirectedGraph generateRandomGraph(int vertexCount, int edgeCount) {DirectedGraph graph = new DirectedGraph();Random random = new Random();for (int i = 0; i < vertexCount; i++) {graph.addVertex(i);}for (int i = 0; i < edgeCount; i++) {int from = random.nextInt(vertexCount);int to = random.nextInt(vertexCount);if (from != to) {graph.addEdge(from, to);}}return graph;}
}

7. 实际应用与扩展

7.1 加权反馈顶点集

在实际应用中,顶点可能有不同的权重,我们需要寻找权重和最小的反馈顶点集:

public Set<Integer> weightedGreedyFVS(Map<Integer, Integer> vertexWeights) {Set<Integer> fvs = new HashSet<>();DirectedGraph graphCopy = this.copy();while (graphCopy.hasCycle()) {// 选择(度数/权重)最大的顶点int vertexToRemove = -1;double maxRatio = -1;for (int vertex : graphCopy.getVertices()) {int outDegree = graphCopy.getNeighbors(vertex).size();int inDegree = 0;for (int v : graphCopy.getVertices()) {if (graphCopy.getNeighbors(v).contains(vertex)) {inDegree++;}}double ratio = (outDegree + inDegree) / (double) vertexWeights.get(vertex);if (ratio > maxRatio) {maxRatio = ratio;vertexToRemove = vertex;}}fvs.add(vertexToRemove);graphCopy.removeVertex(vertexToRemove);}return fvs;
}

7.2 并行化实现

对于大型图,可以并行计算各顶点的环参与度:

public Set<Integer> parallelGreedyFVS() {Set<Integer> fvs = new HashSet<>();DirectedGraph graphCopy = this.copy();ExecutorService executor = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors());while (graphCopy.hasCycle()) {List<Future<VertexCycleCount>> futures = new ArrayList<>();for (int vertex : graphCopy.getVertices()) {futures.add(executor.submit(() -> {int count = countCyclesForVertex(graphCopy, vertex);return new VertexCycleCount(vertex, count);}));}VertexCycleCount best = new VertexCycleCount(-1, -1);for (Future<VertexCycleCount> future : futures) {try {VertexCycleCount current = future.get();if (current.count > best.count) {best = current;}} catch (Exception e) {e.printStackTrace();}}if (best.vertex != -1) {fvs.add(best.vertex);graphCopy.removeVertex(best.vertex);}}executor.shutdown();return fvs;
}private static class VertexCycleCount {int vertex;int count;VertexCycleCount(int vertex, int count) {this.vertex = vertex;this.count = count;}
}private int countCyclesForVertex(DirectedGraph graph, int vertex) {// 简化的环计数实现int count = 0;Set<Integer> visited = new HashSet<>();Stack<Integer> path = new Stack<>();return countCyclesUtil(graph, vertex, visited, path);
}private int countCyclesUtil(DirectedGraph graph, int vertex, Set<Integer> visited, Stack<Integer> path) {if (path.contains(vertex)) {return 1;}if (visited.contains(vertex)) {return 0;}visited.add(vertex);path.push(vertex);int total = 0;for (int neighbor : graph.getNeighbors(vertex)) {total += countCyclesUtil(graph, neighbor, visited, path);}path.pop();return total;
}

8. 总结

最小反馈顶点集问题是一个具有挑战性的NP难问题,贪心算法提供了一种有效的近似解决方案。本文详细介绍了:

  1. 问题的定义和应用背景
  2. 贪心算法的基本原理和多种策略
  3. 完整的Java实现,包括基础和改进版本
  4. 时间复杂度分析和优化策略
  5. 测试验证方法和性能考虑
  6. 实际应用扩展和并行化实现

贪心算法虽然不能保证得到最优解,但在实际应用中通常能提供令人满意的近似解,特别是在处理大规模图数据时。通过选择合适的贪心策略和优化技巧,可以在解的质量和计算效率之间取得良好的平衡。

对于需要更高精度解的场景,可以考虑将贪心算法与其他技术如分支限界、动态规划或元启发式算法结合使用。

更多资源:

https://www.kdocs.cn/l/cvk0eoGYucWA

本文发表于【纪元A梦】!


http://www.hkcw.cn/article/McSeZphbsh.shtml

相关文章

【Doris基础】Apache Doris中的Version概念解析:深入理解数据版本管理机制

目录 引言 1 Version概念基础 1.1 什么是Version 1.2 Version的核心作用 1.3 Version相关核心概念 2 Version工作机制详解 2.1 Version在数据写入流程中的作用 2.2 Version在数据查询流程中的作用 2.3 Version的存储结构 3 Version的进阶特性 3.1 Version的合并与压…

vLLM实战部署embedding、reranker、senseVoice、qwen2.5、qwen3模型

概述 一个开源的支持高并发的高性能大模型推理引擎。在这篇博客有简单提到过。 学习资料&#xff1a;官方文档&#xff0c;官方中文文档&#xff0c;中文文档。 modelscope 通过vLLM&#xff08;或其他平台、框架&#xff09;部署模型前&#xff0c;需要先下载模型。国内一…

Java函数式编程(中)

三、Stream API &#xff08;1&#xff09;创建操作 构建Arrays.stream(数组)根据数组构建Collection.stream()根据集合构建Stream.of(对象1, 对象2, ...)根据对象构建 生成IntStream.range(a, b)根据范围生成&#xff08;含a 不含b&#xff09;IntStream.rangeClosed(a, b)…

16.FreeRTOS

目录 第1章 FreeRTOS 实时操作系统 1.1 认识实时操作系统 1.1.1 裸机的概念 1.1.2 操作系统的概念 1.2 操作系统的分类 1.3 常见的操作系统 1.4 认识实时操作系统 1.4.1 可剥夺型内核与不可剥夺型内核 1.4.2 嵌入式操作系统的作用 1.4.3 嵌入式操作系统的发展 1.4.4…

windows11安装scoop 20250602

详细的 Scoop 安装步骤&#xff1a; 使用国内镜像安装 Scoop 首先&#xff0c;打开 PowerShell&#xff08;右键点击 win按钮&#xff0c;–>终端&#xff0c;Scoop官方不建议用管理员权限安装)&#xff0c;然后执行以下命令&#xff1a; # 设置 Scoop 安装路径 $env:SCOO…

类和对象(一)

一、面向对象 &#xff08;OOP是面向对象的语言的简称&#xff09; Java是⼀⻔纯⾯向对象的语⾔&#xff0c;在⾯向对象的世界⾥&#xff0c;⼀切皆 为对象。⾯向对象是解决问题的⼀种思想&#xff0c;主要依靠对象之间的交互完成⼀件事情。 面向对象——>不关注过程&…

OpenCV4.4.0下载及初步配置(Win11)

目录 OpenCV4.4.0工具下载安装环境变量系统配置 OpenCV4.4.0 工具 系统&#xff1a;Windows 11 下载 OpenCV全版本百度网盘链接&#xff1a;: https://pan.baidu.com/s/15qTzucC6ela3bErdZ285oA?pwdjxuy 提取码: jxuy找到 opencv-4.0.0-vc14_vc15 下载得到 安装 运行op…

QGIS Python脚本开发(入门级)

随着人工智能技术的飞速发展&#xff0c;编程语言和脚本开发正变得前所未有的便捷。在GIS领域&#xff0c;QGIS作为一款卓越的开源地理信息系统软件&#xff0c;凭借其易于下载、界面简洁、功能强大等诸多优势&#xff0c;赢得了全球用户的青睐。更令人兴奋的是&#xff0c;QGI…

【算法】分支限界

一、基本思想 &#xff08;分支限界&#xff0c; 分枝限界&#xff0c; 分支界限 文献不同说法但都是一样的&#xff09; 分支限界法类似于回溯法&#xff0c;也是一种在问题的解空间树上搜索问题解的算法。 但一般情况下&#xff0c;分支限界法与回溯法的求解目标不同。回溯…

【springcloud】快速搭建一套分布式服务springcloudalibaba(四)

第四篇 基于nacos搭建分布式项目 分布式系统日志&#xff08;skywalkinges&#xff09; 项目所需 maven nacos java8 idea git mysql redis skywalking es 本文主要从客户下单时扣减库存的操作&#xff0c;将链路日志模拟出来&#xff0c;网关系统/用户系统/商品系统/订…

设计模式(行为型)-中介者模式

目录 定义 类图结构展示 角色职责详解 模式的优缺点分析 优点 缺点 适用场景 应用实例 与其他模式的结合与拓展 总结 定义 中介者模式的核心思想可以概括为&#xff1a;用一个中介对象来封装一系列的对象交互。这个中介者就像一个通信枢纽&#xff0c;使各对象不需要…

PMOS以及电源转换电路设计

PMOS的使用 5V_EN5V时&#xff0c;PMOS截止&#xff1b; 5V_EN0V时&#xff0c;PMOS导通&#xff1b; 电源转换电路 当Vout0V时&#xff0c;Vg0V, Vgs>Vth, PMOS导通&#xff0c;只有电池供电&#xff1b; 当Vout5V时&#xff0c;Vg4.9V, Vs4.8V?, Vgs<Vth, PMOS截止&am…

本地部署 DeepSeek R1(最新)【从下载、安装、使用和调用一条龙服务】

文章目录 一、安装 Ollama1.1 下载1.2 安装 二、下载 DeepSeek 模型三、使用 DeepSeek3.1 在命令行环境中使用3.2 在第三方软件中使用 一、安装 Ollama 1.1 下载 官方网址&#xff1a;Ollama 官网下载很慢&#xff0c;甚至出现了下载完显示 无法下载&#xff0c;需要授权 目…

数据治理的演变与AI趋势

知识星球&#xff1a;数据书局。打算通过知识星球将这些年积累的知识分享出来&#xff0c;让各位在数据治理、数据分析的路上少走弯路&#xff0c;另外星球也方便动态更新最近的资料&#xff0c;提供各位一起讨论数据的小圈子 1.数据治理的演变 1.1.摘要 数据治理是指组织管…

Fullstack 面试复习笔记:操作系统 / 网络 / HTTP / 设计模式梳理

Fullstack 面试复习笔记&#xff1a;操作系统 / 网络 / HTTP / 设计模式梳理 面试周期就是要根据JD调整准备内容&#xff08;挠头&#xff09;&#xff0c;最近会混合复习针对全栈这块的内容&#xff0c;目前是根据受伤的JD&#xff0c;优先选择一些基础的操作系统、Java、Nod…

【MIMO稳定裕度】基于数据驱动的多输入多输出系统稳定裕度分析

最近一直在忙着写论文&#xff0c;只能说要写一篇高水平论文确实不容易&#xff0c;要一直反复来回修改调整&#xff0c;要求比较高&#xff0c;所以没太有时间和精力写博客&#xff0c;这两天结束了初稿&#xff0c;又正好是假期&#xff0c;出来冒个泡。 本次分享的主题是&am…

Python 训练营打卡 Day 33-神经网络

简单神经网络的流程 1.数据预处理&#xff08;归一化、转换成张量&#xff09; 2.模型的定义 继承nn.Module类 定义每一个层 定义前向传播流程 3.定义损失函数和优化器 4.定义训练过程 5.可视化loss过程 预处理补充&#xff1a; 分类任务中&#xff0c;若标签是整…

TDengine 的 AI 应用实战——电力需求预测

作者&#xff1a; derekchen Demo数据集准备 我们使用公开的UTSD数据集里面的电力需求数据&#xff0c;作为预测算法的数据来源&#xff0c;基于历史数据预测未来若干小时的电力需求。数据集的采集频次为30分钟&#xff0c;单位与时间戳未提供。为了方便演示&#xff0c;按…

【03】完整开发腾讯云播放器SDK的UniApp官方UTS插件——优雅草上架插件市场-卓伊凡

【03】完整开发腾讯云播放器SDK的UniApp官方UTS插件——优雅草上架插件市场-卓伊凡 一、项目背景与转型原因 1.1 原定计划的变更 本系列教程最初规划是开发即构美颜SDK的UTS插件&#xff0c;但由于甲方公司内部战略调整&#xff0c;原项目被迫中止。考虑到&#xff1a; 技术…

(aaai2024) Omni-Kernel Network for Image Restoration

代码&#xff1a;https://github.com/c-yn/OKNet 研究动机&#xff1a;作者认为Transformer模型计算复杂度太高&#xff0c;因此提出了 omni-kernel module &#xff08;OKM&#xff09;&#xff0c;可以有效的学习局部到全局的特征表示。该模块包括&#xff1a;全局、大分支、…