04 2020 档案

摘要:网上有不少解释,包括下面这张图片 光靠图片理解还是不够,而且特别容易理解反了。这里用一个实例进行讲解。 一个非常简单的数据集,包含... 阅读全文
posted @ 2020-04-27 21:41 2021年的顺遂平安君 编辑
摘要:AttributeError: module ‘tensorflow_core._api.v2.config’ has no att... 阅读全文
posted @ 2020-04-27 20:03 2021年的顺遂平安君 编辑
摘要:卸载 sudo apt-get purge teamviewer 下载任意版本 wget https://download.teamviewer.com/download/linux/version_14x/teamviewer_amd64.deb ... 阅读全文
posted @ 2020-04-27 19:44 2021年的顺遂平安君 编辑
摘要:卸载 下载任意版本 安装 可能出现以下报错,可以忽略 配置 其他常用命令 阅读全文
posted @ 2020-04-27 19:44 2021年的顺遂平安君 编辑
摘要:```source activate myenvpython -m ipykernel install --user --name myenv --display-name "Python (myenv)"``` 阅读全文
posted @ 2020-04-24 21:24 2021年的顺遂平安君 编辑
摘要:source activate myenvpython -m ipykernel install --user --name myenv --display-name "Python (myenv)" 阅读全文
posted @ 2020-04-24 21:24 2021年的顺遂平安君 编辑
摘要:The parameters clipnorm and clipvalue can be used with all optimizers to control gradient clipping。 Keras的所有optimizer都可以使用clipno... 阅读全文
posted @ 2020-04-24 21:00 2021年的顺遂平安君 编辑
摘要:The parameters and can be used with all optimizers to control gradient clipping。 Keras的所有optimizer都可以使用 和`clipvalue`来防止梯度过大。 阅读全文
posted @ 2020-04-24 21:00 2021年的顺遂平安君 编辑
摘要:partial函数可以提高代码利用率和简洁性: 阅读全文
posted @ 2020-04-23 21:06 2021年的顺遂平安君 编辑
摘要:partial函数可以提高代码利用率和简洁性: from functools import partialdef power(base, exponent, bias): return base * exponent + biassquared =... 阅读全文
posted @ 2020-04-23 21:06 2021年的顺遂平安君 编辑
摘要:f = lambda X, y: X f(2,2)2 f([1,1]) () missing 1 required positional argument: 'y' f([1,1],[2,2])[1,1] 阅读全文
posted @ 2020-04-23 17:16 2021年的顺遂平安君 编辑
摘要:``` f = lambda X, y: X ``` ``` f(2,2) 2 ``` ``` f([1,1]) () missing 1 required positional argument: 'y' ``` ``` f([1,1],[2,2]) [1,1] ``` 阅读全文
posted @ 2020-04-23 17:16 2021年的顺遂平安君 编辑
摘要:`prefetch`可以使CPU和GPU的使用率最大化。 阅读全文
posted @ 2020-04-23 16:48 2021年的顺遂平安君 编辑
摘要:def csv_reader_dataset(filepaths, repeat=1, n_readers=5, n_read_threads=None, shuffle_buffer_size=10000, ... 阅读全文
posted @ 2020-04-23 16:48 2021年的顺遂平安君 编辑
摘要:导入数据 X = pd.read_csv('./datasets/housing/housing.csv')X = X.sample(n=10)X.drop(columns = X.columns.difference(['longitude']), i... 阅读全文
posted @ 2020-04-23 00:25 2021年的顺遂平安君 编辑
摘要:导入数据 为了避免报错,先进行格式转换: 图解: 将数据集重复3次, 每次输出一个包括10个元素的batch。 如果不能刚好等分,例如 最后一个batch将包含剩下的元素 函数 函数 使用 函数前需要先 阅读全文
posted @ 2020-04-23 00:25 2021年的顺遂平安君 编辑
摘要:以如下模型为例, 两个Dense层都带有regularizer,因此都有regularization loss项。 访问 可以得到当前的regularization loss 当前状态下第一层和第二层的regularization loss分别是0.07213736和0.06456626。 下面验证 阅读全文
posted @ 2020-04-22 20:13 2021年的顺遂平安君 编辑
摘要:以如下模型为例, l2_reg = keras.regularizers.l2(0.05)model = keras.models.Sequential([ keras.layers.Dense(30, activation="elu", kern... 阅读全文
posted @ 2020-04-22 20:13 2021年的顺遂平安君 编辑
摘要:参考文献:Hands-On Machine Learning with Scikit-Learn, Keras, and TensorFlow: Concepts, Tools, and Techniques to Build Intelligent Sy... 阅读全文
posted @ 2020-04-22 19:54 2021年的顺遂平安君 编辑
摘要:参考文献:Hands On Machine Learning with Scikit Learn, Keras, and TensorFlow: Concepts, Tools, and Techniques to Build Intelligent Systems 由于模型中存在regulariz 阅读全文
posted @ 2020-04-22 19:54 2021年的顺遂平安君 编辑
摘要:Loss函数 定义: 用法很简单,就是计算均方误差平均值,例如 Metrics函数 Metrics函数也用于计算误差,但是功能比Loss函数要复杂。 定义 这个定义过于简单,举例说明 输出结果 这个结果等价于 这是因为Metrics函数是 状态函数 ,在神经网络训练过程中会持续不断地更新状态,是有记 阅读全文
posted @ 2020-04-22 19:17 2021年的顺遂平安君 编辑
摘要:Loss函数 定义: keras.losses.mean_squared_error(y_true, y_pred) 用法很简单,就是计算均方误差平均值,例如 loss_fn = keras.losses.mean_squared_error a... 阅读全文
posted @ 2020-04-22 19:17 2021年的顺遂平安君 编辑
摘要:with tf.GradientTape(persistent=True) as tape: z1 = f(w1, w2 + 2.) z2 = f(w1, w2 + 5.) z3 = f(w1, w2 + 7.) z = [z1,z... 阅读全文
posted @ 2020-04-22 17:00 2021年的顺遂平安君 编辑
摘要:输出结果 输出结果 总结:如果对一个list 求微分,其结果将 自动求和 ,而不是返回 、`z2 z3 [w1,w2]`的微分。 阅读全文
posted @ 2020-04-22 17:00 2021年的顺遂平安君 编辑
摘要:``` A = np.matrix('3 1; 8 2') B = np.matrix('6 1; 7 9') ``` ``` A@B matrix([[25, 12], [62, 26]]) ``` 阅读全文
posted @ 2020-04-22 16:30 2021年的顺遂平安君 编辑
摘要:A = np.matrix('3 1; 8 2')B = np.matrix('6 1; 7 9') A@Bmatrix([[25, 12], [62, 26]]) 阅读全文
posted @ 2020-04-22 16:30 2021年的顺遂平安君 编辑
摘要:自定义损失函数 In statistics, the Huber loss is a loss function used in robust regression, that is less sensitive to outliers in data ... 阅读全文
posted @ 2020-04-21 18:01 2021年的顺遂平安君 编辑
摘要:自定义损失函数 In statistics, the Huber loss is a loss function used in robust regression, that is less sensitive to outliers in data than the squared error 阅读全文
posted @ 2020-04-21 18:01 2021年的顺遂平安君 编辑
摘要:输出结果 注意:如果key相同,第二个dict的item会覆盖第一个dict的item。 阅读全文
posted @ 2020-04-21 17:15 2021年的顺遂平安君 编辑
摘要:x = {'a': 1, 'b': 2} y = {'b': 3, 'c': 4} z = {**x, **y} 输出结果 {'a': 1, 'b': 3, 'c': 4} 注意:如果key相同,第二个dict的item会覆盖第一个dict的item... 阅读全文
posted @ 2020-04-21 17:15 2021年的顺遂平安君 编辑
摘要:官方说明: If both x and y are None, then this operation returns the coordinates of true elements of condition. The coordinates are r... 阅读全文
posted @ 2020-04-21 17:08 2021年的顺遂平安君 编辑
摘要:官方说明: If both x and y are None, then this operation returns the coordinates of true elements of condition. The coordinates are returned in a 2 D tenso 阅读全文
posted @ 2020-04-21 17:08 2021年的顺遂平安君 编辑
摘要:如果t是二维数组, 等价于 ;如果是三维数值, 等价于 。 和`np.newaxis`功能相同,都是增加维度。 阅读全文
posted @ 2020-04-21 15:26 2021年的顺遂平安君 编辑
摘要:如果t是二维数组,t[...,1]等价于t[:,1];如果是三维数值,t[...,1]等价于t[:,:,1]。 tf.newaxis和np.newaxis功能相同,都是增加维度。 t=tf.constant([[1,2,3],[4,5,6]]) t[... 阅读全文
posted @ 2020-04-21 15:26 2021年的顺遂平安君 编辑
摘要:tf.keras.backend.learning_phase() The learning phase flag is a bool tensor (0 = test, 1 = train) to be passed as input to any K... 阅读全文
posted @ 2020-04-20 22:24 2021年的顺遂平安君 编辑
摘要:The learning phase flag is a bool tensor (0 = test, 1 = train) to be passed as input to any Keras function that uses a different behavior at train tim 阅读全文
posted @ 2020-04-20 22:24 2021年的顺遂平安君 编辑
摘要:from keras.models import Sequentialfrom keras.layers import Dense, Activationmodel = Sequential([ Dense(32, input_shape=(784,... 阅读全文
posted @ 2020-04-20 20:52 2021年的顺遂平安君 编辑
摘要:mdl_A = keras.models.load("mdl_A.hf")mdl_B_on_A = keras.models.Sequential(mdl_A.layers[:-1])mdl_B_on_A.add(keras.layers.Dense(1,... 阅读全文
posted @ 2020-04-20 20:33 2021年的顺遂平安君 编辑
摘要:需要注意的是,此时 和`mdl_B clone mdl_A mdl_B`互不影响。 只拷贝网络结构,不会拷贝权重等训练好的参数,因此 之后需要用 把`mdl_A`的参数也一同拷贝过去。 阅读全文
posted @ 2020-04-20 20:33 2021年的顺遂平安君 编辑
摘要:概率密度函数(PDF) 以高斯分布的概率密度函数(PDF)为例, $f(x)=\frac{1}{\sigma\sqrt{2\pi}} e^{ \frac{1}{2}\left(\frac{x \mu}{\sigma}\right)^2}$ 期望值$\mu$和方差$\sigma$确定之后,$f(x)$ 阅读全文
posted @ 2020-04-20 19:49 2021年的顺遂平安君 编辑
摘要:概率密度函数(PDF) 以高斯分布的概率密度函数(PDF)为例, \(f(x)=\frac{1}{\sigma\sqrt{2\pi}} e^{-\frac{1}{2}\left(\frac{x - \mu}{\sigma}\right)^2}\) 期望... 阅读全文
posted @ 2020-04-20 19:49 2021年的顺遂平安君 编辑
摘要:Wide & Deep 神经网络 2016年谷歌公司的Cheng等人发表的文章Wide & Deep Learning for Recommender Systems介绍了一种新的架构,Wide & Deep ANNs. 通过将输入层的部分或全部信... 阅读全文
posted @ 2020-04-20 19:39 2021年的顺遂平安君 编辑
摘要:Wide & Deep 神经网络 2016年谷歌公司的Cheng等人发表的文章Wide & Deep Learning for Recommender Systems介绍了一种新的架构,Wide & Deep ANNs. 通过将输入层的部分或全部信息直接与输出层相连接,简单的特征可以通过捷径(sho 阅读全文
posted @ 2020-04-20 19:39 2021年的顺遂平安君 编辑
摘要:参考文献:Géron, Aurélien. Hands On Machine Learning with Scikit Learn, Keras, and TensorFlow: Concepts, Tools, and Techniques to Build Intelligent Systems 阅读全文
posted @ 2020-04-20 19:37 2021年的顺遂平安君 编辑
摘要:参考文献:Géron, Aurélien. Hands-On Machine Learning with Scikit-Learn, Keras, and TensorFlow: Concepts, Tools, and Techniques to Bui... 阅读全文
posted @ 2020-04-20 19:37 2021年的顺遂平安君 编辑
摘要:参考文献:Géron, Aurélien. Hands-On Machine Learning with Scikit-Learn, Keras, and TensorFlow: Concepts, Tools, and Techniques to Bui... 阅读全文
posted @ 2020-04-20 19:33 2021年的顺遂平安君 编辑
摘要:最近准备写一篇关于自组织映射 (Self organizing map)的文章。SOM的代码很多,研究了一圈之后目前使用最顺手的是R语言的kohonen包。 这个kohonen包功能很丰富,但是接口不是特别合理。R语言包大部分是统计学家写的,功能强大,数学上严谨,但是不怎么考虑代码的规范和简洁。 k 阅读全文
posted @ 2020-04-20 19:24 2021年的顺遂平安君 编辑
摘要:最近准备写一篇关于自组织映射 (Self-organizing map)的文章。SOM的代码很多,研究了一圈之后目前使用最顺手的是R语言的kohonen包。 这个kohonen包功能很丰富,但是接口不是特别合理。R语言包大部分是统计学家写的,功能强大,数... 阅读全文
posted @ 2020-04-20 19:24 2021年的顺遂平安君 编辑
摘要:python -c 'print("Hi")'Hi 阅读全文
posted @ 2020-04-15 20:43 2021年的顺遂平安君 编辑
摘要:```python -c 'print("Hi")'Hi``` 阅读全文
posted @ 2020-04-15 20:43 2021年的顺遂平安君 编辑
摘要:a=[2400,156000]b=[1950,126750]np.linalg.norm(a-b)29253.461333661013 a=[240,15600]b=[195,12675]np.linalg.norm(a-b)2925.346133366... 阅读全文
posted @ 2020-04-15 20:41 2021年的顺遂平安君 编辑
摘要:require(caTools)set.seed(101) sample = sample.split(data$anycolumn, SplitRatio = .75)train = subset(data, sample == TRUE)test =... 阅读全文
posted @ 2020-04-15 14:53 2021年的顺遂平安君 编辑
摘要:# reverse color rampcolors <- function(n, alpha = 1) { rev(heat.colors(n, alpha))} plot(NBA.SOM1, type = "counts", palette.n... 阅读全文
posted @ 2020-04-14 18:32 2021年的顺遂平安君 编辑
摘要:frac = .3df.groupby('b').apply(pd.DataFrame.sample, frac=.3) a bb 0 6 7 01 0 1 1 df.groupby('b', group_keys=Fal... 阅读全文
posted @ 2020-04-13 21:19 2021年的顺遂平安君 编辑
摘要:https://github.com/pages themes/cayman/issues/29 Disabling the "View on GitHub" button 阅读全文
posted @ 2020-04-09 18:31 2021年的顺遂平安君 编辑
摘要:https://github.com/pages-themes/cayman/issues/29 Disabling the "View on GitHub" button github: is_project_page: false ... 阅读全文
posted @ 2020-04-09 18:31 2021年的顺遂平安君 编辑
摘要:plt.pcolor(som.distance_map().T, cmap='bone_r') # plotting the distance map as background 这里的转置.T只是为了使得distnace小的地方颜色深,大的地方深色浅... 阅读全文
posted @ 2020-04-09 18:30 2021年的顺遂平安君 编辑
摘要:这里的转置 只是为了使得distnace小的地方颜色深,大的地方深色浅。 阅读全文
posted @ 2020-04-09 18:30 2021年的顺遂平安君 编辑

点击右上角即可分享
微信分享提示