{ "cells": [ { "cell_type": "code", "execution_count": 64, "id": "a94c4760-bcad-4c09-83e7-e5391b059b59", "metadata": {}, "outputs": [], "source": [ "import json\n", "import requests\n", "from misc import nearest_mrt\n", "import pickle\n", "import os\n", "import pandas as pd\n", "import datetime\n", "from datetime import datetime" ] }, { "cell_type": "code", "execution_count": 5, "id": "dfd76296-5048-433b-a29a-cc073dd9d814", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "loaded model\n" ] } ], "source": [ "filename = 'finalized_model2.sav'\n", "\n", "if os.path.exists(\"./finalized_model2.sav\"):\n", " model = pickle.load(open(filename, 'rb'))\n", " print('loaded model')\n", "else:\n", " print('failed loading model')" ] }, { "cell_type": "code", "execution_count": 8, "id": "361df0d9-1659-42ac-9dca-8cdde2ac3a15", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
Pipeline(steps=[('columntransformer',\n", " ColumnTransformer(transformers=[('standardscaler',\n", " StandardScaler(),\n", " ['distance_mrt',\n", " 'age_transation',\n", " 'transaction_yr', 'Postal',\n", " 'storey_height']),\n", " ('pipeline',\n", " Pipeline(steps=[('onehotencoder',\n", " OneHotEncoder(handle_unknown='ignore',\n", " sparse_output=False))]),\n", " ['town', 'flat_num'])])),\n", " ('xgbregressor',\n", " XGBRegressor(base_scor...\n", " feature_types=None, gamma=1, grow_policy=None,\n", " importance_type=None,\n", " interaction_constraints=None, learning_rate=None,\n", " max_bin=None, max_cat_threshold=None,\n", " max_cat_to_onehot=None, max_delta_step=None,\n", " max_depth=7, max_leaves=None,\n", " min_child_weight=None, missing=nan,\n", " monotone_constraints=None, multi_strategy=None,\n", " n_estimators=None, n_jobs=None,\n", " num_parallel_tree=None, random_state=None, ...))])In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
Pipeline(steps=[('columntransformer',\n", " ColumnTransformer(transformers=[('standardscaler',\n", " StandardScaler(),\n", " ['distance_mrt',\n", " 'age_transation',\n", " 'transaction_yr', 'Postal',\n", " 'storey_height']),\n", " ('pipeline',\n", " Pipeline(steps=[('onehotencoder',\n", " OneHotEncoder(handle_unknown='ignore',\n", " sparse_output=False))]),\n", " ['town', 'flat_num'])])),\n", " ('xgbregressor',\n", " XGBRegressor(base_scor...\n", " feature_types=None, gamma=1, grow_policy=None,\n", " importance_type=None,\n", " interaction_constraints=None, learning_rate=None,\n", " max_bin=None, max_cat_threshold=None,\n", " max_cat_to_onehot=None, max_delta_step=None,\n", " max_depth=7, max_leaves=None,\n", " min_child_weight=None, missing=nan,\n", " monotone_constraints=None, multi_strategy=None,\n", " n_estimators=None, n_jobs=None,\n", " num_parallel_tree=None, random_state=None, ...))])
ColumnTransformer(transformers=[('standardscaler', StandardScaler(),\n", " ['distance_mrt', 'age_transation',\n", " 'transaction_yr', 'Postal',\n", " 'storey_height']),\n", " ('pipeline',\n", " Pipeline(steps=[('onehotencoder',\n", " OneHotEncoder(handle_unknown='ignore',\n", " sparse_output=False))]),\n", " ['town', 'flat_num'])])
['distance_mrt', 'age_transation', 'transaction_yr', 'Postal', 'storey_height']
StandardScaler()
['town', 'flat_num']
OneHotEncoder(handle_unknown='ignore', sparse_output=False)
XGBRegressor(base_score=None, booster=None, callbacks=None,\n", " colsample_bylevel=None, colsample_bynode=None,\n", " colsample_bytree=None, device=None, early_stopping_rounds=None,\n", " enable_categorical=False, eval_metric=None, feature_types=None,\n", " gamma=1, grow_policy=None, importance_type=None,\n", " interaction_constraints=None, learning_rate=None, max_bin=None,\n", " max_cat_threshold=None, max_cat_to_onehot=None,\n", " max_delta_step=None, max_depth=7, max_leaves=None,\n", " min_child_weight=None, missing=nan, monotone_constraints=None,\n", " multi_strategy=None, n_estimators=None, n_jobs=None,\n", " num_parallel_tree=None, random_state=None, ...)
\n", " | transaction | \n", "area | \n", "storey_height | \n", "resale_price | \n", "
---|---|---|---|---|
0 | \n", "2023-04 | \n", "114.0 | \n", "07 TO 09 | \n", "510000 | \n", "
1 | \n", "2022-06 | \n", "132.0 | \n", "10 TO 12 | \n", "585000 | \n", "
2 | \n", "2022-12 | \n", "109.0 | \n", "01 TO 03 | \n", "470000 | \n", "
3 | \n", "2021-03 | \n", "121.0 | \n", "07 TO 09 | \n", "455000 | \n", "
4 | \n", "2020-02 | \n", "109.0 | \n", "07 TO 09 | \n", "329000 | \n", "
5 | \n", "2019-05 | \n", "114.0 | \n", "04 TO 06 | \n", "330000 | \n", "
6 | \n", "2017-09 | \n", "109.0 | \n", "10 TO 12 | \n", "355000 | \n", "