python 实现模糊聚类

news2024/9/28 13:21:28

python模糊聚类细节与实现

  • 前言
  • 数学逻辑
  • 代码框架
  • Python实现
    • 数据预处理 preProcess
    • 获得相似矩阵 getSimilarityMatrix
    • 获取传递闭包 transitiveClosure
    • 模糊运算 fuzzMatrixProduct
    • 实现聚类 mergeProcess
  • 实例演示 ![在这里插入图片描述](https://img-blog.csdnimg.cn/b062c59c28294c59918872e8bdcd5fa5.png#pic_center)
  • 完整代码
  • 代码细节

前言

作为数学系的学生,我对于模糊数学并不是很认可,一方面确实是知识的缺失,并没有真正去接触到其底层支持机制,目前我并不认为它是对的或是错的;另一方面,大学时间有限,对于模糊数学我并没有花过多精力在上面。该文的写作来源于好友的毕业需求。

数学逻辑

数据预处理(归一化) ==>相似关系建立 ==>动态聚类

Tip:

  • 这里的第三步使用的是传递闭包法,该法解决的问题是:由第二步相似关系建立得到的相似矩阵只满足自反性和对称性,但并不满足传递性(实际上我也不知道为什么😢)
  • 摒弃某些资料提到的 λ-截矩阵 概念,我的理解是:本质不就是设置阈值么

代码框架

  • preProcess: (mat: np.matrix, method=‘min_max’) -> np.matrix ……预处理函数
  • getSimilarityMatrix:(mat: np.matrix) -> np.matrix ……获得相似矩阵
  • transitiveClosure: (mat: np.matrix) -> np.matrix……获得相似函数的传递闭包
  • fuzzMatrixProduct: (mat: np.mat) -> np.mat……模糊运算(%)
  • mergeProcess:(mat: np.mat) -> list……聚类过程

(%):
R 1 ∘ R 2 = R 3 ,     R 1 ∈ R m × s ,    R 2 ∈ R s × t R 3 [ i ,   j ] = max ⁡ k = 1 , … , s min ⁡ ( R 1 [ i ,   k ] , R 2 [ k ,   j ] ) R_1 \circ R_2 = R_3,~~~R_1 \in \mathbb{R}^{m\times s},~~ R_2 \in \mathbb{R}^{s\times t}\\\\ R_3[i,~j]=\max_{k=1,\dots,s}\min(R_1[i, ~k], R_2[k, ~j]) R1R2=R3,   R1Rm×s,  R2Rs×tR3[i, j]=k=1,,smaxmin(R1[i, k],R2[k, j])
其中, i ∈ [ 1... m ] ,   j ∈ [ 1... t ] i\in[1...m],~j\in[1...t] i[1...m], j[1...t]

Python实现

并没有使用机器学习那一套现成框架,所以代码难免会冗长和欠缺考虑。
【温馨提示】
本文采用的矩阵形式为:行数为待聚类样本数,具体可见后面实例

数据预处理 preProcess

def preProcess(mat: np.matrix, method='min_max') -> np.matrix:
    # 转置,这一步的目的是为了后面求和好写,最后还要换回来
    mat = np.mat(np.transpose(mat))

    # 提供了两种归一化方法: 极差  和   z_score
    if method.lower() != 'min_max' and method.lower() != 'z_score':
        print("Invaild Operation")
        return mat

    # 将默认的int类型换成浮点类型,否则后面可能除法会出错
    mat = mat.astype(np.float32)
    row = mat.shape[0]

    if method.lower() == 'min_max':
        for i in range(row):
            curMax = np.max(mat[i])
            curMin = np.min(mat[i])
            if curMin == curMax:
                continue
            #  核心数学公式1:
            mat[i] = (mat[i] - curMin) / (curMax - curMin)
    else:
        for i in range(row):
            curMean = np.mean(mat[i])
            curStd = np.std(mat[i])
            if curStd == 0:
                continue
            #  核心数学公式2
            mat[i] = (mat[i] - curMean) / curStd

    return np.mat(np.transpose(mat))

获得相似矩阵 getSimilarityMatrix

def getSimilarityMatrix(mat: np.matrix) -> np.matrix:
    row = mat.shape[0]
    similarityMatrix = np.zeros((row, row), dtype=float)

    # 最后要保证落在【0,1】,该标志位指示是否有负数出现
    isexistNegtive = False

    for i in range(1, row):
        for j in range(i):
            similarityMatrix[i][j] = np.sum(np.multiply(mat[i], mat[j]))
            if similarityMatrix[i][j] < 0:
                isexistNegtive = True

    tmp = np.max(similarityMatrix)

    if tmp == 0:
        print("Operation Error!")
        return np.mat(np.zeros(row, row))

    similarityMatrix /= tmp

    if isexistNegtive:
        similarityMatrix = (similarityMatrix + 1) / 2

    for i in range(row):
        similarityMatrix[i][i] = 1
        for j in range(i + 1, row):
            # 利用R的对称性
            similarityMatrix[i][j] = similarityMatrix[j][i]

    return np.mat(similarityMatrix)

获取传递闭包 transitiveClosure

def transitiveClosure(mat: np.matrix) -> np.matrix:
    cnt = 1
    # 循环知道找到闭包
    while False == (fuzzMatrixProduct(mat) == mat).all() and cnt < 10:
        mat = fuzzMatrixProduct(mat)
        cnt += 1

    # cnt设置是为了避免无限循环
    if cnt >= 10:
        print("Calculate Error")
        return np.mat(np.zeros((mat.shape[0], mat.shape[1])))

    print(cnt)
    return mat

模糊运算 fuzzMatrixProduct

def fuzzMatrixProduct(mat: np.mat) -> np.mat:

    size = mat.shape[0]
    ret = np.mat(np.zeros((size, size), dtype=float))

    for i in range(size):
        for j in range(size):
            # 核心数学公式3
            ret[i, j] = min(mat[i, 0], mat[0, j])
            for k in range(1, size):
                #  核心数学公式4
                ret[i, j] = max(min(mat[i, k], mat[k, j]), ret[i, j])

    return ret

实现聚类 mergeProcess

def mergeProcess(mat: np.mat) -> list:
    size = mat.shape[0]
    heap = []
    picked = []
    valtoposi = {}

    objectstack = []
    # mergestack = []
    mergestack = copy.deepcopy(objectstack)
    scorestack = []

    for i in range(1, size):
        for j in range(i):
            if mat[i, j] in valtoposi.keys():
                valtoposi[mat[i, j]].append([i, j])
            else:
                valtoposi[mat[i, j]] = [[i, j]]

    for i in valtoposi.keys():
        pq.heappush(heap, -i)

    while len(picked) < size:
        tmp = pq.heappop(heap) * (-1)

        for i in valtoposi[tmp]:
            if i[0] not in picked and i[1] not in picked:
                picked.append(i[0])
                picked.append(i[1])
                objectstack.append(i)
                mergestack.append(copy.deepcopy(i))
                scorestack.append(tmp)

            elif i[0] in picked and i[1] in picked:
                continue

            elif i[0] in picked:
                picked.append(i[1])
                if i[0] in mergestack[-1]:
                    mergestack[-1] += [int(i[1])]
                    objectstack.append(i[1])
                    scorestack.append(tmp)
                    continue

                for j in range(len(mergestack) - 1, -1, -1):
                    if i[0] in mergestack[j]:
                        break
                mergestack[j] += [int(i[1])]

                for j in range(len(objectstack) - 1, -1, -1):
                    if i[0] in objectstack[j]:
                        break
                objectstack.insert(j + 1, i[1])
                # scorestack.insert(j + 1, tmp)
                scorestack.append(tmp)

            else:
                picked.append(i[0])
                if i[1] in mergestack[-1]:
                    mergestack[-1] += [int(i[0])]
                    objectstack.append(i[0])
                    scorestack.append(tmp)
                    continue

                for j in range(len(objectstack) - 1, -1, -1):
                    if i[1] in objectstack[j]:
                        break
                objectstack.insert(j + 1, i[0])
                # scorestack.insert(j + 1, tmp)
                scorestack.append(tmp)

                for j in range(len(mergestack) - 1, -1, -1):
                    if i[1] in mergestack[j]:
                        break
                mergestack[j] += [int(i[0])]

    return [objectstack, scorestack]

实例演示 在这里插入图片描述

归一化:

>>> Q1
matrix([[0.14876032, 0.3088235 , 0.48584902, 0.07199979, 0.72067046],
        [0.        , 0.        , 0.        , 0.55999994, 1.        ],
        [0.02479339, 0.3823529 , 0.4292453 , 0.51199985, 0.61731845],
        [0.04958678, 0.3382353 , 0.35849056, 0.79999995, 0.56703913],
        [1.        , 0.28676468, 0.3301887 , 0.536     , 0.678771  ],
        [0.09917355, 0.24264704, 0.20283017, 1.        , 0.60893863],
        [0.677686  , 1.        , 1.        , 0.        , 0.        ],
        [0.22314051, 0.49264705, 0.73113203, 0.6799998 , 0.27094975],
        [0.24793388, 0.36029407, 0.6415094 , 0.43999982, 0.44972068]],
       dtype=float32)

相似矩阵:

>>> Q2
matrix([[1.        , 0.55344818, 0.59059223, 0.54709302, 0.67309461,
         0.50842017, 0.65126281, 0.57075019, 0.59316946],
        [0.55344818, 1.        , 0.65748321, 0.73821114, 0.71195069,
         0.85013822, 0.        , 0.47400029, 0.50627011],
        [0.59059223, 0.65748321, 1.        , 0.7593308 , 0.70517938,
         0.77833435, 0.60247369, 0.74411335, 0.6706715 ],
        [0.54709302, 0.73821114, 0.7593308 , 1.        , 0.7844664 ,
         0.94908777, 0.53114982, 0.82722886, 0.70628633],
        [0.67309461, 0.71195069, 0.70517938, 0.7844664 , 1.        ,
         0.86186167, 0.94155703, 0.83943269, 0.80303368],
        [0.50842017, 0.85013822, 0.77833435, 0.94908777, 0.86186167,
         1.        , 0.37286283, 0.82542372, 0.69526072],
        [0.65126281, 0.        , 0.60247369, 0.53114982, 0.94155703,
         0.37286283, 1.        , 1.        , 0.85078273],
        [0.57075019, 0.47400029, 0.74411335, 0.82722886, 0.83943269,
         0.82542372, 1.        , 1.        , 0.81665658],
        [0.59316946, 0.50627011, 0.6706715 , 0.70628633, 0.80303368,
         0.69526072, 0.85078273, 0.81665658, 1.        ]])

传递闭包:

>>> Q3
matrix([[1.        , 0.67309461, 0.67309461, 0.67309461, 0.67309461,
         0.67309461, 0.67309461, 0.67309461, 0.67309461],
        [0.67309461, 1.        , 0.77833435, 0.85013822, 0.85013822,
         0.85013822, 0.85013822, 0.85013822, 0.85013822],
        [0.67309461, 0.77833435, 1.        , 0.77833435, 0.77833435,
         0.77833435, 0.77833435, 0.77833435, 0.77833435],
        [0.67309461, 0.85013822, 0.77833435, 1.        , 0.86186167,
         0.94908777, 0.86186167, 0.86186167, 0.85078273],
        [0.67309461, 0.85013822, 0.77833435, 0.86186167, 1.        ,
         0.86186167, 0.94155703, 0.94155703, 0.85078273],
        [0.67309461, 0.85013822, 0.77833435, 0.94908777, 0.86186167,
         1.        , 0.86186167, 0.86186167, 0.85078273],
        [0.67309461, 0.85013822, 0.77833435, 0.86186167, 0.94155703,
         0.86186167, 1.        , 1.        , 0.85078273],
        [0.67309461, 0.85013822, 0.77833435, 0.86186167, 0.94155703,
         0.86186167, 1.        , 1.        , 0.85078273],
        [0.67309461, 0.85013822, 0.77833435, 0.85078273, 0.85078273,
         0.85078273, 0.85078273, 0.85078273, 1.        ]])

完整代码

import numpy as np
import heapq as pq
import copy
import turtle as tu

#  data4.xlsx 里的数据
Q = np.mat([
    [0.018, 0.048, 0.212, 0.339, 0.382],
    [0, 0.006, 0.109, 0.4, 0.482],
    [0.003, 0.058, 0.2, 0.394, 0.345],
    [0.006, 0.052, 0.185, 0.43, 0.327],
    [0.121, 0.045, 0.179, 0.397, 0.367],
    [0.012, 0.039, 0.152, 0.455, 0.342],
    [0.082, 0.142, 0.321, 0.33, 0.124],
    [0.027, 0.073, 0.264, 0.415, 0.221],
    [0.03, 0.055, 0.245, 0.385, 0.285]
])


# 数据预处理
def preProcess(mat: np.matrix, method='min_max') -> np.matrix:
    # 转置,这一步的目的是为了后面求和好写,最后还要换回来
    mat = np.mat(np.transpose(mat))

    # 提供了两种归一化方法: 极差  和   z_score
    if method.lower() != 'min_max' and method.lower() != 'z_score':
        print("Invaild Operation")
        return mat

    # 将默认的int类型换成浮点类型,否则后面可能除法会出错
    mat = mat.astype(np.float32)
    row = mat.shape[0]

    if method.lower() == 'min_max':
        for i in range(row):
            curMax = np.max(mat[i])
            curMin = np.min(mat[i])
            if curMin == curMax:
                continue
            #  核心数学公式1:
            mat[i] = (mat[i] - curMin) / (curMax - curMin)
    else:
        for i in range(row):
            curMean = np.mean(mat[i])
            curStd = np.std(mat[i])
            if curStd == 0:
                continue
            #  核心数学公式2
            mat[i] = (mat[i] - curMean) / curStd

    return np.mat(np.transpose(mat))

# 得到相似矩阵
def getSimilarityMatrix(mat: np.matrix) -> np.matrix:
    row = mat.shape[0]
    similarityMatrix = np.zeros((row, row), dtype=float)

    # 最后要保证落在【0,1】,该标志位指示是否有负数出现
    isexistNegtive = False

    for i in range(1, row):
        for j in range(i):
            similarityMatrix[i][j] = np.sum(np.multiply(mat[i], mat[j]))
            if similarityMatrix[i][j] < 0:
                isexistNegtive = True

    tmp = np.max(similarityMatrix)

    if tmp == 0:
        print("Operation Error!")
        return np.mat(np.zeros(row, row))

    similarityMatrix /= tmp

    if isexistNegtive:
        similarityMatrix = (similarityMatrix + 1) / 2

    for i in range(row):
        similarityMatrix[i][i] = 1
        for j in range(i + 1, row):
            # 利用R的对称性
            similarityMatrix[i][j] = similarityMatrix[j][i]

    return np.mat(similarityMatrix)

# 得到R的传递闭包
def transitiveClosure(mat: np.matrix) -> np.matrix:
    cnt = 1
    # 循环知道找到闭包
    while False == (fuzzMatrixProduct(mat) == mat).all() and cnt < 10:
        mat = fuzzMatrixProduct(mat)
        cnt += 1

    # cnt设置是为了避免无限循环
    if cnt >= 10:
        print("Calculate Error")
        return np.mat(np.zeros((mat.shape[0], mat.shape[1])))

    print(cnt)
    return mat


# 计算模糊矩阵
def fuzzMatrixProduct(mat: np.mat) -> np.mat:

    size = mat.shape[0]
    ret = np.mat(np.zeros((size, size), dtype=float))

    for i in range(size):
        for j in range(size):
            # 核心数学公式3
            ret[i, j] = min(mat[i, 0], mat[0, j])
            for k in range(1, size):
                #  核心数学公式4
                ret[i, j] = max(min(mat[i, k], mat[k, j]), ret[i, j])

    return ret


def mergeProcess(mat: np.mat) -> list:
    size = mat.shape[0]
    heap = []
    picked = []
    valtoposi = {}

    objectstack = []
    # mergestack = []
    mergestack = copy.deepcopy(objectstack)
    scorestack = []

    for i in range(1, size):
        for j in range(i):
            if mat[i, j] in valtoposi.keys():
                valtoposi[mat[i, j]].append([i, j])
            else:
                valtoposi[mat[i, j]] = [[i, j]]

    for i in valtoposi.keys():
        pq.heappush(heap, -i)

    while len(picked) < size:
        tmp = pq.heappop(heap) * (-1)

        for i in valtoposi[tmp]:
            if i[0] not in picked and i[1] not in picked:
                picked.append(i[0])
                picked.append(i[1])
                objectstack.append(i)
                mergestack.append(copy.deepcopy(i))
                scorestack.append(tmp)

            elif i[0] in picked and i[1] in picked:
                continue

            elif i[0] in picked:
                picked.append(i[1])
                if i[0] in mergestack[-1]:
                    mergestack[-1] += [int(i[1])]
                    objectstack.append(i[1])
                    scorestack.append(tmp)
                    continue

                for j in range(len(mergestack) - 1, -1, -1):
                    if i[0] in mergestack[j]:
                        break
                mergestack[j] += [int(i[1])]

                for j in range(len(objectstack) - 1, -1, -1):
                    if i[0] in objectstack[j]:
                        break
                objectstack.insert(j + 1, i[1])
                # scorestack.insert(j + 1, tmp)
                scorestack.append(tmp)

            else:
                picked.append(i[0])
                if i[1] in mergestack[-1]:
                    mergestack[-1] += [int(i[0])]
                    objectstack.append(i[0])
                    scorestack.append(tmp)
                    continue

                for j in range(len(objectstack) - 1, -1, -1):
                    if i[1] in objectstack[j]:
                        break
                objectstack.insert(j + 1, i[0])
                # scorestack.insert(j + 1, tmp)
                scorestack.append(tmp)

                for j in range(len(mergestack) - 1, -1, -1):
                    if i[1] in mergestack[j]:
                        break
                mergestack[j] += [int(i[0])]

    return [objectstack, scorestack]


def plotCluster(data: list):
    obj = data[0]
    score = data[1]
    tmp = []
    cnt = 0

    for i in obj:
        if type(i) == list:
            cnt += len(i)
        else:
            cnt += 1

    width = 700 / (cnt - 1)
    height = [_ * 700 - 300 for _ in score][::-1]

    tu.setup(1000, 600, -300, -200)
    tu.pensize(2)
    tu.penup()
    tu.goto(-470, -190)
    tu.pendown()

    cnt2 = -1

    for i in obj:
        if type(i) == list:
            cnt2 += 1
            if cnt2 != 0:
                tu.seth(0)
                tu.penup()
                tu.fd(width)
                tu.pendown()

            tu.penup()
            tu.seth(-90)
            tu.fd(25)
            tu.pendown()
            tu.write(str(i[0]), font=('宋体', 15, 'normal'))
            tu.penup()
            tu.seth(90)
            tu.fd(25)
            tu.pendown()

            tu.seth(90)
            tu.fd(height[cnt2])

            tu.seth(0)
            tu.fd(width / 2)
            tu.penup()
            tu.seth(90)
            tu.fd(15)
            tu.pendown()
            tu.write(str(round(score[cnt2], 3)), font=('宋体', 10, 'normal'))
            tu.penup()
            tu.seth(-90)
            tu.fd(15)
            tu.pendown()
            tu.seth(0)
            tu.fd(width / 2)

            tu.seth(-90)
            tu.fd(height[cnt2])

            tu.penup()
            tu.seth(-90)
            tu.fd(25)
            tu.pendown()
            tu.write(str(i[1]), font=('宋体', 15, 'normal'))
            tu.penup()
            tu.seth(90)
            tu.fd(25)
            tu.pendown()

            tmp.append(i)
        else:
            tu.penup()
            tu.seth(90)
            tu.fd(height[cnt2])
            tu.seth(180)
            tu.fd(width * (len(tmp[-1]) - 1) / 2)
            tu.pendown()
            tu.seth(90)
            tu.fd(height[cnt2 + 1] - height[cnt2])
            cnt2 += 1
            tu.seth(0)

            tmp_width = width * (len(tmp[-1]) + 1) / 2
            tu.fd(tmp_width / 2)
            tu.penup()
            tu.seth(90)
            tu.fd(15)
            tu.pendown()
            tu.write(str(round(score[cnt2], 3)), font=('宋体', 10, 'normal'))
            tu.penup()
            tu.seth(-90)
            tu.fd(15)
            tu.pendown()
            tu.seth(0)
            tu.fd(tmp_width / 2)

            tu.seth(-90)
            tu.fd(height[cnt2])

            tu.penup()
            tu.seth(-90)
            tu.fd(25)
            tu.pendown()
            tu.write(str(i), font=('宋体', 15, 'normal'))
            tu.penup()
            tu.seth(90)
            tu.fd(25)
            tu.pendown()

            tmp[-1] += [i]

    if len(tmp) > 1:
        pass

    tu.done()


Q1 = preProcess(Q)
Q2 = getSimilarityMatrix(Q1)
Q3 = transitiveClosure(Q2)
# print(Q3)
Q4 = mergeProcess(Q3)
# print(Q4)
plotCluster(Q4)

代码细节

未完待续

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/487134.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

【Redis】持久化机制详解:从RDB到AOF,你需要知道的一切

本文目录 RDB&#xff08;默认&#xff09; 自动触发 &#x1f19a; 手动触发 优点 缺点 何时会触发RDB快照 AOF 启用 AOF 配置路径 AOF 文件&#x1f4c3; AOF 的写回策略 AOF 的重写机制 优点 缺点 RDB & AOF 优先级 终极方案&#xff1a;RDB AOF 混合方…

城市轨道交通自动售检票系统

概述 城市轨道交通自动售检票系统&#xff08;AFC&#xff09;是基于计算机、通信、网络、自动控制等技术&#xff0c;实现轨道交通售票、检票、计费、收费、统计、清分、管理等全过程的自动化系统。可以提高轨道交通的运营效率&#xff0c;满足乘客的快速出行需求&#xff0c…

看完张一鸣近十年微博,我总结了这些成长特质

从程序员到 CEO 关注我的朋友&#xff0c;很多都是技术背景&#xff0c;之前在一个知乎回答里提到过&#xff0c;技术人在创业过程中并不占优势。 编程和创业是两个不同的体系&#xff0c;大部分技术工程师在工作中&#xff0c;解决的往往是一个限定的问题&#xff0c;而创业是…

【分享】ChatGPT的key,用key免费使用ChatGPT(每天更新)

1、ChatGPT用法总结&#xff1a; 自动化文本生成&#xff1a;可以用GPT生成文章、新闻、文本摘要&#xff0c;甚至小说、诗歌等文学作品。语音生成&#xff1a;结合语音合成技术&#xff0c;GPT可以生成自然流畅的语音&#xff0c;可以用于语音助手、交互式语音应用等。问答系统…

MobileViT神经网络模型

官方源码(Pytorch实现) : https://github.com/apple/ml-cvnets 原文链接&#xff1a;https://blog.csdn.net/qq_37541097/article/details/126715733 霹雳吧啦Wz从ml-evnets仓库中剥离的代码: deep-learning-for-image-processing/pytorch_classification/MobileViT at master…

AWE 2023:科技与艺术的结晶 三星展台亮点回顾

2023年4月27~30日&#xff0c;AWE 2023中国家电及消费电子博览会在上海新国际博览中心盛大举行。 作为全球三大消费电子展之一&#xff0c;每一年的AWE都汇聚了全球家电及消费电子领域最前沿、最尖端的科技和产品&#xff0c;因而向来都被业界人士视为整个行业的风向标。本届AW…

【读书笔记】《深入浅出数据分析》

我最大的收获 试想你在经历一场英语考试&#xff0c;还有两分钟就要交卷了&#xff0c;而你还没有开始写作文。此时&#xff0c;你会怎么做&#xff1f; 利用2分钟时间写出的第一段&#xff0c;还是只写关键句子&#xff0c;搭出文章的开头、过程、结尾&#xff1f; 后者更加明…

【LeetCode】91. 解码方法

91. 解码方法&#xff08;中等&#xff09; 思路 这其实是一道字符串类的动态规划题&#xff0c;不难发现对于字符串s的某个位置i而言&#xff0c;我们只关心「位置 i 自己能否形成独立 item」和「位置 i 能够与上一位置&#xff08;i-1&#xff09;能否形成item 」&#xff0c…

无人机测试二维码降落。

一、首先要做的就是让NX板卡驱动usb摄像头&#xff1a; 1. 下载usb_cam软件包 sudo apt install ros-melodic-usb-cam2. 启动相机节点&#xff1a; A. 查找摄像头接口 ls /dev/video*B. 在该路径下修改launch文件&#xff0c;换成你自己的摄像头接口 我这里的摄像头接口为…

PySpark基础入门(3):RDD持久化

RDD的持久化 RDD 的数据是过程数据&#xff0c;因此需要持久化存储&#xff1b; RDD之间进行相互迭代的计算&#xff0c;新的RDD的生成代表着旧的RDD的消失&#xff1b;这样的特性可以最大化地利用资源&#xff0c;老旧地RDD可以及时地从内存中清理&#xff0c;从而给后续地计…

电脑发挥极致,畅游永恒之塔sf

随着22寸显示器的普及&#xff0c;玩永恒之塔势必会对显示卡造成了很大负担。不要说效果全开&#xff0c;就连简洁的玩&#xff0c;都成了问题&#xff0c;那是不是就要重金把才买的显示卡又要拿掉呢&#xff1f; 最出众的解决办法&#xff0c;是超频。 主要就具有以下条件最佳…

Azure DevOps Server 数据还原方式三:增量还原

Contents 1. 概述2. 操作方式 2.1 创建共享文件夹&#xff0c;并将备份文件复制到共享文件夹中2.2 还原数据3 验证还原的数据库 3.1 方式一&#xff1a;核对工作项所在的表的数据3.2 方式二&#xff1a;将数据库配置到应用层&#xff0c;在应用中验证数据4. 常见问题&#xff1…

FAST协议解析1 通过输入输出逆解析

一、前言 FAST协议可以支持金融机构间高吞吐量、低延迟的数据通讯&#xff0c;目前我知道的应用领域是沪深交易所的Level-2行情传输。网络上无论是FAST协议本身&#xff0c;还是使用相关工具&#xff08;openfast、quickfast&#xff09;对FAST行情进行解析&#xff0c;相关的…

MC9S12G128开发板—解决小车九宫格方位移动功能实现遇到的一些问题

接着我的上一篇文章&#xff1a;MC9S12G128开发板—实现按键发送CAN报文指示小车移动功能。本篇文章主要记录下在实现小车九宫格方位移动功能过程中&#xff0c;遇到的一些程序问题以及解决措施。 1. 上位机小车响应开发板按键CAN报文指令的响应出错问题 问题现象描述&#x…

自动驾驶行业观察之2023上海车展-----车企发展趋势(1)

新势力发展趋势 小鹏汽车&#xff1a;发布新车G6&#xff08;中型SUV&#xff09;&#xff0c;将于2023年年中上市 发布新车G6&#xff1a;车展上&#xff0c;小鹏G6正式首发亮相&#xff0c;定位中型SUV&#xff0c;对标Tesla Model Y&#xff0c;将于2023年年中上市并开始交…

基于web的商场商城后台管理系统

该系统用户分为两类&#xff1a;普通员工和管理员。普通员工是指当前系统中的需要对商品和客户的信息进行查询的人。此类用户只能查看自己的信息&#xff0c;以及对商品和客户的信息进行查看。管理员用户可以对自己和他人的信息进行维护&#xff0c;包括对商品入库、销售、库存…

Redis缓存过期淘汰策略

文章目录 1、如何设置 Redis 最大运行内存&#xff1f;2、过期删除策略3、内存淘汰策略 1、如何设置 Redis 最大运行内存&#xff1f; 在配置文件 redis.conf 中&#xff0c;可以通过参数 maxmemory 来设定最大运行内存&#xff0c;只有在 Redis 的运行内存达到了我们设置的最…

代码命名规范

日常编码中&#xff0c;代码的命名是个大的学问。能快速的看懂开源软件的代码结构和意图&#xff0c;也是一项必备的能力。那它们有什么规律呢&#xff1f; Java项目的代码结构&#xff0c;能够体现它的设计理念。Java采用长命名的方式来规范类的命名&#xff0c;能够自己表达…

消息称苹果Type-C口充电未设MFi限制,iOS17将更新Find My服务

根据国外科技媒体 iMore 报道&#xff0c;基于消息源 analyst941 透露的信息&#xff0c;苹果公司目前并未开发 MFi 限制。 根据推文信息内容&#xff0c;两款 iPhone 15 机型的最高充电功率为 20W&#xff0c;而 iPhone 15 Pro 机型的最高支持 27W 充电。 此前古尔曼表示苹…

Python趋势外推预测模型实验完整版

趋势外推预测模型实验完整版 实验目的 通过趋势外推预测模型&#xff08;佩尔预测模型&#xff09;&#xff0c;掌握预测模型的建立和应用方法&#xff0c;了解趋势外推预测模型&#xff08;佩尔预测模型&#xff09;的基本原理 实验内容 趋势外推预测模型 实验步骤和过程…