데이터 공부기록

[Yang.T]ndarrays with Specific Values - Function 본문

sesac ai 과정/NUMPY

[Yang.T]ndarrays with Specific Values - Function

standingR 2023. 10. 7. 17:01

numpy.zeros (shape, dtype=float, order='C', *, like=None)

 

parameter= shape, dtype 등 들어가야할 변수들

argument = parameter에 실제 들어가는 값들 

 

예를 들자면, 내가 청년취업제도가 함수라고 가정하면, 

청년 취업제도 ( 주민등록등본 = , 월 소득 = , 주거지 정보 = )

이런 식으로 표현 할 수있고 , 각각 필요한 서류들의 종류가 Parameter, 직접 내가 제출한 서류들이 argument이다!  

 

numpy.zeros

numpy.zeros (shape, dtype=float, order='C', *, like=None)

-  Return a new array of given shape and type, filled with zeros./ 새로운 배열을 반환, 0으로 채워진 모양과 티입을 가진

 

>>>import numpy as np

>>>M = np.zeros(shape=(2,3))

>>>print(2,3) 
>>>print(M)  

(2, 3)
[[0. 0. 0.]
 [0. 0. 0.]]

 

numpy.ones

numpy.ones (shape, dtype=None, order='C', *, like=None)

-  Return a new array of given shape and type, filled with ones./ 새로운 배열을 반환, 1으로 채워진 모양과 티입을 가진

 

>>> import numpy as np

>>> M = np.ones(shape=(2, 3))


>>> print(M.shape)
>>> print(M)

(2, 3)
[[1. 1. 1.]
 [1. 1. 1.]]

 

numpy.full

numpy.full(shape,  fill_value dtype=None, order='C', *, like=None)

- Return a new array of given shape and type, filled with fill_value / fill_value로 채워진, 모양과 타입이, 새로운 배열을 반환 

 

Parametersshape : int or sequence of ints

                            Shape of the new array, e.g., (2, 3) or 2.

                         fill_value :   scalar or array_like

                                     Fill value.

                         dtype : data-type, optional

                                     The desired data-type for the array The default, None, means

                                          np.array(fill_value).dtype.

                           order : {‘C’, ‘F’}, optional

                                    Whether to store multidimensional data in C- or Fortran-contiguous

                                     (row- or column-wise) order in memory.

                            like : array_like, optional

                                   Reference object to allow the creation of arrays which are not

                                   NumPy arrays. If an array-like passed in as like supports the 

                                   __array_function__ protocol, the result will be defined by it.

                                   In this case, it ensures the creation of an array object compatible with

                                   that passed in via this argument.

                            Returns: out  : ndarray

                                           Array of fill_value with the given shape, dtype, and order.

 

 

numpy.empty

numpy.empty (shape, dtype=float, order='C', *, like=None)

Return a new unintialized array. / 초기화 되지 않은 값을 반환한다.

 

 

numpy.arange

numpy.arange([start, ]stop, [step, ]dtype=None, *, like=None)

Return evenly spaced values within a given interval. / 주어진 간격내에 균등한 값을 반환합니다.

 

 

 

프로시져,서브루틴,함수,스택

https://velog.io/@hyejin4169/%ED%94%84%EB%A1%9C%EC%8B%9C%EC%A0%B8-%EC%84%9C%EB%B8%8C%EB%A3%A8%ED%8B%B4-%ED%95%A8%EC%88%98-%EC%8A%A4%ED%83%9D

 

 

 

 

 

numpy.linspace

numpy.linspace (start, stop, num=50, endpoint=True, retstep=False, dtype=None, axis=0)

* num=50 뜻 기본값이 50이다.

Return evenly spaced numbers over a specified interval. Returns num evenly spaced samples, calculated over the interval [start, stop]. The endpoint of the interval can optionally be excluded.

- 지정된 간격에 걸쳐 균등한 간격의 숫자를 반환합니다, 간격 [ start , stop ]에 걸쳐 계산된 균일한 간격의 샘플  를 반환합니다 .

간격의 끝점은 선택적으로 제외될 수 있습니다.

-> 괄호 마지막에 들어가는 숫자가 간격의 수가 아니라 뽑는 개수임! 주의할 것

Parameters:

                   

                  start :  array_like

                              The starting value of the sequence.

 

                   stop :  array_like

                        The end value of the sequence, unless endpoint is set to False. In that case, the sequence consists of all                          but the last of num + 1 evenly spaced samples, so that stop is excluded. Note that the step size changes                          when endpoint is False.

 

                   num : int, optional

                             Number of samples to generate. Default is 50. Must be non-negative.

                   

                   endpoint : bool, optional

                         If True, stop is the last sample. Otherwise, it is not included. Default is True.

                   retstep : bool, optional

                        If True, return (samples, step), where step is the spacing between samples.

                   dtype : dtype, optional

                       The type of the output array. If dtype is not given, the data type is inferred from start and stop.

                       The inferred dtype will never be an integer; float is chosen even if the arguments would produce an array                          of integers.

 

>>> print(np.linspace(0, 1, 5))
[0.   0.25 0.5  0.75 1.  ]

>>> print(np.linspace(0, 1, 10))
[0. 0.11111111 0.22222222 0.33333333 0.44444444 0.55555556 0.66666667 0.77777778 0.88888889 1.]

 

 

 

random.randn

random.randn (d0,d1, ..., dn)

Return a sample (or samples) from the “standard normal” distribution. /  "표준 정규" 분포에서 샘플(또는 샘플)을 반환합니다.

 

 

random.normal

random.randn (d0,d1, ..., dn)random.normal(loc=0.0, scale=1.0, size=None)

Draw random samples from a normal (Gaussian) distribution.  정규(가우스) 분포에서 무작위 표본을 추출합니다.

 

 

numpy.random.uniform

random.uniform (low=0.0 high=1.0 size=None)

Draw samples from a uniform distribution.

Samples are uniformly distributed over the half-open interval [low, high) (includes low, but excludes high). In other words, any value within the given interval is equally likely to be drawn by uniform.

 

균등 분포 에서 표본을 추출합니다 .

샘플은 반개방 구간 (낮은 부분은 포함하지만 높은 부분은 제외) 에 걸쳐 균일하게 분포됩니다. 즉, 주어진 구간 내의 모든 값은 에 의해 그려질 가능성이 동일합니다 .[low, high)uniform

numpy.sum

numpy.ones (a, axis=None, dtype=None, out=None, keepdims=<no value>, initial=<no value>, where = <no value>)

Sum of array elements over a given axis. 특정 축에 대한 배열 요소의 합계입니다.

 

numpy.sqrt

numpy.sqrt (a, axis=None, dtype=None, out=None, keepdims=<no value>, initial=<no value>, where = <no value>)

Return the non-negative square-root of an array, element-wise. 요소별로 배열의 음수가 아닌 제곱근을 반환합니다.

'sesac ai 과정 > NUMPY' 카테고리의 다른 글

[NUMPY] Broadcasting - 브로드 캐스팅의 원리  (0) 2023.10.19
What is a Tensor? IN NUMPY  (1) 2023.10.07
[Yang.T]Objection and ndarrays  (0) 2023.10.06
0.NumPy: the absolute basics for beginners  (2) 2023.10.06
INTRO-What is NumPy?  (0) 2023.10.06