摘要: IMDB数据集 它包含来自互联网电影数据库(IMDB)的50000条严重两极分化的评论 数据集被分为用于训练的25000条评论与用于测试的25000条评论 训练集和测试集都包含50%的正面评论和50%的负面评论 加载IMDB数据集 import tensorflow as tf from tenso 阅读全文
posted @ 2021-09-27 21:15 里列昂遗失的记事本 阅读(321) 评论(0) 推荐(0) 编辑
摘要: def f(x): return x ** 3 - 2 * x + 1 # 返回函数的值 def f1(s0, s1, s2): return (((s1 ** 2 - s2 ** 3) * f(s0) + (s2 ** 2 - s0 ** 2) * f(s1) + (s0 ** 2 - s1 ** 阅读全文
posted @ 2021-09-26 22:35 里列昂遗失的记事本 阅读(107) 评论(0) 推荐(0) 编辑
摘要: 梯度消失与梯度爆炸问题 反向传播算法的工作原理是从输出层到输入层次,并在此过程中传播误差梯度。一旦算法计算出损失函数相对于每个参数的梯度,可以使用这些梯度以梯度下降步骤来更新每个参数。 随着算法向下传播到较低层,梯度通常会越来越小。结果梯度下降更新使较低层的连接权重保持不变,训练不能收敛到一个良好的 阅读全文
posted @ 2021-09-26 21:15 里列昂遗失的记事本 阅读(410) 评论(0) 推荐(0) 编辑
摘要: 构造字典 DIAL_COODES=[ # 一个承载成对数据的列表,可以直接用在字典的构造方法中 (86,'China'), (91,'India'), (1,'United States'), (62,'Indonesia'), (55,'Brazil'), (92,'Pakistan'), (88 阅读全文
posted @ 2021-09-26 20:37 里列昂遗失的记事本 阅读(43) 评论(0) 推荐(0) 编辑
摘要: def fun(x): return x ** 3 - 2 * x + 1 def solve(a, b, epsilon): lamd = (5 ** 0.5 - 1) / 2 delta = b - a p = a + (1 - lamd) * (b - a) q = a + lamd * (b 阅读全文
posted @ 2021-09-26 20:17 里列昂遗失的记事本 阅读(726) 评论(0) 推荐(0) 编辑
摘要: 利用顺序API构建回归MLP 用回归神经网络解决加州的住房问题 用Sickit-Learn中的fetch_california_housing()函数加载数据 from sklearn.datasets import fetch_california_housing from sklearn.mod 阅读全文
posted @ 2021-09-19 17:01 里列昂遗失的记事本 阅读(765) 评论(0) 推荐(0) 编辑
摘要: import os import tarfile import urllib DOWNLOAD_ROOT = 'https://raw.githubusercontent.com/ageron/handson-ml2/master/' HOUSING_PATH = os.path.join('dat 阅读全文
posted @ 2021-09-19 09:46 里列昂遗失的记事本 阅读(117) 评论(0) 推荐(0) 编辑
摘要: from sklearn.datasets import load_iris import numpy as np from scipy import sparse import matplotlib.pyplot as plt import pandas as pd from IPython.di 阅读全文
posted @ 2021-09-19 09:43 里列昂遗失的记事本 阅读(349) 评论(0) 推荐(0) 编辑
摘要: 什么是可散列的数据类型 在Python词汇表(https://docs.python.org/3/glossary.html#term-hashable)中,关于可散列类型的定义有这样一段话: 如果一个对象是可散列的,那么在这个对象的生命周期中,它的散列值是不变 的,而且这个对象需要实现__hash 阅读全文
posted @ 2021-09-19 09:31 里列昂遗失的记事本 阅读(151) 评论(0) 推荐(0) 编辑
摘要: 数组 from array import array # 引入数组类型 from random import random floats=array('d',(random()for i in range(10**7))) # 利用一个可迭代对象来创建一个双精度浮点数的列表(类型码是'd'),这里的 阅读全文
posted @ 2021-09-19 09:11 里列昂遗失的记事本 阅读(19) 评论(0) 推荐(0) 编辑