HardWorkingStation commited on
Commit
940c1fc
1 Parent(s): 1cb94a2

Initial commit

Browse files
Files changed (4) hide show
  1. .github/workflows/main.yml +7 -4
  2. README.md +6 -4
  3. src/app.py +2 -4
  4. src/tools.py +3 -10
.github/workflows/main.yml CHANGED
@@ -2,8 +2,9 @@ name: Sync to Hugging Face hub
2
  on:
3
  push:
4
  branches: [main]
5
-
6
- # to run this workflow manually from the Actions tab
 
7
  workflow_dispatch:
8
 
9
  jobs:
@@ -16,6 +17,8 @@ jobs:
16
  with:
17
  filesizelimit: 10485760 # this is 10MB so we can sync to HF Spaces
18
 
 
 
19
  sync-to-hub:
20
  runs-on: ubuntu-latest
21
  steps:
@@ -25,5 +28,5 @@ jobs:
25
  - name: Push to hub
26
  env:
27
  HF_TOKEN: ${{ secrets.HF_TOKEN }}
28
- run: git push --force https://HF_USERNAME:$HF_TOKEN@huggingface.co/spaces/versus666/uplift_lab main && git push https://HF_USERNAME:$HF_TOKEN@huggingface.co/spaces/versus666/uplift_lab main
29
- needs: check_files
 
2
  on:
3
  push:
4
  branches: [main]
5
+ pull_request:
6
+ branches: [main]
7
+ # to run this workflow manually from the Actions tab
8
  workflow_dispatch:
9
 
10
  jobs:
 
17
  with:
18
  filesizelimit: 10485760 # this is 10MB so we can sync to HF Spaces
19
 
20
+
21
+
22
  sync-to-hub:
23
  runs-on: ubuntu-latest
24
  steps:
 
28
  - name: Push to hub
29
  env:
30
  HF_TOKEN: ${{ secrets.HF_TOKEN }}
31
+ run: git push --force https://HF_USERNAME:$HF_TOKEN@huggingface.co/spaces/versus666/uplift_lab main
32
+ needs: check_files
README.md CHANGED
@@ -1,8 +1,10 @@
 
 
1
  ---
2
- title: Uplift
3
- emoji: 👀
4
- colorFrom: pink
5
- colorTo: yellow
6
  sdk: streamlit
7
  sdk_version: 1.10.0
8
  app_file: src/app.py
 
1
+
2
+
3
  ---
4
+ title: Uplift lab
5
+ emoji: 🚀
6
+ colorFrom: blue
7
+ colorTo: green
8
  sdk: streamlit
9
  sdk_version: 1.10.0
10
  app_file: src/app.py
src/app.py CHANGED
@@ -1,11 +1,9 @@
1
- import catboost
2
  import pandas as pd
3
- import os
4
  from sklift.metrics import uplift_at_k, uplift_by_percentile, qini_auc_score, qini_curve, uplift_curve
5
  from sklift.viz import plot_qini_curve, plot_uplift_curve
6
- from sklift.models import SoloModel, TwoModels, ClassTransformation
7
  import streamlit as st
8
- import catboost
9
 
10
  import tools
11
 
 
 
1
  import pandas as pd
2
+
3
  from sklift.metrics import uplift_at_k, uplift_by_percentile, qini_auc_score, qini_curve, uplift_curve
4
  from sklift.viz import plot_qini_curve, plot_uplift_curve
5
+
6
  import streamlit as st
 
7
 
8
  import tools
9
 
src/tools.py CHANGED
@@ -1,16 +1,9 @@
1
- from typing import Any
2
-
3
  import pandas as pd
4
- import numpy as np
5
  from sklearn.model_selection import train_test_split
6
  from sklift.datasets import fetch_hillstrom
7
- from sklift.metrics import uplift_at_k, uplift_by_percentile, weighted_average_uplift
8
- from sklift.viz import plot_uplift_by_percentile
9
- from catboost import CatBoostClassifier
10
- import sklearn
11
  import streamlit as st
12
  import plotly.express as px
13
- import plotly.graph_objects as go
14
 
15
 
16
  def test():
@@ -18,7 +11,7 @@ def test():
18
 
19
 
20
  @st.experimental_memo
21
- def get_data() -> tuple[Any, Any, Any]:
22
  # получаем датасет
23
  dataset = fetch_hillstrom(target_col='visit')
24
  dataset, target, treatment = dataset['data'], dataset['target'], dataset['treatment']
@@ -34,7 +27,7 @@ def get_data() -> tuple[Any, Any, Any]:
34
 
35
 
36
  @st.experimental_memo
37
- def data_split(data: pd.DataFrame, treatment: pd.DataFrame, target: pd.DataFrame) -> tuple[Any, Any, Any, Any, Any, Any]:
38
  # склеиваем threatment и target для дальнейшей стратификации по ним
39
  stratify_cols = pd.concat([treatment, target], axis=1)
40
  # сплитим датасет
 
 
 
1
  import pandas as pd
 
2
  from sklearn.model_selection import train_test_split
3
  from sklift.datasets import fetch_hillstrom
4
+ from sklift.metrics import weighted_average_uplift
 
 
 
5
  import streamlit as st
6
  import plotly.express as px
 
7
 
8
 
9
  def test():
 
11
 
12
 
13
  @st.experimental_memo
14
+ def get_data():
15
  # получаем датасет
16
  dataset = fetch_hillstrom(target_col='visit')
17
  dataset, target, treatment = dataset['data'], dataset['target'], dataset['treatment']
 
27
 
28
 
29
  @st.experimental_memo
30
+ def data_split(data: pd.DataFrame, treatment: pd.DataFrame, target: pd.DataFrame):
31
  # склеиваем threatment и target для дальнейшей стратификации по ним
32
  stratify_cols = pd.concat([treatment, target], axis=1)
33
  # сплитим датасет