Skip to content

Commit

Permalink
Merge branch 'release/v0.1.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
maks-sh committed May 2, 2020
2 parents 7854df2 + fd17ee2 commit 9e4baa6
Show file tree
Hide file tree
Showing 10 changed files with 309 additions and 228 deletions.
17 changes: 17 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,23 @@
* 🔨 something that previously didn’t work as documentated – or according to reasonable expectations – should now work.
* ❗️ you will need to change your code to have the same effect in the future; or a feature will be removed in the future.

## Version 0.1.2

### [sklift.models](https://scikit-uplift.readthedocs.io/en/latest/api/models.html)

* 🔨 Fix bugs in [TwoModels](https://scikit-uplift.readthedocs.io/en/latest/api/models.html#sklift.models.models.TwoModels) for regression problem.
* 📝 Minor code refactoring.

### [sklift.metrics](https://scikit-uplift.readthedocs.io/en/latest/api/metrics.html)

* 📝 Minor code refactoring.

### [sklift.viz](https://scikit-uplift.readthedocs.io/en/latest/api/viz.html)

* 💥 Add bar plot in [plot_uplift_by_percentile](https://scikit-uplift.readthedocs.io/en/latest/api/viz.html#sklift.viz.base.plot_uplift_by_percentile) by [@ElisovaIra](https://github.com/ElisovaIra).
* 🔨 Fix bug in [plot_uplift_by_percentile](https://scikit-uplift.readthedocs.io/en/latest/api/viz.html#sklift.viz.base.plot_uplift_by_percentile).
* 📝 Minor code refactoring.

## Version 0.1.1

### [sklift.viz](https://scikit-uplift.readthedocs.io/en/latest/api/viz.html)
Expand Down
11 changes: 7 additions & 4 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def get_version():
# -- Project information -----------------------------------------------------

project = 'scikit-uplift'
author = 'Maksim Shevchenko'
author = 'Maksim Shevchenko and Contributors'
copyright = "{}, {}".format(datetime.datetime.now().year, author)

# The full version, including alpha/beta/rc tags
Expand All @@ -46,8 +46,11 @@ def get_version():
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
"sphinx.ext.autodoc", "sphinx.ext.viewcode", "sphinx.ext.mathjax", "sphinx.ext.napoleon",
"recommonmark"
"sphinx.ext.autodoc",
"sphinx.ext.viewcode",
"sphinx.ext.mathjax",
"sphinx.ext.napoleon",
"recommonmark",
]

master_doc = 'index'
Expand All @@ -58,7 +61,7 @@ def get_version():
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', 'Readme.rst']


# -- Options for HTML output -------------------------------------------------
Expand Down
71 changes: 38 additions & 33 deletions notebooks/RetailHero.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@
"execution_count": 1,
"metadata": {
"ExecuteTime": {
"end_time": "2020-04-28T09:24:37.492036Z",
"start_time": "2020-04-28T09:24:37.488584Z"
"end_time": "2020-05-02T17:07:22.372375Z",
"start_time": "2020-05-02T17:07:22.368436Z"
},
"colab": {
"base_uri": "https://localhost:8080/",
Expand All @@ -126,7 +126,7 @@
"urllib.request.urlretrieve(url, '/content/retail_hero.zip')\n",
"\n",
"!unzip /content/retail_hero.zip\n",
"!pip install scikit-uplift==0.1.1 catboost=0.22"
"!pip install scikit-uplift==0.1.2 catboost=0.22"
]
},
{
Expand All @@ -144,8 +144,8 @@
"execution_count": 2,
"metadata": {
"ExecuteTime": {
"end_time": "2020-04-28T09:24:40.783897Z",
"start_time": "2020-04-28T09:24:37.503470Z"
"end_time": "2020-05-02T17:07:25.384054Z",
"start_time": "2020-05-02T17:07:22.383222Z"
},
"colab": {},
"colab_type": "code",
Expand Down Expand Up @@ -196,8 +196,8 @@
"execution_count": 3,
"metadata": {
"ExecuteTime": {
"end_time": "2020-04-28T09:24:42.100096Z",
"start_time": "2020-04-28T09:24:40.786498Z"
"end_time": "2020-05-02T17:07:26.483716Z",
"start_time": "2020-05-02T17:07:25.386480Z"
},
"colab": {},
"colab_type": "code",
Expand Down Expand Up @@ -251,8 +251,8 @@
"execution_count": 4,
"metadata": {
"ExecuteTime": {
"end_time": "2020-04-28T09:24:44.483576Z",
"start_time": "2020-04-28T09:24:42.102707Z"
"end_time": "2020-05-02T17:07:28.491581Z",
"start_time": "2020-05-02T17:07:26.486312Z"
},
"colab": {
"base_uri": "https://localhost:8080/",
Expand Down Expand Up @@ -313,8 +313,8 @@
"execution_count": 5,
"metadata": {
"ExecuteTime": {
"end_time": "2020-04-28T09:24:44.511016Z",
"start_time": "2020-04-28T09:24:44.486035Z"
"end_time": "2020-05-02T17:07:28.514717Z",
"start_time": "2020-05-02T17:07:28.494500Z"
},
"colab": {
"base_uri": "https://localhost:8080/",
Expand Down Expand Up @@ -484,8 +484,8 @@
"execution_count": 6,
"metadata": {
"ExecuteTime": {
"end_time": "2020-04-28T09:24:45.715602Z",
"start_time": "2020-04-28T09:24:44.514353Z"
"end_time": "2020-05-02T17:07:29.570605Z",
"start_time": "2020-05-02T17:07:28.518362Z"
},
"colab": {
"base_uri": "https://localhost:8080/",
Expand Down Expand Up @@ -545,8 +545,8 @@
"execution_count": 7,
"metadata": {
"ExecuteTime": {
"end_time": "2020-04-28T09:24:47.941480Z",
"start_time": "2020-04-28T09:24:45.719641Z"
"end_time": "2020-05-02T17:07:31.489869Z",
"start_time": "2020-05-02T17:07:29.572733Z"
},
"colab": {
"base_uri": "https://localhost:8080/",
Expand Down Expand Up @@ -632,8 +632,8 @@
"execution_count": 8,
"metadata": {
"ExecuteTime": {
"end_time": "2020-04-28T09:24:50.571779Z",
"start_time": "2020-04-28T09:24:47.944822Z"
"end_time": "2020-05-02T17:07:33.865281Z",
"start_time": "2020-05-02T17:07:31.494251Z"
},
"colab": {
"base_uri": "https://localhost:8080/",
Expand Down Expand Up @@ -694,8 +694,8 @@
"execution_count": 9,
"metadata": {
"ExecuteTime": {
"end_time": "2020-04-28T09:24:52.942803Z",
"start_time": "2020-04-28T09:24:50.576741Z"
"end_time": "2020-05-02T17:07:36.709646Z",
"start_time": "2020-05-02T17:07:33.871512Z"
},
"colab": {
"base_uri": "https://localhost:8080/",
Expand Down Expand Up @@ -758,8 +758,8 @@
"execution_count": 10,
"metadata": {
"ExecuteTime": {
"end_time": "2020-04-28T09:24:52.964396Z",
"start_time": "2020-04-28T09:24:52.945544Z"
"end_time": "2020-05-02T17:07:36.726223Z",
"start_time": "2020-05-02T17:07:36.712564Z"
},
"colab": {
"base_uri": "https://localhost:8080/",
Expand Down Expand Up @@ -858,8 +858,8 @@
"execution_count": 11,
"metadata": {
"ExecuteTime": {
"end_time": "2020-04-28T09:24:56.505700Z",
"start_time": "2020-04-28T09:24:53.019392Z"
"end_time": "2020-05-02T17:07:39.436995Z",
"start_time": "2020-05-02T17:07:36.729508Z"
},
"colab": {
"base_uri": "https://localhost:8080/",
Expand All @@ -874,7 +874,7 @@
"name": "stderr",
"output_type": "stream",
"text": [
"/Users/Maksim/Library/Python/3.6/lib/python/site-packages/ipykernel_launcher.py:2: UserWarning: It is recommended to use this approach on treatment balanced data. Current sample size is unbalanced.\n",
"/Users/Maksim/Library/Python/3.6/lib/python/site-packages/ipykernel_launcher.py:6: UserWarning: It is recommended to use this approach on treatment balanced data. Current sample size is unbalanced.\n",
" \n"
]
},
Expand All @@ -891,10 +891,15 @@
}
],
"source": [
"cm_full = ClassTransformation(CatBoostClassifier(iterations=20, thread_count=2, random_state=42, silent=True))\n",
"cm_full = cm_full.fit(X_train_full, y_train_full, treat_train_full, estimator_fit_params={'cat_features': [1]})\n",
"ct_full = ClassTransformation(CatBoostClassifier(iterations=20, thread_count=2, random_state=42, silent=True))\n",
"ct_full = ct_full.fit(\n",
" X_train_full, \n",
" y_train_full, \n",
" treat_train_full, \n",
" estimator_fit_params={'cat_features': cat_features}\n",
")\n",
"\n",
"X_test.loc[:, 'uplift'] = cm_full.predict(X_test.values)\n",
"X_test.loc[:, 'uplift'] = ct_full.predict(X_test.values)\n",
"\n",
"sub = X_test[['uplift']].to_csv('sub1.csv')\n",
"\n",
Expand All @@ -906,8 +911,8 @@
"execution_count": 12,
"metadata": {
"ExecuteTime": {
"end_time": "2020-04-28T09:24:56.560018Z",
"start_time": "2020-04-28T09:24:56.508541Z"
"end_time": "2020-05-02T17:07:39.478855Z",
"start_time": "2020-05-02T17:07:39.440546Z"
},
"colab": {
"base_uri": "https://localhost:8080/",
Expand Down Expand Up @@ -988,12 +993,12 @@
}
],
"source": [
"cm_full_fi = pd.DataFrame({\n",
" 'feature_name': cm_full.estimator.feature_names_,\n",
" 'feature_score': cm_full.estimator.feature_importances_\n",
"ct_full_fi = pd.DataFrame({\n",
" 'feature_name': ct_full.estimator.feature_names_,\n",
" 'feature_score': ct_full.estimator.feature_importances_\n",
"}).sort_values('feature_score', ascending=False).reset_index(drop=True)\n",
"\n",
"cm_full_fi"
"ct_full_fi"
]
},
{
Expand Down
Loading

0 comments on commit 9e4baa6

Please sign in to comment.