Skip to content

Commit

Permalink
added correct inheritance to RandomForestWSAA_LGBM.predict
Browse files Browse the repository at this point in the history
  • Loading branch information
kaiguender committed Apr 6, 2023
1 parent 15ff269 commit 77fba88
Show file tree
Hide file tree
Showing 19 changed files with 58 additions and 86 deletions.
2 changes: 1 addition & 1 deletion .ipynb_checkpoints/settings-checkpoint.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
### Python library ###
repo = dddex
lib_name = %(repo)s
version = 0.0.18
version = 0.0.22
min_python = 3.7
license = apache2

Expand Down
31 changes: 11 additions & 20 deletions _proc/03_wSAA.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,7 @@
"metadata": {
"language": "python"
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"The autoreload extension is already loaded. To reload it, use:\n",
" %reload_ext autoreload\n"
]
}
],
"outputs": [],
"source": []
},
{
Expand Down Expand Up @@ -81,7 +72,7 @@
"text/markdown": [
"---\n",
"\n",
"[source](https://github.com/kaiguender/dddex/blob/main/dddex/wSAA.py#L23){target=\"_blank\" style=\"float:right; font-size:smaller\"}\n",
"[source](https://github.com/kaiguender/dddex/blob/main/dddex/wSAA.py#L24){target=\"_blank\" style=\"float:right; font-size:smaller\"}\n",
"\n",
"### RandomForestWSAA\n",
"\n",
Expand Down Expand Up @@ -128,7 +119,7 @@
"text/plain": [
"---\n",
"\n",
"[source](https://github.com/kaiguender/dddex/blob/main/dddex/wSAA.py#L23){target=\"_blank\" style=\"float:right; font-size:smaller\"}\n",
"[source](https://github.com/kaiguender/dddex/blob/main/dddex/wSAA.py#L24){target=\"_blank\" style=\"float:right; font-size:smaller\"}\n",
"\n",
"### RandomForestWSAA\n",
"\n",
Expand Down Expand Up @@ -238,7 +229,7 @@
"text/markdown": [
"---\n",
"\n",
"[source](https://github.com/kaiguender/dddex/blob/main/dddex/wSAA.py#L113){target=\"_blank\" style=\"float:right; font-size:smaller\"}\n",
"[source](https://github.com/kaiguender/dddex/blob/main/dddex/wSAA.py#L114){target=\"_blank\" style=\"float:right; font-size:smaller\"}\n",
"\n",
"### RandomForestWSAA_LGBM\n",
"\n",
Expand All @@ -263,7 +254,7 @@
"text/plain": [
"---\n",
"\n",
"[source](https://github.com/kaiguender/dddex/blob/main/dddex/wSAA.py#L113){target=\"_blank\" style=\"float:right; font-size:smaller\"}\n",
"[source](https://github.com/kaiguender/dddex/blob/main/dddex/wSAA.py#L114){target=\"_blank\" style=\"float:right; font-size:smaller\"}\n",
"\n",
"### RandomForestWSAA_LGBM\n",
"\n",
Expand Down Expand Up @@ -315,7 +306,7 @@
"text/markdown": [
"---\n",
"\n",
"[source](https://github.com/kaiguender/dddex/blob/main/dddex/wSAA.py#L203){target=\"_blank\" style=\"float:right; font-size:smaller\"}\n",
"[source](https://github.com/kaiguender/dddex/blob/main/dddex/wSAA.py#L204){target=\"_blank\" style=\"float:right; font-size:smaller\"}\n",
"\n",
"### SampleAverageApproximation\n",
"\n",
Expand All @@ -327,7 +318,7 @@
"text/plain": [
"---\n",
"\n",
"[source](https://github.com/kaiguender/dddex/blob/main/dddex/wSAA.py#L203){target=\"_blank\" style=\"float:right; font-size:smaller\"}\n",
"[source](https://github.com/kaiguender/dddex/blob/main/dddex/wSAA.py#L204){target=\"_blank\" style=\"float:right; font-size:smaller\"}\n",
"\n",
"### SampleAverageApproximation\n",
"\n",
Expand Down Expand Up @@ -448,16 +439,16 @@
"# n_estimators = 10,\n",
"# n_jobs = 1,\n",
"# boosting_type = 'rf',\n",
"# subsample_freq = 0,\n",
"# subsample = 1)"
"# subsample_freq = 1,\n",
"# subsample = 0.9)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "python3",
"display_name": "dddex",
"language": "python",
"name": "python3"
"name": "dddex"
}
},
"nbformat": 4,
Expand Down
6 changes: 3 additions & 3 deletions conda/dddex/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package:
name: dddex
version: 0.0.20
version: 0.0.22
source:
sha256: c869ddd31bf525b2870ea2189eebfaeedb1b1d89812cfbbe14172522bffb9d8d
url: https://files.pythonhosted.org/packages/af/5e/d09093dcf3d4668c78a13f446584763a3a8c2fef77a7033ac4e662aa39a9/dddex-0.0.20.tar.gz
sha256: 759e3ae5c6d12c2aefa286e84d6ff623d80b8a3de31ea4d3c27e94dad66b9b61
url: https://files.pythonhosted.org/packages/9a/c3/6f95fdd11a54f6e82dfaec9d1bdd952e832fe852b97a0228a42704a620f5/dddex-0.0.22.tar.gz
about:
description: "dddex: Data-Driven Density Estimation x\n================\n\n<!--\
\ WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->\n\n## Install\n\n```\
Expand Down
2 changes: 1 addition & 1 deletion conda/out/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,6 @@ <h3><a href="rss.xml">RSS Feed</a>&nbsp;&nbsp;&nbsp;<a href="channeldata.json">c
<th class="tight">linux-64</th><th class="tight">noarch</th> <th>Summary</th>
</tr>
</table>
<address>Updated: 2023-03-27 17:34:50 +0000 - Files: 0</address>
<address>Updated: 2023-04-06 23:03:38 +0000 - Files: 0</address>
</body>
</html>
2 changes: 1 addition & 1 deletion conda/out/linux-64/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,6 @@ <h2>out/linux-64</h2>
<td>56be0331bc34198bc13979c50d4ffb9a1ff97c287af6c769227ee736291b3ab2</td>
<td>bade2f88b3685cbb93aa4b5f34d36659</td>
</tr> </table>
<address>Updated: 2023-03-27 17:34:50 +0000 - Files: 0</address>
<address>Updated: 2023-04-06 23:03:38 +0000 - Files: 0</address>
</body>
</html>
2 changes: 1 addition & 1 deletion conda/out/noarch/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,6 @@ <h2>out/noarch</h2>
<td>32d48c11b6d5ee61a54a9076f8c06a62ba795f69b671db3e44b1301fa0efae0e</td>
<td>1ecb5b301b9a2ba831f0a68a7ace5f00</td>
</tr> </table>
<address>Updated: 2023-03-27 17:34:50 +0000 - Files: 0</address>
<address>Updated: 2023-04-06 23:03:38 +0000 - Files: 0</address>
</body>
</html>
Binary file modified dddex/__pycache__/__init__.cpython-38.pyc
Binary file not shown.
Binary file modified dddex/__pycache__/_modidx.cpython-38.pyc
Binary file not shown.
Binary file modified dddex/__pycache__/baseClasses.cpython-38.pyc
Binary file not shown.
Binary file modified dddex/__pycache__/crossValidation.cpython-38.pyc
Binary file not shown.
Binary file modified dddex/__pycache__/levelSetKDEx_multivariate.cpython-38.pyc
Binary file not shown.
Binary file modified dddex/__pycache__/levelSetKDEx_univariate.cpython-38.pyc
Binary file not shown.
Binary file modified dddex/__pycache__/loadData.cpython-38.pyc
Binary file not shown.
Binary file modified dddex/__pycache__/utils.cpython-38.pyc
Binary file not shown.
Binary file modified dddex/__pycache__/wSAA.cpython-38.pyc
Binary file not shown.
7 changes: 4 additions & 3 deletions dddex/wSAA.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from sklearn.ensemble import RandomForestRegressor
from lightgbm import LGBMRegressor
from sklearn.base import MetaEstimatorMixin
from lightgbm.sklearn import LGBMModel
from .baseClasses import BaseWeightsBasedEstimator
from .utils import restructureWeightsDataList

Expand Down Expand Up @@ -184,9 +185,9 @@ def predict(self : BaseWeightsBasedEstimator,

__doc__ = BaseWeightsBasedEstimator.predict.__doc__

return super(MetaEstimatorMixin, self).predict(X = X,
probs = probs,
scalingList = scalingList)
return super(LGBMModel, self).predict(X = X,
probs = probs,
scalingList = scalingList)

#---

Expand Down
62 changes: 26 additions & 36 deletions nbs/.ipynb_checkpoints/03_wSAA-checkpoint.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,10 @@
"cells": [
{
"cell_type": "code",
"execution_count": 42,
"execution_count": 1,
"id": "6a9df2e7-fdc8-44e7-b16c-d8b15ed01db9",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"The autoreload extension is already loaded. To reload it, use:\n",
" %reload_ext autoreload\n"
]
}
],
"outputs": [],
"source": [
"%load_ext autoreload\n",
"%autoreload 2"
Expand All @@ -32,7 +23,7 @@
},
{
"cell_type": "code",
"execution_count": 43,
"execution_count": 2,
"id": "8c687b2c-941e-4e2a-9855-aa227ccb8490",
"metadata": {},
"outputs": [],
Expand All @@ -42,7 +33,7 @@
},
{
"cell_type": "code",
"execution_count": 44,
"execution_count": 3,
"id": "6a1faac0-5c0d-4c70-80e9-7d959811b1b7",
"metadata": {},
"outputs": [],
Expand All @@ -63,7 +54,7 @@
},
{
"cell_type": "code",
"execution_count": 45,
"execution_count": 4,
"id": "b86f92e6-67ad-492b-9779-7b9acfc3d3df",
"metadata": {},
"outputs": [],
Expand All @@ -81,6 +72,7 @@
"from sklearn.ensemble import RandomForestRegressor\n",
"from lightgbm import LGBMRegressor\n",
"from sklearn.base import MetaEstimatorMixin\n",
"from lightgbm.sklearn import LGBMModel\n",
"from dddex.baseClasses import BaseWeightsBasedEstimator\n",
"from dddex.utils import restructureWeightsDataList"
]
Expand All @@ -95,7 +87,7 @@
},
{
"cell_type": "code",
"execution_count": 46,
"execution_count": 5,
"id": "36b775c4-ca57-4539-a0b8-e282bdf963cf",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -193,7 +185,7 @@
},
{
"cell_type": "code",
"execution_count": 47,
"execution_count": 6,
"id": "7db18d0f-bdb7-4f08-a8cf-ac07a49e7d2c",
"metadata": {},
"outputs": [],
Expand All @@ -203,7 +195,7 @@
},
{
"cell_type": "code",
"execution_count": 48,
"execution_count": 7,
"id": "2a240e3b-5acc-4f82-8f4d-29391f5692b7",
"metadata": {},
"outputs": [],
Expand All @@ -213,7 +205,7 @@
},
{
"cell_type": "code",
"execution_count": 49,
"execution_count": 8,
"id": "84ebe067-f51e-4038-ae00-06bafa7ca014",
"metadata": {},
"outputs": [],
Expand All @@ -231,7 +223,7 @@
},
{
"cell_type": "code",
"execution_count": 50,
"execution_count": 9,
"id": "da815ec8",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -312,9 +304,9 @@
" \n",
" __doc__ = BaseWeightsBasedEstimator.predict.__doc__\n",
" \n",
" return super(MetaEstimatorMixin, self).predict(X = X,\n",
" probs = probs, \n",
" scalingList = scalingList)\n",
" return super(LGBMModel, self).predict(X = X,\n",
" probs = probs, \n",
" scalingList = scalingList)\n",
" \n",
" #---\n",
" \n",
Expand All @@ -337,7 +329,7 @@
},
{
"cell_type": "code",
"execution_count": 51,
"execution_count": 10,
"id": "952b21e7-4c15-4c6d-8ebd-236740ec71e5",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -473,7 +465,7 @@
},
{
"cell_type": "code",
"execution_count": 52,
"execution_count": 11,
"id": "6dc67de5-0fcb-47b3-82dd-908cbedaae31",
"metadata": {},
"outputs": [],
Expand All @@ -483,7 +475,7 @@
},
{
"cell_type": "code",
"execution_count": 53,
"execution_count": 12,
"id": "a9520933-6480-4e96-bace-8b9f164cd922",
"metadata": {},
"outputs": [],
Expand All @@ -493,7 +485,7 @@
},
{
"cell_type": "code",
"execution_count": 54,
"execution_count": 13,
"id": "c5e77e0d-5cb8-4c29-b356-0f0e61bccde0",
"metadata": {},
"outputs": [],
Expand All @@ -503,7 +495,7 @@
},
{
"cell_type": "code",
"execution_count": 55,
"execution_count": 14,
"id": "9e79762a-1427-49d7-b8b2-42ecde48e16c",
"metadata": {},
"outputs": [],
Expand All @@ -530,7 +522,7 @@
},
{
"cell_type": "code",
"execution_count": 56,
"execution_count": 15,
"id": "c5f055de-89ce-4943-8242-8f434ee8a3f1",
"metadata": {},
"outputs": [],
Expand All @@ -549,7 +541,7 @@
},
{
"cell_type": "code",
"execution_count": 114,
"execution_count": 16,
"id": "bbcd2880-1b9e-4d07-ab84-4ba8a2bef226",
"metadata": {},
"outputs": [],
Expand All @@ -560,18 +552,16 @@
"# n_estimators = 10,\n",
"# n_jobs = 1,\n",
"# boosting_type = 'rf',\n",
"# subsample_freq = 0,\n",
"# subsample = 1)\n",
"\n",
" "
"# subsample_freq = 1,\n",
"# subsample = 0.9) "
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "dddex",
"language": "python",
"name": "python3"
"name": "dddex"
},
"language_info": {
"codemirror_mode": {
Expand All @@ -583,7 +573,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.6"
"version": "3.8.15"
}
},
"nbformat": 4,
Expand Down
Loading

0 comments on commit 77fba88

Please sign in to comment.