11. 统计(均值、方差、正态分布)和聚类(接近kmeans的聚类)分类(python和c++代码)

news2024/11/15 8:30:12

        以下代码的每个函数功能都做了注释,分别用python和c++代码做了具体的实现,不是最终效果,后续会继续优化。以下代码中,python代码在每个步骤处理完数据后都画了散点图显示了处理后的数据效果,c++代码是从python代码翻译过来的,没有显示数据处理后的散点图效果。

1.python代码

import pandas as pd
# coding=utf-8
import matplotlib.pyplot as plt
import numpy as np


ss = [[0.03419, -89.31, 118.5], [0.05676, -67.16, 118.5], [0.07927, -44.99, 118.5],
      [0.10172, -22.84, 118.5], [0.12393, 0.0, 118.5], [0.14626, 21.5, 118.5],
      [0.1683, 43.66, 118.5], [0.19008, 65.81, 118.5], [0.212, 87.97, 118.5],
      [0.03801, -89.32, 118.5], [0.06058, -67.16, 118.5], [0.08309, -45.0, 118.5],
      [0.10551, -22.84, 118.5], [0.12773, 0.0, 118.5], [0.15002, 21.49, 118.5],
      [0.17206, 43.65, 118.5], [0.19395, 65.82, 118.5], [0.21562, 87.97, 118.5],
      [0.04185, -89.32, 118.5], [0.06441, -67.16, 118.5], [0.08692, -44.99, 118.5],
      [0.10931, -22.83, 118.5], [0.1315, 0.0, 118.5], [0.15376, 21.49, 118.5],
      [0.17581, 43.65, 118.5], [0.19769, 65.81, 118.5], [0.21932, 87.96, 118.5],
      [0.04569, -89.32, 118.5], [0.06825, -67.16, 118.5], [0.09073, -45.0, 118.5],
      [0.11312, -22.84, 118.5], [0.1353, 0.0, 118.5], [0.15755, 21.49, 118.5],
      [0.17953, 43.65, 118.5], [0.20137, 65.81, 118.5], [0.2229, 87.97, 118.5],
      [0.04953, -89.32, 118.5], [0.07206, -67.16, 118.5], [0.09452, -44.99, 118.5],
      [0.11692, -22.83, 118.5], [0.13905, 0.0, 118.5], [0.16129, 21.49, 118.5],
      [0.18325, 43.65, 118.5], [0.20504, 65.81, 118.5], [0.22667, 87.97, 118.5],
      [0.05336, -89.32, 118.5], [0.0759, -67.16, 118.5], [0.09835, -45.0, 118.5],
      [0.1207, -22.84, 118.5], [0.14282, 0.0, 118.5], [0.16502, 21.49, 118.5],
      [0.18697, 43.66, 118.5], [0.20875, 65.81, 118.5], [0.23025, 87.96, 118.5],
      [0.05718, -89.32, 118.5], [0.07971, -67.16, 118.5], [0.10214, -44.99, 118.5],
      [0.1245, -22.83, 118.5], [0.14656, 0.0, 118.5], [0.16878, 21.49, 118.5],
      [0.19066, 43.65, 118.5], [0.21238, 65.82, 118.5], [0.2339, 87.97, 118.5],]

# 0~63的数据对齐,投影成直线
classes_index = {
    "0": 0, "9": 1, "18": 2, "27": 3, "36": 4, "45": 5, "54": 6,
    "1": 7, "10": 8, "19": 9, "28": 10, "37": 11, "46": 12, "55": 13,
    "2": 14, "11": 15, "20": 16, "29": 17, "38": 18, "47": 19, "56": 20,
    "3": 21, "12": 22, "21": 23, "30": 24, "39": 25, "48": 26, "57": 27,
    "4": 28, "13": 29, "22": 30, "31": 31, "40": 32, "49": 33, "58": 34,
    "5": 35, "14": 36, "23": 37, "32": 38, "41": 39, "50": 40, "59": 41,
    "6": 42, "15": 43, "24": 44, "33": 45, "42": 46, "51": 47, "60": 48,
    "7": 49, "16": 50, "25": 51, "34": 52, "43": 53, "52": 54, "61": 55,
    "8": 56, "17": 57, "26": 58, "35": 59, "44": 60, "53": 61, "62": 62,
}
colors = ['black', 'green', 'red', 'fuchsia', 'aqua', 'orange', 'pink', 'green','red', 'yellow', 'green',
          'aqua', 'orange', 'red', 'fuchsia', 'yellow', 'aqua', 'orange', 'green', 'red', 'yellow']


# 1. 读取数据,提取出需要计算的数据
def read_datas(filepath):
    with open(filepath, "r", encoding='utf-8') as f:  # 打开文件
        data = f.readlines()  # 读取文件
    datas = []

    for item in data[16:]:  # [16:]
        items = item.split("\t")[:63]
        items.append(item.split("\t")[70])
        items.append(item.split("\t")[66])
        items.append(item.split("\t")[67])
        items.append(item.split("\t")[69])
        items.append(item.split("\t")[68])
        datas.append(items)
    datas = np.asarray(datas)

    # 每组数据的不为0的值
    oneCircle = []
    print(datas.shape)

    # (1. 显示x坐标
    for j in range(datas.shape[0]):
        s = []
        for i in range(datas.shape[1] - 5):
            if float(datas[j][i]) != 0:
                alpha = float(datas[j][-5]) / 100
                alphas = float(datas[j][-5]) / 100
                alpha = alpha * 3.14 / 180
                x = float(datas[j][i]) * np.sin(base_datas[i][0])#+ base_datas[i][1] * np.cos(alpha) + base_datas[i][2] * np.sin(alpha)
                z = float(datas[j][i]) * np.cos(base_datas[i][0])

                # #倾角补偿
                x = x * np.cos(alpha) - z * np.sin(alpha) + base_datas[i][1] * np.cos(alpha) + base_datas[i][2] * np.sin(alpha)
                z = x * np.sin(alpha) + z * np.cos(alpha) + base_datas[i][1] * np.sin(alpha) + base_datas[i][2] * np.cos(alpha)

                # # 加平移的修正
                front = float(datas[j][-3]) - float(datas[j][-4])
                back = float(datas[j][-1]) - float(datas[j][-2])

                translate = (front + back) / 400  # 平移
                baijiao = np.arctan((front - back) / (2 * 313.64))  # 摆角
                # x = x * np.cos(baijiao) + z * np.sin(baijiao)
                # z = z * np.cos(baijiao) - x * np.sin(baijiao)
                # x = x - base_datas[i][-1] * np.sin(baijiao)

                if z < 6800:
                    if z > 5700:
                        s.append([classes_index[str(i)], x - 712.5, z, datas[j][i], alphas])
        oneCircle.append(s)
    return oneCircle

# 2. 画图
def all_scatter_plot(oneCircle):
    nums = 0
    x1 = []
    y1 = []
    z1 = []
    for item in oneCircle:
        # print(item)
        if len(item) > 0:
            for items in item:
                y1.append(nums)
                z1.append(items[2])
                x1.append(items[1])
            nums += 1

    plt.scatter(y1, x1, s=2, c="navy")
    plt.scatter(y1, z1, s=2, c="blue")
    plt.show()

# 3. 去掉数据空格,将数据按照行的接收的前后顺序排序
def rows_sort(oneCircle):
    datas_count = []  # 存放计算用的数据
    y_ins = 0
    for item in oneCircle:
        if len(item) > 0:
            ss = []
            for items in item:
                ss.append([y_ins, items[1], items[2]])
            datas_count.append(ss)
            y_ins += 1
    print("显示数值的长度:   ", y_ins)
    return datas_count

# 4. 将长度大于2的行和小于等于2的行分开,后续要对大于3的行的值进行精简
def two_three(batch_datas):
    ths = {}  # 单个的大于等于3个的类
    cls = {}  # 小于3个的类
    for j in range(len(batch_datas)):
        if len(batch_datas[j]) < 3:
            cls[str(j)] = batch_datas[j]
        else:
            cls[str(j)] = []
            ths[str(j)] = batch_datas[j]
    key1 = list(cls.keys())
    key2 = list(ths.keys())
    return key1, key2, cls, ths

# 5.取最小值
def two_min(cls, ths, tt):
    if str(int(tt[0]) - 1) in cls:

        print("====>   ", cls[str(int(tt[0]) - 1)])

        for item in tt:
            sss = ths[item][:2]  # 存放最小差值时的类,开始是赋值最小差值时的类为多个值的前两个值
            L = [1000, 1000]  # 存放最小的差值,开始时假设最小差值为1000,这个值不能太小,否则后面的比较就没有意义了
            for ts in range(2):
                for cs in cls[str(int(tt[0]) - 1)]:
                    if abs(sss[ts][1] - cs[1]) < L[ts]:
                        L[ts] = abs(sss[ts][1] - cs[1])

            for k in range(2, len(ths[item])):  # 其他数据

                for cs in cls[str(int(tt[0]) - 1)]:
                    for hh in range(2):
                        if abs(ths[item][k][1] - cs[1]) < L[hh]:
                            L[hh] = abs(ths[item][k][1] - cs[1])
                            sss[hh] = cs

            cls[item] = sss
            print("最小值:  ", cls[item])
    return cls

# 6.保存最长为2个数据的列表
def two_saves(key2, cls, ths):
    ll = 0
    tt = []
    if len(key2) > 0:
        ll = int(key2[0])
        tt.append(key2[0])
    for j in range(1, len(key2)):
        if int(key2[j]) - ll == 1:
            ll = int(key2[j])
            tt.append(key2[j])
            if j == len(key2) - 1:
                cls = two_min(cls, ths, tt)

        else:
            ll = int(key2[j])
            print("      ", tt)
            # 根据tt处理数据  找tt[0]-1 和tt[-1]+1 的cls的值,然后作比较加入cls[j][1]
            cls = two_min(cls, ths, tt)

            tt.clear()
            tt.append(key2[j])

    batches = []
    for items in cls:
        batches.append(cls[items])
    return batches


# 7. 求均值
def data_means(batches):
    x_mean = 0
    z_mean = 0
    mean_nums = 0
    yy = 0
    for bd in batches:
        for bds in bd:
            x_mean += bds[1]
            z_mean += bds[2]
            yy += bds[0]
            mean_nums += 1

    x_mean /= mean_nums
    z_mean /= mean_nums
    yy = yy // mean_nums
    return x_mean, z_mean, yy

# 8. 根据均值将数据分为两大类
def two_classes(batches, x_mean, z_mean):
    up_classes = []  # 存上面的类
    down_classes = []  # 存下面的类
    up_limit_x, down_limit_x = x_mean + 50, x_mean - 50
    up_limit_z, down_limit_z = z_mean + 50, z_mean - 50

    for bd in batches:
        for bds in bd:
            if abs(bds[1] - up_limit_x) < abs(bds[1] - down_limit_x):
                up_classes.append(bds)
            else:
                down_classes.append(bds)
    return up_classes, down_classes

# 9. 对两大类数据再分类,分成一个类、两个类再加上其他类
def second_classes(up_classes, down_classes):

    others1 = []
    others2 = []
    # 转换为np数据再进行处理数据,求均值
    up_classes = np.asarray(up_classes)
    down_classes = np.asarray(down_classes)
    u1, u2 = up_classes[:, 1].mean(), down_classes[:, 1].mean()  # 两个类的均值

    # 根据u1,u2判断up_classes与down_classes的上下是不是同一个类
    up_classes = list(up_classes)
    if abs(u1 - u2) < 150:
        for ud in down_classes:
            up_classes.append(ud)
        down_classes = []

    # 根据up_classes[-1][0] 、 down_classes[-1][0] 、 up_classes[0][0] 、 down_classes[0][0]判断左右是不是同一类
    if len(down_classes) != 0:
        if abs(up_classes[-1][0] - down_classes[0][0]) < 20 or abs(up_classes[0][0] - down_classes[-1][0]) < 20:
            for ud in down_classes:
                up_classes.append(ud)
            down_classes = []
    # 根据up_classes[-1][0] 、 up_classes[0][0]判断能不作为一个类
    if abs(up_classes[-1][0] - up_classes[0][0]) < 60:
        for uc in up_classes:
            others1.append(uc)
        up_classes = []
    if len(down_classes) != 0:
        if abs(down_classes[-1][0] - down_classes[0][0]) < 60:
            for uc in down_classes:
                others2.append(uc)
            down_classes = []
    return up_classes, down_classes, others1, others2

# 10. 对分好的类构造直线 y = k1*x + b1
def line_bn(up_classes):
    up_class1 = []  # 存放正态分布满足小于1的值
    down_class1 = []  # 存放正态分布满足小于1的值
    other_class1 = []  # 存放正态分布不满足小于1的值
    other_class2 = []  # 存放正态分布不满足小于1的值

    if len(up_classes) != 0:
        up_classes = np.asarray(up_classes)
        up_cl = np.zeros((up_classes.shape[0], up_classes.shape[1] + 2))

        lens1 = up_classes.shape[0] // 2  # 将数据从中间分割成两部分,分别求均值
        xx1, yy1 = up_classes[:lens1, 0].mean(), up_classes[:lens1, 1].mean()
        xx2, yy2 = up_classes[-lens1:, 0].mean(), up_classes[-lens1:, 1].mean()
        k1 = (yy2 - yy1) / (xx2 - xx1 + 0.000000001)  # 两点求斜率,为了防止分母为0,加0.000000001
        b1 = yy2 - k1 * xx2
        # 则直线方程为 k1 * x - y + b1 = 0    ====>AX + BY + C = 0,    A = k1, B= -1, C = b1,接下来求各点到直线的距离
        # 点到直线的距离公式为|AX + By + C| / (A ** 2 + B ** 2) ** 0.5
        up_cl[:, :-2] = up_classes
        up_cl[:, -1] = (up_cl[:, 0] * k1 - up_cl[:, 1] + b1) / ((k1 ** 2 + 1) ** 0.5)
        # print(up_cl[:5,:])

        # 根据距离求up_cl的均值u_mean和方差vars1
        u_mean = up_cl[:, -1].mean()
        vars1 = 0
        for uc in up_cl:
            vars1 += (uc[-1] - u_mean) ** 2
        vars1 = (vars1 / max(len(up_cl), 1)) ** 0.5

        for j in range(len(up_cl)):
            if abs((up_cl[j][-1] - u_mean) / (vars1 + 0.00001)) < 1:
                up_class1.append(up_classes[j])
            else:
                other_class1.append(up_classes[j])
    return up_class1, other_class1




if __name__ == '__main__':

    # 基础数据处理:   共63行(63个传感器),每行3个数据:每个传感器的弧度制角度、距离中线的距离、距离车底的距离
    base_datas = np.asarray(ss)
    print(base_datas.shape)

    # 1. 读取63个传感器获取到的值,63列,第64列为倾角,前左、前右、后左、后右,然后对其做倾角补偿
    filepath = 'ones.txt'#ones
    oneCircle = read_datas(filepath)

    # 2. 画图
    all_scatter_plot(oneCircle)

    # 3. 去掉数据空格,将数据按照行的接收的前后顺序排序
    datas_count = rows_sort(oneCircle)

    # ##########################################################################################
    # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>   接收数据到算法实现   <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    # ##########################################################################################

    # 4. 计算
    indexs = 1  #每个批次计数
    pre_batch_count = 101  #表示每个批次处理200行数据
    nums_count = 0  # 计算总共有多少批次
    batch_datas = []#每个批次的数据,按照行排序

    # 总共有3个类,"line1"和"line2"表示有两条线时的两个类,"other3"表示其他类
    temporary_class = {}  # 存放临时的大类,对temporary_class1再次聚类,该大类最多有3个小类,两条直线和其他类
    temporary_class["line1"] = []
    temporary_class["line2"] = []
    temporary_class["other3"] = []

    for i in range(len(datas_count)):

        if indexs % pre_batch_count != 0:   #  ==================================> 取200个数据
            batch_datas.append(datas_count[i])
            indexs += 1
        else:
            print(".................................................................................")
            # (1. 记大于等于3个的类
            key1, key2, cls, ths = two_three(batch_datas) # ths = {}: 单个的大于等于3个的类   cls = {}: 小于3个的类 , key1, key2分别是两个字典的键
            # (2. 将同一行大于3个的值去除成2个值
            batches = two_saves(key2, cls, ths)

            #对batch_datas的200行数据进行计算,实际数据可能大于200个
            # (1. 求均值
            # (2. 根据均值将数据分为两大类
            # (3. 对两大类数据再分类,分成一个类、两个类再加上其他类
            # (4. 对分好的类构造直线 y = k*x + b
            # (5. 求类中各点到直线的距离
            # (6. 求距离的正态分布
            # (7. 根据正态分布去掉噪点,剩下的点即为分好类的点

            # (1. 求均值
            x_mean, z_mean, yy = data_means(batches)

            # (2. 根据均值将数据分为两大类
            up_classes, down_classes = two_classes(batches, x_mean, z_mean)

            # (3 对两大类数据再分类,分成一个类、两个类再加上其他类
            up_classes, down_classes, others1, others2 = second_classes(up_classes, down_classes)

            # 画图
            for uc in up_classes:
                plt.scatter(uc[0], uc[1], s=2, c=colors[2])
            for uc in down_classes:
                plt.scatter(uc[0], uc[1], s=2, c=colors[1])
            for uc in others1:
                plt.scatter(uc[0], uc[1], s=2, c=colors[0])
            for uc in others2:
                plt.scatter(uc[0], uc[1], s=2, c=colors[0])
            plt.scatter(yy, x_mean, s=20, c=colors[0])
            plt.show()

            # (4. 对分好的类构造直线 y = k1*x + b1,并返回满足正态分布小于1的数据
            up_class1, other_class1 = line_bn(up_classes)
            down_class1, other_class2 = line_bn(down_classes)

            # 画图
            for uc in up_class1:
                plt.scatter(uc[0], uc[1], s=2, c=colors[2])
            for uc in down_class1:
                plt.scatter(uc[0], uc[1], s=2, c=colors[1])
            for uc in other_class2:
                plt.scatter(uc[0], uc[1], s=2, c=colors[0])
            for uc in other_class1:
                plt.scatter(uc[0], uc[1], s=2, c=colors[3])
            plt.show()

            # 初始值归0,重新开始计算
            indexs = 1
            nums_count += 1
            batch_datas = []

2.c++代码

#include<iostream>
#include<fstream>  //ifstream
#include<string>     //包含getline()
#include<vector>
#include<list>
#include <array>
#include <unordered_map>
#include <math.h>


using namespace std;


//  ...........................................................................................................................
//  ---------------------------------------------------->   数据初始化   <----------------------------------------------------
//  ...........................................................................................................................

// 63个传感器的基础数据初始化
float base_datas[63][3] =
{ {0.03419, -89.31, 118.5},{0.05676, -67.16, 118.5},{0.07927, -44.99, 118.5},
{0.10172, -22.84, 118.5 },{0.12393, 0.0, 118.5 },{0.14626, 21.5, 118.5 },
{0.1683, 43.66, 118.5 },{0.19008, 65.81, 118.5 },{0.212, 87.97, 118.5 },
{0.03801, -89.32, 118.5 },{0.06058, -67.16, 118.5 },{0.08309, -45.0, 118.5 },
{0.10551, -22.84, 118.5 },{0.12773, 0.0, 118.5 },{0.15002, 21.49, 118.5 },
{0.17206, 43.65, 118.5 },{0.19395, 65.82, 118.5 },{0.21562, 87.97, 118.5 },
{0.04185, -89.32, 118.5 },{0.06441, -67.16, 118.5 },{0.08692, -44.99, 118.5 },
{0.10931, -22.83, 118.5 },{0.1315, 0.0, 118.5 },{0.15376, 21.49, 118.5 },
{0.17581, 43.65, 118.5 },{0.19769, 65.81, 118.5 },{0.21932, 87.96, 118.5 },
{0.04569, -89.32, 118.5 },{0.06825, -67.16, 118.5 },{0.09073, -45.0, 118.5 },
{0.11312, -22.84, 118.5 },{0.1353, 0.0, 118.5 },{0.15755, 21.49, 118.5 },
{0.17953, 43.65, 118.5 },{0.20137, 65.81, 118.5 },{0.2229, 87.97, 118.5 },
{0.04953, -89.32, 118.5 },{0.07206, -67.16, 118.5 },{0.09452, -44.99, 118.5 },
{0.11692, -22.83, 118.5 },{0.13905, 0.0, 118.5 },{0.16129, 21.49, 118.5 },
{0.18325, 43.65, 118.5 },{0.20504, 65.81, 118.5 },{0.22667, 87.97, 118.5 },
{0.05336, -89.32, 118.5 },{0.0759, -67.16, 118.5 },{0.09835, -45.0, 118.5 },
{0.1207, -22.84, 118.5 },{0.14282, 0.0, 118.5 },{0.16502, 21.49, 118.5 },
{0.18697, 43.66, 118.5 },{0.20875, 65.81, 118.5 },{0.23025, 87.96, 118.5 },
{0.05718, -89.32, 118.5 },{0.07971, -67.16, 118.5 },{0.10214, -44.99, 118.5 },
{0.1245, -22.83, 118.5 },{0.14656, 0.0, 118.5 },{0.16878, 21.49, 118.5 },
{0.19066, 43.65, 118.5 },{0.21238, 65.82, 118.5 },{0.2339, 87.97, 118.5 } };

// 63个传感器重新排序的字典初始化,将63个传感器的点映射到一条直线上
unordered_map<string, int> classes_index{
	{"0", 0}, {"9" , 1}, {"18" , 2}, {"27" , 3}, {"36" , 4}, {"45" , 5}, {"54" , 6},
	{"1" , 7}, {"10" , 8}, {"19", 9}, {"28" , 10}, {"37" , 11}, {"46" , 12}, {"55" , 13},
	{"2" , 14}, {"11" , 15}, {"20" , 16}, {"29" , 17}, {"38" , 18}, {"47" , 19}, {"56" , 20},
	{"3" , 21}, {"12" , 22}, {"21" , 23}, {"30" , 24}, {"39" , 25}, {"48" , 26}, {"57" , 27},
	{"4" , 28}, {"13" , 29}, {"22" , 30}, {"31" , 31}, {"41" , 39}, {"50" , 40}, {"59" , 41},
	{"6" , 42}, {"15" , 43}, {"24" , 44}, {"33" , 45}, {"42" , 46}, {"51" , 47}, {"60" , 48},
	{"7" , 49}, {"16" , 50}, {"25" , 51}, {"34" , 52}, {"43" , 53}, {"52" , 54}, {"61" , 55},
	{"8" , 56}, {"17" , 57}, {"26" , 58}, {"35" , 59}, {"44" , 60}, {"53" , 61}, {"62" , 62},
};

// 根据长度输出不同的颜色
vector<string> colors = { "black", "green", "red","fuchsia", "aqua", "orange", "pink", "green", "red", "yellow", "green",
"aqua", "orange", "red", "fuchsia", "yellow", "aqua", "orange", "green", "red", "yellow" };



//  ...........................................................................................................................
//  ---------------------------------------------------->   函数功能的实现   <----------------------------------------------------
//  ...........................................................................................................................

//1.字符串的分割
vector <string> splits(string s)
{
	vector<string> lists;
	string t = "";
	char m = '\t';
	for (int i = 0; i < s.size(); i++)
	{
		if (s[i] != m)
		{
			t += s[i];
		}
		else
		{
			if (t.size() != 0)
			{
				lists.push_back(t);
				t = "";
			}
		}
	}
	return lists;
}

// 2.读取txt文件,返回需要的数据
vector <vector<string>> data_back(string filepath)
{

	cout << ".......读取txt文件!!!......." << endl;
	vector<string> v1;//存放数据
	vector<vector<string>> savedatas;
	ifstream infile;
	infile.open("ones.txt", ios::in);//"ones.txt"
	if (!infile.is_open())
	{
		cout << "读取文件失败" << endl;
		v1.push_back("0");
	}
	string s;
	while (getline(infile, s))
	{
		v1.push_back(s);
	}
	// 获取可用的数据

	for (int i = 1; i < v1.size(); i++)
	{
		vector <string> tt = splits(v1[i]);
		savedatas.push_back(tt);
	}
	infile.close();

	return savedatas;
}

//3. 获取63个传感器数据和前后左右加倾角的5个数据,并将其转换为浮点型
vector<vector<float>> apply_datas(vector<vector<string>> savedatas)
{

	vector<vector<float>> onecircles;//对x和z校正

	for (int i = 0; i < savedatas.size(); i++)
	{
		// 取出每行需要计算的数据,并转换为浮点型
		vector<float> ss;//对x和z校正

		for (int j = 0; j < 63; j++)
			ss.push_back(stof(savedatas[i][j]));
		ss.push_back(stof(savedatas[i][70]));//倾角
		ss.push_back(stof(savedatas[i][66]));
		ss.push_back(stof(savedatas[i][67]));
		ss.push_back(stof(savedatas[i][69]));
		ss.push_back(stof(savedatas[i][68]));
		onecircles.push_back(ss);
	}
	return onecircles;

}


// 4. 倾角、平移补偿,去掉空格,返回的数据类型为: vector<vector<vector<float>>>
vector <vector<vector<float>>> angle_dispose(vector<vector<vector<float>>> denoise, vector<float> onecircles,int indexes)
{
	//传入的数据为onecircles[i]
	vector<vector<float>> oc;//每一行存取的数据
	//cout << "每行的长度:  " << onecircles.size() << endl;
	for (int j = 0; j < 63; j++)
	{
		if (onecircles[j] != 0)
		{
			//cout << onecircles[i][j] <<" " << base_datas[j][0] << endl;
			float alpha = onecircles[63] / 100;
			alpha = alpha * 3.1416 / 180;
			float x = onecircles[j] * sin(base_datas[j][0]);
			float z = onecircles[j] * cos(base_datas[j][0]);
			// 倾角补偿
			x = x * cos(alpha) - z * sin(alpha) + base_datas[j][1] * cos(alpha) + base_datas[j][2] * sin(alpha);
			z = x * sin(alpha) + z * cos(alpha) + base_datas[j][1] * sin(alpha) + base_datas[j][2] * cos(alpha);
			// 平移补偿
			//float front = onecircles[i][-3] - onecircles[i][-4];
			//float back = onecircles[i][-1] - onecircles[i][-2];

			//float translate = (front + back) / 400;  // 平移
			//float baijiao = atan((front - back) / (2 * 313.64)); //  # 摆角
			//x = x * cos(baijiao) + z * sin(baijiao);
			//z = z * cos(baijiao) - x * sin(baijiao);

			//x = x - base_datas[j][-1] * sin(baijiao);

			if (z < 6800)
			{
				if (z > 5700)
				{
					vector<float> tt;
					//cout << x << " " << z << "  " << classes_index[to_string(j)] << endl;
					float indexs = classes_index[to_string(j)];
					x = x - 712.5;
					//tt.push_back(indexs);
					tt.push_back(indexes);
					tt.push_back(x);
					tt.push_back(z);
					tt.push_back(onecircles[j]);
					tt.push_back(alpha);
					oc.push_back(tt);
				}
			}

		}
	}
	/*cout << "====>  " << oc.size() << endl;*/
	if (oc.size() > 0)
	{
		denoise.push_back(oc);
	}
	return denoise;
}

// 5.取最小值
unordered_map<string, vector<vector<float>>> two_min(unordered_map<string, vector<vector<float>>> cls, unordered_map<string, vector<vector<float>>> ths, vector<string> tt)
{

	string keys = to_string(stoi(tt[0]) - 1);
	if (cls.count(keys) != 0)
	{
		for (int t1 = 0; t1 < tt.size(); t1++)
		{//item=tt[t1]
			vector<vector<float>> sss;
			sss.push_back(ths[tt[t1]][0]);
			sss.push_back(ths[tt[t1]][1]);// 存放最小差值时的类,开始是赋值最小差值时的类为多个值的前两个值
			vector<float> L = { 1000,1000 };// 存放最小的差值,开始时假设最小差值为1000,这个值不能太小,否则后面的比较就没有意义了
			for (int k = 0; k < 2; k++)
			{
				for (int t2 = 0; t2 < cls[to_string(stoi(tt[0]) - 1)].size(); t2++)
				{
					if (abs(sss[k][1] - cls[to_string(stoi(tt[0]) - 1)][t2][1]) < L[k])
					{
						L[k] = abs(sss[k][1] - cls[to_string(stoi(tt[0]) - 1)][t2][1]);
					}
				}
			}

			for (int kk = 2; kk < ths[tt[t1]].size(); kk++)
			{
				for (int t2 = 0; t2 < cls[to_string(stoi(tt[0]) - 1)].size(); t2++)
				{
					for (int hh = 0; hh < 2; hh++)
					{
						if (abs(ths[tt[t1]][kk][1] - cls[to_string(stoi(tt[0]) - 1)][t2][1]) < L[hh])
						{
							L[hh] = abs(ths[tt[t1]][kk][1] - cls[to_string(stoi(tt[0]) - 1)][t2][1]);
							sss[hh] = cls[to_string(stoi(tt[0]) - 1)][t2];
						}
					}
				}
			}
			cls[tt[t1]] = sss;
			
			//cout << "最小值:  " << cls[tt[t1]][0][1] <<"   " << cls[tt[t1]][0][2] << endl;
		}
	}

	return cls;

}

//(2. 将同一行大于3个的值去除成2个值
vector<vector<vector<float>>> two_saves(vector<string> key1, vector<string> key2, unordered_map<string, vector<vector<float>>> cls, unordered_map<string, vector<vector<float>>> ths)
{
	int ll = 0;
	vector<string> tt;
	if (key2.size() > 0)
	{
		ll = stoi(key2[0]);
		tt.push_back(key2[0]);
	}
	for (int j = 0; j < key2.size(); j++)
	{
		if (stoi(key2[j]) - ll == 1)
		{
			ll = stoi(key2[j]);
			tt.push_back(key2[j]);
			if (j == key2.size() - 1)//倒数第二个值时取最小值
			{
				//5.取最小值
				cls = two_min(cls, ths, tt);
			}
		}
		else
		{
			ll = stoi(key2[j]);
			//5.取最小值
			cls = two_min(cls, ths, tt);
			tt.clear();
			tt.push_back(key2[j]);
		}
	}

	vector<vector<vector<float>>> batchs;
	for (int j = 0; j < key1.size(); j++)
	{
		batchs.push_back(cls[key1[j]]);
	}
	//cout << ":   " << batchs[0][0][0] << " " << batchs[0][0][1] << endl;

	return batchs;
}

// (1. 求均值
vector<float> data_means(vector<vector<vector<float>>> batches)
{
	float x_mean = 0;
	float z_mean = 0;
	float mean_nums = 0;
	float yy = 0;
	for (int j = 0; j < batches.size(); j++)
	{
		//cout <<"::::::::::::::::   " << batches[j].size() << endl;
		for (int k = 0; k < batches[j].size(); k++)
		{
			//cout << batches[j][k].size() <<"  " << batches[j][k][1]<< "  " << batches[j][k][2] << endl;
			x_mean += batches[j][k][1];
			z_mean += batches[j][k][2];
			mean_nums += 1;
			yy += batches[j][k][0];
		}	
	}
	x_mean = x_mean / mean_nums;
	z_mean = z_mean / mean_nums;
	yy = yy / mean_nums;
	vector<float> ss={ x_mean ,z_mean ,yy };
	//cout << "......:  " << ss[0] << "  " << ss[1] << "  " << ss[2] << endl;
	return ss;
}


// (2. 根据均值将数据分为两大类
vector<vector<vector<float>>> two_classes(float  x_mean, float  z_mean, vector<vector<vector<float>>> batchs)
{
	vector<vector<float>> up_classes;
	vector<vector<float>> down_classes;
	float up_limit_x = x_mean + 50;
	float down_limit_x = x_mean - 50;
	float up_limit_z = z_mean + 50;
	float down_limit_z = z_mean - 50;
	for (int j = 0; j < batchs.size(); j++)
	{
		for (int k = 0; k < batchs[j].size(); k++)
		{
			if (abs(batchs[j][k][1] - up_limit_x) < abs(batchs[j][k][1] - down_limit_x))
			{
				up_classes.push_back(batchs[j][k]);
			}
			else
			{
				down_classes.push_back(batchs[j][k]);
			}
		}
	}
	vector<vector<vector<float>>> hh = { up_classes ,down_classes };
	return hh;
}


//求均值
float means(vector<vector<float>> up_classes)
{
	float u1 = 0;
	float nums = 0;
	for (int j = 0; j < up_classes.size(); j++)
	{
		u1 += up_classes[j][1];
		nums += 1;
	}
	u1 = u1 / nums;
	return u1;
}


// (3 对两大类数据再分类,分成一个类、两个类再加上其他类
vector<vector<vector<float>>> second_classes(vector<vector<float>> up_classes, vector<vector<float>> down_classes)
{

	vector<vector<float>> others1;
	vector<vector<float>> others2;
	float u1 = means(up_classes);//两个类的均值
	float u2 = means(down_classes);

	// # 根据u1,u2判断up_classes与down_classes的上下是不是同一个类
	if (abs(u1 - u2) < 150)
	{
		for (int j = 0; j < down_classes.size(); j++)
		{
			up_classes.push_back(down_classes[j]);
		}
		down_classes.clear();
	}

	// # 根据up_classes[-1][0] 、 down_classes[-1][0] 、 up_classes[0][0] 、 down_classes[0][0]判断左右是不是同一类
	if (down_classes.size() > 0)
	{
		int l1 = up_classes.size() - 1;
		int l2 = down_classes.size() - 1;
		float v1 = abs(up_classes[l1][0] - down_classes[0][0]);
		float v2 = abs(up_classes[0][0] - down_classes[l2][0]);
		//cout << "====>  " << up_classes.size() << "  " << v1 << "  " << v2 << endl;
		if (v1 < 20 || v2 < 20)
		{
			for (int j = 0; j < down_classes.size(); j++)
			{
				up_classes.push_back(down_classes[j]);
			}
			down_classes.clear();
		}

	}

	//  # 根据up_classes[-1][0] 、 up_classes[0][0]判断能不作为一个类
	int l1 = up_classes.size() - 1;
	if (abs(up_classes[l1][0] - up_classes[0][0]) < 30)
	{
		for (int j = 0; j < up_classes.size(); j++)
		{
			others1.push_back(up_classes[j]);
		}
		up_classes.clear();
	}
	if (down_classes.size() > 0)
	{
		int l2 = down_classes.size() - 1;
		if (abs(down_classes[l2][0] - down_classes[0][0]) < 30)
		{
			for (int j = 0; j < down_classes.size(); j++)
			{
				others2.push_back(down_classes[j]);
			}
			down_classes.clear();
		}
	}


	vector<vector<vector<float>>> backs = { up_classes, down_classes, others1, others2 };
	return backs;
}


// # (4. 对分好的类构造直线 y = k1*x + b1
vector<vector<vector<float>>> line_bn(vector<vector<float>> up_classes)
{
	vector<vector<float>> up_class1;
	vector<vector<float>> other_class1;

	if (up_classes.size() > 0)
	{
		int lens = up_classes.size() / 2; // # 将数据从中间分割成两部分,分别求均值
		float xx1 = 0;
		float yy1 = 0;
		for (int j = 0; j < lens; j++)
		{
			xx1 += up_classes[j][0];
			yy1 += up_classes[j][1];
		}
		xx1 = xx1 / lens;
		yy1 = yy1 / lens;

		float xx2 = 0;
		float yy2 = 0;
		for (int j = lens; j < up_classes.size(); j++)
		{
			xx2 += up_classes[j][0];
			yy2 += up_classes[j][1];
		}
		xx2 = xx2 / (up_classes.size() - lens + 0.01);
		yy2 = yy2 / (up_classes.size() - lens + 0.01);

		float k1 = (yy2 - yy1) / (xx2 - xx1 + 0.000000001);  //# 两点求斜率,为了防止分母为0,加0.000000001
		float b1 = yy2 - k1 * xx2;
		//# 则直线方程为 k1 * x - y + b1 = 0    ====>AX + BY + C = 0, A = k1, B = -1, C = b1, 接下来求各点到直线的距离
		//# 点到直线的距离公式为 | AX + By + C| / (A * *2 + B * *2) * *0.5

		float u_mean = 0;  //# 根据距离求up_cl的均值u_mean和方差vars1
		for (int j = 0; j < up_classes.size(); j++)
		{
			float distance = (up_classes[j][0] * k1 - up_classes[j][1] + b1) / (pow(pow(k1, 2) + 1, 0.5));
			up_classes[j].push_back(distance);
			u_mean += distance;
		}
		u_mean = u_mean / (up_classes.size() + 0.0001);

		float vars1 = 0; // 方差
		for (int j = 0; j < up_classes.size(); j++)
		{
			vars1 += pow(up_classes[j][5] - u_mean, 2);
		}
		vars1 = pow(vars1 / (up_classes.size() + 0.00001), 0.5);

		for (int j = 0; j < up_classes.size(); j++)
		{
			if (abs(up_classes[j][5] - u_mean) / (vars1 + 0.00001) < 1)
			{
				up_class1.push_back(up_classes[j]);
			}
			else
			{
				other_class1.push_back(up_classes[j]);
			}
		}

	}
	vector<vector<vector<float>>> ff = { up_class1 ,other_class1 };
	return ff;

}







float analysi()
{

	cout << "...................  1.数据处理   ........................" << endl;
	// 1.读取txt文件
	string filepath = "ones.txt";
	vector<vector<string>> savedatas = data_back(filepath);
	//3. 获取63个传感器数据和前后左右加倾角的5个数据,并将其转换为浮点型
	vector<vector<float>> onecircles = apply_datas(savedatas);


	cout << "...................  2.数据修正   ........................" << endl;
	int pre_batch_count = 101; //  #表示每个批次处理200行数据
	int indexs = 1; // 每批次计数
	int nums_count = 0;  // 计算总共有多少批次

	vector<vector<vector<float>>> denoise;//[ row1[[gan1],[gan1]],  row2[[gan1]],   row3[[gan1],[gan2],[gan3]] ]
	for (int i = 0; i < onecircles.size(); i++)//i < onecircles.size()
	{
		//
		// 3. 倾角、平移补偿,去掉空格,返回的数据类型为: vector<vector<vector<float>>>

		if (indexs % pre_batch_count != 0)
		{
			int num1 = denoise.size();
			denoise = angle_dispose(denoise, onecircles[i], indexs);
			if (denoise.size() - num1 > 0)
			{
				indexs += 1;
			}
		}
		else
		{
			cout << "...................." << nums_count<< "...................." << endl;
			//(1. 记大于等于3个的类
			unordered_map<string, vector<vector<float>>> ths;
			unordered_map<string, vector<vector<float>>> cls;
			vector<string>key1;
			vector<string>key2;
			for (int j = 0; j < denoise.size(); j++)
			{
				//cout << "元素长度====>: " << denoise.size() << endl;
				if (denoise[j].size() < 3)
				{
					//cout << "元素个数: " << denoise[j].size() << endl;
					cls[to_string(j)]=(denoise[j]);
					//cls[to_string(j)].push_back(denoise[j]);
					key1.push_back(to_string(j));
				}
				else
				{
					//cout << "元素个数ss: " << denoise[j].size() << endl;
					cls[to_string(j)] = {};
					ths[to_string(j)]=(denoise[j]);
					key1.push_back(to_string(j));
					key2.push_back(to_string(j));
				}
			}

			//(2. 将同一行大于3个的值去除成2个值
			vector<vector<vector<float>>> batchs = two_saves(key1,key2, cls, ths);
			/*#对batch_datas的200行数据进行计算,实际数据可能大于200个
			# (1. 求均值
			# (2. 根据均值将数据分为两大类
			# (3. 对两大类数据再分类,分成一个类、两个类再加上其他类
			# (4. 对分好的类构造直线 y = k*x + b
			# (5. 求类中各点到直线的距离
			# (6. 求距离的正态分布
			# (7. 根据正态分布去掉噪点,剩下的点即为分好类的点

			# (1. 求均值*/
			vector<float> ss = data_means(batchs);
			float x_mean = ss[0];
			float z_mean = ss[1];
			float yy = ss[2];

			cout <<"均值:  " <<x_mean << " " << z_mean << endl;

			//# (2. 根据均值将数据分为两大类
			vector<vector<vector<float>>> hh =two_classes(x_mean, z_mean, batchs);
			vector<vector<float>> up_classes = hh[0];
			vector<vector<float>> down_classes = hh[1];

			//  # (3 对两大类数据再分类,分成一个类、两个类再加上其他类
			vector<vector<vector<float>>> backs = second_classes(up_classes, down_classes);
			cout << "====>  " << backs[0].size() << "  " << backs[1].size() << "  " << backs[2].size() << "  " << backs[3].size() << endl;
			up_classes = backs[0];
			down_classes = backs[1];
			vector<vector<float>> others1 = backs[2];
			vector<vector<float>> others2 = backs[3];
			
			// # (4. 对分好的类构造直线 y = k1*x + b1  
			vector<vector<vector<float>>> ff = line_bn(up_classes);
			vector<vector<float>> up_class1 = ff[0]; // 其中一个类的点
			vector<vector<float>> other_class1 = ff[1];
			cout << "1.--->  " << up_class1.size() << endl;

			vector<vector<vector<float>>> dd = line_bn(down_classes);
			vector<vector<float>> down_class1 = dd[0]; // 另一个类的点
			vector<vector<float>> other_class2 = dd[1];
			cout << "2.--->  " << down_class1.size() << endl;

			
			// 初始值归0,重新开始计算
			indexs = 1;
			denoise.clear();
			nums_count += 1;
		}
		
	}


	cout << "正弦值======>  " << sin(30 * 3.1415926 / 180) << endl;
	//cout << denoise.size() << endl;

	return 0;
}

3.数据处理的散点图效果

(1)所有数据的散点图

(2)将上面的数据每200列作为一组处理,以下是第200列到第400列的数据的散点图,图中的黑点是所有点的均值,并根据均值的竖直方向的距离将所有数据分为上下两类(红色类和绿色类)

(3)以下红色类和绿色类各多出一种颜色,多出的颜色是进一步去除的数据,这一步是计数两个类的数据根据点到直线的距离转换为各自的正态分布数据,然后去除掉距离的正态分布数据大于1的点,最后剩下红色和绿色两个类。

(4)以下是其他几组长度为200的数据的分好类的散点图效果(还可以):

总数据:

分类结果:

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

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

相关文章

学习大数据DAY28 python基础语法

目录 思维导图 数据类型 变量 输入 输出 运算符 bool 类型 常量变量拼接 流程控制 选择结构 if 循环结构 while 及 for 循环 字符串(String) 字符串的索引截取 索引 1.len() #获取字符串长度 2.str.find()字符查找 ,找到返回索引&#xff0c;没找到返回-1 3.st…

[Linux安全运维] iptables包过滤

前言 防火墙是网络安全中非常重要的设备&#xff0c;是一种将内部网络和外部网络隔离开的技术。简单来说&#xff0c;防火墙技术就是访问控制技术&#xff0c;由规则和动作组成。 目录 前言1. Linux 包过滤防火墙1 .1 概述1 .2 四表五链结构1 . 2 .1 规则表1 . 2 .2 规则链1 .…

扩散模型系列ControlNet: Adding Conditional Control to Text-to-Image Diffusion Models

向文本到图像扩散模型添加条件控制 摘要解读&#xff1a; 我对摘要英文的理解&#xff1a; 我们提出了一个神经网络架构ControlNet&#xff0c;可以向大规模的预训练好的文本到图像的扩散模型中添加空间条件控制。ControlNet锁住了准备生产的大规模扩散模型&#xff0c;并且重…

SLAM特征提取新变革:神经符号学结合自适应优化,实现环境适应性大飞跃!

论文标题&#xff1a; A Neurosymbolic Approach to Adaptive Feature Extraction in SLAM 论文作者&#xff1a; Yasra Chandio, Momin A. Khan, Khotso Selialia, Luis Garcia, Joseph DeGol, Fatima M. Anwar 导读&#xff1a; 本研究提出了一种创新的神经符号学方法&a…

Mybatis进阶提升-(一)Mybatis入门

前言 Mybatis是Java 项目开发使用率非常高的一款持久层框架&#xff0c;它支持自定义 SQL、存储过程以及高级映射。MyBatis 免除了几乎所有的 JDBC 代码以及设置参数和获取结果集的工作。MyBatis 可以通过简单的 XML 或注解来配置和映射原始类型、接口和 Java POJO&#xff08…

python+selenium+unittest自动化测试框架

前言 关于自动化测试的介绍&#xff0c;网上已有很多资料&#xff0c;这里不再赘述&#xff0c;UI自动化测试是自动化测试的一种&#xff0c;也是测试金字塔最上面的一层&#xff0c;selenium是应用于web的自动化测试工具&#xff0c;支持多平台、多浏览器、多语言来实现自动化…

【实战】SpringBoot整合ffmpeg实现动态拉流转推

SpringBoot整合ffmpeg实现动态拉流转推 在最近的开发中&#xff0c;遇到一个 rtsp 协议的视频流&#xff0c;前端vue并不能直接播放&#xff0c;因此需要对流进行处理。在网上查阅后&#xff0c;ffmpeg和webrtc是最多的解决方案&#xff0c;但是使用webrtc的时候没成功&#x…

交通 | 不确定条件下旅行者路径选择的K阶均值偏差模型

摘要 现实世界中的交通网络通常具有随机特性&#xff0c;旅行时间可靠性自然成为影响旅行者路线选择的关键因素。在这种情况下&#xff0c;仅凭平均路径旅行时间可能无法充分代表路径对旅行者的吸引力&#xff0c;本研究引入了 k k k 阶均值偏差模型&#xff0c;用于优化大型…

紫辉创投开启Destiny of Gods首轮投资,伯乐与千里马的故事仍在继续

近日&#xff0c;上海紫辉创业投资有限公司&#xff08;以下简称“紫辉创投”&#xff09;宣布开启GameFi链游聚合平台Destiny of Gods首轮投资500,000美金&#xff0c;并与其达成全面战略及业务层合作&#xff0c;双方将协同布局链上生态&#xff0c;共同推动链游行业健康发展…

研究人员可以采用什么策略来批判性地评估和综合其领域的不同文献

VersaBot Literature Review 一键生成文献综述 研究人员可以采用各种策略来批判性地评估和综合其领域内的不同文献&#xff1b; 评估策略 审查方法论&#xff1a; 分析每个来源中使用的研究设计、样本选择、数据收集和分析方法。考虑每种方法的潜在偏见、局限性和优势。评估…

宝通科技携手昇腾技术首席陈仲铭,共探工业大模型与生态发展

在人工智能技术的浪潮中&#xff0c;宝通科技始终致力于探索和应用前沿技术&#xff0c;推动工业智能化的发展。7月26日&#xff0c;宝通科技特邀昇腾生态技术首席陈仲铭博士&#xff0c;为宝通员工带来了一场主题为《工业大模型与业界发展生态》的技术分享会。本次分享会不仅为…

从CNN到Transformer:基于PyTorch的遥感影像、无人机影像的地物分类、目标检测、语义分割和点云分类教程

原文链接&#xff1a;从CNN到Transformer&#xff1a;基于PyTorch的遥感影像、无人机影像的地物分类、目标检测、语义分割和点云分类教程https://mp.weixin.qq.com/s?__bizMzUzNTczMDMxMg&mid2247610610&idx5&snf973c3e430c89d6123ca8f4892086c55&chksmfa8271…

nameparser,一个强大的 Python 库!

更多资料获取 &#x1f4da; 个人网站&#xff1a;ipengtao.com 大家好&#xff0c;今天为大家分享一个强大的 Python 库 - nameparser。 Github地址&#xff1a;https://github.com/derek73/python-nameparser 在处理用户数据时&#xff0c;尤其是涉及到用户姓名的场景下&am…

最佳需求管理工具:2024年10大主流工具

本文将分享2024年排名靠前的10款需求管理工具&#xff1a;PingCode、Worktile、Teambition、TAPD、禅道、明道云、CODING、Jama Connect、Jira、Codebeamer。 在选择需求管理工具时&#xff0c;你是否感到不知从何下手&#xff1f;面对市场上数不清的选项&#xff0c;确定哪一款…

远程办公访问优化指南:如何打造高效企业组网

当今数字化时代&#xff0c;远程办公已成为许多企业不可或缺的工作模式。面对地理位置分散、网络环境复杂等挑战&#xff0c;如何打造高效、稳定、安全的企业组网&#xff0c;成为企业IT部门亟需解决的问题。本文将为您提供一份远程办公访问优化指南&#xff0c;帮助您构建高效…

坐牢二十天 20240731(IO)

一.作业 1> 使用父子进程完成两个文件的拷贝 父进程拷贝前一半内容&#xff0c;子进程拷贝后一半内容 子进程结束后退出&#xff0c;父进程回收子进程的资源 #include <myhead.h> //定义求源文件长度的函数 int lenmain(const char *src,const char *dst) {int fd…

各类基于虚拟主机的应用及上线商城系统

一、基于域名访问 查看没有空行&#xff0c;没有注释的文件内容 [rootweb ~]# grep -Ev "#|^$" /usr/local/nginx/conf/nginx.conf [rootweb ~]# cp /usr/local/nginx/conf/nginx.conf /usr/local/nginx/conf/nginx.conf.bak [rootweb ~]# grep -Ev "#|^$"…

temu插件丨temu插件下载免费体验-特喵数据

在当今这个日新月异的电商时代&#xff0c;每一个细微的洞察都可能是商家决胜千里的关键。随着跨境电商平台的蓬勃兴起&#xff0c;Temu作为一股不可忽视的新兴力量&#xff0c;正以其独特的模式和强大的数据分析能力&#xff0c;引领着行业的新风尚。接下来看看让您的Temu店铺…

解决TensorFlow非法指令 (核心已转储)问题

背景 测试环境使用TensorFlow 1.14.0运行实体抽取和事项要素项目正常&#xff0c;打包项目和miniconda3环境进行部署&#xff0c;进行predict时报错。然后使用dockerfile生成环境镜像进行部署&#xff0c;发现仍报错。最后查资料解决该问题。 Using TensorFlow backend. 非法指…

《CSS创意项目实战指南》:点亮网页,从实战中掌握CSS的无限创意

CSS创意项目实战指南 在数字时代&#xff0c;网页不仅是信息的载体&#xff0c;更是艺术与技术的融合体。通过CSS&#xff0c;你可以将平凡的网页转变为引人入胜的视觉盛宴&#xff0c;让用户体验跃升至全新高度。《CSS创意项目实战指南》正是这样一本引领你探索CSS无限可能的…