{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "from yaml import load, Loader\n",
    "import os, sys\n",
    "os.chdir('/home/phyto/Abil/')  # Provide your path here\n",
    "sys.path.insert(0, './abil/')\n",
    "from post import post"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "with open('./examples/configuration/regressor.yml', 'r') as f:\n",
    "    model_config = load(f, Loader=Loader)\n",
    "\n",
    "model_config['hpc']==False\n",
    "\n",
    "predictors = model_config['predictors']\n",
    "d = pd.read_csv(\"./examples/data/training.csv\")\n",
    "d.dropna(subset='FID', inplace=True)\n",
    "X_train = d[predictors]\n",
    "X_predict = pd.read_csv(\"./examples/data/prediction.csv\")\n",
    "X_predict.set_index([\"time\", \"depth\", \"lat\", \"lon\"], inplace=True)\n",
    "X_predict = X_predict[X_train.columns]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "\n",
    "m = post(model_config)\n",
    "m.merge_performance(model=\"ens\")\n",
    "m.merge_performance(model=\"xgb\", configuration= \"reg\")\n",
    "m.merge_performance(model=\"rf\", configuration= \"reg\")\n",
    "m.merge_performance(model=\"knn\", configuration= \"reg\")\n",
    "\n",
    "m.merge_parameters(model=\"rf\")\n",
    "m.merge_parameters(model=\"xgb\")\n",
    "m.merge_parameters(model=\"knn\")\n",
    "\n",
    "m.total()\n",
    "\n",
    "m.merge_env(X_predict)\n",
    "\n",
    "m.export_ds(\"19_oct\")\n",
    "m.export_csv(\"19_oct\")\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "my-geopandas-env-2",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.4"
  },
  "orig_nbformat": 4
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
