랜덤포레스트 모델 학습을 할 때 .fit과, pred를 수행한 후 별도로 pred_proba를 수행하는데 모델링의 pred_proba는 인자값으로 X_val이 주어지고, 예측할 때는 pred_proba의 인자값으로 test가 들어가게 되는데 왜 그런건가요 ? 별도로 슬라이싱을 하지 않았는데, train_test_split 데이터 분리를 수행한 후 X_tr, X_val의 len 값은 test_size에 의해 결정되는 건가요? 예측할 때 pred_proba에 X_val 값을 넣었더니 길이가 서로 다르다고 실행이 되지 않는 것으로 확인했습니다.
학습 관련 질문을 남겨주세요. 상세히 작성하면 더 좋아요! 질문과 관련된 영상 위치를 알려주면 더 빠르게 답변할 수 있어요 먼저 유사한 질문이 있었는지 검색해보세요 시험칠때, RandomForest만 이용하여 풀어도 될까요?? 분류는 f1-score 나 다른 식의 함수가 기억나지 않는다면 모델 학습 및 평가에서 RandomForestClassifier만을 사용해도 되나요? 마찬가지로 회귀에서도 다른 식의 함수가 기억나지 않는다면 모델 학습 및 평가에서 RandomForestRegression만 사용해도 되나요??
안녕하세요 강사님 바닐라 자바스크립트로 프로젝트를 진행할때 class를 이용해서 이를테면, export default class SearchFormView extends View { constructor(){ super(qs("#search-form-view")) this.resetElement = qs("[type=reset]", this.element) this.showResetButton(false) console.log(this.element, "111") } showResetButton(visible = true){ this.resetElement.style .display = visible ? "block" : "none" } } 와 같이 필요한 속성을 객체의 형태로 저장하고 class를 통해 만들어낸 객체에서 필요한 속성을 꺼내는 방식으로 프로그래밍을 진행하셨는데 이렇게 코딩을 해야하는 이유가 무엇인가요? 직관적으로 와닿지가 않아서 그렇습니다 ㅠㅠ
수업에서 Next.js에서는 클라이언트에 import 되는 서버 컴포넌트를 자동으로 클라이언트 컴포넌트로 변경해주는 동작을 한다. 라고 하셨는데요. 공식문서나 구글 문서를 아무리 찾아봐도 관련 언급이 없던데요. 혹시 출처를 알수 있을까요? 언제 업데이트 된건지 확인해보고 싶어서요
6.5 에러핸들링 24:04 (with-searchbar) 레이아웃을 살리기위해 error.tsx를 app/book/[id] 로 옮겨도 <Searchbar />가 보이지 않는 현상이 있습니다. 그리고 영상에서도 app/book/[id] 가 에러인 상황임에도 검색바 레이아웃이 보이는 장면이 없어서 헷갈리는 것 같습니다!
추가 문제 1번 WITH transaction_data AS ( SELECT 111 AS user_id, 1001 AS item_id, 719200 AS actual_price, '01/08/2024 12:00:00' AS transaction_date UNION ALL SELECT 111, 2002, 89000, '01/10/2024 12:00:00' UNION ALL SELECT 189, 2002, 89000, '01/12/2024 12:00:00' UNION ALL SELECT 156, 3002, 459000, '01/15/2024 12:00:00' UNION ALL SELECT 121, 1001, 719200, '01/18/2024 12:00:00' UNION ALL SELECT 156, 2001, 90300, '01/25/2024 12:00:00' UNION ALL SELECT 145, 3001, 399000, '01/26/2024 12:00:00' UNION ALL SELECT 189, 1002, 607200, '01/28/2024 12:00:00' UNION ALL SELECT 111, 3001, 399000, '02/05/2024 12:00:00' UNION ALL SELECT 178, 1002, 759000, '02/07/2024 12:00:00' UNION ALL SELECT 121, 2002, 62300, '02/08/2024 12:00:00' UNION ALL SELECT 156, 1001, 899000, '02/10/2024 12:00:00' UNION ALL SELECT 190, 2001, 90300, '02/11/2024 12:00:00' UNION ALL SELECT 189, 2001, 90300, '02/14/2024 12:00:00' UNION ALL SELECT 111, 1002, 759000, '02/15/2024 12:00:00' UNION ALL SELECT 156, 3001, 299250, '02/20/2024 12:00:00' UNION ALL SELECT 189, 3002, 344250, '02/25/2024 12:00:00' UNION ALL SELECT 111, 2001, 90300, '02/28/2024 12:00:00' ), user_info AS ( SELECT 111 AS user_id, 'Seoul' AS city, 28 AS age, 'Female' AS gender UNION ALL SELECT 121, 'Busan', 35, 'Male' UNION ALL SELECT 145, 'Incheon', 42, 'Female' UNION ALL SELECT 156, 'Seoul', 31, 'Male' UNION ALL SELECT 178, 'Daegu', 25, 'Female' UNION ALL SELECT 189, 'Seoul', 39, 'Male' UNION ALL SELECT 190, 'Busan', 29, 'Female' ), item_info AS ( SELECT 1001 AS item_id, 'Electronics' AS category, 'Smartphone' AS item_name, 899000 AS list_price UNION ALL SELECT 1002 AS item_id, 'Electronics' AS category, 'Tablet' AS item_name, 759000 AS list_price UNION ALL SELECT 2001 AS item_id, 'Fashion' AS category, 'Sneakers' AS item_name, 129000 AS list_price UNION ALL SELECT 2002 AS item_id, 'Fashion' AS category, 'Backpack' AS item_name, 89000 AS list_price UNION ALL SELECT 3001 AS item_id, 'Home' AS category, 'Coffee Machine' AS item_name, 399000 AS list_price UNION ALL SELECT 3002 AS item_id, 'Home' AS category, 'Air Purifier' AS item_name, 459000 AS list_price ) # 1번 문제(15분) -- - 주차별 각 카테고리별 평균 할인율이 가장 높았던 기간과 할인율을 구하는 쿼리를 작성해주세요 -- - 단, 날짜 데이터를 YYYY-MM-DD 23:59:39 이런 형태로 변경해주세요 , real_base as ( select * from ( select *, avg(diff_price) as avg_price, from( SELECT transaction_date, category, list_price, (list_price - actual_price) as diff_price FROM item_info as item left join transaction_data trans_date on item.item_id = trans_date.item_id ) as base group by all ) as base2 ) ## 주차별 평균 할인율 가장 높은 기간 --> 2024-01-08 ~ 2024-01-18 -- select -- FORMAT_TIMESTAMP('%Y-%m-%d 23:59:39', PARSE_TIMESTAMP('%m/%d/%Y %H:%M:%S', transaction_date)) AS formatted_date, -- avg_price -- from real_base -- group by -- 1,2 -- order by -- 2 desc ## 카테고리별 평균 할인율이 가장 높았던 기간 select *, round((max_price / list_price) * 100, 2) as `할인율` from ( select distinct FORMAT_TIMESTAMP('%Y-%m-%d 23:59:39', PARSE_TIMESTAMP('%m/%d/%Y %H:%M:%S', transaction_date)) AS formatted_date, category, max(avg_price) as max_price, list_price from real_base group by all order by 3 desc ) as avg_price_table order by 5 desc ## 할인율이 가장 높았던 주차 -- 01/25/2024 -- 02/08/2024 -- 02/11/2024 -- 02/14/2024 -- 02/28/2024 -- select -- transaction_date, -- round((diff_price / list_price) * 100, 2) as `할인율` -- -- transaction_date, -- -- safe_divide(diff_price, list_price) -- from real_base -- group by -- 1,2 -- order by -- 2 desc ## 할인율이 높았던 카테고리 -- Fashion -- select -- category, -- round((diff_price / list_price) * 100, 2) as `할인율` -- -- transaction_date, -- -- safe_divide(diff_price, list_price) -- from real_base -- group by all -- order by -- 2 desc 2번 WITH transaction_data AS ( SELECT 111 AS user_id, 1001 AS item_id, 719200 AS actual_price, '01/08/2024 12:00:00' AS transaction_date UNION ALL SELECT 111, 2002, 89000, '01/10/2024 12:00:00' UNION ALL SELECT 189, 2002, 89000, '01/12/2024 12:00:00' UNION ALL SELECT 156, 3002, 459000, '01/15/2024 12:00:00' UNION ALL SELECT 121, 1001, 719200, '01/18/2024 12:00:00' UNION ALL SELECT 156, 2001, 90300, '01/25/2024 12:00:00' UNION ALL SELECT 145, 3001, 399000, '01/26/2024 12:00:00' UNION ALL SELECT 189, 1002, 607200, '01/28/2024 12:00:00' UNION ALL SELECT 111, 3001, 399000, '02/05/2024 12:00:00' UNION ALL SELECT 178, 1002, 759000, '02/07/2024 12:00:00' UNION ALL SELECT 121, 2002, 62300, '02/08/2024 12:00:00' UNION ALL SELECT 156, 1001, 899000, '02/10/2024 12:00:00' UNION ALL SELECT 190, 2001, 90300, '02/11/2024 12:00:00' UNION ALL SELECT 189, 2001, 90300, '02/14/2024 12:00:00' UNION ALL SELECT 111, 1002, 759000, '02/15/2024 12:00:00' UNION ALL SELECT 156, 3001, 299250, '02/20/2024 12:00:00' UNION ALL SELECT 189, 3002, 344250, '02/25/2024 12:00:00' UNION ALL SELECT 111, 2001, 90300, '02/28/2024 12:00:00' ), user_info AS ( SELECT 111 AS user_id, 'Seoul' AS city, 28 AS age, 'Female' AS gender UNION ALL SELECT 121, 'Busan', 35, 'Male' UNION ALL SELECT 145, 'Incheon', 42, 'Female' UNION ALL SELECT 156, 'Seoul', 31, 'Male' UNION ALL SELECT 178, 'Daegu', 25, 'Female' UNION ALL SELECT 189, 'Seoul', 39, 'Male' UNION ALL SELECT 190, 'Busan', 29, 'Female' ), item_info AS ( SELECT 1001 AS item_id, 'Electronics' AS category, 'Smartphone' AS item_name, 899000 AS list_price UNION ALL SELECT 1002 AS item_id, 'Electronics' AS category, 'Tablet' AS item_name, 759000 AS list_price UNION ALL SELECT 2001 AS item_id, 'Fashion' AS category, 'Sneakers' AS item_name, 129000 AS list_price UNION ALL SELECT 2002 AS item_id, 'Fashion' AS category, 'Backpack' AS item_name, 89000 AS list_price UNION ALL SELECT 3001 AS item_id, 'Home' AS category, 'Coffee Machine' AS item_name, 399000 AS list_price UNION ALL SELECT 3002 AS item_id, 'Home' AS category, 'Air Purifier' AS item_name, 459000 AS list_price ) # 2번 문제(10분) 1610 -- - 2024년 1월에 가장 많은 매출을 기록한 카테고리를 구하는 쿼리를 작성해주세요 -- 날짜 테이블 -- 아이템 테이블 활용 -- 기간에 필터링 걸기 -- 카테고리 -- 매출 -- 카테고리별 구매가 -- 구매가의 합 = 매출 ## 카테고리별 구매가 , category_price as ( select item_date.transaction_date, item.category, item_date.actual_price from item_info as item left join transaction_data as item_date on item.item_id = item_date.item_id group by all ) ## 매출 | 카테고리별 구매가의 합 , `매출_테이블` as ( select *, sum(actual_price) over(partition by category) as `매출` from category_price ) ## 카테고리별 매출에 1월 필터링 select * from `매출_테이블` where transaction_date between '01/08/2024' and '01/28/2024' 3번 WITH transaction_data AS ( SELECT 111 AS user_id, 1001 AS item_id, 719200 AS actual_price, '01/08/2024 12:00:00' AS transaction_date UNION ALL SELECT 111, 2002, 89000, '01/10/2024 12:00:00' UNION ALL SELECT 189, 2002, 89000, '01/12/2024 12:00:00' UNION ALL SELECT 156, 3002, 459000, '01/15/2024 12:00:00' UNION ALL SELECT 121, 1001, 719200, '01/18/2024 12:00:00' UNION ALL SELECT 156, 2001, 90300, '01/25/2024 12:00:00' UNION ALL SELECT 145, 3001, 399000, '01/26/2024 12:00:00' UNION ALL SELECT 189, 1002, 607200, '01/28/2024 12:00:00' UNION ALL SELECT 111, 3001, 399000, '02/05/2024 12:00:00' UNION ALL SELECT 178, 1002, 759000, '02/07/2024 12:00:00' UNION ALL SELECT 121, 2002, 62300, '02/08/2024 12:00:00' UNION ALL SELECT 156, 1001, 899000, '02/10/2024 12:00:00' UNION ALL SELECT 190, 2001, 90300, '02/11/2024 12:00:00' UNION ALL SELECT 189, 2001, 90300, '02/14/2024 12:00:00' UNION ALL SELECT 111, 1002, 759000, '02/15/2024 12:00:00' UNION ALL SELECT 156, 3001, 299250, '02/20/2024 12:00:00' UNION ALL SELECT 189, 3002, 344250, '02/25/2024 12:00:00' UNION ALL SELECT 111, 2001, 90300, '02/28/2024 12:00:00' ), user_info AS ( SELECT 111 AS user_id, 'Seoul' AS city, 28 AS age, 'Female' AS gender UNION ALL SELECT 121, 'Busan', 35, 'Male' UNION ALL SELECT 145, 'Incheon', 42, 'Female' UNION ALL SELECT 156, 'Seoul', 31, 'Male' UNION ALL SELECT 178, 'Daegu', 25, 'Female' UNION ALL SELECT 189, 'Seoul', 39, 'Male' UNION ALL SELECT 190, 'Busan', 29, 'Female' ), item_info AS ( SELECT 1001 AS item_id, 'Electronics' AS category, 'Smartphone' AS item_name, 899000 AS list_price UNION ALL SELECT 1002 AS item_id, 'Electronics' AS category, 'Tablet' AS item_name, 759000 AS list_price UNION ALL SELECT 2001 AS item_id, 'Fashion' AS category, 'Sneakers' AS item_name, 129000 AS list_price UNION ALL SELECT 2002 AS item_id, 'Fashion' AS category, 'Backpack' AS item_name, 89000 AS list_price UNION ALL SELECT 3001 AS item_id, 'Home' AS category, 'Coffee Machine' AS item_name, 399000 AS list_price UNION ALL SELECT 3002 AS item_id, 'Home' AS category, 'Air Purifier' AS item_name, 459000 AS list_price ) # 3번 문제(10분) 1646 -- - 유저별 총 구매 금액이 200만원 이상인 유저들이 가장 많이 구매한 카테고리를 찾는 쿼리를 작성해주세요 -- 유저별 총 구매 금액 -- 유저 | 총 구매금액 -- 유저별 | 구매금액 -- 구매금액 합산 = 총 구매금액 , `유저별_총구매금액` as ( select user_id, `총 구매금액` from ( select user_id, sum(actual_price) over(partition by user_id) as `총 구매금액` from ( SELECT user_id, actual_price, FROM transaction_data group by all ) as base1 ) base2 group by 1,2 ) -- 200만원 이상 필터링 , `200만원 이상 필터링` as ( select * from `유저별_총구매금액` where `총 구매금액` >= 2000000 ) ## 유저들이 가장 많이 구매한 카테고리 -- 유저 | 카테고리 | 구매 -- 구매가가 있는 카테고리 수를 세면 어떨까? -- 카테고리별 카운트? select category, `카테고리별카운트` from ( select *, sum(`카테고리수`) over(partition by category) as `카테고리별카운트` from ( select user_id, category, count(category) over(partition by user_id) as `카테고리수` from ( select td2.user_id, item2.category, td2.actual_price from transaction_data as td2 left join item_info as item2 on td2.item_id = item2.item_id ) b_base ) as b_base2 ) as b_base3 group by 1,2 order by 2 desc
유저 상태 new user # User Status 정의 -- "우리 서비스를 이용하는 유저들의 주차별 상태가 어떻게 되나?" /* 1. New User: 해당 주차에 처음 방문한 유저 2. Current User: 지난주에도 방문했고 이번 주에도 방문한 유저 3. Resurrected User: 지난주에는 없었는데 이번주에 다시 방문한 유저 (첫 방문은 아님) 4. Dormant User: 지난주까지는 있었는데 이번주에 방문하지 않은 유저 */ # New User: 해당 주차에 처음 방문한 유저 -- '유저의 첫 방문 주'와 '유저별 이벤트 발생주'가 같은지 확인 -- 같으면, 1 -- 아니면 0 ## '유저의 첫 방문 주' with user_first_visit as ( select user_pseudo_id, date_trunc(min(event_date), week(monday)) as first_visit_date from `advanced.app_logs` where event_date between '2022-08-01' and '2022-12-31' group by 1 ) ## '유저의 모든 방문 주' , user_event_week as ( select distinct user_pseudo_id, date_trunc(event_date, week(monday)) as visit_date from `advanced.app_logs` where event_date between '2022-08-01' and '2022-12-31' ) ## 첫 방문 주와 모든 방문 주 중 같은 데이터가 있다면 '방문(=1)' , new_user_table as ( select ufv.user_pseudo_id, ufv.first_visit_date, uew.visit_date, if(ufv.first_visit_date = uew.visit_date, 1, 0) as new_user from user_first_visit as ufv inner join user_event_week as uew on ufv.user_pseudo_id = uew.user_pseudo_id group by 1,2,3 ) select first_visit_date as week, sum(new_user) as new_user_count from new_user_table group by 1 order by 1 current user # User Status 정의 -- "우리 서비스를 이용하는 유저들의 주차별 상태가 어떻게 되나?" /* 1. New User: 해당 주차에 처음 방문한 유저 2. Current User: 지난주에도 방문했고 이번 주에도 방문한 유저 3. Resurrected User: 지난주에는 없었는데 이번주에 다시 방문한 유저 (첫 방문은 아님) 4. Dormant User: 지난주까지는 있었는데 이번주에 방문하지 않은 유저 */ -- Current User: 지난주에도 방문했고 이번 주에도 방문한 유저 -- 유저별 모든 방문 주 구하기 -- 모든 방문주 - 전주 방문 데이터 = 1 --> current user ## 유저별 모든 방문 주 구하기 with user_visits as ( select user_pseudo_id, date_trunc((event_date), week(monday)) as visit_date from `advanced.app_logs` where event_date between '2022-08-01' and '2022-12-31' group by 1,2 ) ## 유저의 전주 방문 데이터 , prev_user_table as ( select user_pseudo_id, visit_date, lag(visit_date) over(partition by user_pseudo_id order by visit_date) as previous_visit_user from user_visits ) ## 모든 방문주 - 전주 방문 데이터 = 1 --> current user select visit_date as week, count(distinct user_pseudo_id) as current_user_cnt from( select distinct user_pseudo_id, visit_date, date_diff(visit_date, previous_visit_user, week) = 1 as current_user from prev_user_table ) as base where current_user is not null group by 1 order by 1 resurrected user # User Status 정의 -- "우리 서비스를 이용하는 유저들의 주차별 상태가 어떻게 되나?" /* 1. New User: 해당 주차에 처음 방문한 유저 2. Current User: 지난주에도 방문했고 이번 주에도 방문한 유저 3. Resurrected User: 지난주에는 없었는데 이번주에 다시 방문한 유저 (첫 방문은 아님) 4. Dormant User: 지난주까지는 있었는데 이번주에 방문하지 않은 유저 */ # Resurrected User: 지난주에는 없었는데 이번주에 다시 방문한 유저 (첫 방문은 아님) ## 유저별 모든 방문 주 구하기 with user_visits as ( select user_pseudo_id, date_trunc((event_date), week(monday)) as visit_date from `advanced.app_logs` where event_date between '2022-08-01' and '2022-12-31' group by 1,2 ) ## 유저의 전주 방문 데이터 , prev_user_table as ( select user_pseudo_id, visit_date, lag(visit_date) over(partition by user_pseudo_id order by visit_date) as previous_visit_user from user_visits ) ## (첫 방문이 아님) + (모든 방문 주 데이터 - 이전 방문주 > 1) = Resurrected User -- 첫 방문이 아닌 유저 : 'previous_visit_user is not null' -- 첫 방문이었으면 previous_visit_user가 null이었을테니깐. select visit_date as week, count(user_status) as Resurrected_User from ( select user_pseudo_id, visit_date, previous_visit_user, case when previous_visit_user is not null and date_diff(visit_date, previous_visit_user, week) > 1 then 'Resurrected_User' else null end as user_status from prev_user_table ) as Resurrected_User where user_status is not null group by 1 order by 1 dormant user # User Status 정의 -- "우리 서비스를 이용하는 유저들의 주차별 상태가 어떻게 되나?" /* 1. New User: 해당 주차에 처음 방문한 유저 2. Current User: 지난주에도 방문했고 이번 주에도 방문한 유저 3. Resurrected User: 지난주에는 없었는데 이번주에 다시 방문한 유저 (첫 방문은 아님) 4. Dormant User: 지난주까지는 있었는데 이번주에 방문하지 않은 유저 */ # Dormant User: 지난주까지는 있었는데 이번주에 방문하지 않은 유저 ## 모든 방문 데이터 with base as ( select user_pseudo_id, date_trunc((event_date), week(monday)) as visit_date from `advanced.app_logs` where event_date between '2022-08-01' and '2022-12-31' group by 1,2 ) ## 유저의 다음 방문주 데이터= , next_visit_date_table as ( select *, lead(visit_date) over(partition by user_pseudo_id order by visit_date) as next_visit_date from base ) ## Dormant User -- Dormant User? -- 다음주 방문 데이터가 null 이거나, -- next_visit_date > 1 week가 아닌 유저 , Dormant_User_table as ( select *, case when next_visit_date is null or date_diff(next_visit_date, visit_date, week) > 1 then 'Dormant_User' else null end as Dormant_User_data from next_visit_date_table ) select visit_date as week, count(Dormant_User_data) as Dormant_User_data_cnt from Dormant_User_table group by 1 order by 1
[종합 느낀점] 1. 날짜 데이터 변환 함수, 날짜 데이터로 추출 하는 함수 등 문제 풀 때 사용하는 함수를 까먹어 애를 먹었습니다. 2. 테이블 조인시 첫 테이블을 잘못 선택하면, 쿼리가 길어지고 꼬인다는 것을 느꼈습니다. 3. 지표가 어떤 지표느냐에 따라 해석 방법이 달라진 점도 알게 됐습니다. [문제 풀이 소요 시간] 1번 문제 : 30분 2번 문제 : 12분 3번 문제 : 12분 정답이면서도 확장성 있는 쿼리를 작성하다가는 영원히 못풀겠더라고요.. 그래서 최대한 쿼리 작성을 마무리 짓는데 초점을 뒀습니다.. ㅠㅠ [new_users] 위와 같은 시각화 결과가 나왔습니다. 눈에 띄는 데이터로는 두 가지가 있습니다: 1. 10월 new users 상승 상승 추정 이유: 1. 새로운 마케팅 전략 시행(시기가 추석 근처이니깐 추석을 기념해서 배달앱 쿠폰 지급?) 2. 12월 new users 하락 하락 추정 이유: 1. 연말 모임으로 인한 배달 수요 감소 (사실 감소세는 10월달에 고점을 찍은 이후 쭉 하락세이지만, 그 이유를 단정짓지는 못하겠습니다..) [Current User] 위와 같은 시각화 결과가 나왔습니다. 눈에 띄는 데이터로는 세가지가 있습니다: 1. 9월 중순 이후 Current User 상승 상승 추정 이유: 1. 새로운 마케팅 전략 시행(시기가 추석 근처이니깐 추석을 기념해서 배달앱 쿠폰 지급?) 2. 12월까지 꾸준한 상승 상승 추정 이유: 1. 기존 유저의 긍정적인 경험이 이어져서 서비스에 잔류 2. 마케팅으로 유입된 신규 유저도 긍정적인 경험을 해서 서비스에 잔류 3. 12월 Current User 하락 하락 추정 이유: 1. 연말 모임으로 인한 배달 수요 감소 [Resurrected User] 'Current User' 해석과 비슷할 거 같습니다. [Dormant User] 1. 9월 -> 10월 급격한 상승 상승 추정 이유: 1. 앞선 이유과 같음. 추석 관련 이벤트 실시. 2. 그러나 계속 상승이 이어지지 않은 점을 고민해 봐야 함. 2. 10월 -> 11월 말 유지 유지 추정 이유: 1. 마케팅으로 긍정적인 경험을 한 기존·신규 유저 잔류 2. 하지만 입소문이 나서 계속 상승하지는 않음. 3. 일부 유저만 잔류하고, 나머지 신규 유입 유저는 이벤트만 맛보고 이탈. 3. 12월 급격한 상승 상승 추정 이유: 1. 연말에 배달 수요가 감소할 것을 예측해 새로운 마케팅 전략 실시 주차별 리텐션 # 리텐션 정의 -- "우리 서비스를 이용한 사람들이 현재는 얼마큼 이용하고 있을까?" /* 1. 무슨 데이터가 필요할까? - 유저 - 날짜 왜 이런 데이터가 필요할까? 이에 대한 답변: '사람들'이니깐, '유저'를 인식할 수 있는 데이터가 필요하다. '현재'이니깐, '시간'을 인식할 수 있는 데이터가 필요하다. ## 1. 유저별 첫 방문 주 구하기*/ with first_visit_table as ( select user_pseudo_id, date_trunc(min(event_date), week(monday)) as first_visit_date from `advanced.app_logs` where event_date between '2022-08-01' and '2022-12-31' group by 1 ) /*2. 처음 이벤트를 발생 시킨 주는? - 무슨 데이터가 필요할까? 1. 첫 이벤트 발생 날짜 2. 유저 - 왜 이런 데이터가 필요할까? 이에 대한 답변: '이벤트'는 주체가 있어야 발동 되는 거니깐 '유저' 데이터가 필요하다. 또 이벤트 발생이란 결과에는 '날짜'라는 개념도 포함 되어 있기 때문에, '날짜' 데이터가 필요하다. 그중에서도 '처음 이벤트를 발생한 주'의 데이터가 필요하다. 3. 유저가 이벤트를 실행한 주는? - 무슨 데이터가 필요할까? 1. 유저 2. 이벤트 이름(선택) 3. 이벤트 발생 날짜 + 중복제거 왜? 목적이 모든 유저의 리텐션이기 때문에. 중복 제거를 하지 않으면, 모든 유저가 발생시킨 모든 이벤트가 보이기 때문에 가독성이 안 좋기 때문에. - 왜 이런 데이터가 필요할까? 이에 대한 답변: 처음 이벤트를 발생시킨 날짜와 비교하기 위해서 ## 2. 유저별 이벤트 발생 주 구하기*/ , user_event as ( select distinct user_pseudo_id, date_trunc(event_date, week(monday)) as user_event_week from `advanced.app_logs` where event_date between '2022-08-01' and '2022-12-31' ) /*4. '유저가 이벤트 실행한 주 - 유저가 처음 방문한 주' - 무슨 데이터가 필요할까? 1. 유저 2. 첫 이벤트 발생 날짜 3. 이벤트 발생 날짜 4. (이벤트 발생 날짜 - 첫 이벤트 발생 날짜) - 왜 이런 데이터가 필요할까? 이에 대한 답변: 처음 이벤트를 발생시킨 날짜와 비교하기 위해서 ## 3. 유저별 이벤트 발생주와 첫 방문주 차이 구하기*/ , diff_week_table as ( select fvt.user_pseudo_id, fvt.first_visit_date, ue.user_event_week, date_diff(ue.user_event_week, fvt.first_visit_date, week(monday)) as diff_week from first_visit_table as fvt left join user_event as ue on fvt.user_pseudo_id = ue.user_pseudo_id order by 2, 4 ) /*5. 주차별 유저수 구하기 - 왜 위와 같은 생각을 했는가? 이에 대한 답변: 주차수에 따른 유저수를 알아야만 첫 주차에 비해 얼마큼 유저가 이벤트를 발생시키지 않았는지 알 수 있으니깐. - 무슨 데이터가 필요한가? 이에 대한 답변: 1. 이벤트 발생 차이 주 2. 중복 없는 유저 수 ## 4. 주차별 유저수 구하기*/ , unique_user_cnt_table as ( select diff_week, count(distinct user_pseudo_id) as unique_user_cnt from diff_week_table group by 1 order by 1 ) /*6. 모든 행에 첫 주 유저수 적용하기 - 왜 위와 같은 생각을 했는가? 이에 대한 답변: 첫 주 유저수로 주차마다 달라지는 유저수를 나누면, 리텐션을 구할 수 있기 때문에. - 무슨 데이터가 필요한가? 이에 대한 답변: 1. 이벤트 발생 차이주 2. 주차별 중복 없는 유저수 3. 모든 행에 적용하는 첫 주 유저수 ## 5. 모든 행에 첫 주 유저수 적용하기*/ , first_visit_week_data_table as ( select *, first_value(unique_user_cnt) over(order by unique_user_cnt desc) AS first_visit_week_data from unique_user_cnt_table order by 1 ) ## 6. 리텐션 구하기 | 주차별 유저수 / 첫 주 유저수 select *, round(safe_divide(unique_user_cnt, first_visit_week_data), 2) as retention_rate from first_visit_week_data_table
안녕하세요 강사님 강의는 단일 페이지에 대해서 mvc 패턴을 잡을 때 하나의 페이지를 대상으로 controller views helpers.js, main.js, storage.js, Store.js를 만드셨는데 여러개의 페이지가 연결된 상황에서 여러 페이지를 동시에 작업하는 경우.. 폴더 구조가 어떻게 되는 건지 궁금합니다. 그러니깐.. 하나의 helpers, 하나의 storage, 하나의 Store.js를 만들고 거기 안에 여러 페이지에서 쓰는 로직들을 다 때려박는건지 아니면 각각의 페이지에 대해서 폴더를 만들고 helpers, storage, Store 같은 것을 각각 다 따로 만드는건지 현업에서 프로젝트는 어떻게 진행하는건지 궁금합니다!
섹선1에 한글 파일을 불러올 때마다 뜨는 팝업 조치하고 있는데 컴퓨터\HKEY_CURRENT_USER\SOFTWARE\HNC\HwpAutomation\Modules 이 레지스트리 경로가 없습니다..ㅠ 저희 기관은 한글 2014를 아직 사용하고 있는데 이전 버전이라서 없는 걸까요?
import { type NextRequest, NextResponse } from 'next/server'; import { fetchData } from '@/shared/apis/fetch-data'; import type { IAcademyCreateDTO, IPostEnrollAcademyResponse } from '@/shared/types/acadmy'; export async function POST(req: NextRequest) { const body = (await req.json()) as Promise<IAcademyCreateDTO>; const data = await fetchData<IPostEnrollAcademyResponse>('/api/v1/academies', 'POST', body); if (!data.isSuccess) { return NextResponse.json( {}, { status: 500, statusText: data.message, }, ); } return NextResponse.json(data); } 서버에, 에러시 아래와 같은 데이터 구조를 준다고 했을떄 위의 방식처럼, 에러 핸들링을 하는 것이 맞는지 궁금합니다... Route Handler의 보편적인 에러처리 방식이 너무 궁금합니다!! (직접 에러 메시지를 작성하는것이 아닌 서버에서 내려주는 에러메시지를 화면에 표기하고 싶습니다.) export type CommonResponse<T = unknown> = { code: string; isSuccess: boolean; message: string; result: T; };