{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "from yaml import load\n",
    "from yaml import CLoader as Loader\n",
    "from sklearn.preprocessing import OneHotEncoder\n",
    "\n",
    "import os, sys\n",
    "os.chdir('/home/phyto/Abil/')  # Provide your path here\n",
    "\n",
    "sys.path.insert(0, './abil/')\n",
    "from abil.tune import tune"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Setting up a regressor model\n",
    "with open('./examples/configuration/2-phase.yml', 'r') as f:\n",
    "    model_config = load(f, Loader=Loader)\n",
    "\n",
    "predictors = model_config['predictors']\n",
    "#read your target + environmental data:\n",
    "d = pd.read_csv(model_config['local_root'] + model_config['training'])\n",
    "target =  \"Emiliania huxleyi\"\n",
    "\n",
    "\n",
    "#in this example we introduce pseudo-absences:\n",
    "d[target] = d[target].fillna(0)\n",
    "d = upsample(d, target, ratio=10)\n",
    "\n",
    "#drop any missing values:\n",
    "d = d.dropna(subset=[target])\n",
    "d = d.dropna(subset=predictors)\n",
    "\n",
    "#here we randomly sample data to speed up training:\n",
    "d = d.sample(1000)\n",
    "\n",
    "X_train = d[predictors]\n",
    "y = d[target]\n",
    "\n",
    "m = tune(X_train, y, model_config)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "training classifier\n",
      "Fitting 3 folds for each of 16 candidates, totalling 48 fits\n",
      "exported model to:/home/phyto/Abil/examples/ModelOutput/rf/model/Emiliania huxleyi_clf.sav\n",
      "exported scoring to: /home/phyto/Abil/examples/ModelOutput/rf/scoring/Emiliania huxleyi_clf.sav\n",
      "[0.64985402 0.61787879 0.71212121]\n",
      "clf balanced accuracy 0.66\n",
      "execution time: 7.152557373046875e-07 seconds\n"
     ]
    }
   ],
   "source": [
    "'''\n",
    "1-phase RF classifier\n",
    "'''\n",
    "m.train(model=\"rf\", classifier=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "training regressor\n",
      "{'R2': 'r2', 'MAE': 'neg_mean_absolute_error', 'RMSE': 'neg_root_mean_squared_error', 'tau': make_scorer(tau_scoring), 'tau_p': make_scorer(tau_scoring_p)}\n",
      "{'regressor__estimator__n_estimators': [100], 'regressor__estimator__max_features': [4], 'regressor__estimator__max_depth': [50], 'regressor__estimator__min_samples_leaf': [0.5, 1], 'regressor__estimator__max_samples': [0.5, 1]}\n",
      "Fitting 3 folds for each of 4 candidates, totalling 12 fits\n",
      "exported model to: /home/phyto/Abil/examples/ModelOutput/rf/model/Emiliania huxleyi_reg.sav\n",
      "exported scoring to: /home/phyto/Abil/examples/ModelOutput/rf/scoring/Emiliania huxleyi_reg.sav\n",
      "reg rRMSE: 751%\n",
      "reg rMAE: 184%\n",
      "reg R2: -0.12\n",
      "reg tau: nan\n",
      "execution time: 4.76837158203125e-07 seconds\n"
     ]
    }
   ],
   "source": [
    "'''\n",
    "1-phase RF regressor\n",
    "'''\n",
    "m.train(model=\"rf\", regressor=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "training classifier\n",
      "Fitting 3 folds for each of 16 candidates, totalling 48 fits\n",
      "exported model to:/home/phyto/Abil/examples/ModelOutput/rf/model/Emiliania huxleyi_clf.sav\n",
      "exported scoring to: /home/phyto/Abil/examples/ModelOutput/rf/scoring/Emiliania huxleyi_clf.sav\n",
      "[0.56732617 0.63793103 0.63793103]\n",
      "clf balanced accuracy 0.61\n",
      "training regressor\n",
      "{'R2': 'r2', 'MAE': 'neg_mean_absolute_error', 'RMSE': 'neg_root_mean_squared_error', 'tau': make_scorer(tau_scoring), 'tau_p': make_scorer(tau_scoring_p)}\n",
      "{'regressor__estimator__n_estimators': [100], 'regressor__estimator__max_features': [4], 'regressor__estimator__max_depth': [50], 'regressor__estimator__min_samples_leaf': [0.5, 1], 'regressor__estimator__max_samples': [0.5, 1]}\n",
      "Fitting 3 folds for each of 4 candidates, totalling 12 fits\n",
      "exported model to: /home/phyto/Abil/examples/ModelOutput/rf/model/Emiliania huxleyi_reg.sav\n",
      "exported scoring to: /home/phyto/Abil/examples/ModelOutput/rf/scoring/Emiliania huxleyi_reg.sav\n",
      "reg rRMSE: 2585%\n",
      "reg rMAE: 1611%\n",
      "reg R2: -1.79\n",
      "reg tau: nan\n",
      "training zero-inflated regressor\n",
      "exported model to: /home/phyto/Abil/examples/ModelOutput/rf/model/Emiliania huxleyi_zir.sav\n",
      "exported scoring to: /home/phyto/Abil/examples/ModelOutput/rf/scoring/Emiliania huxleyi_zir.sav\n",
      "zir rRMSE: 689%\n",
      "zir rMAE: 102%\n",
      "zir R2: -0.32\n",
      "execution time: 7.152557373046875e-07 seconds\n"
     ]
    }
   ],
   "source": [
    "'''\n",
    "2-phase RF regressor\n",
    "'''\n",
    "m.train(model=\"rf\", classifier=True, regressor=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "training classifier\n",
      "Fitting 3 folds for each of 1 candidates, totalling 3 fits\n",
      "exported model to:/home/phyto/Abil/examples/ModelOutput/knn/model/Emiliania huxleyi_clf.sav\n",
      "exported scoring to: /home/phyto/Abil/examples/ModelOutput/knn/scoring/Emiliania huxleyi_clf.sav\n",
      "[0.51724138 0.5        0.5       ]\n",
      "clf balanced accuracy 0.51\n",
      "execution time: 9.5367431640625e-07 seconds\n"
     ]
    }
   ],
   "source": [
    "'''\n",
    "1-phase KNN classifier\n",
    "'''\n",
    "m.train(model=\"knn\", classifier=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "training regressor\n",
      "{'R2': 'r2', 'MAE': 'neg_mean_absolute_error', 'RMSE': 'neg_root_mean_squared_error', 'tau': make_scorer(tau_scoring), 'tau_p': make_scorer(tau_scoring_p)}\n",
      "{'regressor__estimator__max_samples': [0.2], 'regressor__estimator__max_features': [0.2], 'regressor__estimator__estimator__leaf_size': [25], 'regressor__estimator__estimator__n_neighbors': [5]}\n",
      "Fitting 3 folds for each of 1 candidates, totalling 3 fits\n",
      "exported model to: /home/phyto/Abil/examples/ModelOutput/knn/model/Emiliania huxleyi_reg.sav\n",
      "exported scoring to: /home/phyto/Abil/examples/ModelOutput/knn/scoring/Emiliania huxleyi_reg.sav\n",
      "reg rRMSE: 743%\n",
      "reg rMAE: 172%\n",
      "reg R2: -0.45\n",
      "reg tau: 0.15\n",
      "execution time: 7.152557373046875e-07 seconds\n"
     ]
    }
   ],
   "source": [
    "'''\n",
    "1-phase KNN regressor\n",
    "'''\n",
    "m.train(model=\"knn\", regressor=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "training classifier\n",
      "Fitting 3 folds for each of 1 candidates, totalling 3 fits\n",
      "exported model to:/home/phyto/Abil/examples/ModelOutput/knn/model/Emiliania huxleyi_clf.sav\n",
      "exported scoring to: /home/phyto/Abil/examples/ModelOutput/knn/scoring/Emiliania huxleyi_clf.sav\n",
      "[0.51724138 0.5        0.5       ]\n",
      "clf balanced accuracy 0.51\n",
      "training regressor\n",
      "{'R2': 'r2', 'MAE': 'neg_mean_absolute_error', 'RMSE': 'neg_root_mean_squared_error', 'tau': make_scorer(tau_scoring), 'tau_p': make_scorer(tau_scoring_p)}\n",
      "{'regressor__estimator__max_samples': [0.2], 'regressor__estimator__max_features': [0.2], 'regressor__estimator__estimator__leaf_size': [25], 'regressor__estimator__estimator__n_neighbors': [5]}\n",
      "Fitting 3 folds for each of 1 candidates, totalling 3 fits\n",
      "exported model to: /home/phyto/Abil/examples/ModelOutput/knn/model/Emiliania huxleyi_reg.sav\n",
      "exported scoring to: /home/phyto/Abil/examples/ModelOutput/knn/scoring/Emiliania huxleyi_reg.sav\n",
      "reg rRMSE: 2229%\n",
      "reg rMAE: 1306%\n",
      "reg R2: -0.39\n",
      "reg tau: 0.2\n",
      "training zero-inflated regressor\n",
      "exported model to: /home/phyto/Abil/examples/ModelOutput/knn/model/Emiliania huxleyi_zir.sav\n",
      "all predictions are zero (!)\n",
      "regressor has also not been fitted (!)\n",
      "all predictions are zero (!)\n",
      "regressor has also not been fitted (!)\n",
      "exported scoring to: /home/phyto/Abil/examples/ModelOutput/knn/scoring/Emiliania huxleyi_zir.sav\n",
      "rRMSE NA\n",
      "rRMSE NA\n",
      "zir R2: nan\n",
      "execution time: 9.5367431640625e-07 seconds\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/home/phyto/anaconda3/envs/my-geopandas-env-2/lib/python3.11/site-packages/sklearn/model_selection/_validation.py:425: FitFailedWarning: \n",
      "1 fits failed out of a total of 3.\n",
      "The score on these train-test partitions for these parameters will be set to nan.\n",
      "If these failures are not expected, you can try to debug them by setting error_score='raise'.\n",
      "\n",
      "Below are more details about the failures:\n",
      "--------------------------------------------------------------------------------\n",
      "1 fits failed with the following error:\n",
      "joblib.externals.loky.process_executor._RemoteTraceback: \n",
      "\"\"\"\n",
      "Traceback (most recent call last):\n",
      "  File \"/home/phyto/Abil/abil/functions.py\", line 145, in fit\n",
      "    check_is_fitted(self.regressor)\n",
      "  File \"/home/phyto/anaconda3/envs/my-geopandas-env-2/lib/python3.11/site-packages/sklearn/utils/validation.py\", line 1462, in check_is_fitted\n",
      "    raise NotFittedError(msg % {\"name\": type(estimator).__name__})\n",
      "sklearn.exceptions.NotFittedError: This TransformedTargetRegressor instance is not fitted yet. Call 'fit' with appropriate arguments before using this estimator.\n",
      "\n",
      "During handling of the above exception, another exception occurred:\n",
      "\n",
      "Traceback (most recent call last):\n",
      "  File \"/home/phyto/anaconda3/envs/my-geopandas-env-2/lib/python3.11/site-packages/joblib/_parallel_backends.py\", line 273, in _wrap_func_call\n",
      "    return func()\n",
      "           ^^^^^^\n",
      "  File \"/home/phyto/anaconda3/envs/my-geopandas-env-2/lib/python3.11/site-packages/joblib/parallel.py\", line 588, in __call__\n",
      "    return [func(*args, **kwargs)\n",
      "           ^^^^^^^^^^^^^^^^^^^^^^\n",
      "  File \"/home/phyto/anaconda3/envs/my-geopandas-env-2/lib/python3.11/site-packages/joblib/parallel.py\", line 588, in <listcomp>\n",
      "    return [func(*args, **kwargs)\n",
      "            ^^^^^^^^^^^^^^^^^^^^^\n",
      "  File \"/home/phyto/anaconda3/envs/my-geopandas-env-2/lib/python3.11/site-packages/sklearn/utils/parallel.py\", line 127, in __call__\n",
      "    return self.function(*args, **kwargs)\n",
      "           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n",
      "  File \"/home/phyto/anaconda3/envs/my-geopandas-env-2/lib/python3.11/site-packages/sklearn/ensemble/_bagging.py\", line 144, in _parallel_build_estimators\n",
      "    estimator_fit(X_, y[indices])\n",
      "  File \"/home/phyto/anaconda3/envs/my-geopandas-env-2/lib/python3.11/site-packages/sklearn/base.py\", line 1151, in wrapper\n",
      "    return fit_method(estimator, *args, **kwargs)\n",
      "           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n",
      "  File \"/home/phyto/anaconda3/envs/my-geopandas-env-2/lib/python3.11/site-packages/sklearn/neighbors/_regression.py\", line 218, in fit\n",
      "    return self._fit(X, y)\n",
      "           ^^^^^^^^^^^^^^^\n",
      "  File \"/home/phyto/anaconda3/envs/my-geopandas-env-2/lib/python3.11/site-packages/sklearn/neighbors/_base.py\", line 456, in _fit\n",
      "    X, y = self._validate_data(\n",
      "           ^^^^^^^^^^^^^^^^^^^^\n",
      "  File \"/home/phyto/anaconda3/envs/my-geopandas-env-2/lib/python3.11/site-packages/sklearn/base.py\", line 621, in _validate_data\n",
      "    X, y = check_X_y(X, y, **check_params)\n",
      "           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n",
      "  File \"/home/phyto/anaconda3/envs/my-geopandas-env-2/lib/python3.11/site-packages/sklearn/utils/validation.py\", line 1147, in check_X_y\n",
      "    X = check_array(\n",
      "        ^^^^^^^^^^^^\n",
      "  File \"/home/phyto/anaconda3/envs/my-geopandas-env-2/lib/python3.11/site-packages/sklearn/utils/validation.py\", line 969, in check_array\n",
      "    raise ValueError(\n",
      "ValueError: Found array with 0 sample(s) (shape=(0, 1)) while a minimum of 1 is required by KNeighborsRegressor.\n",
      "\"\"\"\n",
      "\n",
      "The above exception was the direct cause of the following exception:\n",
      "\n",
      "Traceback (most recent call last):\n",
      "  File \"/home/phyto/anaconda3/envs/my-geopandas-env-2/lib/python3.11/site-packages/sklearn/model_selection/_validation.py\", line 732, in _fit_and_score\n",
      "    estimator.fit(X_train, y_train, **fit_params)\n",
      "  File \"/home/phyto/Abil/abil/functions.py\", line 151, in fit\n",
      "    self.regressor_.fit(\n",
      "  File \"/home/phyto/anaconda3/envs/my-geopandas-env-2/lib/python3.11/site-packages/sklearn/base.py\", line 1151, in wrapper\n",
      "    return fit_method(estimator, *args, **kwargs)\n",
      "           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n",
      "  File \"/home/phyto/anaconda3/envs/my-geopandas-env-2/lib/python3.11/site-packages/sklearn/compose/_target.py\", line 267, in fit\n",
      "    self.regressor_.fit(X, y_trans, **fit_params)\n",
      "  File \"/home/phyto/anaconda3/envs/my-geopandas-env-2/lib/python3.11/site-packages/sklearn/base.py\", line 1151, in wrapper\n",
      "    return fit_method(estimator, *args, **kwargs)\n",
      "           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n",
      "  File \"/home/phyto/anaconda3/envs/my-geopandas-env-2/lib/python3.11/site-packages/sklearn/pipeline.py\", line 420, in fit\n",
      "    self._final_estimator.fit(Xt, y, **fit_params_last_step)\n",
      "  File \"/home/phyto/anaconda3/envs/my-geopandas-env-2/lib/python3.11/site-packages/sklearn/base.py\", line 1151, in wrapper\n",
      "    return fit_method(estimator, *args, **kwargs)\n",
      "           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n",
      "  File \"/home/phyto/anaconda3/envs/my-geopandas-env-2/lib/python3.11/site-packages/sklearn/ensemble/_bagging.py\", line 338, in fit\n",
      "    return self._fit(X, y, self.max_samples, sample_weight=sample_weight)\n",
      "           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n",
      "  File \"/home/phyto/anaconda3/envs/my-geopandas-env-2/lib/python3.11/site-packages/sklearn/ensemble/_bagging.py\", line 473, in _fit\n",
      "    all_results = Parallel(\n",
      "                  ^^^^^^^^^\n",
      "  File \"/home/phyto/anaconda3/envs/my-geopandas-env-2/lib/python3.11/site-packages/sklearn/utils/parallel.py\", line 65, in __call__\n",
      "    return super().__call__(iterable_with_config)\n",
      "           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n",
      "  File \"/home/phyto/anaconda3/envs/my-geopandas-env-2/lib/python3.11/site-packages/joblib/parallel.py\", line 1944, in __call__\n",
      "    return output if self.return_generator else list(output)\n",
      "                                                ^^^^^^^^^^^^\n",
      "  File \"/home/phyto/anaconda3/envs/my-geopandas-env-2/lib/python3.11/site-packages/joblib/parallel.py\", line 1587, in _get_outputs\n",
      "    yield from self._retrieve()\n",
      "  File \"/home/phyto/anaconda3/envs/my-geopandas-env-2/lib/python3.11/site-packages/joblib/parallel.py\", line 1691, in _retrieve\n",
      "    self._raise_error_fast()\n",
      "  File \"/home/phyto/anaconda3/envs/my-geopandas-env-2/lib/python3.11/site-packages/joblib/parallel.py\", line 1726, in _raise_error_fast\n",
      "    error_job.get_result(self.timeout)\n",
      "  File \"/home/phyto/anaconda3/envs/my-geopandas-env-2/lib/python3.11/site-packages/joblib/parallel.py\", line 735, in get_result\n",
      "    return self._return_or_raise()\n",
      "           ^^^^^^^^^^^^^^^^^^^^^^^\n",
      "  File \"/home/phyto/anaconda3/envs/my-geopandas-env-2/lib/python3.11/site-packages/joblib/parallel.py\", line 753, in _return_or_raise\n",
      "    raise self._result\n",
      "ValueError: Found array with 0 sample(s) (shape=(0, 1)) while a minimum of 1 is required by KNeighborsRegressor.\n",
      "\n",
      "  warnings.warn(some_fits_failed_message, FitFailedWarning)\n"
     ]
    }
   ],
   "source": [
    "'''\n",
    "2-phase KNN regressor\n",
    "'''\n",
    "m.train(model=\"knn\", classifier=True, regressor=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "training classifier\n",
      "Fitting 3 folds for each of 1 candidates, totalling 3 fits\n",
      "exported model to:/home/phyto/Abil/examples/ModelOutput/xgb/model/Emiliania huxleyi_clf.sav\n",
      "exported scoring to: /home/phyto/Abil/examples/ModelOutput/xgb/scoring/Emiliania huxleyi_clf.sav\n",
      "[0.5 0.5 0.5]\n",
      "clf balanced accuracy 0.5\n",
      "execution time: 4.76837158203125e-07 seconds\n"
     ]
    }
   ],
   "source": [
    "'''\n",
    "1-phase XGB classifier\n",
    "'''\n",
    "m.train(model=\"xgb\", classifier=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "training regressor\n",
      "{'R2': 'r2', 'MAE': 'neg_mean_absolute_error', 'RMSE': 'neg_root_mean_squared_error', 'tau': make_scorer(tau_scoring), 'tau_p': make_scorer(tau_scoring_p)}\n",
      "{'regressor__estimator__learning_rate': [0.05], 'regressor__estimator__n_estimators': [100], 'regressor__estimator__max_depth': [7], 'regressor__estimator__subsample': [0.8], 'regressor__estimator__colsample_bytree': [0.5], 'regressor__estimator__gamma': [1], 'regressor__estimator__reg_alpha': [0.1]}\n",
      "Fitting 3 folds for each of 1 candidates, totalling 3 fits\n",
      "exported model to: /home/phyto/Abil/examples/ModelOutput/xgb/model/Emiliania huxleyi_reg.sav\n",
      "exported scoring to: /home/phyto/Abil/examples/ModelOutput/xgb/scoring/Emiliania huxleyi_reg.sav\n",
      "reg rRMSE: 738%\n",
      "reg rMAE: 100%\n",
      "reg R2: 0.02\n",
      "reg tau: 0.16\n",
      "execution time: 9.5367431640625e-07 seconds\n"
     ]
    }
   ],
   "source": [
    "'''\n",
    "1-phase XGB regressor\n",
    "'''\n",
    "m.train(model=\"xgb\", regressor=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "training classifier\n",
      "Fitting 3 folds for each of 1 candidates, totalling 3 fits\n",
      "exported model to:/home/phyto/Abil/examples/ModelOutput/xgb/model/Emiliania huxleyi_clf.sav\n",
      "exported scoring to: /home/phyto/Abil/examples/ModelOutput/xgb/scoring/Emiliania huxleyi_clf.sav\n",
      "[0.5 0.5 0.5]\n",
      "clf balanced accuracy 0.5\n",
      "training regressor\n",
      "{'R2': 'r2', 'MAE': 'neg_mean_absolute_error', 'RMSE': 'neg_root_mean_squared_error', 'tau': make_scorer(tau_scoring), 'tau_p': make_scorer(tau_scoring_p)}\n",
      "{'regressor__estimator__learning_rate': [0.05], 'regressor__estimator__n_estimators': [100], 'regressor__estimator__max_depth': [7], 'regressor__estimator__subsample': [0.8], 'regressor__estimator__colsample_bytree': [0.5], 'regressor__estimator__gamma': [1], 'regressor__estimator__reg_alpha': [0.1]}\n",
      "Fitting 3 folds for each of 1 candidates, totalling 3 fits\n",
      "exported model to: /home/phyto/Abil/examples/ModelOutput/xgb/model/Emiliania huxleyi_reg.sav\n",
      "exported scoring to: /home/phyto/Abil/examples/ModelOutput/xgb/scoring/Emiliania huxleyi_reg.sav\n",
      "reg rRMSE: 2432%\n",
      "reg rMAE: 1088%\n",
      "reg R2: -0.13\n",
      "reg tau: 0.3\n",
      "training zero-inflated regressor\n",
      "exported model to: /home/phyto/Abil/examples/ModelOutput/xgb/model/Emiliania huxleyi_zir.sav\n",
      "all predictions are zero (!)\n",
      "regressor has also not been fitted (!)\n",
      "all predictions are zero (!)\n",
      "regressor has also not been fitted (!)\n",
      "exported scoring to: /home/phyto/Abil/examples/ModelOutput/xgb/scoring/Emiliania huxleyi_zir.sav\n",
      "zir rRMSE: 746%\n",
      "zir rMAE: 100%\n",
      "zir R2: -0.02\n",
      "execution time: 4.76837158203125e-07 seconds\n"
     ]
    }
   ],
   "source": [
    "'''\n",
    "2-phase XGB regressor\n",
    "'''\n",
    "m.train(model=\"xgb\", classifier=True, regressor=True)"
   ]
  }
 ],
 "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"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
