axis

matlab的三维绘图和四维绘图

不羁的心 提交于 2020-02-14 02:07:03
一、三维绘图 1.曲线图 plot3(X1,Y1,Z1,...):以默认线性属性绘制三维点集(X1,Y1,Z1)确定的曲线 plot3(X1,Y1,Z1,LineSpec):以参数LineSpec确定的线性属性绘制三维点集 plot3(X1,Y1,Z1,'PropertyName',PropertyValue,...):根据指定的属性绘制三维曲线 theta = 0:0.01*pi:2*pi; x = sin(theta); y = cos(theta); z = cos(4*theta); plot3(x,y,z,'LineWidth',2); hold on; theta = 0:0.02*pi:2*pi; x = sin(theta); y = cos(theta); z = cos(4*theta); plot3(x,y,z,'rd','MarkerSize',10,'LineWidth',2); 2.网格图 绘制函数z=f(x,y)的三维网格图的过程: 确定自变量x和y的取值范围和取值间隔 利用meshgrid函数生成“格点”矩阵 计算自变量采样“格点”上的函数值:Z = f(x,y) matlab中提供了mesh函数用于实现绘制网格图: mesh(X,Y,Z):绘制三维网格图,颜色与曲面的高度相匹配 mesh(Z):系统默认颜色与网格区域的情况下绘制数据Z的网格图

【机器学习】逻辑回归

折月煮酒 提交于 2020-02-14 01:30:46
logistic回归又称logistic回归分析,是一种广义的线性回归分析模型,常用于数据挖掘,疾病自动诊断,经济预测等领域。例如,探讨引发疾病的危险因素,并根据危险因素预测疾病发生的概率等。 sigmoid函数 通过sigmoid函数,可以将任何实数值转换为区间为【0,1】之间值相应的值就符合了概率对应的值域 import numpy as np from matplotlib import pyplot as plt # 定义sigmoid函数 def sigmoid ( t ) : return 1 / ( 1 + np . exp ( - t ) ) x = np . linspace ( - 10 , 10 , 1000 ) y = sigmoid ( x ) plt . plot ( x , y ) plt . show ( ) 逻辑回归损失函数:表征模型预测值与真实值的不一致程度。 损失函数为什么选择用交叉验证。原因是平方损失在训练的时候会出现一定的问题。当预测值与真实值之间的差距过大时,这时候参数的调整就需要变大,但是如果使用平方损失,训练的时候可能看到的情况是预测值和真实值之间的差距越大,参数调整的越小,训练的越慢。 from sklearn import datasets iris = datasets . load_iris ( ) x = iris .

合并与分割

烈酒焚心 提交于 2020-02-13 06:40:16
目录 Merge and split concat Along distinct dim/axis stack: create new dim Dim mismatch Unstack Split Merge and split tf.concat tf.split tf.stack tf.unstack concat Statistics ablout scores [class1-4,students,scores] [class5-6,students,scores] import tensorflow as tf # 6个班级的学生分数情况 a = tf.ones([4, 35, 8]) b = tf.ones([2, 35, 8]) c = tf.concat([a, b], axis=0) c.shape TensorShape([6, 35, 8]) # 3个学生学生补考 a = tf.ones([4, 32, 8]) b = tf.ones([4, 3, 8]) tf.concat([a, b], axis=1).shape TensorShape([4, 35, 8]) Along distinct dim/axis stack: create new dim Statistics about scores School1:[classes,students

Pytorch——Deeplizard视频学习 (4)

江枫思渺然 提交于 2020-02-12 04:32:24
CNN Flatten Operation Visualized - Tensor Batch Processing for Deep Learning Flatten operation for a batch of image inputs to a CNN Flattening an entire tensor Flattening specific axes of a tensor Flattening the tensor batch Flattening specific axes of a tensor Flattening an RGB Image Flatten operation for a batch of image inputs to a CNN Flattening an entire tensor To flatten a tensor, we need to have at least two axes. This makes it so that we are starting with something that is not already flat. But what if we want to only flatten specific axes within the tensor? This is typically required

tensorflow中 tf.reduce_mean函数

痞子三分冷 提交于 2020-02-12 03:53:11
tf.reduce_mean 函数用于计算张量tensor沿着指定的数轴(tensor的某一维度)上的的平均值,主要用作降维或者计算tensor(图像)的平均值。 reduce_mean(input_tensor, axis=None, keep_dims=False, name=None, reduction_indices=None) 第一个参数input_tensor: 输入的待降维的tensor; 第二个参数axis: 指定的轴,如果不指定,则计算所有元素的均值; 第三个参数keep_dims:是否降维度,设置为True,输出的结果保持输入tensor的形状,设置为False,输出结果会降低维度; 第四个参数name: 操作的名称; 第五个参数 reduction_indices:在以前版本中用来指定轴,已弃用; 以一个维度是2,形状是[2,3]的tensor举例: import tensorflow as tf x = [[1,2,3], [1,2,3]] xx = tf.cast(x,tf.float32) mean_all = tf.reduce_mean(xx, keep_dims=False) mean_0 = tf.reduce_mean(xx, axis=0, keep_dims=False) mean_1 = tf.reduce_mean(xx, axis

DataFrame和Series的简单运算(加减乘除)

半世苍凉 提交于 2020-02-10 22:17:26
一、先运行下面的程序 import numpy as np import pandas as pd from pandas import Series , DataFrame # 下面两个方法都可以 # frame = DataFrame(np.arange(9).reshape(3,3), columns=list('abc'), index=['one', 'two', 'threee']) frame = DataFrame ( np . arange ( 9 ) . reshape ( 3 , 3 ) , columns = [ 'a' , 'b' , 'c' ] , index = [ 'one' , 'two' , 'threee' ] ) # print(frame) series = frame [ 'b' ] # print(series) 二、然后在Python Console交互 frame和Series如下: In [ 3 ] : frame Out [ 3 ] : a b c one 0 1 2 two 3 4 5 threee 6 7 8 In [ 4 ] : series Out [ 4 ] : one 1 two 4 threee 7 Name : b , dtype : int32 下面是运算交互: DataFrame.operate(Series

pandas核心数据结构第二天

a 夏天 提交于 2020-02-08 09:20:03
文章目录 一、Series 创建 支持ndarry数组操作 二、DataFrame 创建 特性 三维数组创建 三、基础运算 一维数组处理 排序 排名 一、Series 创建 #1创建一个序列,索引必须为列表 b = pd . Series ( np . random . randn ( 5 ) , index = [ 'a' , 'b' , 'c' , 'd' , 'e' ] ) print ( b ) #2查看索引 print ( b . index ) #3默认不指定索引时,为0开始排的整型索引即可 c = pd . Series ( np . random . randn ( 5 ) ) print ( c ) 结果: D : \ProgramData\Anaconda3\python . exe D : / numpy - kexue / 03. py a 0.168710 b 0.436219 c - 0.236762 d 0.426008 e - 0.951852 dtype : float64 Index ( [ 'a' , 'b' , 'c' , 'd' , 'e' ] , dtype = 'object' ) 0 1.506954 1 0.282373 2 0.963675 3 0.671374 4 - 0.936167 dtype : float64

numpy中的ufunc函数详解

社会主义新天地 提交于 2020-02-08 05:12:30
什么是universal function A universal function (or ufunc for short) is a function that operates on ndarrays in an element-by-element fashion, supporting array broadcasting, type casting, and several other standard features. That is, a ufunc is a “vectorized” wrapper for a function that takes a fixed number of specific inputs and produces a fixed number of specific outputs ——来源:numpy.org 简言之,universal function是定义在ndarray上的运算,是元素-元素的运算 numpy中还有一个十分重要的概念:broadcast(广播),借助广播,能够使得shape不相同的array一同参与运算,可参考: 广播 ufunc的一些简单属性 nin : 输入的个数 nout : 输出的个数 nargs : The number of arguments. Data attribute containing the

Kaggle | Santander Customer Transaction Prediction(EDA and Baseline)

ぐ巨炮叔叔 提交于 2020-02-08 01:18:16
Santander Customer Transaction Prediction: EDA and Baseline 1 Description At Santander our mission is to help people and businesses prosper. We are always looking for ways to help our customers understand their financial health and identify which products and services might help them achieve their monetary goals. Our data science team is continually challenging our machine learning algorithms, working with the global data science community to make sure we can more accurately identify new ways to solve our most common challenge, binary classification problems such as: is a customer satisfied?

Pandas基础4(变换与排序)

為{幸葍}努か 提交于 2020-02-07 19:53:15
Pandas排序(主要研究对DataFrame的排序): .sort_index(axis,ascending)方法对指定轴的索引进行排序; 未给定参数的情况下,默认对0轴进行升序操作。左侧列为0轴,上行排为1轴。 .sort_values(by,axis=0,ascending=True)方法对值进行排序; by是给定的一个索引。 这里需要注意的是,若排序方向为axis=0,axis参数可以缺省;排序方向为axis=1,axis参数不能缺省。 NaN统一放在排序的末尾。 基本统计分析函数: 适用于DataFrame,Series类型 : .sum() .count() .mean() .median() .var() .std().min() .max()其中DataFrame返回为Series类型,Series返回为零维。 仅适用于Series类型 : .argmin() .argmax()返回自动索引位置 .idxmin() .idxmax()返回自定义索引位置 .describe()方法: Series返回一个Series类型: 因此可以索引:Se.describe()[‘count’]获得count DataFrame返回一个DataFrame类型: 默认按照0轴进行统计,需要获得某一个统计值,可以使用loa=c.discribe().iloc(‘max’)即可。 复习