size

R语言中的四类统计分布函数

ぐ巨炮叔叔 提交于 2020-02-01 04:25:51
本文转载自: https://www.cnblogs.com/end/p/3718822.html 作者:end 转载请注明该声明。 R语言 中提供了四类有关统计分布的函数(密度函数,累计分布函数,分位函数,随机数函数)。分别在代表该分布的R函数前加上相应前缀获得(d,p,q,r)。如: 1)正态分布的函数是norm,命令dnorm(0)就可以获得正态分布的密度函数在0处的值(0.3989)(默认为标准正态分布)。 2)同理,pnorm(0)是0.5就是正态分布的累计密度函数在0处的值。 3)而qnorm(0.5)则得到的是0,即标准正态分布在0.5处的分位数是0(在来个比较常用的:qnorm(0.975)就是那个估计中经常用到的1.96了)。 4)最后一个rnorm(n)则是按正态分布随机产生n个数据。 上面正态分布的参数平均值和方差都是默认的0和1,你可以通过在函数里显示指定这些参数对其进行更改。如dnorm(0,1,2)则得出的是均值为1,标准差为2的正态分布在0处的概率值。 要注意的是()内的顺序不能颠倒。 关于二项分布的有关函数为: The Binomial Distribution Description Density, distribution function, quantile function and random generation for the

20175324 数据结构-java实现

北慕城南 提交于 2020-01-31 18:43:40
循环单链表-数据结构-java实现 目录 抽象表:1 循环单链表实现:1 循环单链表输出测试:4 输出结果:5 抽象表: package edu.cquptzx.List; public interface List { public void insert( int i ,Object obj) throws Exception; //插入 public Object delete( int i ) throws Exception; //删除 public Object getData( int i ) throws Exception; //获取i元素 public int size(); //表数据总数 public boolean isEmpty(); //是否为空 } 循环单链表实现: package edu.cquptzx.List; public class LoopLinkList implements List { Node head; Node current; int size; LoopLinkList() { head = current = new Node( null ); head.next = head; size =0; } /** * 定位成员函数index(int i)的实现 * 循环从头开始查找,循环的条件是:1.定位完成j==i;2

pytorch维度变换

喜夏-厌秋 提交于 2020-01-30 22:26:16
import torch as t a = t . rand ( 4 , 1 , 28 , 28 ) a . shape torch.Size([4, 1, 28, 28]) a . view ( 4 , 28 * 28 ) tensor([[0.7170, 0.7973, 0.8322, ..., 0.2318, 0.9531, 0.6618], [0.7864, 0.9424, 0.7775, ..., 0.7293, 0.7722, 0.3481], [0.4799, 0.8308, 0.0384, ..., 0.5429, 0.3318, 0.3176], [0.3548, 0.2738, 0.1126, ..., 0.8103, 0.5105, 0.5830]]) a . view ( 4 , 28 * 28 ) . shape torch.Size([4, 784]) a . view ( 4 * 28 , 28 ) . shape torch.Size([112, 28]) a . view ( 4 * 1 , 28 , 28 ) . shape torch.Size([4, 28, 28]) b = a . view ( 4 , 784 ) b . view ( 4 , 28 , 28 , 1 ) tensor([[[[0.7170], [0.7973], [0

Vector && String

自古美人都是妖i 提交于 2020-01-30 15:21:11
在需要动态分配数组时,考虑使用vector或string代替数组。大部分情况下,vector或string都可以完全替代Array。但当有性能要求时,基于引用计数实现的string则有可能无法满足要求。多线程环境下,基于引用计数实现的string存在性能隐忧,考虑禁用引用基数或者采用vector<char>代替。 利用reserve(size_t n)减少频繁reallocation开销。 对于Vector而言: 1 vector < int > v; 2 v.reserve( 1000 ); 3 for ( int i = 0 ; i < 1000 ; ++ i ) 4 v.push_back(i); 当然,这种方法只能在可以确切的或大概预计出需要多大容量的情况下使用。但如果事先无法预计,则可预先分配尽可能大的空间来容纳所需的元素。当添加完所有元素后,采用"Swap trick"裁减掉多余的空间 (Shrink-to-fit: reduction in capacity)。 Swap Trick: 1 vector < int > v; 2 3 vector < int > (v).swap(v); vector<int>(v)创建一个临时vector,该vector包含了v中所有int元素。创建临时vector调用vector的拷贝构造函数

Size definition of strcat() function

非 Y 不嫁゛ 提交于 2020-01-30 11:51:52
问题 The question is why should I define size of string ( string[] should be string[some-number] ) When the program is as following it gives me Abort trap: 6 : #include <stdio.h> #include <string.h> int main(void) { char buffer1[] = "computer"; char string[]="program"; strcat( buffer1, string ); printf( "buffer1 = %s\n", buffer1 ); } This is the program from http://www.tutorialspoint.com/cprogramming/c_data_types.htm it works fine: #include <stdio.h> #include <string.h> int main () { char str1[12]

Size definition of strcat() function

左心房为你撑大大i 提交于 2020-01-30 11:51:07
问题 The question is why should I define size of string ( string[] should be string[some-number] ) When the program is as following it gives me Abort trap: 6 : #include <stdio.h> #include <string.h> int main(void) { char buffer1[] = "computer"; char string[]="program"; strcat( buffer1, string ); printf( "buffer1 = %s\n", buffer1 ); } This is the program from http://www.tutorialspoint.com/cprogramming/c_data_types.htm it works fine: #include <stdio.h> #include <string.h> int main () { char str1[12]

Size definition of strcat() function

最后都变了- 提交于 2020-01-30 11:51:07
问题 The question is why should I define size of string ( string[] should be string[some-number] ) When the program is as following it gives me Abort trap: 6 : #include <stdio.h> #include <string.h> int main(void) { char buffer1[] = "computer"; char string[]="program"; strcat( buffer1, string ); printf( "buffer1 = %s\n", buffer1 ); } This is the program from http://www.tutorialspoint.com/cprogramming/c_data_types.htm it works fine: #include <stdio.h> #include <string.h> int main () { char str1[12]

Does double have a greater range than long?

时间秒杀一切 提交于 2020-01-29 04:22:09
问题 In an article on MSDN, it states that the double data type has a range of "-1.79769313486232e308 .. 1.79769313486232e308". Whereas the long data type only has a range of "-9,223,372,036,854,775,808 .. 9,223,372,036,854,775,807". How can a double hold so much more data than a long if they are both 64 bits in size? http://msdn.microsoft.com/en-us/library/cs7y5x0x(v=vs.90).aspx 回答1: The number of possible doubles, and the number of possible longs is the same, they are just distributed

Python property() 函数的使用方法

穿精又带淫゛_ 提交于 2020-01-29 00:43:21
class C: def __init__(self,size=100): self.size = size def getx(self): return self.size def setx(self,value): self.size = value def delx(self): del self.size x = property(getx,setx,delx) #如果c是C的实例化,c.x将触发getx, x=value将触发setx, del c.x将触发delx。 >>>c=C() #类的实例化 >>>c.x #调用property的第1个方法 100 >>>c.x = 200 #调用property的第2个方法 >>>c.x 200 >>>del c.x #调用property的第3个方法 c.x Traceback (most recent call last): File "<input>", line 1, in <module> File "<input>", line 5, in getx AttributeError: 'C' object has no attribute 'size' 来源: CSDN 作者: Rocky-zg 链接: https://blog.csdn.net/mtldswz312/article/details/103876265

pymysql模块学习之获取结果

允我心安 提交于 2020-01-28 04:40:59
目录 起步 查 获取结果 fetchone 情况一 情况二 情况三 fetchmany 情况一 情况二 情况三 fetchall 情况一 情况二 情况三 scroll移动 相对移动 绝对移动 示例代码 起步 #!/usr/bin/python3 # -*- coding: utf-8 -*- """pymysql查询 """ import pymysql conn = pymysql . connect ( user = 'root' , password = '' , host = 'localhost' , port = 3306 , charset = 'utf8mb4' , database = 'hardy2_db' , ) # 游标类型 cursor = conn . cursor ( cursor = None ) # cursor = conn.cursor(cursor=pymysql.cursors.DictCursor) 查 sql = 'select id, age, name as nickname from pymysql_tb;' affected = cursor . execute ( query = sql ) # 拿到查询到的记录数 # print(affected) # int, 返回受影响的行数数目 获取结果 fetchone cursor