Spaces:
Build error
Build error
refractor: place all code in src
Browse files- src/__main__.py +0 -0
- app.py → src/app.py +5 -5
- src/features/build_features.py +2 -2
- src/models/logistic_model.py +5 -5
- src/models/logistic_predict_model.py +1 -1
- src/models/logistic_test_model.py +1 -1
- src/models/logistic_train_model.py +2 -2
- src/models/util_model_comparison.py +4 -4
- src/models/util_predict_model.py +2 -2
- src/models/util_predict_model_threshold.py +2 -2
- src/models/util_strategy_table.py +2 -2
- src/models/util_test.py +3 -3
- src/models/xgboost_model.py +5 -5
- src/models/xgboost_predict_model.py +1 -1
- src/models/xgboost_test_model.py +1 -1
- src/models/xgboost_train_model.py +4 -4
- src/visualization/graphs_test.py +1 -1
src/__main__.py
ADDED
File without changes
|
app.py → src/app.py
RENAMED
@@ -2,14 +2,14 @@ import streamlit as st
|
|
2 |
from typing import OrderedDict
|
3 |
|
4 |
|
5 |
-
from
|
6 |
|
7 |
-
from
|
8 |
-
from
|
9 |
|
10 |
-
from
|
11 |
|
12 |
-
from
|
13 |
|
14 |
|
15 |
def main():
|
|
|
2 |
from typing import OrderedDict
|
3 |
|
4 |
|
5 |
+
from features.build_features import initialise_data
|
6 |
|
7 |
+
from models.xgboost_model import xgboost_class
|
8 |
+
from models.logistic_model import logistic_class
|
9 |
|
10 |
+
from models.util_model_comparison import model_comparison_view
|
11 |
|
12 |
+
from models.util_strategy_table import strategy_table_view
|
13 |
|
14 |
|
15 |
def main():
|
src/features/build_features.py
CHANGED
@@ -6,14 +6,14 @@ import pandas as pd
|
|
6 |
import streamlit as st
|
7 |
|
8 |
|
9 |
-
from
|
10 |
Dataset,
|
11 |
SplitDataset,
|
12 |
undersample_training_data,
|
13 |
select_predictors,
|
14 |
import_data)
|
15 |
|
16 |
-
from
|
17 |
streamlit_2columns_metrics_df_shape,
|
18 |
streamlit_2columns_metrics_series,
|
19 |
streamlit_2columns_metrics_pct_series,
|
|
|
6 |
import streamlit as st
|
7 |
|
8 |
|
9 |
+
from features.util_build_features import (
|
10 |
Dataset,
|
11 |
SplitDataset,
|
12 |
undersample_training_data,
|
13 |
select_predictors,
|
14 |
import_data)
|
15 |
|
16 |
+
from visualization.metrics import (
|
17 |
streamlit_2columns_metrics_df_shape,
|
18 |
streamlit_2columns_metrics_series,
|
19 |
streamlit_2columns_metrics_pct_series,
|
src/models/logistic_model.py
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
-
from
|
2 |
|
3 |
-
from
|
4 |
-
from
|
5 |
-
from
|
6 |
|
7 |
-
from
|
8 |
|
9 |
|
10 |
def logistic_class(split_dataset: SplitDataset, currency: str) -> ModelClass:
|
|
|
1 |
+
from features.build_features import SplitDataset
|
2 |
|
3 |
+
from models.logistic_train_model import logistic_train_model
|
4 |
+
from models.logistic_predict_model import logistic_predict_model
|
5 |
+
from models.logistic_test_model import logistic_test_model
|
6 |
|
7 |
+
from models.util_model_class import ModelClass
|
8 |
|
9 |
|
10 |
def logistic_class(split_dataset: SplitDataset, currency: str) -> ModelClass:
|
src/models/logistic_predict_model.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
from
|
2 |
|
3 |
logistic_predict_model = make_prediction_view(
|
4 |
"Logistic", "Logisitic Model")
|
|
|
1 |
+
from models.util_predict_model import make_prediction_view
|
2 |
|
3 |
logistic_predict_model = make_prediction_view(
|
4 |
"Logistic", "Logisitic Model")
|
src/models/logistic_test_model.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
from
|
2 |
|
3 |
logistic_test_model = make_tests_view(
|
4 |
"Logistic", "Logistic Model")
|
|
|
1 |
+
from models.util_test import make_tests_view
|
2 |
|
3 |
logistic_test_model = make_tests_view(
|
4 |
"Logistic", "Logistic Model")
|
src/models/logistic_train_model.py
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
|
2 |
import numpy as np
|
3 |
from sklearn.linear_model import LogisticRegression
|
4 |
-
from
|
5 |
import streamlit as st
|
6 |
import pandas as pd
|
7 |
|
8 |
-
from
|
9 |
|
10 |
|
11 |
@st.cache(suppress_st_warning=True)
|
|
|
1 |
|
2 |
import numpy as np
|
3 |
from sklearn.linear_model import LogisticRegression
|
4 |
+
from features.build_features import SplitDataset
|
5 |
import streamlit as st
|
6 |
import pandas as pd
|
7 |
|
8 |
+
from visualization.graphs_logistic import plot_logistic_coeff_barh
|
9 |
|
10 |
|
11 |
@st.cache(suppress_st_warning=True)
|
src/models/util_model_comparison.py
CHANGED
@@ -1,18 +1,18 @@
|
|
1 |
from typing import OrderedDict
|
2 |
import streamlit as st
|
3 |
from sklearn.metrics import roc_auc_score
|
4 |
-
from
|
5 |
-
from
|
6 |
streamlit_chart_setting_height_width
|
7 |
)
|
8 |
|
9 |
-
from
|
10 |
roc_auc_compare_n_models,
|
11 |
calibration_curve_report_commented_n
|
12 |
)
|
13 |
|
14 |
|
15 |
-
from
|
16 |
|
17 |
|
18 |
def roc_auc_for_model(split_dataset: SplitDataset, model_view: ModelClass):
|
|
|
1 |
from typing import OrderedDict
|
2 |
import streamlit as st
|
3 |
from sklearn.metrics import roc_auc_score
|
4 |
+
from features.util_build_features import SplitDataset
|
5 |
+
from visualization.graphs_settings import (
|
6 |
streamlit_chart_setting_height_width
|
7 |
)
|
8 |
|
9 |
+
from visualization.graphs_test import (
|
10 |
roc_auc_compare_n_models,
|
11 |
calibration_curve_report_commented_n
|
12 |
)
|
13 |
|
14 |
|
15 |
+
from models.util_model_class import ModelClass
|
16 |
|
17 |
|
18 |
def roc_auc_for_model(split_dataset: SplitDataset, model_view: ModelClass):
|
src/models/util_predict_model.py
CHANGED
@@ -7,9 +7,9 @@ import pandas as pd
|
|
7 |
from dataclasses import dataclass
|
8 |
|
9 |
from xgboost import XGBClassifier
|
10 |
-
from
|
11 |
|
12 |
-
from
|
13 |
user_defined_probability_threshold,
|
14 |
J_statistic_driven_probability_threshold,
|
15 |
tradeoff_threshold,
|
|
|
7 |
from dataclasses import dataclass
|
8 |
|
9 |
from xgboost import XGBClassifier
|
10 |
+
from features.util_build_features import SplitDataset
|
11 |
|
12 |
+
from models.util_predict_model_threshold import (
|
13 |
user_defined_probability_threshold,
|
14 |
J_statistic_driven_probability_threshold,
|
15 |
tradeoff_threshold,
|
src/models/util_predict_model_threshold.py
CHANGED
@@ -10,9 +10,9 @@ import pandas as pd
|
|
10 |
|
11 |
from numpy import argmax
|
12 |
|
13 |
-
from
|
14 |
|
15 |
-
from
|
16 |
|
17 |
|
18 |
def model_probability_values_df(model, X):
|
|
|
10 |
|
11 |
from numpy import argmax
|
12 |
|
13 |
+
from visualization.metrics import streamlit_2columns_metrics_df, streamlit_2columns_metrics_pct_df
|
14 |
|
15 |
+
from visualization.graphs_threshold import acceptance_rate_driven_threshold_graph
|
16 |
|
17 |
|
18 |
def model_probability_values_df(model, X):
|
src/models/util_strategy_table.py
CHANGED
@@ -2,8 +2,8 @@ from typing import OrderedDict
|
|
2 |
import plotly.express as px
|
3 |
import numpy as np
|
4 |
import streamlit as st
|
5 |
-
from
|
6 |
-
from
|
7 |
|
8 |
|
9 |
def strategy_table_view(
|
|
|
2 |
import plotly.express as px
|
3 |
import numpy as np
|
4 |
import streamlit as st
|
5 |
+
from models.util_test import create_strategyTable_df
|
6 |
+
from models.util_model_class import ModelClass
|
7 |
|
8 |
|
9 |
def strategy_table_view(
|
src/models/util_test.py
CHANGED
@@ -10,13 +10,13 @@ from sklearn.metrics import (
|
|
10 |
from sklearn.linear_model import LogisticRegression
|
11 |
import xgboost as xgb
|
12 |
from xgboost.sklearn import XGBClassifier
|
13 |
-
from
|
14 |
-
"""from
|
15 |
create_cross_validation_df,
|
16 |
cross_validation_scores,
|
17 |
get_df_trueStatus_probabilityDefault_threshStatus_loanAmount,
|
18 |
)"""
|
19 |
-
from
|
20 |
cross_validation_graph,
|
21 |
)
|
22 |
|
|
|
10 |
from sklearn.linear_model import LogisticRegression
|
11 |
import xgboost as xgb
|
12 |
from xgboost.sklearn import XGBClassifier
|
13 |
+
from features.util_build_features import SplitDataset
|
14 |
+
"""from models.model_utils import (
|
15 |
create_cross_validation_df,
|
16 |
cross_validation_scores,
|
17 |
get_df_trueStatus_probabilityDefault_threshStatus_loanAmount,
|
18 |
)"""
|
19 |
+
from visualization.graphs_test import (
|
20 |
cross_validation_graph,
|
21 |
)
|
22 |
|
src/models/xgboost_model.py
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
-
from
|
2 |
|
3 |
-
from
|
4 |
-
from
|
5 |
-
from
|
6 |
|
7 |
-
from
|
8 |
|
9 |
|
10 |
def xgboost_class(split_dataset: SplitDataset, currency: str):
|
|
|
1 |
+
from features.build_features import SplitDataset
|
2 |
|
3 |
+
from models.xgboost_train_model import xgboost_train_model
|
4 |
+
from models.xgboost_predict_model import xgboost_predit_model
|
5 |
+
from models.xgboost_test_model import xgboost_test_model
|
6 |
|
7 |
+
from models.util_model_class import ModelClass
|
8 |
|
9 |
|
10 |
def xgboost_class(split_dataset: SplitDataset, currency: str):
|
src/models/xgboost_predict_model.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
from
|
2 |
|
3 |
xgboost_predit_model = make_prediction_view(
|
4 |
"XGBoost", "Gradient Boosted Tree with XGBoost")
|
|
|
1 |
+
from models.util_predict_model import make_prediction_view
|
2 |
|
3 |
xgboost_predit_model = make_prediction_view(
|
4 |
"XGBoost", "Gradient Boosted Tree with XGBoost")
|
src/models/xgboost_test_model.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
from
|
2 |
|
3 |
xgboost_test_model = make_tests_view(
|
4 |
"XGBoost", "Gradient Boosted Tree with XGBoost")
|
|
|
1 |
+
from models.util_test import make_tests_view
|
2 |
|
3 |
xgboost_test_model = make_tests_view(
|
4 |
"XGBoost", "Gradient Boosted Tree with XGBoost")
|
src/models/xgboost_train_model.py
CHANGED
@@ -2,15 +2,15 @@ import pickle
|
|
2 |
|
3 |
import numpy as np
|
4 |
import xgboost as xgb
|
5 |
-
from
|
6 |
import streamlit as st
|
7 |
|
8 |
-
from
|
9 |
plot_tree_gbt)
|
10 |
|
11 |
-
from
|
12 |
|
13 |
-
from
|
14 |
download_tree_gbt)
|
15 |
|
16 |
|
|
|
2 |
|
3 |
import numpy as np
|
4 |
import xgboost as xgb
|
5 |
+
from features.build_features import SplitDataset
|
6 |
import streamlit as st
|
7 |
|
8 |
+
from visualization.graphs_decision_tree import(plot_importance_gbt,
|
9 |
plot_tree_gbt)
|
10 |
|
11 |
+
from visualization.graphs_settings import streamlit_chart_setting_height_width
|
12 |
|
13 |
+
from visualization.graphs_download import (download_importance_gbt,
|
14 |
download_tree_gbt)
|
15 |
|
16 |
|
src/visualization/graphs_test.py
CHANGED
@@ -4,7 +4,7 @@ from sklearn.metrics import roc_curve
|
|
4 |
|
5 |
from typing import OrderedDict
|
6 |
|
7 |
-
from
|
8 |
|
9 |
from sklearn.calibration import calibration_curve
|
10 |
|
|
|
4 |
|
5 |
from typing import OrderedDict
|
6 |
|
7 |
+
from models.util_model_class import ModelClass
|
8 |
|
9 |
from sklearn.calibration import calibration_curve
|
10 |
|