Skip to content

Instantly share code, notes, and snippets.

import pandas as pd
import numpy as np
%matplotlib inline
import matplotlib.pyplot as plt
# 파일 업로드 기능 실행
from google.colab import files
uploaded = files.upload()
for fn in uploaded.keys():
@roboreport
roboreport / crawl_news.php
Created March 23, 2019 07:51
crawl_news.php
<?php
echo "\nstock cron start".date("Ymd")."\n";
$start=1;
$display=20;
$total=20;
$newname = "news.txt";
$line = "";
for($start=1;$start <=$total; $start=$start+$display)
%matplotlib inline
import matplotlib.pyplot as plt
Y_pred = lm.predict(X_test)
plt.scatter(Y_test, Y_pred)
plt.xlabel("Price Index: $Y_i$")
plt.ylabel("Predicted price Index: $\hat{Y}_i$")
plt.title("Prices vs Predicted price Index: $Y_i$ vs $\hat{Y}_i$")
X_Cols = X_train.rename(columns= {'region_cd': '지역코드(시도)', 'year': '연도', 'month':'월', 'building_type': '부동산타입',
'tradeprice_sido' : '매매가격지수(시도)', 'construction_realized_amount' : '건설기성액(백만원)', "cd": "cd(91일물)",
'spirit_deposit_rate': '정기예금금리', 'exchange_rate': '환율', 'composite_stock_price_index': '종합주가지수',
'economy_growth': '경제성장률','exchequer_bond_three' : '국고채3년','household_loan_all': '가계대출액(전국)',
'mortgage_all' : '주택대출액(전국)', 'numberofnosells':'미분양 가구수(시도)','unsalenum_c':'공사완료후 미분양(민간,시도)' })
print(X_train.columns)
coefs = pd.DataFrame(zip(X_Cols.columns,lm.coef_), columns = ['features', 'coefficients'])
from sklearn.linear_model import LinearRegression
lm = LinearRegression(fit_intercept=True, normalize=True, n_jobs=None)
lm.fit(X_train, Y_train)
accuracy = lm.score(X_test, Y_test)
print "Linear Regression test file accuracy:"+str(accuracy)
lm.coef_