세션 종료

코드 작성하고 실행 시켰는데 세션이 다운됐어요. 왜 이런걸까요??
코랩 자체에서 무료 제공하는 리소스를 모두 소진한 줄 알았는데, 다른 문제들에 대해서는 아직 잘 돌아갑니다.
제가 작성한 코드도 같이 올려둘게요!
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
38
2
강의 내용 관련 질문드립니다~
0
35
2
수강 연장 문의
0
33
1
강의자료 일괄 다운로드
0
43
2
수강기간 연장 문의드립니다
0
29
1
list 문제 질문드립니다~
0
31
2
빅분기 실기 12회 재도전
0
40
1
강의 기간 연장 가능여부 검토 요청건
0
30
1
수강기간 연장 문의 드립니다
0
36
2
수강기간 연장 문의드립니다
0
47
2
질문이요
0
51
2
수강기간 연장 문의드립니다.
0
50
2
문제 3-2 질문드립니다
0
44
2
수강기간 연장 문의 드립니다.
0
58
2
변수, 칼럼 , df 구분
0
50
2
수강기간 연장 문의드립니다.
0
50
2
수강기간 연장 문의
0
48
2
수강기간 연장 문의드립니다.
0
42
2
수강기한 연장 문의
0
80
2
수강기간 연장 문의드립니다
0
57
2
결정트리에서 적절한 깊이 선택 후 시각화 과정에서 학습 데이터만 사용하는 이유
0
45
2
수강기간 연장 문의드립니다.
0
71
2
수강연장 문의
0
77
2
수강연장문의
0
53
2





