묻고 답해요
164만명의 커뮤니티!! 함께 토론해봐요.
인프런 TOP Writers
-
해결됨[개정판] 파이썬 머신러닝 완벽 가이드
과적합과 eta
233페이지에 과적합 문제가 심각하다면 eta값을 낮추라고 했는데, 학습률은 overshooting과 local minima문제와 관련된 것이지, 과적합과는 관계가 없는 것 아닌가요?
-
미해결프로그래밍 시작하기 : 웹 입문 (Inflearn Original)
모양이 조금 다릅니다..
안녕하세요. 영상을 보고 똑같이 만들었는데 저 공백부분은 간격이 왜이렇게 넓은지 .. 두번씩 다시 코딩해보아도 잘 못찾겠습니다.
-
미해결타입스크립트 입문 - 기초부터 실전까지
선생님 자꾸 질문드려서죄송합니다. [ function]
function fetchItems2() { let items2 = ['a', 'b', 'c']; return new Promise(function (resolve) { resolve(items2); }) } tsconfig.json { "compilerOptions": { "allowJs": true, "checkJs": true, "noImplicitAny": true, // 묵시적으로 any로도 해라는 것 "strict": true, "strictFunctionTypes": true, }, "include": ["./src/**/*"] } .eslintrc.js module.exports = { root: true, env: { browser: true, node: true, jest: true, }, extends: [ "plugin:@typescript-eslint/eslint-recommended", "plugin:@typescript-eslint/recommended", ], plugins: ["prettier", "@typescript-eslint"], rules: { "prettier/prettier": [ "error", { singleQuote: true, semi: true, useTabs: false, tabWidth: 2, printWidth: 80, bracketSpacing: true, arrowParens: "avoid", }, ], // "@typescript-eslint/no-explicit-any": "warn", // "@typescript-eslint/explicit-function-return-type": "off", // "prefer-const": "off", }, parserOptions: { parser: "@typescript-eslint/parser", }, }; 설정했는데.. 선생님 화면하고 다른 부분은 function에 밑줄 안들어옵니다... 왜 그런걸까요?....
-
파이썬 알고리즘 문제풀이 입문(코딩테스트 대비)
코딩테스트를 볼 언어 선택에 관한 질문입니다
삭제된 글입니다
-
미해결파이썬 무료 강의 (활용편1) - 추억의 오락실 게임 만들기 (3시간)
TypeError: invalid destination position for blit
위와 같은 에러가 납니다.. ball을 cat으로 쓴 점 감안해주시면 감사하겠습니다. error: File "c:\Users\user\Desktop\pygame_basic\1_create_frame.py", line 159, in <module> screen.blit(cat_images[cat_img_idx], (cat_pos_x, cat_pos_y)) TypeError: invalid destination position for blit --source import pygame, os pygame.init() # 초기화 필수 # 게임 화면 크기 설정 screen_width = 640 # 가로 크기 screen_height = 480 # 세로 크기 screen = pygame.display.set_mode((screen_width, screen_height)) # 화면 타이틀 설정 pygame.display.set_caption('강아지가 츄르주는 게임') # 게임 이름 # FPS clock = pygame.time.Clock() # 1. 사용자 게임 초기화 # 이미지 불러오기 current_path = os.path.dirname(__file__) # 현재 파일 위치 반환 image_path = os.path.join(current_path, "images") # 배경 이미지 background = pygame.image.load(os.path.join(image_path, "background.png")) # 스테이지 stage = pygame.image.load(os.path.join(image_path, "stage.png")) stage_size= stage.get_rect().size stage_height = stage_size[1] # 스테이지 높이 # 캐릭터 만들기 character = pygame.image.load(os.path.join(image_path, "puppy.png")) # 70*70 캐릭터 불러오기 character_size = character.get_rect().size # 캐릭터 이미지의 가로 세로 크기를 가져옴 character_width = character_size[0] # 캐릭터의 가로 크기 character_height = character_size[1] # 캐릭터의 세로 크기 character_x_pos = (screen_width - character_width) / 2 # x position = 화면 가로의 절반에 위치 하도록 (캐릭터의 x 좌표) character_y_pos = screen_height - stage_height - character_height + 10 # 이동할 좌표 chracter_to_x = 0 # 이동 속도 character_speed = 0.4 # 무기 만들기 weapon = pygame.image.load(os.path.join(image_path, "weapon.png")) # 무기 이미지 불러오기 weapon_size = weapon.get_rect().size weapon_width = weapon_size[0] # 무기 동작: 무기는 한 번에 여러 발 발사 가능 weapons = [] # 무기 이동 속도 weapon_speed = 10 # target cat_images = [ pygame.image.load(os.path.join(image_path, "cat0.png")), pygame.image.load(os.path.join(image_path, "cat1.png")), pygame.image.load(os.path.join(image_path, "cat2.png")), pygame.image.load(os.path.join(image_path, "cat3.png")) ] # 타겟 크기에 따른 최초 스피드 cat_speed_y = [-18, -15, -12, -9] # index 0 1 2 3 - cat 1 2 3 4 # 타겟들 cats = [] # 최초 발생하는 큰 고양이 추가 cats.append({ "pos_x" : 50, # 고양이의 x 좌표 "pos_y" : 50, # 고양이의 y 좌표 "img_idx" : 0, # 고양이의 이미지 인덱스 "to_x" : 3, # 고양이의 x축 이동 방향, -3이면 왼쪽으로 3이면 오른쪽ㅇfh "to_y" : -6, # y축 이동 방향 "init_spd_y" : cat_speed_y[0] # y축 최초 속도 }) # 폰트 정의 game_font = pygame.font.Font(None, 40) # 폰트 객체 생성 (폰트, 크기) # 게임 총 시간 total_time= 10 # 시작 시간 계산 start_ticks = pygame.time.get_ticks() # 현재 tick 정보를 받아옴 # event loop running = True # 게임이 진행 중인가? while running: dt = clock.tick(30) # delta = clock. FPS 설정 for event in pygame.event.get(): # 키보드에 맞는 이벤트 실행되면 if event.type == pygame.QUIT: # 창 끄기 이벤트 발생 시 running = False if event.type == pygame.KEYDOWN: # 키가 눌러졌는데 확인 if event.key == pygame.K_RIGHT: chracter_to_x += character_speed elif event.key == pygame.K_LEFT: chracter_to_x -= character_speed elif event.key == pygame.K_SPACE: # 스페이스바 누르면 무기 발사 weapon_x_pos = character_x_pos + (character_width / 2) - (weapon_width / 2) weapon_y_pos = character_y_pos weapons.append([weapon_x_pos, weapon_y_pos]) elif event.key == pygame.K_UP: pass elif event.key == pygame.K_DOWN: pass if event.type == pygame.KEYUP: # 방향키를 뗐을 때 if event.key == pygame.K_RIGHT or event.key == pygame.K_LEFT: chracter_to_x = 0 elif event.key == pygame.K_UP or event.key == pygame.K_DOWN: pass # 캐릭터 움직이기 character_x_pos += chracter_to_x * dt # FPS에 따라 속도가 변하지 않게 delta 값을 곱해주어 고정해줌 # 캐릭터 가로 경계값 처리 if character_x_pos < 0: character_x_pos = 0 elif character_x_pos > screen_width - character_width: character_x_pos = screen_width - character_width # 무기 위치 조정 weapons = [[w[0], w[1] - weapon_speed] for w in weapons] # 무기가 천장에 닿으면 없애기 # weapons = [[w[0], w[1]] for w in wea pons if w[1] > 0] # 타겟 위치 정의 for cat_idx, cat_val in enumerate(cats): cat_pos_x = cat_val["pos_x"] cat_pos_y = cat_val["pos_y"] cat_img_idx = cat_val["img_idx"] cat_size = cat_images[cat_img_idx].get_rect().size cat_width = cat_size[0] cat_height = cat_size[1] # 가로 경계값: 타겟의 경계값 처리 -> 경계값이 닿으면 반대 쪽으로 튕김 if cat_pos_x < 0 or cat_pos_x > (screen_width - cat_width): cat_val["to_x"] *= -1 # 세로 경계값: 스테이지에 튕겨서 올라감 if cat_pos_y >= (screen_height - stage_height - cat_height): cat_val["to_y"] = cat_val["init_spd_y"] else: # 그 외 모든 경우에는 to_y를 증가 cat_val["to_y"] += 0.5 cat_val["pos_x"] += cat_val["pos_x"] cat_val["pos_y"] += cat_val["pos_y"] # 충돌 처리를 위한 rect 정보 update character_rect = character.get_rect() character_rect.left = character_x_pos character_rect.top = character_y_pos # screen.fill((r, g, b)) # rgb 값으로 배경색 채울 수도 있음 screen.blit(background, (0, 0)) # 배경 이미지를 어디서부터 나타내줄건지. 0, 0 -> 왼쪽 맨 위부터 for weapon_x_pos, weapon_y_pos in weapons: screen.blit(weapon, (weapon_x_pos, weapon_y_pos)) for idx, val in enumerate(cats): cat_pos_x = val["pos_x"] cat_pos_y = val["pos_y"] cat_img_idx = val["img_idx"] screen.blit(cat_images[cat_img_idx], (cat_pos_x, cat_pos_y)) screen.blit(stage, (0, screen_height - stage_height)) screen.blit(character, (character_x_pos, character_y_pos)) # 캐릭터 그리기 # 타이머, 경과 시간 계산 elapsed_time = (pygame.time.get_ticks() - start_ticks) / 1000 # 초단위로 표시 timer = game_font.render(str(int(total_time - elapsed_time)), True, (255, 0, 0)) screen.blit(timer, (10, 10)) # 시간이 0 이하면 game over if(total_time - elapsed_time <= 0): print("Game Over") running = False pygame.display.update() # 게임 화면 다시 그리기 # 잠시 대기 pygame.time.delay(2000) # 2초 대기 # pygame 종료 pygame.quit()
-
미해결it 취업을 위한 알고리즘 문제풀이 입문 (with C/C++) : 코딩테스트 대비
강의 문제푸는 방법에대해 여쭤봅니다
안녕하세요 선생님 강의가 처음부터 선생님이랑 문제를 같이 푸는방식으로 진행하시잖아요? 궁금한점이 강의를 듣기전에 문제를 풀어보고 강의를 듣는게 맞는걸까요? 아니면 처음 몇개의 섹션까지는 그냥 강의만 듣다가 나중에가서 미리 문제를 고민하고 풀어본후에 강의를 듣는식으로 할까요? 처음부터 다 고민해보고 풀어보고 강의를 듣는게 제일 좋을것 같지만 지금 시간이 한정적이어서요 ㅜㅜ
-
미해결모든 개발자를 위한 HTTP 웹 기본 지식
cache-control: no-cache 질문
안녕하세요. 만약 cache-control: no-cache로 설정했을 경우, 모든 요청을 원 서버에 검증해야한다고 이해했습니다. 그럼 no-cache를 사용하는 이유는 원 서버에 검증을 하고 데이터 변경이 이루어지지 않았다면 cache에 저장된 데이터를 사용함으로써 네트워크 크기를 줄이기 위해 사용한다고 이해하면 될까요?? 아 그리고 해당 강의를 학습하며 공부한 내용을 블로그에 정리하여 포스팅하고 싶은데 PDF 이미지 몇 개를 캡처하여 사용해도 괜찮을까요?? (출처는 당연히 밝히겠습니다!)
-
해결됨피그마(Figma)를 활용한 UI디자인 입문부터 실전까지 A to Z
에릭 쌤!
와이어프레임 워크플로우까지 했는데요. 마지막에 내가 연결한거 확인해보려면 어떻게 해야하나요? 오토 에로우 플러그인 사용만하고 그냥 끝나서.. 엇 내가 제대로 했나? 나중에 팀원들한테 공유할때 어떻게 보여줘야하지? 이런 생각이 들더라구요. 알려주시면 감사하겠습니다. 영상 잘보고 있어요.^^
-
해결됨스프링 핵심 원리 - 기본편
코드에 오류가 납니다!
지금 이렇게 똑같이 넣엇는데... NoSuchBeandefinitionException이 터지는데 이유를 모르겠습니다. DiscountService.class만 넣었을 때는 문제가 없었는데 AutoAppConfig.class를 넣자마자 바로 에러가 터져버립니다. ㅠ 도와주십시오 선생님ㅠㅠ
-
미해결Vue.js 끝장내기 - 실무에 필요한 모든 것
eslint 오류?
강의 내용을 따라하다 보니 이것과 같이 빨간 줄이 생기고 App.vue에서는 빨간줄이 보이질 않는데.. 왜그럴까요?
-
미해결프로그래밍 시작하기 : 파이썬 입문 (Inflearn Original)
:
print('{:>10}'.format('nice')) 이런 코드에서 : <- 이게 의미하는게 뭐예요??
-
미해결프로그래밍 시작하기 : 파이썬 입문 (Inflearn Original)
질문이요!
%s 에서는 print('%10s' % ('nice')) 처럼 nice를 ' ' 안에 집어 넣었는데 %d, %f에선 그렇지 않은 건 숫자라서 그런 건가요??
-
미해결윤재성의 만들면서 배우는 Spring MVC 5
ojdbc6.jar파일 붙여넣기 시 오류
안녕하세요. ojdbc6.jar를 /WEB-INF/lib폴더에 붙여넣기 아래와 같이 jar파일 아이콘이 문서형태로 나옵니다. 이것때문에 BasicDataSource를 import가 할수없는것 같습니다. 해결법좀 알려주세요 ㅠㅠ
-
미해결타입스크립트 입문 - 기초부터 실전까지
자동 추론 관련 질문 드립니다.
interface Test { [key: number]: string; } const val: Test = { 1: 'one', 2: 'two', }; const valKeys = Object.keys(val); // valKeys의 type이 number[]가 아니라 string[] Object.keys()의 return type은 string[]로 정해져있는 것 같아요...! 그래서 4분 쯤에 말씀하신 interface를 통해 type을 지정했을 때 forEach나 map의 parameter가 자동 추론이 되게 하려면 추가적인 조치가 필요할 것 같아요~ 혹시 좋은 방법 있을까요? 저도 개발하면서 이 부분이 조금 불편했거든요ㅠㅠ
-
해결됨스프링 핵심 원리 - 기본편
안녕하세요 선생님.. 오류가...ㅠㅠ
안녕하세요 선생님.. 오류가나서요... Qualifier넣기 전까지는 테스트가 잘 돌아갔는데 Qualifier를 넣으니 NoSuchBeanDefinitionException 오류가 나는데... 왜 그런건지 잘 모르겟습니다 ㅠㅠ org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'orderServiceImpl' defined in file [D:\study\practice_again\out\production\classes\practice_again\core\order\OrderServiceImpl.class]: Unsatisfied dependency expressed through constructor parameter 1; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'practice_again.core.discount.DiscountPolicy' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Qualifier(value="mainDiscountPolicy")}
-
미해결프로그래밍 시작하기 : 파이썬 입문 (Inflearn Original)
format 사용
print('%s %s' % ('1', '2')) 라고 코드를 작성하면 1과 2를 문자열로 인식하는 건가요?
-
미해결스프링 핵심 원리 - 기본편
롬복에서 getter setter 질문
롬복에서 getter setter 을 Annotation을 붙여주면 된다고 말씀을 해주셨습니다 선생님! 그러면... 사용자가 입력시 정제된 값을 getter로 받아오게 하려면 getter안에서 조작을 하는걸로 알고있습니다. 예를 들어 나이는 마이너스(-)가 없으니 -로 입력을 하게 하면 다시 입력을 하게 한다던지 말입니다. 그러한 것을 Getter Setter안에서 로직을 구현하고 싶으면 이러한 경우에는 어느곳에서 해야하나요?
-
미해결데브옵스(DevOps)를 위한 쿠버네티스 마스터
로컬환경에서 로드밸런서 작성시 External IP 관련 질문 드립니다!
안녕하세요 강사님 좋은 강의 정말 잘 보고 있습니다. 다름이 아니라 현재 오픈스택으로 로컬 환경에서 실습 하던 중에 강사님의 강의에서 로드밸런서 타입이나 기타 External IP 환경을 재현해 보고 싶었습니다. 외부 IP가 없으니 당연히 Pending이 걸리는게 맞는거 같고 좀 더 알아보니 오픈 로드밸런서로 Porter나 MetalLB 등이 있더군요. 그래서 여차저차 MetalLB의 Config.yaml 파일까지 작성 후 적용하여 로드밸런서가 잡히는 걸 확인 했습니다. 1. 헌데 현재 오픈스택에서 사용중인 인스턴스들의 아이피 10.x.x.x 는 아이피 192.168.xxx.xxx 와 같이 1:1 로 밖에 매핑이 안돼고 결론적으로 오픈 로드밸런서를 사용하려면 현재 마스터의 인스턴스 10.x.x.x IP 주소를 MetalLB의 Config.yaml 의 address에 할당하여 접속은 되긴 하지만 그 이상의 IP를 config에 할당하여도 마스터 인스턴스의 IP가 할당된 로드밸런서만 접속이 가능하더군요. 로컬에서는 오픈 로드밸런서 사용 시 로드밸런서를 단 1개밖에 사용할 수 없는지 궁금합니다. 2. 로드 밸런서를 구성의 맨 앞단에 붙이는 것과 마스터-노드 사이에 서비스로 붙이는 거랑은 완전히 다른 개념인지 궁금합니다.
-
미해결모든 개발자를 위한 HTTP 웹 기본 지식
cache 304 관련 질문있습니다.
1. 9분 14초쯤에 cache-control 헤더의 max-age가 31536000 으로 설정되어 있습니다. 2. 이렇게 응답헤더를 받게되면 캐시 유효기간을 다시 설정한다고 생각을 했습니다. 3. 다시 설정됐으니 재요청시 캐시 데이터를 그대로 응답해줄 것이라 생각했는데 다시 304 응답이 온 걸 보니 서버에서 요청이 간 것 같은데 영상의 설명대로라면 유효기간이 만료됐을 경우에만 데이터가 변경되었는지 비교를 한 후 max-age를 다시 설정해주는 것 아닌가요???
-
미해결it 취업을 위한 알고리즘 문제풀이 입문 (with C/C++) : 코딩테스트 대비
시간 초과가 나고 있습니다 선생님 어느 부분에서 효율화가 필요할까요??
선생님, 안녕하세요? 늘 좋은 강의 감사드립니다. 본 문제 코드를 bfs로 풀었는데, 4 5 예제에서 오류가 발생하고 있습니다. 제 코드 상에서 어느 부분이 효율이 떨어지고 있는지 궁금합니다. 한번 제 코드를 봐주시면 대단히 감사하겠습니다. 늘 좋은 영상 감사드립니다. #include<stdio.h> #include<stdlib.h> #include<iostream> #include<queue> #include<algorithm> #include<vector> using namespace std; int TomatoBox[1000][1000]; int visited[1000][1000]; int n, m; queue<pair < pair<int, int>, int> >Q; int dx[4] = { -1,1,0,0 }; int dy[4] = { 0,0,-1,1 }; void BFS(pair< pair<int, int>, int> vertex) { pair< pair<int, int>, int> temp; while (!Q.empty()) { temp.first.first = Q.front().first.first; temp.first.second = Q.front().first.second; temp.second = Q.front().second; //temp.second++; Q.pop(); for (int i = 0; i < 4; i++) { int x = temp.first.first + dx[i]; int y = temp.first.second + dy[i]; int v = temp.second; if (x < 0 || y < 0 || x >= n || y >= m) { continue; } if (TomatoBox[x][y] == 1 || TomatoBox[x][y] == -1) { continue; } //토마토가 익지 않았고 아직 방문을 하지 않았다면 if (visited[x][y] == 0 && TomatoBox[x][y] == 0) { v++; pair< pair<int, int>, int>next; visited[x][y] = 1; TomatoBox[x][y] = 1; next.first.first = x; next.first.second = y; next.second = v; Q.push(next); } else { return; } } } int flag = 0; for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { if (TomatoBox[i][j] == 0) { flag = 1; break; } else { continue; } } } if (flag == 0) { printf("%d ", temp.second); } else { printf("-1"); } } int main() { ios_base::sync_with_stdio(false); /*scanf("%d %d", &m, &n);*/ cin >> m >> n; for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { //scanf("%d", &TomatoBox[i][j]); cin >> TomatoBox[i][j]; } } //시작점의 갯수를 파악합니다. int startcount = 0; //pair <pair<int, int>, int> start; vector< pair <pair<int, int>, int> > startpoint(1000); for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { if (TomatoBox[i][j] == 1) { startcount++; //printf("현재 시작점의 개수 : %d \n", startcount); startpoint[startcount].first.first = i; //printf("해당 시작점의 x좌표 : %d \n", startpoint[startcount].first.first); startpoint[startcount].first.second = j; //printf("해당 시작점의 y좌표 : %d \n", startpoint[startcount].first.second); startpoint[startcount].second = 0; //printf("해당 시작점에서의 움직임 계수 : %d \n", startpoint[startcount].second); visited[startpoint[startcount].first.first][startpoint[startcount].first.second] = 1; startpoint[startcount]; Q.push(startpoint[startcount]); Q.push(startpoint[startcount]); } } } BFS(startpoint[1]); return 0; }