This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 生成测试数据,训练样本 | |
X_train, y = make_blobs(n_samples = 1000, centers =2, n_features=2, random_state = 2) | |
# StandardScaler()以及fit_transfrom函数的作用需要解释一下 | |
scaler = StandardScaler() #数据预处理,使得经过处理的数据符合正态分布,即均值为0,标准差为1 | |
X_train_scaled = scaler.fit_transform(X_train, y) | |
y[y == 0] = -1 | |
# 将训练数据绘制出来 | |
fig, ax = plt.subplots() | |
ax.scatter(X_train_scaled[:, 0], X_train_scaled[:, 1], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
import time | |
from sklearn.datasets import make_blobs,make_circles,make_moons | |
from sklearn.preprocessing import StandardScaler | |
class SMOStruct: | |
""" 按照John Platt的论文构造SMO的数据结构""" | |
def __init__(self, X, y, C, kernel, alphas, b, errors, tol, eps, user_linear_optim, loop_threshold=2000): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# fcn全连接网络+RNN | |
1. 切片为单列 第一层全连接中neuron为1024,batch_size:3000(太大)。 170epoch错误率 0.27/0.31 | |
![enter description here][1] | |
第一层全连接neuron为512,batch_size:2500. 170epoch 错误率0.154/0.186;230epoch错误率0.154/0.186;280epoch错误率 0.063/0.078 | |
![enter description here][2] | |
2. 切片为2列 第一层全连接中neuron为1024,batch_size:2500。280epoch错误率0.093/0.127. | |
![enter description here][3] | |
第一层全连接中neuron为512,batch_size:2500. 260epoch错误率0.089/0.12. | |
![enter description here][4] | |
3. 切片为3列 第一层全连接中neuron为1024,batch_size:2500. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# fcn全连接网络+RNN | |
1. 切片为单列 第一层全连接中neuron为1024,batch_size:3000(太大)。 170epoch错误率 0.27/0.31 | |
![enter description here][1] | |
第一层全连接neuron为512,batch_size:2500. 170epoch 错误率0.154/0.186;230epoch错误率0.154/0.186;280epoch错误率 0.063/0.078 | |
![enter description here][2] | |
2. 切片为2列 第一层全连接中neuron为1024,batch_size:2500。280epoch错误率0.093/0.127. | |
![enter description here][3] | |
第一层全连接中neuron为512,batch_size:2500. 260epoch错误率0.089/0.12. | |
![enter description here][4] | |
3. 切片为3列 第一层全连接中neuron为1024,batch_size:2500. |