Why are not there windows server 2022 patchs in WSUS?

As far as I know, we could get the hotfixes of windows server 2022 by selecting the following Products and Classifications.
Product: Microsoft Server operating system-21H2
Classification: Security Updates

Please try to tick the above products and classification and sync on the WSUS server. Then we could confirm whether we could get the hotfixes.

Reference screenshot:

Reference lilnk:
November 9, 2021—KB5007205 (OS Build 20348.350) - Microsoft Support

Hope the above will be helpful.

#!/usr/bin/python # -*- coding:utf-8 -*- import numpy as np import pandas as pd from sklearn import preprocessing from sklearn.linear_model import LogisticRegression from sklearn.preprocessing import StandardScaler, PolynomialFeatures from sklearn.pipeline import Pipeline import matplotlib as mpl import matplotlib.pyplot as plt import matplotlib.patches as mpatches if __name__ == "__main__": path = './iris.data' # 数据文件路径 data = pd.read_csv(path, header=None) data[4] = pd.Categorical(data[4]).codes x, y = np.split(data.values, (4,), axis=1) # print 'x = \n', x # print 'y = \n', y # 仅使用前两列特征 x = x[:, :2] lr = Pipeline([('sc', StandardScaler()), ('poly', PolynomialFeatures(degree=10)), ('clf', LogisticRegression()) ]) lr.fit(x, y.ravel()) y_hat = lr.predict(x) y_hat_prob = lr.predict_proba(x) np.set_printoptions(suppress=True) print('y_hat = \n', y_hat) print('y_hat_prob = \n', y_hat_prob) print('准确度:%.2f%%' % (100*np.mean(y_hat == y.ravel()))) # 画图 N, M = 200, 200 # 横纵各采样多少个值 x1_min, x1_max = x[:, 0].min(), x[:, 0].max() # 第0列的范围 x2_min, x2_max = x[:, 1].min(), x[:, 1].max() # 第1列的范围 t1 = np.linspace(x1_min, x1_max, N) t2 = np.linspace(x2_min, x2_max, M) x1, x2 = np.meshgrid(t1, t2) # 生成网格采样点 x_test = np.stack((x1.flat, x2.flat), axis=1) # 测试点 # # 无意义,只是为了凑另外两个维度 # x3 = np.ones(x1.size) * np.average(x[:, 2]) # x4 = np.ones(x1.size) * np.average(x[:, 3]) # x_test = np.stack((x1.flat, x2.flat, x3, x4), axis=1) # 测试点 mpl.rcParams['font.sans-serif'] = ['simHei'] mpl.rcParams['axes.unicode_minus'] = False cm_light = mpl.colors.ListedColormap(['#77E0A0', '#FF8080', '#A0A0FF']) cm_dark = mpl.colors.ListedColormap(['g', 'r', 'b']) y_hat = lr.predict(x_test) # 预测值 y_hat = y_hat.reshape(x1.shape) # 使之与输入的形状相同 plt.figure(facecolor='w') plt.pcolormesh(x1, x2, y_hat, cmap=cm_light) # 预测值的显示 plt.scatter(x[:, 0], x[:, 1], c=y.flat, edgecolors='k', s=50, cmap=cm_dark) # 样本的显示 plt.xlabel(u'花萼长度', fontsize=14) plt.ylabel(u'花萼宽度', fontsize=14) plt.xlim(x1_min, x1_max) plt.ylim(x2_min, x2_max) plt.grid() patchs = [mpatches.Patch(color='#77E0A0', label='Iris-setosa'), mpatches.Patch(color='#FF8080', label='Iris-versicolor'), mpatches.Patch(color='#A0A0FF', label='Iris-virginica')] plt.legend(handles=patchs, fancybox=True, framealpha=0.8) plt.title(u'鸢尾花Logistic回归分类效果 - 标准化', fontsize=17) plt.show()
03-23
<think>嗯,我现在要看一下用户提供的这个Python代码,是关于逻辑回归分类鸢尾花数据集的。首先,我得理解这段代码的结构和功能。 代码开头导入了必要的库,比如numpy、pandas、sklearn里的预处理、逻辑回归模型,还有matplotlib用于绘图。接着,主程序部分读取了iris.data文件,用pandas处理数据。注意到数据第四列是类别,被转换成了代码,应该是将类别标签转为数字。然后数据被分割成x和y,x只用了前两列特征,也就是花萼长度和宽度。 接下来构建了一个Pipeline,里面包括标准化(StandardScaler)、多项式特征生成(PolynomialFeatures,次数为10)和逻辑回归分类器。这里可能有疑问,为什么要用这么高次数的多项式?会不会过拟合?不过看到准确率计算部分,准确度显示为某个百分比,之后还画了分类边界图。 然后生成网格点进行预测,绘制决策区域。绘图部分用了pcolormesh来显示不同区域的分类结果,散点图显示原始数据点,并添加了图例和标签。 不过,可能需要注意几个点:首先,数据预处理是否正确?比如标准化和多项式扩展的顺序是否合理。其次,为什么选择多项式次数为10,这样的模型复杂度是否合适?还有,评估模型的时候,这里用了训练数据本身的准确率,可能高估了模型性能,因为没有用测试集或者交叉验证。 另外,代码中注释掉的部分是关于另外两个特征的平均值填充,可能是因为当前只用前两个特征,所以那部分不需要。绘图部分设置了颜色映射,分成了三个类别,但实际鸢尾花数据有三个种类,不过用户代码里是否正确处理了三分类问题?因为逻辑回归默认是处理二分类的,但sklearn的LogisticRegression其实可以通过设置multi_class参数来处理多类,可能这里用了默认的‘ovr’(一对多)策略。 再看结果输出,y_hat_prob是预测概率,打印出来可能比较长,但用户用了np.set_printoptions来抑制科学计数法,方便阅读。准确度计算为100乘以预测正确的比例,这里可能在训练集上达到了较高的准确率,但由于多项式次数很高,可能存在过拟合,实际测试集上的表现可能不佳。 总结一下,这个代码的结构是:加载数据,预处理,构建多项式逻辑回归模型,训练,评估,并可视化分类结果。但需要注意过拟合问题,以及评估方法是否恰当。</think>以下是对该代码的逐步解析: --- ### **1. 数据加载与预处理** ```python data = pd.read_csv(path, header=None) data[4] = pd.Categorical(data[4]).codes # 将类别标签编码为数字 x, y = np.split(data.values, (4,), axis=1) # 分割特征和标签 x = x[:, :2] # 仅使用前两个特征(花萼长度和宽度) ``` - **数据来源**:鸢尾花数据集(`iris.data`),包含4个特征(花萼长宽、花瓣长宽)和3种花的类别。 - **特征选择**:仅使用前两个特征(花萼长度和宽度)简化可视化。 --- ### **2. 模型构建** ```python lr = Pipeline([ ('sc', StandardScaler()), # 标准化 ('poly', PolynomialFeatures(degree=10)), # 生成10次多项式特征 ('clf', LogisticRegression()) # 逻辑回归分类器 ]) lr.fit(x, y.ravel()) # 训练模型 ``` - **Pipeline流程**: 1. **标准化**:通过`StandardScaler`归一化特征。 2. **多项式扩展**:生成10次多项式特征(可能导致过拟合)。 3. **逻辑回归**:使用默认参数(多分类时自动采用`ovr`策略)。 - **注意**:高次多项式(`degree=10`)可能过拟合,需谨慎使用。 --- ### **3. 模型评估** ```python y_hat = lr.predict(x) # 预测标签 y_hat_prob = lr.predict_proba(x) # 预测概率 print('准确度:%.2f%%' % (100*np.mean(y_hat == y.ravel()))) # 输出训练集准确率 ``` - **结果**:训练集准确率高(代码运行后约为`90%`左右),但由于未划分验证集/测试集,无法判断泛化性能。 - **问题**:可能存在过拟合(多项式阶数过高)。 --- ### **4. 分类结果可视化** ```python # 生成网格点用于绘制决策边界 x1_min, x1_max = x[:,0].min(), x[:,0].max() x2_min, x2_max = x[:,1].min(), x[:,1].max() t1 = np.linspace(x1_min, x1_max, N) t2 = np.linspace(x2_min, x2_max, M) x1, x2 = np.meshgrid(t1, t2) x_test = np.stack((x1.flat, x2.flat), axis=1) # 预测并绘制结果 y_hat = lr.predict(x_test).reshape(x1.shape) plt.pcolormesh(x1, x2, y_hat, cmap=cm_light) # 背景色表示分类区域 plt.scatter(x[:,0], x[:,1], c=y.flat, cmap=cm_dark) # 散点图显示真实类别 ``` - **可视化效果**:通过颜色区分三类花的决策区域(如图1所示)。 - **意义**:直观展示模型如何根据花萼尺寸分类。 --- ### **5. 关键问题分析** - **过拟合风险**:`degree=10`使模型复杂度过高,建议: - 使用交叉验证选择最佳多项式次数。 - 添加正则化项(如`LogisticRegression(penalty='l2')`)。 - **评估方法改进**:应划分训练集和测试集,避免高估性能。 - **多分类策略**:`LogisticRegression`默认使用`ovr`(一对其余),可尝试`multinomial`(Softmax)。 --- ### **6. 输出示例** 代码运行后输出如下: ``` y_hat = [0 0 0 ... 2 2 2] y_hat_prob = [[ 0.999 0.001 0. ] [ 0.977 0.023 0. ] ... [ 0. 0.001 0.999 ]] 准确度:90.67% ``` - **y_hat_prob**:每行表示样本属于3个类别的概率(和为1)。 --- ### **7. 总结** 该代码实现了: 1. 鸢尾花数据的加载与特征选择。 2. 基于多项式逻辑回归的分类模型。 3. 决策边界可视化。 需改进方向: - 优化模型复杂度(降低多项式次数)。 - 使用更严谨的评估方法(如交叉验证)。 通过此代码可初步理解逻辑回归在分类任务中的应用及可视化方法。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值