axis

How to make X axis in matplotlib/pylab to NOT sort automatically the values?

懵懂的女人 提交于 2019-12-05 16:46:56
问题 Whenever I plot, the X axis sorts automatically (for example, if i enter values 3, 2, 4, it will automatically sort the X axis from smaller to larger. How can I do it so the axis remains with the order I input the values i.e 3, 2, 4 import pylab as pl data = genfromtxt('myfile.dat') pl.axis('auto') pl.plot(data[:,1], data[:,0]) I found one function, set_autoscalex_on(FALSE) but I'm not sure how to use it or whether it is what I want. Thanks 回答1: You could provide a dummy x-range, and then

解释张量及TF的一些API

帅比萌擦擦* 提交于 2019-12-05 15:39:42
张量的定义   张量(Tensor)理论是数学的一个分支学科,在力学中有重要应用。张量这一术语起源于力学,它最初是用来表示弹性介质中各点应力状态的,后来张量理论发展成为力学和物理学的一个有力的数学工具。张量之所以重要,在于它可以满足一切物理定律必须与坐标系的选择无关的特性。 张量概念是矢量概念的推广,矢量是一阶张量。张量是一个可用来表示在一些矢量、标量和其他张量之间的线性关系的多线性函数(可以理解成是向量、矩阵以及更高维结构的统称)。   But we don’t have to restrict ourselves to linear algebra. As it turns out, we can move up the mathematical food chain a bit. It has long been known that there are bigger fish in the mathematical abstraction sea than just matrices. One such candidate is called a tensor. Tensors figure prominently in the mathematical underpinnings of general relativity and are fundamental to

numpy基本使用

我的梦境 提交于 2019-12-05 11:01:29
轴 axis 正常情况 0 行, 1 列 聚合函数 0列, 1 行 import numpy as np np.__version__ #查看numpy版本 一.创建ndarray 1.使用np.array()由python list创建 l = [1,4,2,5,6] n = np.array(l) 注意: numpy默认ndarray的所有元素的类型是相同的 如果传进来的列表中包含不同的类型,则统一为同一类型,优先级:str>float>int 2. 使用np的routines函数创建 1) np.ones(shape, dtype=None, order="C") 用来产生全是1的ndarray shape是用来指定ndarray的形状 dtype是数字的类型 例如: np.ones(shape=(7,7), dtype=np.int8) 2) np.zeros(shape, dtype=float, order='C') 用来产生全是0的ndarray 例如: np.zeros(shape=(7,7), dtype=np.float32) 3) np.full(shape, fill_value, dtype=None, order='C') 按照指定数字产生ndarray 例如: np.full(shape=(8,8), fill_value=8.) 4) np.eye

Get rid of client-config.wsdd in Axis

一笑奈何 提交于 2019-12-05 10:29:44
I am setting up my test environment and I need to programmatically register my handler/transport instead of using a client-config.wsdd: <?xml version="1.0" encoding="UTF-8"?> <deployment xmlns="http://xml.apache.org/axis/wsdd/" xmlns:java="http://xml.apache.org/axis/wsdd/providers/java"> <handler name="MyClient" type="java:foo.bar.MyClient"/> <transport name="MyTransport" pivot="MyClient"/> </deployment> Would you know if it's possible? Thanks in advance. OK, I've checked Axis sources and the following code solved my problem: AxisProperties.setProperty(EngineConfigurationFactory.SYSTEM

R - ggplot2 change x-axis values to non-log values

允我心安 提交于 2019-12-05 10:27:38
I am plotting some payment distribution information and I aggregated the data after scaling it to log-normal (base-e). The histograms turn out great but I want to modify the x-axis to display the non-log equivalents. My current axis displays [0:2.5:10] values Alternatively, I would like to see values for exp(2.5), exp(5), etc. Any suggestions on how to accomplish this? Anything I can add to my plotting statement to scale the x-axis values? Maybe there's a better approach - thoughts? Current code: ggplot(plotData, aes_string(pay, fill = pt)) + geom_histogram(bins = 50) + facet_wrap(~M_P)

Invoke soap webservice returning list of objects from java client with axis

不羁岁月 提交于 2019-12-05 09:37:40
I'm getting mad with webservices. I have a very simple soap webservice : @Remote public interface StudentService { public String sayHello(); public List<Student> getStudents(); } And @Stateless @WebService public class StudentServiceImpl implements StudentService { @Override public String sayHello() { return "Hello World"; } public List<Student> getStudents() { List<Student> students = new ArrayList<Student>(); Student st1 = new Student(); st1.setMatricule(1234); st1.setName("student1"); students.add(st1); Student st2 = new Student(); st2.setMatricule(5678); st2.setName("student2"); students

np的concatenate和pandas的groupby

与世无争的帅哥 提交于 2019-12-05 09:19:21
1. concatenate   concatenate函数可以实现对两个张量进行拼接,这个张量可以实一维向量,二维矩阵等等   1. 首先定义四个列表,然后用concatenate把他们拼接起来,这里我设axis=0 name = ['jack', 'ross', 'john', 'blues', 'frank', 'bitch', 'haha', 'asd', 'loubin'] age = [12, 32, 23, 4,32,45,65,23,65] married = [1, 0, 1, 1, 0, 1, 0, 0, 0] gender = [0, 0, 0, 0, 1, 1, 1, 1, 1] matrix = np.concatenate((name, age, married, gender), axis=0) print(matrix)   运行结果如下 C:\software\Anaconda\envs\ml\python.exe C:/学习/python/科比生涯数据分析/venv/groupy.py ['jack' 'ross' 'john' 'blues' 'frank' 'bitch' 'haha' 'asd' 'loubin' '12' '32' '23' '4' '32' '45' '65' '23' '65' '1' '0' '1' '1' '0'

numpy.linalg.norm() 求范数

白昼怎懂夜的黑 提交于 2019-12-05 09:10:49
1、linalg=linear(线性)+algebra(代数),norm则表示范数。 2、函数参数 x_norm=np.linalg.norm(x, ord=None, axis=None, keepdims=False) ①x: 表示矩阵(也可以是一维) ②ord:范数类型 向量的范数: 矩阵的范数: ord=1:列和的最大值 ord=2:|λE-ATA|=0,求特征值,然后求最大特征值得算术平方根( matlab在线版 ,计算ans=ATA,[x,y]=eig(ans),sqrt(y),x是特征向量,y是特征值) ord=∞:行和的最大值 ord=None:默认情况下,是求整体的矩阵元素平方和,再开根号。(没仔细看,以为默认情况下就是矩阵的二范数,修正一下,默认情况下是求整个矩阵元素平方和再开根号) ③axis:处理类型 axis=1表示按行向量处理,求多个行向量的范数 axis=0表示按列向量处理,求多个列向量的范数 axis=None表示矩阵范数。 ④keepding:是否保持矩阵的二维特性 True表示保持矩阵的二维特性,False相反 3、代码实现 import numpy as npx = np.array([ [0, 3, 4], [1, 6, 4]])#默认参数ord=None,axis=None,keepdims=Falseprint "默认参数

【深度学习】 Keras 实现Minst数据集上经典网络结构(DeepDense、LeNet、AlexNet、ZFNet)分类

 ̄綄美尐妖づ 提交于 2019-12-05 08:47:34
实验简介   本次实验一方面是熟悉Keras 序列式(Sequential)模型的使用,另一方面是复现早期的经典网络结构来学习神经网络搭建的技巧。数据集采用的是熟知的Minst手写识别,框架采用的是tensorflow、Keras,数据集和框架的导入和安装请点击 这里 。经典的网络结构已有大量博客进行理论分析,这里只给出代码仅供参考,关于神经网络结构的发展,推荐大家看 这篇文章 。 DeepDense   这个是自己定义的名字,也就是深度全连接网络。 # -*- coding: utf-8 -*- """ Created on Thu Jun 13 11:19:33 2019 @author: YLC """ from keras . datasets import mnist from keras . models import Sequential from keras . layers . core import Dense , Activation , Dropout from keras . utils import np_utils #数据集导入模块 ( X_train , y_train ) , ( X_test , y_test ) = mnist . load_data ( ) ; #参数定义模块 img_rows , img_cols = 28 , 28 #

jquery background change one axis only

*爱你&永不变心* 提交于 2019-12-05 06:55:02
I think my last question overwhelmed everybody so I will simplify I am attempting to change the background-position of the x-axis only. By default if only one value is defined, the other defaults to 50% , so this function: function colorChangePiano() { var bp = $("background-position").css; $("#target").css('background-position', (bp == -1131) ? '-377' : '0'); } returns background-position: 0 50% ; How can I modify the function to change x-axis but leave y-axis unchanged? edited --> this is for a sprite with 4 columns and 4 rows so the y-axis should remain dynamic. working site here: http:/