본문 바로가기

분류 전체보기187

[R]xgboost 코드 (iris) library(xgboost) data(iris) # Convert the Species factor to an integer class starting at 0 # This is picky, but it's a requirement for XGBoost species = iris$Species label = as.integer(iris$Species)-1 iris$Species = NULL n = nrow(iris) train.index = sample(n,floor(0.75*n)) train.data = as.matrix(iris[train.index,]) train.label = label[train.index] test.data = as.matrix(iris[-train.index,]) test... 2020. 6. 18.
[파이썬]글 내의 단어 빈도 체크 count = {} # 딕셔너리 생성 for j in open('jupytorNotebooks/poet.txt').read().replace("\n","").replace(".","").split() : count[j] = count.get(j,0) + 1 # items 생성 [(x,y) for (y,x) in sorted([(x, y) for (y, x) in count.items()], reverse=True)[:11]] # 정렬 쓸 데 없는 집착이긴 한데, 더 줄일 방법이 있을까? count = {} # 딕셔너리 생성 for j in "apple apple monkey snail apple monkey chiken".replace("\n","").replace(".","").split() : cou.. 2020. 6. 17.
[CSS]우선순위 결정 같은 요소가 여러 선언의 대상이 될 경우, 어떤 선언의 CSS 속성을 우선 적용할지 결정하는 방법 1. 명시도 점수가 높은 선언 (명시도) 2. 점수가 같은경우, 가장 마지막에 해석되는 선언 (선언 순서) 3. 명시도는 '상속' 규칙보다 우선(중요도) 4. !important가 적용 된 선언방식이 다른 모든방식보다 우선(중요도) !important > 명시도 점수가 같을 때 가장 마지막에 해석되는 선언 > 명시도 점수가 가장 높은 선언 > 상속 스타일 속성을 통한 인라인선언(1000 Point)[비추천/ 덮어쓰기 힘듦] ex) HELLO WORLD ID 선택자를 통한 선언(100pt) ... #Apple Class 선택자를 통한 선언(10pt)... .Apple 단, 가상클래스 선택자 중 :not은 점수.. 2020. 6. 17.
[파이썬]열쇠 모양 만들기 Ban's Key def factorials(n): if n ==1 : return 1 else: return n*factorials(n-1) base_key = [1,11,11,5,7,30,30,19,21,60] a = list( range(base_key[0],base_key[1])) + list( range(base_key[2],base_key[3],-1)) + list( range(base_key[4],base_key[5])) + list( range(base_key[6],base_key[7],-1)) + list( range(base_key[8],base_key[9])) for i in a: print(("{0:^105}".format(factorials(i)).replace("0",""))[4.. 2020. 6. 17.
[저장]파이썬 문자열 문장 단위 문자열 나누기 너무 자주 쓰는건데, 문장별로 나눈 후 온점 붙이는 코드입니다. a = "앨리스는 갔다. 이상한 나라로. 돌아왔다".split(".") if (a[-1] == '') or a[-1] == ' ': del(a[-1]) a=[i+"." for i in a] a 2020. 6. 16.
[Web]HTML, CSS 속성(Attribute)과 값(value) HTML ex) 에서 class는 속성, "A"는 값이 됨. CSS ex) color:tomato; 에서 color가 속성, tomato는 값이 됨. 2020. 6. 13.