随机有放回采样:假设训练数据集有 m 条样本数据,每次从这 m 条数据中随机取一条数据放入采样集,然后将其返回,让下一次采样有机会仍然能被采样。然后重复 m 次,就能得到拥有 m 条数据的采样集,该采样集作为 Bagging 的众多分类器中的一个作为训练数据集。假设有 T 个分类器(随便什么分类器),那么就重复 T 此随机有放回采样,构建出 T 个采样集分别作为 T 个分类器的训练数据集。
# ********* Begin *********# def_G(self, features, labels, weights): ''' input:features(ndarray):数据特征 labels(ndarray):数据标签 weights(ndarray):样本权重系数 ''' e = 0 for i inrange(weights.shape[0]): if (labels[i] == self.G(self.X[i], self.clif_sets, self.alpha)): e += weights[i] return e
# 权值更新 def_w(self, a, clf, Z): w = np.zeros(self.weights.shape) for i inrange(self.M): w[i] = weights[i] * np.exp(-a * self.Y[i] * G(x, clf, self.alpha)) / Z self.weights = w
# G(x)的线性组合 defG(self, x, v, direct): result = 0 x = x.reshape(1, -1) for i inrange(len(v)): result += v[i].predict(x) * direct[i] return result
# 计算G(x)系数a self.init_args(X, y) ''' for i in range(100): classifier = DecisionTreeClassifier(max_depth=3) classifier.fit(X, y) self.clf_sets.append(classifier) e = 0 for i in range(len(self.weights)): temp = -1 if classifier.predict(X[i].reshape(1,-1))>0: temp = 1 if(self.Y[i] == temp): e += self.weights[i] a = self._alpha(e) self.alpha.append(a) z = self._Z(self.weights, a, self.clf_sets) self._w(a, self.clf_sets, z) '''
MNIST(Modified National Institute of Standards and Technology database)是一个广泛用于训练各种图像处理系统的大型手写数字数据库。它包含60,000个训练样本和10,000个测试样本,每个样本都是一个28x28像素的灰度图像,代表了0到9的一个数字。
import torch import torchvision from torch.utils.data import DataLoader import torch.nn as nn import torch.nn.functional as F import torch.optim as optim import matplotlib.pyplot as plt
# 开始一个循环,循环6次。在每次循环中,都会创建一个子图并显示一张图像和对应的标签 for i inrange(6): # 创建一个子图。2, 3, i + 1 表示创建一个2行3列的子图网格,并在第 i + 1 个位置创建子图 plt.subplot(2, 3, i + 1)
# 调整子图的布局,使得子图之间的间距适当,避免重叠 plt.tight_layout()
# 显示一张图像。example_data[i][0].cpu() 是要显示的图像,它被转移到 CPU 以便于绘图。cmap='gray' 表示使用灰度色图。interpolation='none' 表示不使用插值 plt.imshow(example_data[i][0].cpu(), cmap='gray', interpolation='none') # Move to CPU for plotting
sudomkdir -p /data/hbase/zookeeper vim /data/hbase/rsync.sh
添加以下内容:
1 2 3 4 5 6 7 8 9 10 11
for i in hadoop02 hadoop03 do sudo rsync -a /data/hbase $i:/data/ sudo scp -p /etc/profile.d/hbase.sh $i:/etc/profile.d/ done #复制hbase配置到其他机器 for i in hadoop02 hadoop03 do sudo rsync -a ~/hbase-2.5.6 $i:~/hbase-2.5.6 done
签名算法:这是一种用于验证信息来源和完整性的方法。在这种情况下,私钥用于生成数字签名,而公钥用于验证签名。这意味着只有拥有私钥的人才能生成有效的签名,但任何人都可以使用公钥来验证签名。这种方法通常用于防止信息被篡改或伪造。RSA和ECDSA(Elliptic Curve Digital Signature Algorithm)是签名算法的例子。
On branch master nothing to commit, working tree clean Enumerating objects: 710, done. Counting objects: 100% (710/710), done. Delta compression using up to 16 threads Compressing objects: 100% (326/326), done. Writing objects: 100% (550/550), 148.70 KiB | 1.33 MiB/s, done. Total 550 (delta 285), reused 4 (delta 2), pack-reused 0 remote: error: refusing to update checked out branch: refs/heads/master remote: error: By default, updating the current branch in a non-bare repository remote: error: is denied, because it will make the index and work tree inconsistent remote: error: with what you pushed, and will require 'git reset --hard' to match remote: error: the work tree to HEAD. remote: error: remote: error: You can set 'receive.denyCurrentBranch' configuration variable to remote: error: 'ignore' or 'warn' in the remote repository to allow pushing into remote: error: its current branch; however, this is not recommended unless you remote: error: arranged to update its work tree to match what you pushed in some remote: error: other way. remote: error: remote: error: To squelch this message and still keep the default behaviour, set remote: error: 'receive.denyCurrentBranch' configuration variable to 'refuse'.
# 配置阿里云的yum源 RUN curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo RUN curl -o /etc/yum.repos.d/epel.repo https://mirrors.aliyun.com/repo/epel-7.repo RUN yum makecache fast
Access to font at 'https://cdn.staticfile.org/font-awesome/6.4.2/webfonts/fa-solid-900.woff2' from origin 'http://localhost:4000' has been blocked by CORS policy: The 'Access-Control-Allow-Origin' header has a value 'https://www.pil0txia.com' that is not equal to the supplied origin. fa-solid-900.woff2:1 Failed to load resource: net::ERR_FAILED localhost/:1 Access to font at 'https://cdn.staticfile.org/font-awesome/6.4.2/webfonts/fa-brands-400.woff2' from origin 'http://localhost:4000' has been blocked by CORS policy: The 'Access-Control-Allow-Origin' header has a value 'https://www.mikuclub.win' that is not equal to the supplied origin. fa-brands-400.woff2:1 Failed to load resource: net::ERR_FAILED VM25:1 [Deprecation] 'window.webkitStorageInfo' is deprecated. Please use 'navigator.webkitTemporaryStorage' or 'navigator.webkitPersistentStorage' instead. V @ VM25:1 fireworks.min.js:1 Uncaught ReferenceError: anime is not defined at fireworks.min.js:1 at fireworks.min.js:1 localhost/:1 Access to font at 'https://cdn.staticfile.org/font-awesome/6.4.2/webfonts/fa-solid-900.ttf' from origin 'http://localhost:4000' has been blocked by CORS policy: The 'Access-Control-Allow-Origin' header has a value 'https://www.mikuclub.win' that is not equal to the supplied origin. fa-solid-900.ttf:1 Failed to load resource: net::ERR_FAILED localhost/:1 Access to font at 'https://cdn.staticfile.org/font-awesome/6.4.2/webfonts/fa-brands-400.ttf' from origin 'http://localhost:4000' has been blocked by CORS policy: The 'Access-Control-Allow-Origin' header has a value 'https://www.mikuclub.win' that is not equal to the supplied origin. fa-brands-400.ttf:1 Failed to load resource: net::ERR_FAILED content.js:30 Uncaught DOMException: Failed to execute 'getRangeAt' on 'Selection': 0 is not a valid index. at HTMLDocument.checkContextMenuInSelection (chrome-extension://hgploeanmefhfpokeenldbnhbnmnlplj/scripts/content.js:30:33)
VM26:1 [Deprecation] 'window.webkitStorageInfo' is deprecated. Please use 'navigator.webkitTemporaryStorage' or 'navigator.webkitPersistentStorage' instead. V @ VM26:1 fireworks.min.js:1 Uncaught ReferenceError: anime is not defined at fireworks.min.js:1 at fireworks.min.js:1 12Failed to decode downloaded font: <URL> localhost/:1 Failed to decode downloaded font: https://tianapi.netlify.app/fontawesome/fontawesome6.5.1/webfonts/fa-solid-900.woff2 localhost/:1 Failed to decode downloaded font: https://tianapi.netlify.app/fontawesome/fontawesome6.5.1/webfonts/fa-solid-900.woff2 localhost/:1 Failed to decode downloaded font: https://tianapi.netlify.app/fontawesome/fontawesome6.5.1/webfonts/fa-solid-900.woff2 localhost/:1 Failed to decode downloaded font: https://tianapi.netlify.app/fontawesome/fontawesome6.5.1/webfonts/fa-brands-400.woff2 localhost/:1 Failed to decode downloaded font: https://tianapi.netlify.app/fontawesome/fontawesome6.5.1/webfonts/fa-brands-400.woff2 localhost/:1 Failed to decode downloaded font: https://tianapi.netlify.app/fontawesome/fontawesome6.5.1/webfonts/fa-brands-400.woff2 localhost/:1 Failed to decode downloaded font: https://tianapi.netlify.app/fontawesome/fontawesome6.5.1/webfonts/fa-solid-900.ttf localhost/:1 Failed to decode downloaded font: https://tianapi.netlify.app/fontawesome/fontawesome6.5.1/webfonts/fa-solid-900.ttf localhost/:1 Failed to decode downloaded font: https://tianapi.netlify.app/fontawesome/fontawesome6.5.1/webfonts/fa-solid-900.ttf localhost/:1 Failed to decode downloaded font: https://tianapi.netlify.app/fontawesome/fontawesome6.5.1/webfonts/fa-brands-400.ttf localhost/:1 Failed to decode downloaded font: https://tianapi.netlify.app/fontawesome/fontawesome6.5.1/webfonts/fa-brands-400.ttf localhost/:1 Failed to decode downloaded font: https://tianapi.netlify.app/fontawesome/fontawesome6.5.1/webfonts/fa-brands-400.ttf 6OTS parsing error: Failed to convert WOFF 2.0 font to SFNT localhost/:1 OTS parsing error: Failed to convert WOFF 2.0 font to SFNT localhost/:1 OTS parsing error: Failed to convert WOFF 2.0 font to SFNT localhost/:1 OTS parsing error: Failed to convert WOFF 2.0 font to SFNT localhost/:1 OTS parsing error: Failed to convert WOFF 2.0 font to SFNT localhost/:1 OTS parsing error: Failed to convert WOFF 2.0 font to SFNT localhost/:1 OTS parsing error: Failed to convert WOFF 2.0 font to SFNT localhost/:1 OTS parsing error: cmap: invalid table offset localhost/:1 OTS parsing error: cmap: invalid table offset localhost/:1 OTS parsing error: cmap: invalid table offset localhost/:1 OTS parsing error: cmap: table overruns end of file localhost/:1 OTS parsing error: cmap: table overruns end of file localhost/:1 OTS parsing error: cmap: table overruns end of file content.js:30 Uncaught DOMException: Failed to execute 'getRangeAt' on 'Selection': 0 is not a valid index. at HTMLDocument.checkContextMenuInSelection (chrome-extension://hgploeanmefhfpokeenldbnhbnmnlplj/scripts/content.js:30:33)