import numpy as np

A = np.array([])


1. np.argsort(A)

returns indicies in ascending order


2. np.bincount(A)

A: int array

A[1,2,3,1] -> B[0,2,1,1] (B[i]는 A의 원소들 중 i의 개수  0의 개수 0개, 1의 개수 2개...)


3. np.argmax(A)

returns index number that holds the maximum value 

if tied, return the smallest index number.


4. np.concatenate

returns concatenated(합쳐진) arrays.


이용된 코드:

https://github.com/blackco66/cs231n/blob/master/assignment1/cs231n/classifiers/k_nearest_neighbor.py

'스터디 > R, Python' 카테고리의 다른 글

[Python] 'self' input in class function  (0) 2018.10.09

class FourCal:
   def setdata(self, first, second):
      self.first = first
      self.second = second

1. 메서드 첫 번째 매개변수 'self'

메서드 매개변수(이 경우 'setdata')로 첫 번째 self를 명시적으로 적어두어 객체('a')에서 메서드를 호출할 수 있게 한다. 


2. 객체 변수 'self.*'

'self.first = first', 'self.second = second' 으로  객체변수를 선언하게 된다.

---> 객체변수를 따로 선언하지 않고 사용하는 곳에서 바로 선언하는 것인가? => 그런듯..

'스터디 > R, Python' 카테고리의 다른 글

[Python, Numpy] argsort, bincount, argmax, concatenate  (0) 2018.10.10

+ Recent posts