axis

How to use maxout activation function in tensorflow?

匿名 (未验证) 提交于 2019-12-03 00:45:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I want to use maxout activation function in tensorflow, but I don't know which function should use. 回答1: I sent a pull request for maxout, here is the link: https://github.com/tensorflow/tensorflow/pull/5528 Code is as follows: def maxout(inputs, num_units, axis=None): shape = inputs.get_shape().as_list() if axis is None: # Assume that channel is the last dimension axis = -1 num_channels = shape[axis] if num_channels % num_units: raise ValueError('number of features({}) is not a multiple of num_units({})' .format(num_channels, num_units))

AttributeError: module 'numpy' has no attribute 'flip'

匿名 (未验证) 提交于 2019-12-03 00:44:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Error message: AttributeError: module 'numpy' has no attribute 'flip' I can't understand why it's giving me this error, I've googled and made sure I'm up to the latest version of numpy. I definitely don't have another file called numpy in my working directory. Any help would be greatly appreciated! 回答1: np.flip has been introduced for versions v.1.12.0 and beyond. For older versions, you can consider using np.fliplr and np.flipud . Alternatively, upgrade your numpy version using sudo pip install --upgrade numpy 回答2: Yes, flip is new, but

Axis Web Service throws error: Exception occurred while trying to invoke service method

匿名 (未验证) 提交于 2019-12-03 00:44:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am trying to invoke a web service that I have just hosted on out linux redhat server but it throws the error { http://xml.apache.org/axis/ }stackTrace:Exception occurred while trying to invoke service method + "methodname" I host the service in apache tomcat webserver The same service works fine when i host it in the windows xp environment with the same apache web server... Is there anyone who has experienced a similar problem. thanks.. 回答1: in the axis2.xml ... <parameter name="sendStacktraceDetailsWithFaults">false</parameter> set the

基于pandas进行数据预处理

匿名 (未验证) 提交于 2019-12-03 00:43:02
很久没用pandas,有些有点忘了,转载一个比较完整的利用pandas进行数据预处理的博文:https://blog.csdn.net/u014400239/article/details/70846634 1 import pandas as pd 2 import numpy as np 3 train_df =pd.read_csv( ‘ ../datas/train.csv ‘ ) # train set 4 test_df = pd.read_csv( ‘ ../datas/test.csv ‘ ) # test set 5 combine = [train_df, test_df] 查看数据维度以及类型 缺失值处理 查看object数据统计信息 数值属性离散化 计算特征与target属性之间关系 1 # 查看前五条数据 2 print train_df.head(5 ) 3 # 查看每列数据类型以及nan情况 4 print train_df.info() 5 # 获得所有object属性 6 print train_data.describe().columns 1 # 查看连续数值属性基本统计情况 2 print train_df.describe() 3 # 查看object属性数据统计情况 4 print train_df.describe(include=[

Scikit-learn数据变换

匿名 (未验证) 提交于 2019-12-03 00:41:02
转载自: https://blog.csdn.net/Dream_angel_Z/article/details/49406573 本文主要是对照 scikit-learn的preprocessing 章节结合代码简单的回顾下预处理技术的几种方法,主要包括标准化、数据最大最小缩放处理、正则化、特征二值化和数据缺失值处理。内容比较简单,仅供参考! 首先来回顾一下下面要用到的基本知识。 均值公式: 方差公式: 0-范数,向量中非零元素的个数。 1-范数: 2-范数: p-范数的计算公式: 数据标准化:当单个特征的样本取值相差甚大或明显不遵从高斯正态分布时,标准化表现的效果较差。实际操作中,经常忽略特征数据的分布形状,移除每个特征均值,划分离散特征的标准差,从而等级化,进而实现数据中心化。 公式为:(X-X_mean)/X_std 计算时对每个属性/每列分别进行. 将数据按其属性(按列进行)减去其均值,然后除以其方差。最后得到的结果是,对每个属性/每列来说所有数据都聚集在0附近,方差值为1。 首先说明下sklearn中preprocessing库里面的scale函数使用方法: sklearn.preprocessing.scale(X, axis= 0 , with_mean= True ,with_std= True , copy = True ) 1 根据参数的不同

pandas入门指南

匿名 (未验证) 提交于 2019-12-03 00:40:02
上一篇讲了numpy,除此之外,还有一个工具我们一定会使用,那就是pandas。如果说numpy中数据存储形式是 列表 的话,那么pandas中数据的存储形式更像是 字典 。为什么这么说呢?因为pandas中的数据每一行每一列都有名字,而numpy中没有。本文主要介绍pandas的基本使用方法,更多高级用法大家可以参考 pandas官方文档 安装:命令行中输入以下代码 pip3 install pandas 导入:为了简便,这里使用pd作为pandas的缩写(因为pandas依赖numpy,所以在使用之前需要安装和导入numpy) import numpy as np import pandas as pd 创建方法: pd.Series:创建pandas列表 pd.date_range:创建pandas日期列表 pd.DataFrame:创建pandas矩阵 矩阵属性 dtypes:数据类型 index:行名 columns:列名 values:数据值 describe():实值数据列的统计数据 T:矩阵的倒置 sort_index(axis=, ascending=):矩阵排序{axis:0(行排序),1(列排序)}{ascending:True(升序),False(降序)} sort_values(by=, ascending=):按某一列的值排序{by:列名} s = pd

R语言基础

匿名 (未验证) 提交于 2019-12-03 00:38:01
# encoding=utf-8 import numpy as np l = [[ 1 , 2 , 3 ] , [ 1 , 3 , 5 ]] type ( l ) # list # np.array npl = np.array ( l, dtype = np.int16 ) # np.array, type ( npl ) # np.array npl.shape # npl.ndim # 缁村害 npl.dtype # npl.size # # np.zeros ( [ 3 , 4 ] ) # 0 np.ones ( [ 3 , 4 ] ) # 1 # np.random.rand ( 2 , 4 ) # 2 X 4 np.random.rand () # np.random.randint ( 1 , 5 , 5 ) # 5 1~5 np.random.randn ( 1 , 5 ) # np.random.choice ( [ 10 , 20 , 30 ] ) # np.random.beta ( 10 , 20 , 100 ) # BETA 1~10 100 # npl = np.arange ( 1 , 11 ) .reshape ( [ 2 , 5 ] ) # 2 5 np.exp ( npl ) # e , npl np.exp2 ( npl ) # 2 ,

matlab 绕z轴旋转并绘制surf 和mesh 图

匿名 (未验证) 提交于 2019-12-03 00:34:01
clear m_data =load('xuanzhuan1.txt'); figure(1) x_temp = m_data(:,1); x = x_temp(1:10:length(x_temp));%数据截断 y = zeros(length(x),1); z_temp = m_data(:,2); z = z_temp(1:10:length(z_temp)); hold on; xlabel('x/mm axis') ylabel('y/mm axis') zlabel('z/um axis') plot3(x,y,z); %% 绕z轴旋转 r = sqrt(x.^2+y.^2); % 绕z轴旋转,求各点到z轴的距离r,即旋转半径 n = length(z); alpha = linspace(-pi,pi,n); xx = r * cos(alpha); % 前面的x,y,z是列向量,r就是列向量,列向量*行向量生成n阶矩阵 yy = r * sin(alpha); zz = z * ones(1,n); figure(2) %mesh(xx,yy,zz) % 之后可以用hidden off来关闭透视效果。 surf(xx,yy,zz); xlabel('x/mm axis') ylabel('y/mm axis') zlabel('z/um axis') axis

numpy.argsort的用法介绍

匿名 (未验证) 提交于 2019-12-03 00:30:01
参考文章: https://docs.scipy.org/doc/numpy-1.13.0/reference/generated/numpy.argsort.html numpy. argsort ( a axis=-1 kind='quicksort' order=None ) 返回数组排序后对应的下标。kind是排序算法,axis是排序的轴。 Parameters: a Array to sort. axis Axis along which to sort. The default is -1 (the last axis). If None, the flattened array is used. kind Sorting algorithm. order a Returns: index_array a a a[index_array] a . 举例: 1、一维数组 >>> x = np . array ([ 3 , 1 , 2 ]) >>> np . argsort ( x ) array([1, 2, 0]) 2、二维数组 >>> x = np . array ([[ 0 , 3 ], [ 2 , 2 ]]) >>> x array([[0, 3], [2, 2]]) >>> np . argsort ( x , axis = 0 ) array([[0, 1],

机器学习之 决策树

匿名 (未验证) 提交于 2019-12-03 00:30:01
决策树在现实生活中应用广泛,也非常容易理解,通过构建一颗决策树,只要根据树的的判断条件不断地进行下去,最终就会返回一个结果。例如下图所示。决策树天然地可以解决多分类问题,同时也可以应用于回归问题中。 现在先通过sklearn中封装的决策树方法对数据进行分类,来学习决策树。 [html] view plain copy print ? iris datasets x = iris y = iris plt.scatter(x[ y ==0,0],x[ y plt.scatter(x[ y ==1,0],x[ y plt.scatter(x[ y ==2,0],x[ y import numpy as np import matplotlib.pyplot as plt from sklearn import datasets iris = datasets.load_iris() x=iris.data[:,2:]#这里就用了2个特征 y=iris.target plt.scatter(x[y==0,0],x[y==0,1]) plt.scatter(x[y==1,0],x[y==1,1]) plt.scatter(x[y==2,0],x[y==2,1]) plt.show() [html] view plain copy print ? dt