- 학습 관련 질문을 남겨주세요. 상세히 작성하면 더 좋아요! - 먼저 유사한 질문이 있었는지 검색해보세요. - 서로 예의를 지키며 존중하는 문화를 만들어가요. - 잠깐! 인프런 서비스 운영 관련 문의는 1:1 문의하기를 이용해주세요. 여기에서 public static void main(String[] args) { Scanner in = new Scanner(System.in); String input1 = in.nextLine(); Integer size = Integer.valueOf(input1); int[][] input2 = new int[Integer.valueOf(input1) ][Integer.valueOf(input1) ]; for (int i = 0; i < Integer.valueOf(input1); i++) { String[] temp = in.nextLine().split(" "); for (int j = 0; j < temp.length; j++) { input2[i ][j] = Integer.valueOf(temp[j]); } } int[] count = new int[size]; // 학생 번호 -> [V][] // 학년 -> [][V] // 자기자신 번호를 추가해도 문제X for (int i = 0; i < size; i++) { boolean[] matched = new boolean[size]; // 학년 for (int j = 0; j < size; j++) { int now = input2[i][j]; // 학생 for (int k = 0; k < size; k++) { int another = input2[k][j]; if (now == another){ matched[k] = true; } } } int matchedCount = 0; for (int j = 0; j < size; j++) { if (matched[j]){ matchedCount++; } } count[i] = matchedCount; } int max = 0; int maxStu = 0; for (int i = 0; i < size; i++) { if (count[i] > max){ maxStu = i; } } System.out.println(maxStu); } 어차피 자기자신은 항상 포함되어 기본값이 1이게될텐데, boolean[] matched = new boolean[size]; 에서 체크하는걸로 처리하였습니다. 이접근법이 틀린이유를 모르겠습니다. 1. 자기자신을 같이처리 (기본카운트는 항상 1부터) 2. 리스트에 매치된 학생들을 계산 후 마지막에 더함
이유는 모르겠습니다만 제 컴퓨터에서는 DELIMITER 로 지정한 문자 "|" 가 split 메서드에서 작동하지 않더라구요. window를 사용하는데 그 때문인지는 모르겠습니다. 그래서 저는 DELIMITER = "\\|" 로 지정해 동작시켰습니다. 강사님과 split 메서드가 다르게 작동하는 이유는 뭘까요?
자바와 스프링 부트로 생애 최초 서버 만들기, 누구나 쉽게 개발부터 배포까지! [서버 개발 올인원 패키지]
안녕하세요! 질문이 생겨 질문글 남깁니다 :) 영속성 컨텍스트는 트랜잭션을 사용하면 생겨난다 라고 말씀 해주셨는데요. 이중에 1차 캐시 부분에 대한 내용이 궁금해서 코드를 작성하던중에 의아한점이 생겼습니다. @Transactional public List<UserResponse> getUsers() { User user = userRepository.findById(4L).orElseThrow(); user.updateName("test"); userRepository.findById(4L); userRepository.findById(4L); return userRepository.findAll() .stream() .map(UserResponse::new) .toList(); } 우선은 위 내용인데요, updateName을 호출한 시점에 변경 감지가 되어서 update문이 호출 되었는데, 이후에 로그로 찍히는 select문이 없더라구요. 1차캐시가 진행되면 그 이후에 객체의 값이 변경 되더라도 그 내용까지 다시 반영해서 캐싱 해주는걸까요? public List<UserResponse> getUsers() { userRepository.findById(4L); userRepository.findById(4L); userRepository.findById(4L); return userRepository.findAll() .stream() .map(UserResponse::new) .toList(); } 그리고 두번째 질문은 코드를 이런식으로 트랜잭션 어노테이션 없이 작성했을 때 인데요. 제 추측은 트랜잭션 어노테이션이 없으니 영속성컨텍스트가 생성되지 않을것이고 그에따라 select문이 3번 호출될것이다. 였는데 실행해보니 select문은 한번만 호출되더라구요. 나름대로 왜일까 고민해본 결론은 findById가 구현된 SimpleJpaRepository클래스에 붙어있는 Transactional이 영향을 주는건가? 싶긴 한데 명확한 답은 모르겠습니다 ☹ 1차캐시에 한해서는 트랜잭셔널과는 독립되게 영속성컨텍스트가 동작하는걸까요?
1987번 제 풀이가 선생님의 리스트 풀이와 비슷하다고 생각해서 제출을 해봤는데 시간 초과가 나는 것 같습니다. 이상하다고 생각해서 선생님께서 작성해주신 예시코드도 복붙해봤는데 똑같이 시간 초과가 나는 것 같아서요... 혹시 뭐가 문제일까요? 컴퓨터마다 시간이 달라서 그런걸까요?
안녕하세요 선생님. 백준 3085번 풀이2와 제 풀이가 비슷한 것 같은데 제 풀이는 틀린 것으로 나오는데 어떤 부분이 잘못됐는지 잘 모르겠습니다. 제가 어떤 부분을 놓치고 있는지 알려주시면 감사하겠습니다! import sys from itertools import combinations def input(): return sys.stdin.readline().rstrip() def get_max(i,j): global data, n ser1 = data[i] ser2 = [data[k][j] for k in range(n)] return max(count_max(ser1), count_max(ser2)) def count_max(ser): count = 0 bef = '.' for idx in range(len(ser)): if bef != ser[idx]: count = 1 else: count += 1 bef = ser[idx] return count n = int(input()) data = [] for _ in range(n): data.append(list(input())) dx = [0,1,-1,0] dy = [1,0,0,-1] cur_max = 0 for i in range(n): for j in range(n): if i == j: cur_max = max(cur_max, get_max(i, j)) for di, dj in zip(dx,dy): ni = i + di nj = j + dj if not ((0 <= ni < n) & (0 <= nj < n)): continue if (data[ni][nj] == data[i][j]): continue data[i][j], data[ni][nj] = data[ni][nj], data[i][j] cur_max = max(cur_max, get_max(i, j)) data[i][j], data[ni][nj] = data[ni][nj], data[i][j] print(cur_max)
자바와 스프링 부트로 생애 최초 서버 만들기, 누구나 쉽게 개발부터 배포까지! [서버 개발 올인원 패키지]
안녕하세요, 24강 수강중에 궁금한점이 생겨 문의 남깁니다. 야믈파일에 설정한 ddl-auto옵션 관련해서 validate로 값을 바꾼 뒤 몇가지 테스트를 해보았습니다. age필드를 완전히 제거 name필드를 named 명칭으로 변경. name필드의 column()안에 들어가는 속성값들을 변경. 이렇게 3가지를 해보았는데 실질적으로 테이블과 일치하지 않는다 라며 서버를 실행하지 않는 경우는 2번 name필드가 다른 명칭으로 변경되었을 때 한가지 경우더라구요. age는 nullable이라 아에 필드가 명시되지 않아도 일치한다고 판단하는걸까요? column 어노테이션 안에 들어가는 값들은 감지하지 못하는게 맞나요?
안녕하세요, 강의 너무 잘 듣고 있습니다. 잘 따라가고 있던 와중 프론트 코드에 URL 상수를 지정하는 과정들을 거치고 UI가 있는 창에서 개발자 도구를 열어도 연결 완료 문구가 뜨지 않아 글 남깁니다. 저와 같은 문제로 질문 주신 커뮤니티의 다른 분께 프론트 파일과 주소를 남겨달라고 하셔서 메일로 프론트 파일과 주소를 보내드린 상태입니다. 한 번만 확인해 주신다면 감사드립니다.
학습 관련 질문을 남겨주세요. 상세히 작성하면 더 좋아요! 질문과 관련된 영상 위치를 알려주면 더 빠르게 답변할 수 있어요 먼저 유사한 질문이 있었는지 검색해보세요 import pandas as pd train = pd.read _csv("data/customer_train.csv") test = pd.read _csv("data/customer_test.csv") # print(train.shape,test.shape) #2482 # print( train.info (), test.info ()) # print(train.isnull().sum()) # 결측값 존재함 # print(test.isnull().sum()) # 결측값 존재함 # 전처리 train = train.fillna(0) test =test.fillna(0) # print(train.isnull().sum()) # print(test.isnull().sum()) target = train.pop('성별') df= pd.concat([train,test]) df = pd.get_dummies(df) train = df.iloc[:len(train)] test = df.iloc[len(train):] print(train.shape,test.shape) # 모델 분리 및 검증 from sklearn.model_selection import train_test_split X_tr,X_val,y_tr,y_val = train_test_split(train,target,test_size=0.2,random_state=22) # print(X_tr.shape,X_val.shape,y_tr.shape,y_val.shape) # 모델 학습 from sklearn.ensemble import RandomForestClassifier rf = RandomForestClassifier(random_state=22) rf.fit (X_tr,y_tr) pred = rf.predict_proba(X_val) # 결과 pred = rf.predict_proba(test) submit = pd.DataFrame({'pred':pred[:,1]}) submit.to _csv('result.csv',index=False) print( pd.read _csv('result.csv').head()) print( pd.read _csv('result.csv').shape) #2482 이 식으로 풀어도 될까요??
from sklearn.ensemble import RandomForestClassifier model = RandomForestClassifier(random_state = 0, max_depth = 3, n_estimators = 200) model.fit(X_tr, y_tr) pred_proba = model.predict_proba(X_val) from sklearn.metrics import roc_auc_score print(pred_proba) print(roc_auc_score(y_val, pred_proba[:, 1])) 안녕하세요, 모델학습 후 검증하려고 하니 print(roc_auc_score(y_val, pred_proba[:, 1]))에서 아래와 같은 오류가 발생합니다. list indices must be integers or slices, not tuple 혹시 pred_proba의 형태에 문제가 있어서 그러나 출력해봤더니 아래처럼 array가 2개가 뜨는데 원래 출력되던 값이랑 다른 것 같기도 한데 어떤 부분이 잘못된걸까요..? [array([[6.17771951e-04, 3.90720727e-04, 5.61044129e-04, ..., 1.88014875e-05, 2.71602426e-05, 9.26113606e-05], [4.72241735e-04, 7.55194719e-04, 3.70085375e-04, ..., 7.58005053e-06, 2.24283166e-05, 3.95537961e-05], [2.06135825e-05, 1.04454196e-05, 1.96540881e-06, ..., 2.93436306e-05, 1.84382330e-05, 6.98070487e-05], ..., [2.26718012e-05, 2.39307053e-05, 1.96540881e-06, ..., 3.02043842e-05, 1.54553261e-05, 6.62548451e-05], [1.51536674e-05, 2.15648698e-05, 2.06815630e-06, ..., 4.15875993e-05, 3.06270026e-05, 3.26545900e-05], [2.84102759e-05, 1.47138847e-05, 6.29396294e-06, ..., 3.17093190e-05, 1.71020727e-05, 4.92247989e-05]]), array([[0.05156594, 0.94843406], [0.0402204 , 0.9597796 ], [0.54197093, 0.45802907], ..., [0.53420482, 0.46579518], [0.5344612 , 0.4655388 ], [0.53436829, 0.46563171]])] @ 위 문제를 기존에는 y_train의 'ID' 값을 drop하지 않았다가, y_train의 'ID' 값을 drop하니 해결되었는데 그것과 관련이 있는 것일까요? 그리고, 'ID'값을 제거하려고 할 때에는 X_train, y_train, X_test 세 데이터 프레임 모두의 'ID'값을 반드시 제거해야 하는 것인가요?
질문 답변을 제공하지만, 강의 비용에는 Q&A는 포함되어 있지 않습니다. 다만 실습이 안되거나, 잘못된 내용의 경우는 알려주시면 가능한 빠르게 조치하겠습니다! [질문 전 답변] 1. 강의에서 다룬 내용과 관련된 질문인가요? 예 2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? 예 3. 질문 잘하기 법을 읽어보셨나요? 예 (https://www.inflearn.com/blogs/1719) 4. 잠깐! 인프런 서비스 운영 관련 문의는 1:1 문의하기를 이용해주세요. 5. vagrant up 에서 발생하는 문제는 주로 호스트 시스템(Windows, MacOS)과 연관된 다양한 조건에 의해 발생합니다. 따라서 이를 모두 제가 파악할 수 없어서 해결이 어렵습니다. vagrant up 으로 진행이 어렵다면 제공해 드리는 가상 머신(VM) 이미지를 import해서 진행하시기 바랍니다. ( https://www.inflearn.com/questions/992407/comment/281901 ) [질문 하기] tabby로 노드 접속 시 pass워드 입력창이 떠 질문게시판 보고 비밀번호 입력해 들어갔고, 그 후 tabby-v1.0.207/config.yaml 도 다시 한번 cp했습니다. PS C:\Users\sua\sua-study\k8s-edu\_Lecture_k8s_learning.kit\ch1\1.5\tabby-v1.0.207> cp ./config.yaml $env:APPDATA/tabby/ PS C:\Users\sua\sua-study\k8s-edu\_Lecture_k8s_learning.kit\ch1\1.5\tabby-v1.0.207> $env:APPDATA C:\Users\sua\AppData\Roaming PS C:\Users\sua\sua-study\k8s-edu\_Lecture_k8s_learning.kit\ch1\1.5\tabby-v1.0.207> cd C:\Users\sua\AppData\Roaming\tabby PS C:\Users\sua\AppData\Roaming\tabby> ls 디렉터리: C:\Users\sua\AppData\Roaming\tabby Mode LastWriteTime Length Name ---- ------------- ------ ---- d----- 2024-11-09 오후 11:20 blob_storage d----- 2024-11-09 오후 11:20 Code Cache d----- 2024-11-09 오후 11:30 Crashpad d----- 2024-11-09 오후 11:20 DawnCache d----- 2024-11-09 오후 11:20 Dictionaries d----- 2024-11-09 오후 11:20 GPUCache d----- 2024-11-09 오후 11:20 Local Storage d----- 2024-11-09 오후 11:30 Network d----- 2024-11-09 오후 11:20 plugins d----- 2024-11-09 오후 11:20 sentry -a---- 2024-11-09 오후 11:20 36 .updaterId -a---- 2024-11-09 오후 12:17 9408 config.yaml -a---- 2024-11-09 오후 11:23 9377 config.yaml.backup -a---- 2024-11-09 오후 11:20 434 Local State -a---- 2024-11-09 오후 11:20 0 lockfile -a---- 2024-11-09 오후 11:27 5190 log.txt -a---- 2024-11-09 오후 11:20 57 Preferences -a---- 2024-11-09 오후 11:20 2 window.json 컨트롤 플레인 노드에 접속해 controlpalne_node.sh을 실행하니 계속해서 no such file, directory, unable to load certificate 에러가 뜹니다. root@cp-k8s:~/_Lecture_k8s_learning.kit.git/ch1/1.5# ./controlplane_ node.sh I1109 23:46:22.735630 2906 version.go:256] remote version is much newer: v1.31.2; falling back to: stable-1.30 [init] Using Kubernetes version: v1.30.6 [preflight] Running pre-flight checks error execution phase preflight: [preflight] Some fatal errors occurred: [ERROR FileContent--proc-sys-net-ipv4-ip_forward]: /proc/sys/net/ipv4/ip_forward contents are not set to 1 [preflight] If you know what you are doing, you can make a check non-fatal with --ignore-preflight-errors=... To see the stack trace of this error execute with --v=5 or higher cp: cannot stat '/etc/kubernetes/admin.conf': No such file or directory chown: cannot access '/root/.kube/config': No such file or directory error: error validating " https://raw.githubusercontent.com/sysnet4admin/IaC/main/k8s/CNI/172.16_net_calico_v3.26.0.yaml ": error validating data: failed to download openapi: Get " http://localhost:8080/openapi/v2?timeout=32s ": dial tcp 127.0.0.1:8080: connect: connectio n refused; if you choose to ignore these errors, turn validation off with --validate=false fatal: destination path '_Lecture_k8s_starter.kit' already exists and is not an empty directory. mv: cannot stat '/home/vagrant/_Lecture_k8s_starter.kit': No such file or directory find: ‘/root/_Lecture_k8s_starter.kit’: No such file or directory Cloning into '/tmp/update-kube-cert'... remote: Enumerating objects: 166, done. remote: Counting objects: 100% (54/54), done. remote: Compressing objects: 100% (45/45), done. remote: Total 166 (delta 18), reused 20 (delta 8), pack-reused 112 (from 1) Receiving objects: 100% (166/166), 63.56 KiB | 1.63 MiB/s, done. Resolving deltas: 100% (81/81), done. CERTIFICATE EXPIRES grep: /etc/kubernetes/controller-manager.conf: No such file or directory Could not read certificate from /dev/fd/63 Unable to load certificate /etc/kubernetes/controller-manager.config grep: /etc/kubernetes/scheduler.conf: No such file or directory Could not read certificate from /dev/fd/63 Unable to load certificate /etc/kubernetes/scheduler.config grep: /etc/kubernetes/admin.conf: No such file or directory Could not read certificate from /dev/fd/63 Unable to load certificate /etc/kubernetes/admin.config Could not open file or uri for loading certificate from /etc/kubernetes/pki/ca.crt 40E755C3AE7F0000:error:16000069:STORE routines:ossl_store_get0_loader_int:unregistered scheme:../crypto/store/store_register.c:237:scheme=file 40E755C3AE7F0000:error:80000002:system library:file_open:No such file or directory:../providers/implementations/storemgmt/file_store.c:267:calling stat(/etc/kubernetes/pki/ca.crt) Unable to load certificate /etc/kubernetes/pki/ca.crt Could not open file or uri for loading certificate from /etc/kubernetes/pki/apiserver.crt 40676913F77F0000:error:16000069:STORE routines:ossl_store_get0_loader_int:unregistered scheme:../crypto/store/store_register.c:237:scheme=file 40676913F77F0000:error:80000002:system library:file_open:No such file or directory:../providers/implementations/storemgmt/file_store.c:267:calling stat(/etc/kubernetes/pki/apiserver.crt) Unable to load certificate /etc/kubernetes/pki/apiserver.crt Could not open file or uri for loading certificate from /etc/kubernetes/pki/apiserver-kubelet-client.crt 40A791BE7A7F0000:error:16000069:STORE routines:ossl_store_get0_loader_int:unregistered scheme:../crypto/store/store_register.c:237:scheme=file 40A791BE7A7F0000:error:80000002:system library:file_open:No such file or directory:../providers/implementations/storemgmt/file_store.c:267:calling stat(/etc/kubernetes/pki/apiserver-kubelet-client.crt) Unable to load certificate /etc/kubernetes/pki/apiserver-kubelet-client.crt Could not open file or uri for loading certificate from /etc/kubernetes/pki/front-proxy-ca.crt 40E7648A397F0000:error:16000069:STORE routines:ossl_store_get0_loader_int:unregistered scheme:../crypto/store/store_register.c:237:scheme=file 40E7648A397F0000:error:80000002:system library:file_open:No such file or directory:../providers/implementations/storemgmt/file_store.c:267:calling stat(/etc/kubernetes/pki/front-proxy-ca.crt) Unable to load certificate /etc/kubernetes/pki/front-proxy-ca.crt Could not open file or uri for loading certificate from /etc/kubernetes/pki/front-proxy-client.crt 40D71C6F6E7F0000:error:16000069:STORE routines:ossl_store_get0_loader_int:unregistered scheme:../crypto/store/store_register.c:237:scheme=file 40D71C6F6E7F0000:error:80000002:system library:file_open:No such file or directory:../providers/implementations/storemgmt/file_store.c:267:calling stat(/etc/kubernetes/pki/front-proxy-client.crt) Unable to load certificate /etc/kubernetes/pki/front-proxy-client.crt Could not open file or uri for loading certificate from /etc/kubernetes/pki/etcd/ca.crt 40276AA0EE7F0000:error:16000069:STORE routines:ossl_store_get0_loader_int:unregistered scheme:../crypto/store/store_register.c:237:scheme=file 40276AA0EE7F0000:error:80000002:system library:file_open:No such file or directory:../providers/implementations/storemgmt/file_store.c:267:calling stat(/etc/kubernetes/pki/etcd/ca.crt) Unable to load certificate /etc/kubernetes/pki/etcd/ca.crt Could not open file or uri for loading certificate from /etc/kubernetes/pki/etcd/server.crt 40479185CE7F0000:error:16000069:STORE routines:ossl_store_get0_loader_int:unregistered scheme:../crypto/store/store_register.c:237:scheme=file 40479185CE7F0000:error:80000002:system library:file_open:No such file or directory:../providers/implementations/storemgmt/file_store.c:267:calling stat(/etc/kubernetes/pki/etcd/server.crt) Unable to load certificate /etc/kubernetes/pki/etcd/server.crt Could not open file or uri for loading certificate from /etc/kubernetes/pki/etcd/peer.crt 4037467AD47F0000:error:16000069:STORE routines:ossl_store_get0_loader_int:unregistered scheme:../crypto/store/store_register.c:237:scheme=file 4037467AD47F0000:error:80000002:system library:file_open:No such file or directory:../providers/implementations/storemgmt/file_store.c:267:calling stat(/etc/kubernetes/pki/etcd/peer.crt) Unable to load certificate /etc/kubernetes/pki/etcd/peer.crt Could not open file or uri for loading certificate from /etc/kubernetes/pki/etcd/healthcheck-client.crt 40F739C5117F0000:error:16000069:STORE routines:ossl_store_get0_loader_int:unregistered scheme:../crypto/store/store_register.c:237:scheme=file 40F739C5117F0000:error:80000002:system library:file_open:No such file or directory:../providers/implementations/storemgmt/file_store.c:267:calling stat(/etc/kubernetes/pki/etcd/healthcheck-client.crt) Unable to load certificate /etc/kubernetes/pki/etcd/healthcheck-client.crt Could not open file or uri for loading certificate from /etc/kubernetes/pki/apiserver-etcd-client.crt 40474EDD807F0000:error:16000069:STORE routines:ossl_store_get0_loader_int:unregistered scheme:../crypto/store/store_register.c:237:scheme=file 40474EDD807F0000:error:80000002:system library:file_open:No such file or directory:../providers/implementations/storemgmt/file_store.c:267:calling stat(/etc/kubernetes/pki/apiserver-etcd-client.crt) Unable to load certificate /etc/kubernetes/pki/apiserver-etcd-client.crt [2024-11-09T23:46:25.77+0900][ WARNING ] does not backup, /etc/kubernetes.old-20241109 already exists [2024-11-09T23:46:25.78+0900][INFO] updating... Wait 30 seconds for restarting the Control-Plane Node... 추가 설정이 더 필요할까요,,,?ㅜ
검증 데이터 분리 시, X_tr ~ = train_test_split( train.drop('output', axis=1) 에서 전단계에서 데이터 전처리 할 때, 이미 train에서 output 드랍하고 train에 저장했는데 (train = train.drop('output')) 검증 데이터 분리 작성 시 다시 drop 해주는 이유가 있나요? X_tr ~ = train_test_split( train) 이렇게 바로 하면 안되나요?
안녕하세요! 명목형 자료의 인코딩 시 Test 데이터에만 있는 Unique 값이 있을 수 있어 데이터를 합치고 인코딩 한 후에 다시 분리하는 것으로 이해하였습니다. 예시에 사용된 원핫인코딩의 pd.get_dummies와 달리 라벨인코딩의 경우 사이킷런의 인코더를 이용하는데, 이에 따라 fit_transform, transform으로 나누어 진행하는 것 같습니다. 질문은! 라벨인코딩의 경우에 Train, Test 데이터를 합쳐서 인코딩 할 때 fit_transform을 사용하면 될까요?