- 博客(33)
- 资源 (11)
- 收藏
- 关注
原创 Python Scipy&NUmpy Tutorials:Scipy与Matplot
import numpy as npfrom scipy.misc import imread, imresizeimport matplotlib.pyplot as pltimg = imread('assets/cat.jpg')img_tinted = img * [1, 0.95, 0.9]# Show the original imageplt.subplot(1, 2, 1)
2017-05-12 14:11:58 598
原创 Python Scipy Tutorials:Matplot
# -*- coding: utf-8 -*-"""Python Version: 3.5Created on Fri May 12 14:06:44 2017E-mail: Eric2014_Lv@sjtu.edu.cn@author: DidiLv"""import numpy as npimport matplotlib.pyplot as plt# Compute the x
2017-05-12 14:10:07 504
原创 Python Scipy Tutorials:Distance between points
# -*- coding: utf-8 -*-"""Python Version: 3.5Created on Fri May 12 13:52:52 2017E-mail: Eric2014_Lv@sjtu.edu.cn@author: DidiLv"""import numpy as npfrom scipy.spatial.distance import pdist, squar
2017-05-12 13:59:06 583
原创 Python Scipy Tutorials:Scipy(Image Operation)
# -*- coding: utf-8 -*-"""Python Version: 3.5Created on Fri May 12 13:33:35 2017E-mail: Eric2014_Lv@sjtu.edu.cn@author: DidiLv"""from scipy.misc import imread, imsave, imresize# Read an JPEG imag
2017-05-12 13:44:57 651
原创 Python Numpy Tutorials: Broadcasting
Broadcasting typically makes your code more concise and faster, so you should strive to use it where possible.# -*- coding: utf-8 -*-"""Python Version: 3.5Created on Fri May 12 12:50:49 2017E-mail:
2017-05-12 13:14:03 611
原创 Numpy问题:empty_like函数工作原理?
# -*- coding: utf-8 -*-"""Python Version: 3.5Created on Fri May 12 11:24:54 2017E-mail: Eric2014_Lv@sjtu.edu.cn@author: DidiLv"""import numpy as npx = np.array([[1,2,3],[4,5,6],[7,8,9],[10,11,12
2017-05-12 12:38:14 5169 1
原创 Python Numpy Tutorials: 改变数组的维度
转自原链接,向作者致敬! 我们已经学习了怎样使用reshape函数,现在来学习一下怎样将数组展平。(1) ravel 我们可以用ravel函数完成展平的操作: In: b Out: array([[[ 0, 1, 2, 3], [ 4, 5, 6, 7], [ 8, 9,10,11]], [[12,13,14,15], [16,17,18,19], [20,21,22,23]]])
2017-05-11 23:35:09 8804 1
原创 Python Numpy Tutorials: 数组中数学函数及变形(reshape)
# -*- coding: utf-8 -*-"""Python Version: 3.5Created on Thu May 11 17:00:47 2017E-mail: Eric2014_Lv@sjtu.edu.cn@author: DidiLv"""# 数学的函数import numpy as npx = np.array([[1,2],[3,4]])# 计算所有的数组值pr
2017-05-11 23:09:43 1478
原创 Python Numpy Tutorials: 数组乘法:点乘和矩阵(数组)乘法
# -*- coding: utf-8 -*-"""Python Version: 3.5Created on Thu May 11 16:51:20 2017E-mail: Eric2014_Lv@sjtu.edu.cn@author: DidiLv"""import numpy as npx = np.array([[1,2],[3,4]], dtype=np.float64)y
2017-05-11 16:59:54 24823 1
原创 Python Numpy Tutorials: 数据类型
# -*- coding: utf-8 -*-"""Python Version: 3.5Created on Thu May 11 16:32:36 2017E-mail: Eric2014_Lv@sjtu.edu.cn@author: DidiLv"""import numpy as npx = np.array([1,2])print(x.dtype) #在python 3.5里
2017-05-11 16:44:50 587
原创 机器学习小组知识点40:岭回归(L2)和LASSO(L1)
本文的照片皆源于参考文献链接,向原作者致敬! 注意: 防止过拟合加正则项,其余完全没啥难的。参考文献: http://www.jianshu.com/p/a47c46153326
2017-05-11 15:31:20 692
原创 Python Numpy Tutorials: 数组--4
# -*- coding: utf-8 -*-"""Python Version: 3.5Created on Thu May 11 14:42:49 2017E-mail: Eric2014_Lv@sjtu.edu.cn@author: DidiLv"""import numpy as npa = np.array([[1,2], [3, 4], [5, 6]])# 寻找元素大于2的值
2017-05-11 14:45:17 609
原创 Python Numpy Tutorials: 数组--3
# -*- coding: utf-8 -*-"""Python Version: 3.5Created on Thu May 11 11:18:49 2017E-mail: Eric2014_Lv@sjtu.edu.cn@author: DidiLv"""import numpy as npa = np.array([[1,2], [3, 4], [5, 6]])# An exampl
2017-05-11 14:41:26 476
原创 Python Numpy Tutorials: 数组--2
本文内容: 1. 从二维数组里面提取一维和二维数组,注意Index的区别和用法 2. 区分matlab的用法# -*- coding: utf-8 -*-"""Python Version: 3.5Created on Thu May 11 10:52:38 2017E-mail: Eric2014_Lv@sjtu.edu.cn@author: DidiLv"""import nu
2017-05-11 11:17:54 503
原创 Python Numpy Tutorials: 数组--1
# -*- coding: utf-8 -*-"""Python Version: 3.5Created on Thu May 11 10:45:37 2017E-mail: Eric2014_Lv@sjtu.edu.cn@author: DidiLv"""import numpy as np# 下面创建一个二维数组# [[ 1 2 3 4]# [ 5 6 7 8]#
2017-05-11 10:52:01 412
原创 Python Numpy Tutorials: 数组
作为科学工作者,Matlab大家更为熟悉,该Tutorial将会更新Python与Matlab的对比,前期扎扎实实打基础,后面总结。# -*- coding: utf-8 -*-"""Python Version: 3.5Created on Thu May 11 10:20:49 2017E-mail: Eric2014_Lv@sjtu.edu.cn@author: DidiLv"""
2017-05-11 10:43:45 441
原创 Python Numpy Tutorials: 类
class Greeter(object): # Constructor def __init__(self, name): self.name = name # Create an instance variable # Instance method def greet(self, loud=False): if loud:
2017-05-08 21:20:15 509
原创 Python Numpy Tutorials: 函数
本文内容: 函数# -*- coding: utf-8 -*-"""Python Version: 3.5Created on Mon May 8 21:01:40 2017E-mail: Eric2014_Lv@sjtu.edu.cn@author: DidiLv"""# function 1: def sign(x): if x > 0: return
2017-05-08 21:06:59 500
原创 Python Numpy Tutorials: 元组
# -*- coding: utf-8 -*-"""Python Version: 3.5Created on Mon May 8 17:04:45 2017E-mail: Eric2014_lv@sjtu.edu.cn@author: DidiLv"""d = {(x, x + 1): x for x in range(10)} # Create a dictionary wit
2017-05-08 17:13:36 888
原创 Python Numpy Tutorials: 集合
本文内容: 集合# -*- coding: utf-8 -*-"""Python Version: 3.5Created on Mon May 8 16:46:14 2017E-mail: Eric2014_lv@sjtu.edu.cn@author: DidiLv"""# add(), len(), remove() function# Note: {**} stands fo
2017-05-08 17:04:04 493
原创 Python Numpy Tutorial: 字典
本文的内容: 字典的应用方法# -*- coding: utf-8 -*-"""Python Version: 3.5Created on Mon May 8 16:02:30 2017E-mail: Eric2014_Lv@sjtu.edu.cn@author: DidiLv"""d = {'cat': 'cute', 'dog': 'furry'} # Create a new
2017-05-08 16:36:46 1195
原创 Python Numpy Tutorial: 列表
1.# -*- coding: utf-8 -*-"""Python Version: 3.5Created on Sun May 7 23:12:00 2017E-mail: Eric2014_Lv@sjtu.edu.cn@author: DidiLv"""# 首先声明list 列表是一个可变的容器xs = [3, 1, 2] # Create a listprint(xs,
2017-05-07 23:55:36 428
原创 Python Numpy Tutorial: 基本数据类型
1. python里面没有对变量“++”的操作,例如: “x++” 2. 用关键字“True”和“False”来表示bool特征,例如: # -*- coding: utf-8 -*-"""Python Version: 3.5Created on Sun May 7 22:27:34 2017E-mail: Eric2014_Lv@sjtu.edu.cn@author: Didi
2017-05-07 23:11:26 545
原创 Python Numpy Tutorial: 二分归并排序
# -*- coding: utf-8 -*-"""Created on Sat May 6 11:32:07 2017E-mail: Eric2014_Lv@sjtu.edu.cn @author: DidiLvpython version: 3.5"""def quicksort(arr): if len(arr) <= 1: return arr
2017-05-06 11:47:33 839
原创 -----------------------python&Tensorflow分割线------------------
接下来的日子准备手撕Tensorflow,敬请期待。目标:细致的写代码,谨慎的debug,大胆的去尝试。
2017-05-04 11:23:17 959
原创 Tensorflow学习: RNN-LSTM应用于MNIST数据分类
本文内容: 1. RNN 2. 转自周莫烦的youtube视频,代码为原作者的Github# View more python learning tutorial on my Youtube and Youku channel!!!# Youtube video tutorial: https://www.youtube.com/channel/UCdyjiB5H8Pu7aDTNVXTTpcg
2017-05-03 20:34:43 2874
原创 Tensorflow学习: 保存变量和网络
本文内容: 1. 保存网络 2. 在保存网络的路径下保存变量import tensorflow as tfimport numpy as np### Save to file# remerber to define the same dtype and shape when restore#W = tf.Variable([[1,2,3],[3,4,5]], dtype = tf.fl
2017-05-03 17:09:53 630
原创 Tensorflow学习:单层神经网络的建立
本文内容:简单的建立一个神经网络 注:由于前博客中已经写过了线性回归以及深度神经网络(cnn)的博客,这篇看起来更简单些。# -*- coding: utf-8 -*-"""Created on Wed May 3 11:19:01 2017E-mail: Eric2014_Lv@sjtu.edu.cn@author: DidiLv"""import tensorflow as tf
2017-05-03 12:48:01 1187
原创 Tensorflow学习: Placeholder占位符
本文注意: 1. placeholder应用与feed_dcit是绑定的 2. 在r0.12版本中tensorflow的乘法是tensorflow.multiply(x,y)# -*- coding: utf-8 -*-"""Created on Wed May 3 11:05:30 2017E-mail: Eric2014_Lv@sjtu.edu.cn@author: DidiLv
2017-05-03 11:18:26 1798
原创 Tensorflow学习:Variable变量
本文注意: 1. 变量设置千万一定要初始化,代码r0.12推荐 init = tf.global_variables_initializer() 2. 赋值函数assign()和add()函数类似,直到session的run()之后才会执行操作。与之类似的,一般我们会将神经网络模型中的参数表示为一系列的变量,在模型的训练过程中对变量进行更新操作。# -*- coding: utf-8 -*-"
2017-05-03 11:04:33 509
原创 Tensorflow学习:Session会话控制
本文内容:体会tensorflow.matmul(x,y)与numpy.dot(x,y)的内容with tf.Session()的自动关闭功能(即with语句功能)# -*- coding: utf-8 -*-"""Created on Wed May 3 09:18:43 2017E-mail: Eric2014_Lv@sjtu.edu.cn@author: DidiLv"""i
2017-05-03 10:40:55 670
原创 Tensorflow学习:MNIST 识别
# -*- coding: utf-8 -*-"""Created on Tue May 2 14:18:24 2017@author: DidiLvEmail: Eric2014_Lv@sjtu.edu.cn"""## import the examples startfrom tensorflow.examples.tutorials.mnist import input_data
2017-05-02 16:04:00 828
原创 Tensorflow学习:线性回归问题
# -*- coding: utf-8 -*-"""This is a practise of tensorflowTIME: 2017/5/2Author: Eric LvE-mail: Eric2014_Lv@sjtu.edu.cn """import tensorflow as tfimport numpy as np# 创建100个假点x y其中满足 y = x * 0.1 +
2017-05-02 13:20:32 1144
Inverse and determinant of partitioned symmetric matrix
2018-03-30
机器学习小组知识点18:伽马分布(Gamma Distribution)
2016-11-23
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人