![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Numpy
北辰Rick
学生学生学生!
展开
-
Python Numpy学习(一)数组结构
首先导入Nunpy import numpy as np 一、数组基础操作 数组内元素加法 array =np.array([1,2,3,4,5]) print(type(array)) <class 'numpy.ndarray'> array += 1 array array([2, 3, 4, 5, 6]) array2 = array +1 array2 array...原创 2019-01-24 23:52:35 · 663 阅读 · 0 评论 -
NonLinear Regression Problem & Ridge Regression
Part One : Basis for Nonlinear Regression In this part we’re going to investigate how to use linear regression to approximate and estimate complicated functions. For example, suppose we want to fit th...原创 2019-02-18 00:18:08 · 706 阅读 · 0 评论 -
Python Numpy学习(六)随机数生成
import numpy as np 一、随机数构造 np.random.rand(3,2) array([[0.6372113 , 0.27436914], [0.91140569, 0.95159513], [0.86491427, 0.58310291]]) np.random.randint(10,size =(5,4)) array([[3, 8, 1...原创 2019-01-31 05:47:46 · 245 阅读 · 0 评论 -
Python Numpy学习(五)四则运算
import numpy as np 一、向量相乘 x = np.array([5,5]) y = np.array([2,2]) 1、对应位置相乘 np.multiply(x,y) array([10, 10]) 2、向量内积 np.dot(x,y) 20 3、矩阵相乘 x.shape = 1,2 y.shape = 2,1 np.dot(x,y) array([[20]]) ...原创 2019-01-31 05:24:22 · 673 阅读 · 0 评论 -
Python Numpy学习(四)数组生成方式
import numpy as np np.array([1,2,3]) array([1, 2, 3]) 一、Arange结构 np.arange(10) array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) np.arange(2,20,2) array([ 2, 4, 6, 8, 10, 12, 14, 16, 18]) 从哪个数开始+到哪个数截止+...原创 2019-01-30 04:57:35 · 1229 阅读 · 0 评论 -
Python Numpy学习(三)数组形状操作
import numpy as np a_array = np.arange(10) a_array array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) 一、数组结构改变 a_array.shape (10,) a_array.shape = 2,5 a_array array([[0, 1, 2, 3, 4], [5, 6, 7, 8, 9]]...原创 2019-01-30 04:34:00 · 1049 阅读 · 0 评论 -
Linear Regression Practice
import numpy as np import pandas as pd import matplotlib.pyplot as plt Import other modules from sklearn import linear_model from sklearn.metrics import mean_squared_error from sklearn.metrics impor...原创 2019-02-15 05:56:53 · 489 阅读 · 0 评论 -
Python Numpy学习(二)排序
一、简单排序 import numpy as np a_array = np.array([[1.5,1.3,7.5], [5.6,7.8,1.2]]) a_array array([[1.5, 1.3, 7.5], [5.6, 7.8, 1.2]]) 按行排序 np.sort(a_array) array([[1.3, 1.5, 7.5]...原创 2019-01-25 11:27:48 · 189 阅读 · 0 评论 -
NonLinear Regression & Lasso & Homotopy Method
Part One : Coordinate Descent for Lasso The Lasso optimization problem can be formulated as w^∈argminw∈Rd∑i=1m(hw(xi)−yi)2+λ∥w∥1, \hat{w}\in{ argmin_{w\in R^{d}}\sum_{i=1}^{m}(h_{w}(x_{i})-y_{i})^{2}+...原创 2019-02-21 06:03:52 · 523 阅读 · 0 评论