机器学习\数据挖掘学习日记20160504
来源:互联网 发布:2016年4月进出口数据 编辑:程序博客网 时间:2024/05/22 00:25
Python Numpy Reference 阅读
np.array, np.dtype 和 array scalar type 概念与关系
NumPy provides an N-dimensional array type, the ndarray, which describes a collection of items of the same type.
All ndarrays are homogenous: every item takes up the same size block of memory, and all blocks are interpreted in exactly the same way. How each item in the array is to be interpreted is specified by a separate data-type object
An item extracted from an array, e.g., by indexing, is represented by a Python object whose type is one of the array scalar types built in Numpy.
np.array
Base array and View array
View is An array that does not own its data, but refers to another array’s data instead.
Different ndarrays can share the same data, so that changes made in one ndarray may be visible in another. That is, an ndarray can be a view to another ndarray, and the data it is referring to is taken care of by the base ndarray.
任何对于np.array的操作,先明确其操作对象,是array本身? array的一个view? 还是array的一个copy?
Creation
- Using ndarray constructor
- Using array creation routines
Function XXX_like(an_array) Return a new array with the same shape and type as a given array
https://docs.scipy.org/doc/numpy-dev/reference/routines.array-creation.html#routines-array-creation
Indexing and Slicing
熟练地应用indexing 和 slicing 非常重要,可以对 data set 进行初步的处理
Basic indexing/slicing
x[selection object]
All arrays generated by basic slicing are always views of the original array.
You may use slicing to set values in the array, but (unlike lists) you can never grow the array.
integers: postivie index, negative index
slice object
tuple for multi-dimensions
ellipsis
np.newaxis = np.NoneField access
Indexing x[‘field-name’] returns a new view to the array (same shape with x)Advanced indexing
Advanced indexing always returns a copy of the data contrast with basic slicing that returns a view
integer array indexing
auto-broadcast
Boolean array indexing
If obj.ndim == x.ndim, x[obj] returns a 1-dimensional array filled with the elements of x corresponding to the True values of obj.np.ix_() function
Flat Iterator indexing
ndarray.flat : A 1-D iterator over the array
This iterator object can also be indexed using basic slicing or advanced indexing as long as the selection object is not a tuple. This should be clear from the fact that x.flat is a 1-dimensional view. The shape of any returned array is therefore the shape of the integer indexing object.
https://docs.scipy.org/doc/numpy-dev/reference/arrays.indexing.html#flat-iterator-indexing
- 机器学习\数据挖掘学习日记20160504
- 机器学习\数据挖掘学习日记 20160430
- 数据挖掘&机器学习
- 数据挖掘/机器学习
- 数据挖掘&机器学习
- 数据挖掘 机器学习 区别
- 机器学习与数据挖掘
- 机器学习与数据挖掘
- 机器学习与数据挖掘
- 机器学习 数据挖掘 好书
- 机器学习与数据挖掘
- 机器学习与数据挖掘
- 机器学习数据挖掘书单
- 机器学习&数据挖掘算法
- 机器学习与数据挖掘
- 机器学习与数据挖掘
- 机器学习&数据挖掘笔记
- 机器学习&数据挖掘笔记
- /*C#:扩展方法*/ 《自学系列》
- 并发编程学习总结(一) :java 创建线程的三种方式的优缺点和实例
- (礼拜三log)前端开发:replace函数
- javaweb学习总结(六)——Servlet开发(二)
- log4jdbc数据库访问日志框架使用
- 机器学习\数据挖掘学习日记20160504
- css选择器
- STM32F103 USART DMA收发不定长数据
- iOS热更新,JSPatch初探
- javaweb学习总结(七)——HttpServletResponse对象(一)
- java用double和float进行小数计算精度不准确
- iOS应用架构谈(一):架构设计的方法论
- javaweb学习总结(八)——HttpServletResponse对象(二)
- 第三届 山东省ACM省赛 Mine Number