inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

묻고 답해요

172만명의 커뮤니티!! 함께 토론해봐요.

오류가 뜹니다

해결됨

[퇴근후딴짓] 빅데이터 분석기사 실기 (작업형1,2,3)

#1.문제정의 #평가:ROC-AUC #target:'성별' 1 #최종파일:"result.csv"(컬럼 1개 pred, 1확률값) #2.라이브러리 및 데이터 불러오기 import pandas as pd train = pd.read _csv("data/customer_train.csv") test = pd.read _csv("data/customer_test.csv") #3.탐색적 데이터분석(EDA). shape head info isnull.sum. value_counts. describe target pd.set_option('display.max_columns', None) print(train.shape, test.shape) print(train.head(2)) print(test.head(2)) print( train.info ()) print( test.info ()) print(train.isnull().sum()) print(test.isnull().sum()) print(train['성별'].value_counts()) #결측치채우기 train = train.fillna(0) test = test.fillna(0) print(train.isnull().sum()) print(test.isnull().sum()) # 4.데이터전처리 - object데이터를 인코딩 df = pd.concat([train,test]) df = pd.get_dummies(df) train = df[:len(train)].copy() test = df[len(train):].copy() print(train.shape, test.shape) #5. 검증 데이터 분할 from sklearn.model_selection import train_test_split X_tr, X_val, y_tr, y_val = train_test_split(train.drop('성별', axis=1), train['성별'], test_size=0.2, random_state=10) print(X_tr.shape, X_val.shape, y_tr.shape, y_val.shape) #6. 머신러닝 학습 및 평가 from sklearn.ensemble import RandomForestClassifier from sklearn.metrics import roc_auc_score model = RandomForestClassifier(random_state=0) model.fit (X_tr, y_tr) pred = model.predict_proba(X_val) score = roc_auc_score(y_val, pred[:,1]) print(score) # 7. 예측 및 평가 파일 생성 pred = model.predict_proba(test) submit = pd.DataFrame({'pred':pred[:,1]}) submit.to _csv("result.csv") print( pd.read _csv("result.csv")) 이렇게 했는데요. pred = model.predict_proba(test)만 작성하면 오류가 나는 이유가 뭘까요?? Makefile:6: recipe for target 'py3_run' failed make: *** [py3_run] Error 1 Traceback (most recent call last): File "/goorm/Main.out", line 64, in <module> pred = model.predict_proba(test) File "/usr/local/lib/python3.9/dist-packages/sklearn/ensemble/_forest.py", line 674, in predict_proba X = self._validate_X_predict(X) File "/usr/local/lib/python3.9/dist-packages/sklearn/ensemble/_forest.py", line 422, in validate X_predict return self.estimators_[0]._validate_X_predict(X, check_input=True) File "/usr/local/lib/python3.9/dist-packages/sklearn/tree/_classes.py", line 407, in validate X_predict X = self._validate_data(X, dtype=DTYPE, accept_sparse="csr", File "/usr/local/lib/python3.9/dist-packages/sklearn/base.py", line 421, in validate data X = check_array(X, **check_params) File "/usr/local/lib/python3.9/dist-packages/sklearn/utils/validation.py", line 63, in inner_f return f(*args, **kwargs) File "/usr/local/lib/python3.9/dist-packages/sklearn/utils/validation.py", line 720, in check_array assert all_finite(array, File "/usr/local/lib/python3.9/dist-packages/sklearn/utils/validation.py", line 103, in assert all_finite raise ValueError( ValueError: Input contains NaN, infinity or a value too large for dtype('float32').

  • python
  • 머신러닝
  • 빅데이터
  • pandas
  • 빅데이터분석기사
뚜디니 댓글 2 좋아요 0 조회수 210

target(label)별 개수 확인

해결됨

[퇴근후딴짓] 빅데이터 분석기사 실기 (작업형1,2,3)

강의 11:55 부분의 #target(label)별 개수 확인 y_train.value_counts() 위 코드를 작성하는 이유(중요성)가 궁금합니다.

  • python
  • 머신러닝
  • 빅데이터
  • pandas
  • 빅데이터분석기사
정원 댓글 2 좋아요 0 조회수 238

localhost연결이 안됩니다.

미해결

스프링 입문 - 코드로 배우는 스프링 부트, 웹 MVC, DB 접근 기술

학습하는 분들께 도움이 되고, 더 좋은 답변을 드릴 수 있도록 질문전에 다음을 꼭 확인해주세요. 1. 강의 내용과 관련된 질문을 남겨주세요. 2. 인프런의 질문 게시판과 자주 하는 질문(링크)을 먼저 확인해주세요. (자주 하는 질문 링크: https://bit.ly/3fX6ygx) 3. 질문 잘하기 메뉴얼(링크)을 먼저 읽어주세요. (질문 잘하기 메뉴얼 링크: https://bit.ly/2UfeqCG) 질문 시에는 위 내용은 삭제하고 다음 내용을 남겨주세요. ========================================= [질문 템플릿] 1. 강의 내용과 관련된 질문인가요? (예) 2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (예) 3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예) [질문 내용] HelloSpringApplication.java 의 main 실행 했을 때 사진과 같은 화면이 뜹니다. locallhot는 연결이안됩니다. JDK는 17.0.11.9 버전으로 다운받았습니다. 어디가 잘못된걸까요..

  • java
  • spring
  • mvc
  • spring-boot
박희영 댓글 2 좋아요 0 조회수 1611

hibernate가 select를 두번 하는 이유

해결됨

실전! 코틀린과 스프링 부트로 도서관리 애플리케이션 개발하기 (Java 프로젝트 리팩토링)

안녕하세요 강사님 강의를 들으면서 이번에 처음 JPA를 알아가고 있는 중입니다. 헌데 궁금한점이 JPA 특성인것인지 아니면 H2 DB 문제인지 그것도 아니면 제 Intellij 설정 문제인지 모르겠지만 select가 두번이 되는 이유가 무엇때문이지 궁금해서 질문 드립니다. 실질적인 동작에 문제가 생기지는 않겠지만 N+1 관련 강의를 듣다보니 불필요하게 쿼리가 호출되면 안좋은것 같아 여쭈어 봅니다. @Test @DisplayName("대출 기록이 없는 유저도 응답에 포함") fun getUserLoanHistoriesTest() { //given userRepository.save(User("A",null)) //when val results = userService.getUserLoanHistories() //then assertThat(results).hasSize(1) assertThat(results[0].name).isEqualTo("A") assertThat(results[0].books).isEmpty() } 위의 코드를 동작시켰을때 Hibernate: insert into user (id, age, name) values (default, ?, ?) Hibernate: select user0_.id as id1_1_, user0_.age as age2_1_, user0_.name as name3_1_ from user user0_ Hibernate: select userloanhi0_.user_id as user_id4_2_0_, userloanhi0_.id as id1_2_0_, userloanhi0_.id as id1_2_1_, userloanhi0_.book_name as book_nam2_2_1_, userloanhi0_.status as status3_2_1_, userloanhi0_.user_id as user_id4_2_1_ from user_loan_history userloanhi0_ where userloanhi0_.user_id=? Hibernate: select user0_.id as id1_1_, user0_.age as age2_1_, user0_.name as name3_1_ from user user0_ Hibernate: select userloanhi0_.user_id as user_id4_2_0_, userloanhi0_.id as id1_2_0_, userloanhi0_.id as id1_2_1_, userloanhi0_.book_name as book_nam2_2_1_, userloanhi0_.status as status3_2_1_, userloanhi0_.user_id as user_id4_2_1_ from user_loan_history userloanhi0_ where userloanhi0_.user_id=? Hibernate: delete from user where id=? 출력 부분에 위에 처럼 뜨는데요 제가 이해한 바로는 insert는 save 때문에 한번인 반면에 getUserLoanHistoreies 부분에 findAll로 한번의 쿼리를 불러오는 거라서 user와 와 userloanhistory 테이블을 각각 한번 씩 조회 해야 하지 않는가 싶어서 질문 드립니다. 추가로 확인해 보보니 LEFT join에 fetch를 추가했을때 위의 select user와 user_loan_history는 left join 쿼리문으로 변한는 반면 아래의 select user와 user_loan_history는 남아 있습니다. 따로 user를 find 하는 곳이 없는 것 같은데 이런 현상이 나오는 이유가 뭘까요?.... 추측 하기로는 AfterEach로 clear할때 deleteAll을 사용해서 사용했던 테이블을 모두 select 하는건가 싶긴 한데... 제가 이해를 잘 못해서 그런건지 이부분이 어렵네요....

  • java
  • spring
  • kotlin
  • spring-boot
  • 리팩토링
김민승 댓글 1 좋아요 0 조회수 259

7회 작업형 1 과목점수 스탠다드 스케일 할 때

해결됨

[퇴근후딴짓] 빅데이터 분석기사 실기 (작업형1,2,3)

이상치에 민감하지 않도록 Rubust scaler 사용하실 때는 scaler = Rubustscaler() 하시고, scaler.fit_trasnform(train) scaler.transform(test) 하셨던 걸로 기억하는데 왜 여기서는 scaler.fit _transform(df[['socre']])로 진행하신 걸까요?

  • python
  • 머신러닝
  • 빅데이터
  • pandas
  • 빅데이터분석기사
yhr581 댓글 1 좋아요 1 조회수 223

작업형3 범주형 변수 인코딩

해결됨

[퇴근후딴짓] 빅데이터 분석기사 실기 (작업형1,2,3)

안녕하세요 선생님, 작업형3 범주형 변수 인코딩 질문드립니다. [예시문제 작업형3(신버전)]의 6:37 부분을 보면 Gender는 인코딩이 되지않아서 C로 감싸주시더라구요. 근데 [시험응시전략] 강의에서는 '회귀, 로지스틱 회귀에서 숫자이지만, 범주형 변수로 명시된 것이 있다면 C()로 감싸서 처리할 것, 범주형 변수 object 값이 문자로 있다면 알아서 바꿔준다'라고 말씀하셨어요. 이부분이 헷갈립니다. 1) [시험응시전략]에서 말씀대로라면 [예시문제 작업형3]의 Gender는 C 처리할 필요없이, 알아서 바뀌는게 아닌가요? 2) 캐글에 T3-2-example-py 을 보면, 여기서는 gender를 C로 감싸서 인코딩 해주지 않으셨더라구요. 기준이 헷갈립니다.

  • python
  • 머신러닝
  • 빅데이터
  • pandas
  • 빅데이터분석기사
gusmgl94 댓글 1 좋아요 0 조회수 210

기출 2회 문제 3번

해결됨

[퇴근후딴짓] 빅데이터 분석기사 실기 (작업형1,2,3)

'age'컬럼의 이상치를 모두 더하시오! print(sum(df['age']<lower) + sum(df['age']>upper)) 컬럼의 이상치를 다 더한다는 의미를 이렇게 해석했는데,, # 이상치 age합 print(df[cond1|cond2]['age'].sum()) 왜 선생님은 '또는'이라는 조건을 사용하셨나요?

  • python
  • 머신러닝
  • 빅데이터
  • pandas
  • 빅데이터분석기사
lovelove567 댓글 2 좋아요 0 조회수 192

3회기출 작업형 1 하드코딩

해결됨

[퇴근후딴짓] 빅데이터 분석기사 실기 (작업형1,2,3)

안녕하세요. 섹션12 3회 기출유형 작업형 1 강의 9:54 경에서 '하드코딩 하지말라' 라는 메시지가 나오는데, 정답이 있는 작업형 1, 3은 정답만 맞으면 만점처리 되는거 아닌가요? 하드코딩을 하거나 눈으로 세거나 혹시 채점하면서 코드문(풀이과정)까지 봐서, 답은 맞아도 풀이가 정답이 아니라면 틀릴수도 있나요...? 아래 비슷한 질문이 있는거같은데, 응시자 유의사항 보면 정답만 맞추라는 뉘앙스인데, 이번 8회 실기는 어떻게 해야하나요?

  • python
  • 머신러닝
  • 빅데이터
  • pandas
  • 빅데이터분석기사
최지훈 댓글 1 좋아요 0 조회수 201

Caw -> Cow 오타 안 고치신 건가요??

미해결

김영한의 실전 자바 - 기본편

[질문 템플릿] 1. 강의 내용과 관련된 질문인가요? (예) 2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (예) 3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예) [질문 내용] PDF 교안 최신버전(20240411 ver)으로 다시 확인해봤는데 Caw 오타 그대로인거 같아서 문의드립니다.

  • java
  • 객체지향
lgh8079 댓글 2 좋아요 -2 조회수 589

NoSuchElementException 에러 해결은 되었는데, 정확한 원인은 ㅠㅠ

미해결

[신규 개정판] 이것이 진짜 크롤링이다 - 실전편 (인공지능 수익화)

#드롭다운 메뉴 클릭 driver.find_element(By.CSS_SELECTOR,"#account > div.MyView-module__my_menu___eF24q.MyView-module__is_open____qWM1 > div > div > ul > li:nth-child(1) > a > span.MyView-module__item_text___VTQQM").click() CSS selector 제대로 한것 같은데 실행하면 하기와 같이 에러 발생합니다. 도움 부탁드립니다. --------------------------------------------------------------------------- NoSuchElementException Traceback (most recent call last) Cell In[5], line 1 ----> 1 driver.find_element(By.CSS_SELECTOR,\"#account > div.MyView-module__my_menu___eF24q.MyView-module__is_open____qWM1 > div > div > ul > li:nth-child(1) > a > span.MyView-module__item_text___VTQQM\").click() File c:\\Users\\visio\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\selenium\\webdriver\\remote\\webdriver.py:741, in WebDriver.find_element(self, by, value) 738 by = By.CSS_SELECTOR 739 value = f'[name=\"{value}\"]' --> 741 return self.execute(Command.FIND_ELEMENT, {\"using\": by, \"value\": value})[\"value\"] File c:\\Users\\visio\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\selenium\\webdriver\\remote\\webdriver.py:347, in WebDriver.execute(self, driver_command, params) 345 response = self.command_executor.execute(driver_command, params) 346 if response: --> 347 self.error_handler.check_response(response) 348 response[\"value\"] = self._unwrap_value(response.get(\"value\", None)) 349 return response File c:\\Users\\visio\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\selenium\\webdriver\\remote\\errorhandler.py:229, in ErrorHandler.check_response(self, response) 227 alert_text = value[\"alert\"].get(\"text\") 228 raise exception_class(message, screen, stacktrace, alert_text) # type: ignore[call-arg] # mypy is not smart enough here --> 229 raise exception_class(message, screen, stacktrace) NoSuchElementException: Message: no such element: Unable to locate element: {\"method\":\"css selector\",\"selector\":\"#account > div.MyView-module__my_menu___eF24q.MyView-module__is_open____qWM1 > div > div > ul > li:nth-child(1) > a > span.MyView-module__item_text___VTQQM\"} (Session info: chrome=125.0.6422.176); For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors#no-such-element-exception Stacktrace: \tGetHandleVerifier [0x00007FF7C22C1F52+60322] \t(No symbol) [0x00007FF7C223CEC9] \t(No symbol) [0x00007FF7C20F7EBA] \t(No symbol) [0x00007FF7C2147676] \t(No symbol) [0x00007FF7C214773C] \t(No symbol) [0x00007FF7C218E967] \t(No symbol) [0x00007FF7C216C25F] \t(No symbol) [0x00007FF7C218BC80] \t(No symbol) [0x00007FF7C216BFC3] \t(No symbol) [0x00007FF7C2139617] \t(No symbol) [0x00007FF7C213A211] \tGetHandleVerifier [0x00007FF7C25D94AD+3301629] \tGetHandleVerifier [0x00007FF7C26236D3+3605283] \tGetHandleVerifier [0x00007FF7C2619450+3563680] \tGetHandleVerifier [0x00007FF7C2374326+790390] \t(No symbol) [0x00007FF7C224750F] \t(No symbol) [0x00007FF7C2243404] \t(No symbol) [0x00007FF7C2243592] \t(No symbol) [0x00007FF7C2232F9F] \tBaseThreadInitThunk [0x00007FF81527257D+29] \tRtlUserThreadStart [0x00007FF8161EAF28+40] "

  • python
  • 웹-크롤링
송내 댓글 3 좋아요 0 조회수 681

예제파일

미해결

파이썬으로 10가지 게임 만들기 1편 [비전공자 초급 과정]

예제파일은 어디있나요?

  • python
서정민 댓글 2 좋아요 0 조회수 255

jsp) 자바빈으로 값 전달이 안 되고 null로 뜨는 문제

미해결

이런 식으로 됩니다. join.jsp에서 회원가입 정보를 작성하고 등록 버튼을 누르면 join_process.jsp로 이동하는 방식입니다. joinBean.java와 joinBean.class 파일은 [톰캣경로/webapps/java_web_last/WEB-INF/classes/com/test]에 있고 다른 jsp 파일은 [톰캣경로/webapps/java_web_last]에 있습니다. vscode로 작업하고 있구요, 위치가 잘못된 걸까요? 뤼튼에 물어볼 때마다 코드는 문제가 없다고 뜨거든요. 코드도 함께 첨부합니다. 잘 아시는 분들 도움 부탁드립니다. ㅠㅠ join.jsp join_process.jsp <%@ page contentType="text/html; charset=UTF-8"%> <%@ page import="com.test.joinBean" %> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> <jsp:useBean id="joinBean" class="com.test.joinBean" scope="request" /> <jsp:setProperty name="joinBean" property="*" /> <html> <head> <title>회원 가입 확인</title> <link rel="stylesheet" href="bootstrap.min.css" /> </head> <body> <div class="container py-4"> <jsp:include page="/menu.jsp" /> <div class="p-5 mb-4 bg-body-tertiary rounded-3"> <div class="container-fluid py-5"> <h1 class="display-5 fw-bold">회원 가입 확인</h1> <p class="col-md-8 fs-4">Please confirm your registration information.</p> </div> </div> <div class="row align-items-md-stretch text-center"> <table class="table table-striped"> <tr> <th>아이디</th> <td><jsp:getProperty name="joinBean" property="id" /></td> </tr> <tr> <th>비밀번호</th> <td><jsp:getProperty name="joinBean" property="password" /></td> </tr> <tr> <th>성명</th> <td><jsp:getProperty name="joinBean" property="name" /></td> </tr> <tr> <th>성별</th> <td><jsp:getProperty name="joinBean" property="gender" /></td> </tr> <tr> <th>생일</th> <td><jsp:getProperty name="joinBean" property="birthyy" />년 <jsp:getProperty name="joinBean" property="birthmm" />월 <jsp:getProperty name="joinBean" property="birthdd" />일</td> </tr> <tr> <th>이메일</th> <td><jsp:getProperty name="joinBean" property="mail1" />@<jsp:getProperty name="joinBean" property="mail2" /></td> </tr> <tr> <th>전화번호</th> <td><jsp:getProperty name="joinBean" property="phone" /></td> </tr> <tr> <th>주소</th> <td><jsp:getProperty name="joinBean" property="postcode" /> <jsp:getProperty name="joinBean" property="addr1" /> <jsp:getProperty name="joinBean" property="addr2" /></td> </tr> </table> <div class="mb-3 row"> <div class="col-sm-12"> <div class="d-flex justify-content-center"> <form action="join_complete.jsp" method="post"> <input type="hidden" name="id" value="<jsp:getProperty name="joinBean" property="id" />"> <input type="hidden" name="password" value="<jsp:getProperty name="joinBean" property="password" />"> <input type="hidden" name="name" value="<jsp:getProperty name="joinBean" property="name" />"> <input type="hidden" name="gender" value="<jsp:getProperty name="joinBean" property="gender" />"> <input type="hidden" name="birthyy" value="<jsp:getProperty name="joinBean" property="birthyy" />"> <input type="hidden" name="birthmm" value="<jsp:getProperty name="joinBean" property="birthmm" />"> <input type="hidden" name="birthdd" value="<jsp:getProperty name="joinBean" property="birthdd" />"> <input type="hidden" name="mail1" value="<jsp:getProperty name="joinBean" property="mail1" />"> <input type="hidden" name="mail2" value="<jsp:getProperty name="joinBean" property="mail2" />"> <input type="hidden" name="phone" value="<jsp:getProperty name="joinBean" property="phone" />"> <input type="hidden" name="postcode" value="<jsp:getProperty name="joinBean" property="postcode" />"> <input type="hidden" name="addr1" value="<jsp:getProperty name="joinBean" property="addr1" />"> <input type="hidden" name="addr2" value="<jsp:getProperty name="joinBean" property="addr2" />"> <button type="submit" class="btn btn-primary me-2"> <span class="d-flex justify-content-center align-items-center"> 이대로 회원가입 </span> </button> </form> <a href="join.jsp" class="btn btn-primary"> <span class="d-flex justify-content-center align-items-center"> 돌아가기 </span> </a> </div> </div> </div> </div> <jsp:include page="/footer.inc.jsp" /> </div> </body> </html> joinBean.java package com.test; public class joinBean { private String id; private String password; private String name; private String gender; private String birthyy; private String birthmm; private String birthdd; private String mail1; private String mail2; private String phone; private String postcode; private String addr1; private String addr2; public String getId() { return id; } public void setId(String id) { this.id = id; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getGender() { return gender; } public void setGender(String gender) { this.gender = gender; } public String getBirthyy() { return birthyy; } public void setBirthyy(String birthyy) { this.birthyy = birthyy; } public String getBirthmm() { return birthmm; } public void setBirthmm(String birthmm) { this.birthmm = birthmm; } public String getBirthdd() { return birthdd; } public void setBirthdd(String birthdd) { this.birthdd = birthdd; } public String getMail1() { return mail1; } public void setMail1(String mail1) { this.mail1 = mail1; } public String getMail2() { return mail2; } public void setMail2(String mail2) { this.mail2 = mail2; } public String getPhone() { return phone; } public void setPhone(String phone) { this.phone = phone; } public String getPostcode() { return postcode; } public void setPostcode(String postcode) { this.postcode = postcode; } public String getAddr1() { return addr1; } public void setAddr1(String addr1) { this.addr1 = addr1; } public String getAddr2() { return addr2; } public void setAddr2(String addr2) { this.addr2 = addr2; } } null로 표시되는 것 말고 따로 오류 뜨는 건 없습니다. 자바빈 파일이 연결이 안 되는 것 같은데...

  • jsp
  • java
  • javabean
임서하 댓글 2 좋아요 0 조회수 391

단일표본검정 강의 질문

해결됨

[퇴근후딴짓] 빅데이터 분석기사 실기 (작업형1,2,3)

만약 대립 가설이 반대로 120g보다 크다고 하면, 아래 코드처럼 작성하면 되나요? stats.wilcoxon(df['무게'] - 120, alternative='grater')

  • python
  • 머신러닝
  • 빅데이터
  • pandas
  • 빅데이터분석기사
세린 댓글 1 좋아요 0 조회수 212

작업형 2 랜덤포레스트

해결됨

[퇴근후딴짓] 빅데이터 분석기사 실기 (작업형1,2,3)

선생님! 작업형 2 문제 푸는 방식을 정해서 시험장에서 그 방식대로만 풀려고 하는데 혹시 회귀나 분류 모두 randomforest 하나만 사용해서 학습시켜 예측값을 도출해도 2유형에서 고득점 받는데 무리 없을까요? 다른 모델 식까지 외우기에는 너무 시간이 많이 걸릴거 같아서요 ㅎㅎ 혹시 랜포말고 더 추천하시는 모델이 따로 있을까요?

  • python
  • 머신러닝
  • 빅데이터
  • pandas
  • 빅데이터분석기사
박나현 댓글 1 좋아요 0 조회수 268

결측치가 만약 생기면

해결됨

[퇴근후딴짓] 빅데이터 분석기사 실기 (작업형1,2,3)

랜덤포레스트 모델을 쓴다는 가정하에 가장 무난한 방법은 뭔가요...? 랜덤포레스트 결측치 계산하는 기능있어서 냅두는게 나을 지 아니면 0으로 채우는게 나을지 (둘다 확인해보는게 좋지만, 만약 확인하는 코드 잊었다고 생각하면 가장 무난한게 어떤 방법인지!) 알고싶습니다!

  • python
  • 머신러닝
  • 빅데이터
  • pandas
  • 빅데이터분석기사
임재홍 댓글 1 좋아요 0 조회수 206

4회 작업형 2 문제

해결됨

[퇴근후딴짓] 빅데이터 분석기사 실기 (작업형1,2,3)

학습 관련 질문을 남겨주세요. 상세히 작성하면 더 좋아요! 질문과 관련된 영상 위치를 알려주면 더 빠르게 답변할 수 있어요 먼저 유사한 질문이 있었는지 검색해보세요 안녕하세요 강사님 수업 잘 듣고 있습니다! 다름이 아니라 제가 분류/회귀 문제에서 랜덤포레스트와 xgboost 두 가지 코딩을 이용하려 하는데 이번 문제의 경우 랜덤포레스트는 돌아가지만 xgboost 같은 경우는 오류가 발생하더라구요 모든 데이터에 사용 가능한 줄 알았는데 데이터마다 사용할 수 있는 모델이 한정적인가요?? from xgboost import XGBClassifier model = XGBClassifier() model.fit(X_tr, y_tr) pred = moedl.predict(X_val) 위와 같이 실행했고, 아래는 에러코드입니다! ValueError: Invalid classes inferred from unique values of `y`. Expected: [0 1 2 3], got [1 2 3 4]

  • python
  • 머신러닝
  • 빅데이터
  • pandas
  • 빅데이터분석기사
조현우 댓글 2 좋아요 0 조회수 173

@BatchSize 적용 시 로그

미해결

자바 ORM 표준 JPA 프로그래밍 - 기본편

========================================= [질문 템플릿] 1. 강의 내용과 관련된 질문인가요? (예) 2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (예) 3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예) [질문 내용] 안녕하세요. 정말 JPA를 제대로 배우며 유익한 시간을 보내고 있는 수강생입니다. 질문 1. 페치조인2 - 한계 강의를 듣던 중 @BatchSize 를 조절하여 N+1 문제를 해결하는 예시를 보여주시는데 보여주신 예시의 로그와 제가 테스트 해봤을 때의 로그가 좀 다르게 나와 질문드립니다. 인강에서 보여주실 때에는 load one-to-many 라고 주석이 달리면서 실제 조건문에서는 ? 가 2개만 찍혀있는데 제가 테스트 해보니 BatchSize에 지정해준 숫자 만큼 로그에 ? 가 찍히는것을 확인 할 수 있었습니다. 혹시 제가 잘 못 테스트 한 것 일까요? 질문 2. 또한 강의에서 일반적으로 BatchSize 를 전역 설정으로 해놓고 100~1000 사이의 크기를 지정하여 사용하신다고 말씀하셨는데 이는 DB 조회 쿼리 횟수는 줄어들어 N+1 문제는 완화할수 있지만 지연 로딩 시 내가 접근한 객체의 수 만큼만 로드하는 것이 아닌 무조건 배치 사이즈 만큼 로드되기 때문에 그 간격이 크면 메모리적인 낭비가 되는거 아닌가요?

  • java
  • jpa
JJ L 댓글 1 좋아요 0 조회수 339

작업형 2 모의문제 2번

해결됨

[퇴근후딴짓] 빅데이터 분석기사 실기 (작업형1,2,3)

학습 관련 질문을 남겨주세요. 상세히 작성하면 더 좋아요! 질문과 관련된 영상 위치를 알려주면 더 빠르게 답변할 수 있어요 먼저 유사한 질문이 있었는지 검색해보세요 안녕하세요 선생님! 항상 좋은 강의 제공해주셔서 감사합니다! '작업형2 한가지 방법으로만 푸는 방법' 강의해주신 걸 기반으로 작업형 2 모의문제 2번 코드를 작성해 봤는데요 잘 실행되지가 않습니다. import pandas as pd train = pd.read_csv('train.csv') test = pd.read_csv('test.csv') y_test= pd.read_csv('y_test.csv') print(train.shape, test.shape) print(train.head()) print(test.head()) print(train.isnull().sum()) print(test.isnull().sum()) train['price'].describe()#분류는 밸류카운트로 타겟확인 train['reviews_per_month'].sample(10) train.info() # 월간리뷰는 mean으로, 라스트리뷰는 0으로 print(train.head(2)) train.nunique() #name, hostname lastreview 삭제 cols = ['name','host_name','last_review','host_id'] # print('삭제전',train.shape) train = train.drop(cols, axis =1) test = test.drop(cols, axis =1) print('\n삭제한 후', train.shape) train['reviews_per_month'] = train['reviews_per_month'].fillna(0) test['reviews_per_month'] = test['reviews_per_month'].fillna(0) train.isnull().sum() train = train.drop('id',axis = 1) testid = test.pop('id') #테스트아이디는 나중에 쓰니까 # test.head() print(train.isnull().sum()) #test.info() # print(train.shape) # print(test.shape) print(test.info()) print(train.info()) train = pd.get_dummies(train) test = pd.get_dummies(test) set1 = set(train.columns) set2 = set(test.columns) print('------------차이가없어야하는데',set1 - set2,'-----------------') df = pd.concat([train, test], axis=0) train = df.iloc[:len(train), :] test = df.iloc[len(train):, :] print('------------아직도 차이가 있나',set1 - set2,'-----------------') # print(train.shape) # print(test.shape) # print(train.shape, test.shape) # from sklearn.model_selection import train_test_split # print(train.head(2)) # target = train['price'] # target.sample(3) # xtr,xval,ytr,yval = train_test_split(train,target,test_size = 0.2, random_state=2) # print('\n분할 데이터 크기', xtr.shape,xval.shape,ytr.shape,yval.shape) # from sklearn.ensemble import RandomForestRegressor # rf=RandomForestRegressor(random_state=0) # rf.fit(xtr,ytr) # pred = rf.predict(xval) # from sklearn.metrics import mean_squared_error # rmse = mean_squared_error(yval,pred) # rmse = rmse ** 0.5 # rmse # test.head() #from sklearn.metrics import r2_score #y_test = pd.read_csv("y_test.csv") #print('r2도 좋다면',r2_score(y_test, pred)) pred = rf.predict(test) submit = pd.DataFrame({'id':test_id,'output' :pred }).to_csv('왜안만들어지지;;.csv',index=False) submit.to_csv("result.csv", index=False) 이렇게 코드를 작성해봤는데, r2 score로 평가가 안되고, pred = rf.predict(test)에서 train, test의 컬럼수가 차이난다는 오류가 떠서 인코딩 후 concat 활용후 다시 분리하는 작업도 했는데 계속 안돌아갑니다...

  • python
  • 머신러닝
  • 빅데이터
  • pandas
  • 빅데이터분석기사
김주원 댓글 2 좋아요 0 조회수 326

문제와풀이1 문제2번 질문

해결됨

김영한의 실전 자바 - 중급 2편

학습하는 분들께 도움이 되고, 더 좋은 답변을 드릴 수 있도록 질문전에 다음을 꼭 확인해주세요. 1. 강의 내용과 관련된 질문을 남겨주세요. 2. 인프런의 질문 게시판과 자주 하는 질문(링크)을 먼저 확인해주세요. (자주 하는 질문 링크: https://bit.ly/3fX6ygx) 3. 질문 잘하기 메뉴얼(링크)을 먼저 읽어주세요. (질문 잘하기 메뉴얼 링크: https://bit.ly/2UfeqCG) 질문 시에는 위 내용은 삭제하고 다음 내용을 남겨주세요. ========================================= [질문 템플릿] 1. 강의 내용과 관련된 질문인가요? (예/아니오) 2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (예/아니오) 3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예/아니오) [질문 내용] 여기에 질문 내용을 남겨주세요. for (int i = 0; i < numbers.size(); i++) { System.out.print(numbers.get(i)); if(i<numbers.size()-1){ System.out.print(", "); } } i < number.size()-1 쪽이 제대로 이해가 안되는거같아서 질문합니다. 정수 입력을 1,2,3 입력했으면 numbers.size() = 3 i값 = 0 , numbers.size =3 i값 = 1 , numbers.size = 3 마지막 반복인 i값 = 2 , numbers.size = 3 을 할때는 2<3-1 은 맞지않으니 마지막 3뒤에 " , " 출력안됨 제가 이해한게 맞을까요 ?

  • java
  • 객체지향
  • 코딩-테스트
  • 알고리즘
deoksam 댓글 1 좋아요 0 조회수 248

인기 태그

인프런 TOP Writers

주간 인기글