一.Matplotlib[结果可视化] #import os #os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' import tensorflow as tf import numpy as np import matplotlib.pyplot as plt #添加一个神经层,定义添加神经层的函数 def add_layer(inputs, in_size, out_size, activation_function = None): Weights =…
1. 代码实战 #!/usr/bin/env python #!_*_ coding:UTF-8 _*_ import numpy as np from sklearn import datasets from sklearn.cross_validation import train_test_split from sklearn.neighbors import KNeighborsClassifier # 载入内置训练数据集 iris = datasets.load_iris() # 这时…
1. 代码实战 #!/usr/bin/env python #!_*_ coding:UTF-8 _*_ import numpy as np # 这句话不知道是什么意思 np.random.seed(1337) from keras.models import Sequential from keras.layers import Dense import matplotlib.pyplot as plt # 创建一些训练数据 # 生成-1 到 1 之间的float64的200个数的列表 X…
1. 代码实现 #!/usr/bin/env python #! _*_ coding:UTF-8 _*_ import numpy as np import theano.tensor as T import theano if __name__ == "__main__": # 用一个累加器来测试共享变量 state = theano.shared(np.array(0, dtype=np.float64), 'state') inc = T.scalar('inc', dtype…
1.代码实战 #!/usr/bin/env python #!_*_ coding:UTF-8 _*_ from sklearn import datasets from sklearn.linear_model import LinearRegression import matplotlib.pyplot as plt # 从内置训练数据集中加载房价数据 loaded_data = datasets.load_boston() data_X = loaded_data.data data_y…
一.机器学习算法分类: 监督学习:提供数据和数据分类标签.--分类.回归 非监督学习:只提供数据,不提供标签. 半监督学习 强化学习:尝试各种手段,自己去适应环境和规则.总结经验利用反馈,不断提高算法质量 遗传算法:淘汰弱者,留下强者,进行繁衍和变异穿产生更好的算法. 二.选择机器学习算法和数据集 sklearn中有很多真实的数据集可以引入,也可以根据自己的需求自动生成多种数据集.对于数据集可以对其进行归一化处理. sklearn中的有着多种多样的算法,每一种算法都有其适用的场合.不同的属性和功…
scikit-learn官网:http://scikit-learn.org/stable/ 通常情况下,一个学习问题会包含一组学习样本数据,计算机通过对样本数据的学习,尝试对未知数据进行预测. 学习问题一般可以分为: 监督学习(supervised learning) 分类(classification) 回归(regression) 非监督学习(unsupervised learning) 聚类(clustering) 监督学习和非监督学习的区别就是,监督学习中,样本数据会包含要预测的标签(…
一.步骤: 导入包以及读取数据 设置参数 数据预处理 构建模型 编译模型 训练以及测试模型 二.代码: 1.导入包以及读取数据 #导入包 import numpy as np np.random.seed(1337) #设置之后每次执行代码,产生的随机数都一样 from tensorflow.examples.tutorials.mnist import input_data from keras.utils import np_utils from keras.models import Se…
一.步骤: 导入模块以及读取数据 数据预处理 构建模型 编译模型 训练模型 测试 二.代码: 导入模块以及读取数据 #导包 import numpy as np np.random.seed(1337) # from keras.datasets import mnist from keras.utils import np_utils # 主要采用这个模块下的to_categorical函数,将该函数转成one_hot向量 from keras.models import Sequential…
一.TensorFlow中的优化器 tf.train.GradientDescentOptimizer:梯度下降算法 tf.train.AdadeltaOptimizer tf.train.AdagradOptimizer tf.train.MomentumOptimizer:动量梯度下降算法 tf.train.AdamOptimizer:自适应矩估计优化算法 tf.train.RMSPropOptimizer tf.train.AdagradDAOptimizer tf.train.FtrlO…
# View more python tutorials on my Youtube and Youku channel!!! # Youtube video tutorial: https://www.youtube.com/channel/UCdyjiB5H8Pu7aDTNVXTTpcg # Youku video tutorial: http://i.youku.com/pythontutorial """ Please note, this code is only…
# View more python learning tutorial on my Youtube and Youku channel!!! # Youtube video tutorial: https://www.youtube.com/channel/UCdyjiB5H8Pu7aDTNVXTTpcg # Youku video tutorial: http://i.youku.com/pythontutorial """ Please note, this code…
# View more python learning tutorial on my Youtube and Youku channel!!! # Youtube video tutorial: https://www.youtube.com/channel/UCdyjiB5H8Pu7aDTNVXTTpcg # Youku video tutorial: http://i.youku.com/pythontutorial """ Please note, this code…
# View more python learning tutorial on my Youtube and Youku channel!!! # Youtube video tutorial: https://www.youtube.com/channel/UCdyjiB5H8Pu7aDTNVXTTpcg # Youku video tutorial: http://i.youku.com/pythontutorial """ Please note, this code…
# View more python learning tutorial on my Youtube and Youku channel!!! # Youtube video tutorial: https://www.youtube.com/channel/UCdyjiB5H8Pu7aDTNVXTTpcg # Youku video tutorial: http://i.youku.com/pythontutorial """ Please note, this code…
#调用查看线性回归的几个属性 # Youtube video tutorial: https://www.youtube.com/channel/UCdyjiB5H8Pu7aDTNVXTTpcg # Youku video tutorial: http://i.youku.com/pythontutorial """ Please note, this code is only for python 3+. If you are using python 2+, please…
# View more python learning tutorial on my Youtube and Youku channel!!! # Youtube video tutorial: https://www.youtube.com/channel/UCdyjiB5H8Pu7aDTNVXTTpcg # Youku video tutorial: http://i.youku.com/pythontutorial """ Please note, this code…
# View more python learning tutorial on my Youtube and Youku channel!!! # Youtube video tutorial: https://www.youtube.com/channel/UCdyjiB5H8Pu7aDTNVXTTpcg # Youku video tutorial: http://i.youku.com/pythontutorial """ Please note, this code…
bilibili莫烦tensorflow视频教程学习笔记 1.初次使用Tensorflow实现一元线性回归 # 屏蔽警告 import os os.environ[' import numpy as np import tensorflow as tf # create dataset x_data = np.random.rand(100).astype(np.float32) y_data = x_data * 2 + 5 ### create tensorflow structure St…
bilibili莫烦scikit-learn视频学习笔记 1.使用KNN对iris数据分类 from sklearn import datasets from sklearn.model_selection import train_test_split from sklearn.neighbors import KNeighborsClassifier # 从datasets中导入iris数据,包含150条样本,每条样本4个feature iris_data = datasets.load_i…
稍稍乱入的CNN,本文依然是学习周莫烦视频的笔记. 还有 google 在 udacity 上的 CNN 教程. CNN(Convolutional Neural Networks) 卷积神经网络简单讲就是把一个图片的数据传递给CNN,原涂层是由RGB组成,然后CNN把它的厚度加厚,长宽变小,每做一层都这样被拉长,最后形成一个分类器: 如果想要分成十类的话,那么就会有0到9这十个位置,这个数据属于哪一类就在哪个位置上是1,而在其它位置上为零. 在 RGB 这个层,每一次把一块核心抽出来,然后厚度…
一.Scikit Learn中使用estimator三部曲 1. 构造estimator 2. 训练模型:fit 3. 利用模型进行预测:predict 二.模型评价 模型训练好后,度量模型拟合效果的常见准则有: 1.      均方误差(mean squared error,MSE): 2.      平均绝对误差(mean absolute error,MAE) 3.      R2 score:scikit learn线性回归模型的缺省评价准则,既考虑了预测值与真值之间的差异,也考虑了问题…
The Road to learn React书籍学习笔记(第三章) 代码详情 声明周期方法 通过之前的学习,可以了解到ES6 类组件中的生命周期方法 constructor() 和 render() constructor() 构造函数只有在组件实例化并插入到 DOM 中的时候才会被调用.组件实例化的过程称为组件的挂载 mount render()方法也会在组件挂载过程中被调用,同时组件更新的时候也会被调用.每当组件的状态 state 和属性 props 改变的时候,组件的 render()…
莫烦视频网址 这个代码实现了预测和可视化 import os # third-party library import torch import torch.nn as nn import torch.utils.data as Data import torchvision import matplotlib.pyplot as plt # torch.manual_seed() # reproducible # Hyper Parameters EPOCH = # train the tra…
各种优化器的比较 莫烦的对各种优化通俗理解的视频 import torch import torch.utils.data as Data import torch.nn.functional as F from torch.autograd import Variable import matplotlib.pyplot as plt # 超参数 LR = 0.01 BATCH_SIZE = EPOCH = # 生成假数据 # torch.unsqueeze() 的作用是将一维变二维,torc…
import torch from torch.autograd import Variable import matplotlib.pyplot as plt torch.manual_seed() # fake data x = torch.unsqueeze(torch.linspace(-,,),dim=) y = x.pow() + 0.2 * torch.rand(x.size()) x, y = Variable(x,requires_grad=False), Variable(y…
转自:http://my.oschina.net/u/175377/blog/84420#OSC_h2_23 Scikit Learn: 在python中机器学习 Warning 警告:有些没能理解的句子,我以自己的理解意译. 翻译自:Scikit Learn:Machine Learning in Python 作者: Fabian Pedregosa, Gael Varoquaux 先决条件 Numpy, Scipy IPython matplotlib scikit-learn 目录 载入…
scikit learn 模块 调参 pipeline+girdsearch 数据举例:文档分类数据集 fetch_20newsgroups #-*- coding: UTF-8 -*- import numpy as np from sklearn.pipeline import Pipeline from sklearn.linear_model import SGDClassifier from sklearn.grid_search import GridSearchCV from sk…
滴:转载引用请注明哦[握爪] https://www.cnblogs.com/zyrb/p/9700343.html 莫烦教程是一个免费的机器学习(不限于)的学习教程,幽默风俗的语言让我们这些刚刚起步的小白们感到Friendly~o(* ̄︶ ̄*)o.为了巩固自己的记忆,也小小の贡献于他人,将莫烦教程进行整理.难免于有错误恳请批评指正,也希望自己始终能愉悦的学习!PS:大多数为整理文本,少部分添加自己的理解. Artificial Neural Nets VS Neural Nets ? 二三十年…
[pytorch]学习笔记-激励函数 学习自:莫烦python 什么是激励函数 一句话概括 Activation: 就是让神经网络可以描述非线性问题的步骤, 是神经网络变得更强大 1.激活函数是用来加入非线性因素的,解决线性模型所不能解决的问题. 2.激励函数要考虑到线性所收到的约束条件,也就是掰弯线性函数 3.它其实就是另外一个非线性函数. 比如说relu, sigmoid, tanh. 将这些掰弯利器嵌套在原有的结果之上, 强行把原有的线性结果给扭曲了. 使得输出结果 y 也有了非线性的特征…