728x90
SMALL
def solution(n, lost, reserve):
    answer = 0 
    answer = n - len(lost)
    
    lost.sort()
    reserve.sort()
    
    D = [i for i in lost if i in reserve]
    
    for d in D:
        lost.remove(d)
        reserve.remove(d)
    answer += len(D)
    
    
    for i in lost:
        if i-1 in reserve:
            reserve.remove(i-1)
            answer += 1
        elif i+1 in reserve:
            reserve.remove(i+1)
            answer += 1

    return answer

 

[솔루션]

 

1. 정렬

2. 특이 조건처리 ) 여벌 체육복을 가져온 학생이 체육복을 도난당했을 수 있습니다. 이때 이 학생은 체육복을 하나만 도난당했다고 가정하며, 남은 체육복이 하나이기에 다른 학생에게는 체육복을 빌려줄 수 없습니다.

-> D 라는 리스트로 교집합을 리스트 형태로 구해준뒤,

-> 먼저 제거를 하고 greedy를 위한 for문을 돌린다.

 

 

 

LIST

'개발공부' 카테고리의 다른 글

[캐글스터디] kernel density estimation  (0) 2021.04.07
2. 깃허브(Github) 연동하기  (0) 2021.02.21
1. Visual Studio Code 설치  (0) 2021.02.21

파트너스 및 광고 활동을 통해 일정액의 수수료를 제공받을 수 있음

728x90
SMALL

1. sns.kdeplot

f, ax = plt.subplots(1,1, figsize = (9,5))

sns.kdeplot(df_train[df_train['Survived'] == 1]['Age'])
sns.kdeplot(df_train[df_train['Survived'] == 0]['Age'])

plt.legend(['Survived == 1', 'Survived == 0'])

2. plot(kind = "kde")

plt.figure(figsize =(8,6))
df_train['Age'][df_train['Pclass'] == 1].plot(kind = 'kde')
df_train['Age'][df_train['Pclass'] == 2].plot(kind = "kde")
df_train['Age'][df_train['Pclass'] == 3].plot(kind = 'kde')

plt.xlabel('Age')
plt.title("Age Distribution within Pclass")
plt.legend(['1st', '2nc', '3rd'])

 

pandas.DataFrame.plot.kde

DataFrame.plot.kde(bw_method=None, ind=None, **kwargs)[source]

Generate Kernel Density Estimate plot using Gaussian kernels.

In statistics, kernel density estimation (KDE) is a non-parametric way to estimate the probability density function (PDF) of a random variable. This function uses Gaussian kernels and includes automatic bandwidth determination.

 

Kernel density estimation

From Wikipedia, the free encyclopedia

Jump to navigationJump to search

For broader coverage of this topic, see Kernel estimation.

 

Kernel density estimation of 100 normally distributed random numbers using different smoothing bandwidths.

In statistics, kernel density estimation (KDE) is a non-parametric way to estimate the probability density function of a random variable. Kernel density estimation is a fundamental data smoothing problem where inferences about the population are made, based on a finite data sample. In some fields such as signal processing and econometrics it is also termed the Parzen–Rosenblatt window method, after Emanuel Parzen and Murray Rosenblatt, who are usually credited with independently creating it in its current form.[1][2]

 

Kernel density estimation - Wikipedia

In statistics, kernel density estimation (KDE) is a non-parametric way to estimate the probability density function of a random variable. Kernel density estimation is a fundamental data smoothing problem where inferences about the population are made, base

en.wikipedia.org

 

KDE 를 알기 위해선 밀도추정이 무엇인지 알아야한다.

 

밀도추정(Density Estimation)

모아진 데이터들의 분포 특성을 이용해 내가 찾고자 하는 변수의 특성을 추정하고자 하는 것

그 변수의 확률밀도함수를 추정하는 것

 

밀도추정의 방법은 Parametric / non-Parametric 으로 나눠진다

1) Parametric 은 확률밀도함수에 대한 모델을 "미리" 정해놓고, 데이터들로부터 모델의 파라미터만 추정하는 방식.

2) non-Parametric 은 사전지식 없이 순수하게 관측된 데이터만으로 확률밀도함수를 추정하는 방식, 가장 간단한 형태가 히스토그램.

 

이제 다시 KDE(Kernal Density Estimation 커널 밀도 추정), 

KDE 방법은 non-Parametric 밀도추정 방법 중 하나로, 커널함수를 이용해서 히스토그램의 문제점을 개선한 것.

커널함수는 원점을 중심으로 대칭이면서 적분값이 1인 non-negative 함수로 정의되는... 수학적 어쩌구...

 

 

-> 그래서 결론은 히스토그램보다 좋은 데이터의 분포를 확인하는 순수한 방법이라는 것이다.

 

LIST

파트너스 및 광고 활동을 통해 일정액의 수수료를 제공받을 수 있음

728x90
SMALL

앞서 Visual Studio Code를 설치를 완료했다.

 

1. 다음으로 git 연동을 위해 설치해야 할 것은 바로 

git-scm.com/download
  Git - Downloads  Downloads Mac OS X Windows Linux/Unix Older releases are available and the Git source repository is on GitHub. GUI Clients Git comes with built-in GUI tools (git-gui, gitk), but there are several third-party tools for users looking for a platform-specific  git-scm.com

가장 최근 Release 버전을 본인의 PC에 맞게 다운 받는다.

 

 

2. exe 파일을 실행

default 세팅으로 진행하다가 중간에 Choosing the default editor used by Git 단계에서 반드시

Use Visual Studio Code as Git's default editor를 선택해야 한다

 

나머지는 모두다 디폴트로 진행

 

 

 

3. git 설치 확인하기

 

 

4. local 경로와 git 계정 연동

이전 게시물에서 Visual Studio Code 설치 후 소스코드를 관리할 경로를 만들어 두었었다.

나의 경우는 D:\WebApp 폴더 아래에 소스코드를 관리할 것이다.

 

1) 설치된 git CMD를 실행한다.

2) 나는 D드라이브 밑에서 소스코드관리를 하기 때문에 D드라이브로 경로를 이동한다.

> d:

> dir 

> cd WebApp

명령어를 통해서 소스코드를 관리할 폴더위치까지 이동한다.

 

3)  github 계정과 연동을 진행

> git --version 

> git config --global user.name "깃허브유저이름"

> git config --global user.email "깃허브이메일계정"

> git init 

 

 

 

5. 소스코드 관리 폴더에서 .git 폴더 생성 확인

*안보일 시 보기-숨긴항목 체크

 

LIST

파트너스 및 광고 활동을 통해 일정액의 수수료를 제공받을 수 있음

728x90
SMALL

러닝메이트 웹앱(WebApp)개발 일지

 

 

웹앱 개발 아이디어가 떠올랐다.

 

대략적인 아이디어는 구상이 완료 되었고, 간단하게 내 컴퓨터안에서 구동되는 웹앱을 만들어 보려한다.

 

그 개발 툴로는 비쥬얼스튜디오코드로 선택했다.

다양한 툴들이 있지만, 역시 손에 익은게 최고가 아닐까..

 

1. 설치

code.visualstudio.com/docs/?dv=win64user
  Documentation for Visual Studio Code  Find out how to set-up and get the most from Visual Studio Code. Optimized for building and debugging modern web and cloud applications. Visual Studio Code is free and available on your favorite platform - Linux, macOS, and Windows.  code.visualstudio.com

 

 

2. 다운로드 파일에서 exe 파일 실행

(설치 경로는 원하는 곳에 세팅)

모든 선택사항들을 default 값으로 하고 진행한다.

 

 

3. Visual Studio Code 실행하여 New File 생성해보기!

 

 

4. 앞으로 소스코드를 관리할 폴더를 만들고 3번에서 생성한 New File을 저장하기

Untilted-1 파일에 'hello'라는 문자를 쓰고 Save를 한다.

나는 D드라이브 밑에 WebApp이라는 폴더를 만들고 그 밑에 소스코드를 관리할 생각이므로 해당 폴더에 app.js라는 파일 이름으로 저장하였다.

 

 

 

앞으로 소스코드를 관리할 경로는 기억해 두는 것이 좋다!

LIST

파트너스 및 광고 활동을 통해 일정액의 수수료를 제공받을 수 있음

+ Recent posts