Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,8 +1,43 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
-
import pandas as pd
|
| 3 |
-
import numpy
|
| 4 |
import joblib
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
Home, Eda, App, Predictions = st.tabs(['Home', 'Eda', 'App', 'Predictions'])
|
| 8 |
|
|
@@ -72,16 +107,23 @@ with App:
|
|
| 72 |
@st.cache_data
|
| 73 |
def fetch_data():
|
| 74 |
df = pd.read_csv('loan_approval_dataset.csv')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
|
| 76 |
df = fetch_data()
|
| 77 |
-
income_annum = st.slider('income_annum', 0
|
| 78 |
-
loan_amount = st.slider('loan_amount', 0
|
| 79 |
loan_term = st.slider('loan_term', 2, 24)
|
| 80 |
cibil_score = st.slider('age', 0,900)
|
| 81 |
-
residential_assets_value = st.slider('residential_assets_value', 0
|
| 82 |
-
commercial_assets_value = st.slider('commercial_assets_value',0
|
| 83 |
-
luxury_assets_value = st.slider('luxury_assets_value',0
|
| 84 |
-
bank_asset_value = st.slider('bank_asset_value',0
|
| 85 |
education = st.selectbox('education',[' Not Graduate', ' Graduate'])
|
| 86 |
data = {
|
| 87 |
' income_annum': income_annum,
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
+
import pandas as pd
|
|
|
|
| 3 |
import joblib
|
| 4 |
+
import numpy as np
|
| 5 |
+
import matplotlib.pyplot as plt
|
| 6 |
+
import matplotlib as mpl
|
| 7 |
+
import seaborn as sns
|
| 8 |
|
| 9 |
+
from feature_engine.outliers import Winsorizer
|
| 10 |
+
from sklearn.impute import SimpleImputer
|
| 11 |
+
from sklearn.pipeline import Pipeline
|
| 12 |
+
from sklearn.decomposition import PCA
|
| 13 |
+
from sklearn.compose import ColumnTransformer
|
| 14 |
+
from sklearn.cluster import KMeans
|
| 15 |
+
from sklearn.metrics import silhouette_score
|
| 16 |
+
from sklearn.metrics import silhouette_samples
|
| 17 |
+
import matplotlib.cm as cm
|
| 18 |
+
from dataprep.eda import plot, plot_correlation, plot_missing, create_db_report, create_report
|
| 19 |
+
from sklearn.model_selection import train_test_split
|
| 20 |
+
from sklearn.preprocessing import StandardScaler, OneHotEncoder, OrdinalEncoder
|
| 21 |
+
from sklearn.linear_model import LogisticRegression
|
| 22 |
+
from sklearn.svm import SVC
|
| 23 |
+
from sklearn.tree import DecisionTreeClassifier
|
| 24 |
+
from sklearn.ensemble import RandomForestClassifier
|
| 25 |
+
from sklearn.model_selection import GridSearchCV, cross_val_score
|
| 26 |
+
from sklearn.metrics import classification_report
|
| 27 |
+
from sklearn.neighbors import KNeighborsClassifier
|
| 28 |
+
from sklearn.naive_bayes import GaussianNB
|
| 29 |
+
from sklearn.feature_selection import SelectKBest
|
| 30 |
+
from sklearn.metrics import accuracy_score
|
| 31 |
+
from sklearn.metrics import precision_score
|
| 32 |
+
from sklearn.metrics import f1_score
|
| 33 |
+
from sklearn.metrics import recall_score
|
| 34 |
+
from sklearn.model_selection import RandomizedSearchCV
|
| 35 |
+
from sklearn.metrics import confusion_matrix
|
| 36 |
+
from sklearn.metrics import ConfusionMatrixDisplay
|
| 37 |
+
from imblearn.over_sampling import SMOTENC
|
| 38 |
+
|
| 39 |
+
import warnings
|
| 40 |
+
warnings.filterwarnings(action='ignore')
|
| 41 |
|
| 42 |
Home, Eda, App, Predictions = st.tabs(['Home', 'Eda', 'App', 'Predictions'])
|
| 43 |
|
|
|
|
| 107 |
@st.cache_data
|
| 108 |
def fetch_data():
|
| 109 |
df = pd.read_csv('loan_approval_dataset.csv')
|
| 110 |
+
df[' income_annum'] = df[' income_annum'] / 82.08
|
| 111 |
+
df[' loan_amount'] = df[' loan_amount'] / 82.08
|
| 112 |
+
df[' residential_assets_value'] = df[' residential_assets_value'] / 82.08
|
| 113 |
+
df[' commercial_assets_value'] = df[' commercial_assets_value'] / 82.08
|
| 114 |
+
df[' luxury_assets_value'] = df[' luxury_assets_value'] / 82.08
|
| 115 |
+
df[' bank_asset_value'] = df[' bank_asset_value'] / 82.08
|
| 116 |
+
return df
|
| 117 |
|
| 118 |
df = fetch_data()
|
| 119 |
+
income_annum = st.slider('income_annum', 0,9999999)
|
| 120 |
+
loan_amount = st.slider('loan_amount', 0,9999999)
|
| 121 |
loan_term = st.slider('loan_term', 2, 24)
|
| 122 |
cibil_score = st.slider('age', 0,900)
|
| 123 |
+
residential_assets_value = st.slider('residential_assets_value', 0, 9999999)
|
| 124 |
+
commercial_assets_value = st.slider('commercial_assets_value',0,9999999)
|
| 125 |
+
luxury_assets_value = st.slider('luxury_assets_value',0,9999999)
|
| 126 |
+
bank_asset_value = st.slider('bank_asset_value',0,9999999)
|
| 127 |
education = st.selectbox('education',[' Not Graduate', ' Graduate'])
|
| 128 |
data = {
|
| 129 |
' income_annum': income_annum,
|