axis

百度PaddlePaddle入门-5

夙愿已清 提交于 2020-02-06 18:38:11
Numpy是 Numerical Python 的简称,是Python中高性能科学计算和数据分析的基础包。Numpy提供了一个多维数组类型ndarray,它具有矢量算术运算和复杂广播的能力,可以实现快速的计算并且能节省存储空间。在使用Python调用飞桨API完成深度学习任务的过程中, 通常会使用Numpy实现数据预处理和一些模型指标的计算 ,飞桨中的Tensor数据可以很方便的和ndarray数组进行相互转换。 在这一节将介绍以下内容: 基础数据结构ndarray数组 随机数numpy.random 线性代数numpy.linalg Numpy保存和导入文件 应用举例 基础数据结构ndarray数组 ndarray数组是Numpy中的基础数据结构式,这一小节将从以下几个方面展开进行介绍: 为什么引入ndarray数组 如何创建ndarray数组 ndarray数组的基本运算 ndarray数组的切片和索引 ndarray数组的统计运算 为什么引入ndarray数组 在Python中使用list列表可以非常灵活的处理多个元素的操作,但是其效率却比较低。ndarray数组相比于Python中的list列表具有以下特点: ndarray数组中所有元素的数据类型是相同的,数据地址是连续的,批量操作数组元素时速度更快;list列表中元素的数据类型可以不同,需要通过寻址方式找到下一个元素

JAVA记录-WebService开发部署

醉酒当歌 提交于 2020-02-06 14:14:21
JWS、Axis2、cxf 1.下载axis2.war和axis2.bin.zip 2.将axis2.war包部署到Tomcat下,启动Tomcat测试:http://localhost:8089/axis2 3.新建web project,在src新建一个类编写好代码作为服务端,无需包名,编译生成.class, 拷贝到tomcat\webapps\axis2\WEB-INF\pojo下(需要新建pojo) 4.运行http://localhost:8089/axis2/services/listServices,查看服务名 5.获取服务:http://localhost:8089/axis2/services/DataGetService 6.客户端调用写好类代码,并运行http://localhost:8089/axis2/services/DataGetService?wsdl ###集成到ssmm web项目中去,将axis2-web拷贝到webapp下,将lib、conf、modules、services拷贝到WEB-INF下, spring-axis2.xml: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www

Axis2 插件安装 如何在低版本eclipse使用axis2 1.6.1插件

℡╲_俬逩灬. 提交于 2020-02-06 09:29:29
在eclipse-jee-galileo-SR1-win32上装了半天都装不上,偶然发现通过非常规手段可以使用。 一.插件安装 Add 1.3 插件到plugins Add 1.6插件到dropins 重启eclipse, 出现了2个,用第二个应该是1.6的 反向生成代码。 报错,缺少下图最上面2个包。 从AXIS2的LIB库中复制"geronimo-stax-api_1.0_spec-1.0.1.jar"和"backport-util-concurrent-3.1.jar"文件到Codegen的lib目录中,同时修改plugin.xml文件,添加 <library name="lib/geronimo-stax-api_1.0_spec-1.0.1.jar"> <exportname="*"/> </library> <library name="lib/backport-util-concurrent-3.1.jar"> <export name="*"/> </library> 到plugin.xml文件中,保存。 成功后1.3生成出的代码。 1.6生成出的代码 public void downFile(StringfilePath) { System.out.println(filePath); StringtargetUrl = "http://localhost

Numpy:矩阵分割

女生的网名这么多〃 提交于 2020-02-05 11:56:26
原文地址 生成测试数据 import numpy as np # 生成测试数据(下述维度描述针对此二维数据) a = np . arange ( 12 ) . reshape ( ( 3 , 4 ) ) # [[ 0 1 2 3] # [ 4 5 6 7] # [ 8 9 10 11]] 均等切分—— np.split(A,n,axis=0) # np.split(A,n,axis=0)把所有切分子集放在一个列表中返回 # A:要切分的矩阵 # n:均等切分成n个,若不能整除会报错 # axis:从哪个维度切分,索引从0开始 竖直切,也就是切第二维度 resdivide = np . split ( a , 2 , axis = 1 ) # 切成2个 # [array([[0, 1], # [4, 5], # [8, 9]]), array([[ 2, 3], # [ 6, 7], # [10, 11]])] 水平切,也就是切分第一维度 resdivide = np . split ( a , 3 , axis = 0 ) # 切成3个 # [array([[0, 1, 2, 3]]), array([[4, 5, 6, 7]]), array([[ 8, 9, 10, 11]])] 均等切分—— np.vsplit() 与 np.hsplit() np.vsplit()

决策树

霸气de小男生 提交于 2020-02-05 10:34:18
版权声明: 本文为博主原创文章,发表自 知一的指纹 。转载需向 我的邮箱 申请。 简单解释: 熵 为信息的期望值,计算公式如下。 $$ info(D) = -sum_{i=1}^m p_i log_2(p_i) $$ 信息增益 是指在划分数据集之前之后信息发生的变化。对信息按属性A划分后取得的熵。 $$ info_A(D) = sum_{j=1}^v frac{|D_j|}{|D|}info(D_j) $$ 计算两者之间的变化就是信息增益。 $$ gain(A) = info(D) - info_A(D) $$ 如下算法计算最大信息增益。 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 # -*- coding:utf-8 -*-"""决策树算法"""from __future__ import divisionimport mathimport operatorfrom collections import

DataFrame(8):DataFrame的排序问题

这一生的挚爱 提交于 2020-02-04 13:15:34
1、说明   DataFrame中的排序分为两种,一种是对索引排序,一种是对值进行排序。   对于索引排序,涉及到对行索引、列索引的排序,并且还涉及到是升序还是降序。函数df.sort_index(axis= , ascending= , inplace=),需要特别注意这三个参数。axis表示对行操作,还是对列操作;ascending表示升序,还是降序操作。   对于值排序,同样也是涉及到行、列排序问题,升序、降序排列问题。函数df.sort_values(by= , axis= , ascending= , inplace=),也需要特别注意这几个参数,只是多了一个by操作,需要我们指明是按照哪一行或哪一列,进行排序的。    注意:axis=0表示对行操作,axis=1表示对列进行操作;ascending=True表示升序,ascending=False表示降序;inplace=True表示对原始DataFrame本身操作,因此不需要赋值操作,inplace=False相当于是对原始DataFrame的拷贝,之后的一些操作都是针对这个拷贝文件进行操作的,因此需要我们赋值给一个变量,保存操作后的结果。 2、索引排序:df.sort_index() ① 对行索引,进行升序排列 df = pd . DataFrame ( { "A" : [ 1 , 3 , 5 , 7 , 9 ]

numpy

浪尽此生 提交于 2020-02-02 21:43:49
ndarray自带属性 import numpy as np a = np . array ( [ [ 0 , 1 , 2 , 3 , 4 ] , [ 9 , 8 , 7 , 6 , 5 ] ] ) a . ndim a . shape a . size a . dtype a . itemsize ndarray创建方法 #ndarray数组的创建方法 #1.从python中的列表元组创建 x = np . array ( [ 0 , 1 , 2 , 3 ] ) print ( x ) x = np . array ( ( 4 , 5 , 6 , 7 ) ) print ( x ) x = np . array ( [ [ 1 , 2 ] , [ 3 , 4 ] , ( 5 , 6 ) ] ) print ( x ) #2.使用numpy中的函数创建数组 #(1) y = np . arange ( 6 ) print ( y ) y = np . ones ( ( 2 , 2 ) , dtype = np . int32 ) print ( y ) y = np . eye ( 5 ) print ( y ) #(2) #np.ones_like(a) #np.zeros_like(a) #np.full_like(a,val) #(3) a = np . linspace (

python进行数据清理之pandas中的drop用法

北城以北 提交于 2020-02-02 21:37:59
好久好久没有更新博客了,之前自学的估计也都忘记差不多了。由于毕业选择从事的行业与自己的兴趣爱好完全两条路,心情也难过了很久,既然入职了就要好好干,仍要保持自己的兴趣,利用业余时间重拾之前的乐趣。 从基本的数据清理学起吧 讲一下drop函数的用法 删除表中的某一行或者某一列更明智的方法是使用drop,它不改变原有的df中的数据,而是可选择性的返回另一个dataframe来存放删除后的数据。 删除无效项 df[df.isnull()] #返回的是个true或false的Series对象(掩码对象),进而筛选出我们需要的特定数据。 df[df.notnull()] df.dropna() #将所有含有nan项的row删除 df.dropna(axis=1,thresh=3) #将在列的方向上三个为NaN的项删除 df.dropna(how='ALL') #将全部项都是nan的row删除 这里面,print(data.dropna() )和 print(data[data.notnull()] )结果一样 填充空缺项 df.fillna(0) df.fillna({1:0, 2:0.5}) #对第一列nan值赋0,第二列赋值0.5 df.fillna(method='ffill') #在列方向上以前一个值作为值赋给NaN method : {‘backfill’, ‘bfill’,

Two levels of y-axis tick labels in text on imagesc

时间秒杀一切 提交于 2020-02-02 15:13:32
问题 I'm plotting a figure that is a grid of colors/shades, based on the values from a 4x5 matrix. The x-axis and y-axis tick labels are set using text from a cell array. The y-axis tick labels exist at 2 levels, % y ticks, 2 levels ylabelnames = {'team1','set1';'team1','set2';'team2','set1';'team2','set2'}; I'd like the y-axis tick labels to either 1) span 2 lines, so that they match the 2 lines of text being overlaid in the squares of the plot, i.e. 'team#' on the first line and 'set#' on the

100道关于numpy的练习

↘锁芯ラ 提交于 2020-02-02 13:32:27
声明:并非原创,转自 https://github.com/rougier/numpy-100 This is a collection of exercises that have been collected in the numpy mailing list, on stack overflow and in the numpy documentation. The goal of this collection is to offer a quick reference for both old and new users but also to provide a set of exercices for those who teach. If you find an error or think you've a better way to solve some of them, feel free to open an issue at https://github.com/rougier/numpy-100 1. Import the numpy package under the name np (★☆☆) import numpy as np 2. Print the numpy version and the configuration (★☆☆) print