세션 종료

코드 작성하고 실행 시켰는데 세션이 다운됐어요. 왜 이런걸까요??
코랩 자체에서 무료 제공하는 리소스를 모두 소진한 줄 알았는데, 다른 문제들에 대해서는 아직 잘 돌아갑니다.
제가 작성한 코드도 같이 올려둘게요!
import pandas as pd
from sklearn.ensemble import RandomForestRegressor
from sklearn.model_selection import train_test_split
from sklearn.metrics import mean_squared_error
df1 = pd.read_csv('/content/drive/MyDrive/bigdata(빅분기 놀이터)/작업형2 모의문제/모의문제 2번/train.csv')
# print(df1.head())
# print(df1.info())
# print(df1.shape)
df2 = pd.read_csv('/content/drive/MyDrive/bigdata(빅분기 놀이터)/작업형2 모의문제/모의문제 2번/test.csv')
# print(df2.head())
# print(df2.info())
# print(df2.shape)
df1['name'] = df1['name'].fillna(df1['name'].mode()[0])
df1['host_name'] = df1['host_name'].fillna(df1['name'].mode()[0])
df1['last_review'] = df1['last_review'].fillna(df1['name'].mode()[0])
df1['reviews_per_month'] = df1['reviews_per_month'].fillna(df1['reviews_per_month'].median())
df2['name'] = df2['name'].fillna(df2['name'].mode()[0])
df2['host_name'] = df2['host_name'].fillna(df2['name'].mode()[0])
df2['last_review'] = df2['last_review'].fillna(df2['name'].mode()[0])
df2['reviews_per_month'] = df2['reviews_per_month'].fillna(df2['reviews_per_month'].median())
x = df1.drop('price', axis=1)
y = df1['price']
x_encoded = pd.get_dummies(x)
x_train, x_valid, y_train, y_valid = train_test_split(x_encoded.drop('id', axis=1), y, test_size=0.25)
md = RandomForestRegressor(n_estimators=300)
md.fit(x_train, y_train)
pred = md.predict(x_valid)
print(mean_squared_error(y_valid, pred)) # MSE
print(mean_squared_error(y_valid, pred, squared=False)) # RMSE
x_test = df2
x_test_encoded = pd.get_dummies(x_test)
md = RandomForestRegressor(n_estimators=300)
md.fit(x_encoded.drop('id', axis=1), y)
pred = md.predict_proba(x_test_encoded.drop('id', axis=1))
print(pred)
print(pred.shape)
result = pd.DataFrame({'id' : df2['id'], 'price' : pred })
result.to_csv('작업형2 모의문제 2번.csv', index=False)
답변 1
수강 연장 문의드립니다.
0
20
2
강의 연장 문의
0
29
2
수강 신청 연장 문의드립니다.
0
36
2
작업형 1번문제... 환경관련
0
30
2
12회 기출은 언제 업데이트 될까요??
0
37
2
8/6 작성한 연장문의 질문글에 대한 재요청
0
38
2
수강기간 연장 문의
0
39
2
수강기간 연장문의
0
37
2
수강기간 연장 요청 문의드립니다
0
38
2
수강 기간 연장 문의
0
47
2
수강연장 가능 문의 (기간 약 한달반)
0
60
2
수강기간 연장 가능할까요 선생님
0
74
2
Section15. 수업에 사용하는 데이터 주소가 다 보이지 않아서 실습을 위한 데이터를 다운 받지 못하고 있습니다.
0
56
3
수강연장요청 문의
0
90
2
아무래도 다음 시험 연장은 어렵겠죠?
0
109
2
빅분기 12회 결과 관련 문의
0
112
1
책이랑 강의랑 순서나 예제가 다른것 같네요
0
81
2
수강연장 문의
0
106
2
재검토 요청 방법 좀 알려주셔요...-.-;;
0
106
2
12회 실기 질문(작업형 2)
0
92
2
뒤로가기 버튼 같은 것이 있나요?
0
66
1
강의 연장 문의
0
99
2
출력값 질문
0
73
2
수업노트가 어디에 있나요?
0
63
1





