ErenKontas commited on
Commit
13fd657
·
verified ·
1 Parent(s): 8d54216

Upload 5 files

Browse files
Sigorta.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:488fcba24d1edcaa614b57b8d03c43b970e65215ed766519508b2606ae68e093
3
+ size 4525961
app.py ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pandas as pd
2
+ import numpy as np
3
+ import streamlit as st
4
+ import joblib
5
+
6
+ from sklearn.preprocessing import StandardScaler,OneHotEncoder
7
+ from sklearn.model_selection import train_test_split
8
+ from sklearn.compose import ColumnTransformer
9
+
10
+ df = pd.read_csv('train.csv')
11
+
12
+ x = df.drop(['id', 'Response'], axis=1)
13
+ y = df[['Response']]
14
+
15
+ x_train, x_test, y_train, y_test = train_test_split(x, y, test_size=0.20, random_state=42)
16
+
17
+ preprocessor = ColumnTransformer(
18
+ transformers=[
19
+ ('num', StandardScaler(), ['Age','Driving_License','Region_Code','Previously_Insured','Annual_Premium','Policy_Sales_Channel','Vintage']),
20
+ ('cat', OneHotEncoder(), ['Gender','Vehicle_Age','Vehicle_Damage'])
21
+ ]
22
+ )
23
+
24
+
25
+ # Prediction function
26
+ def mantar_pred(Gender, Age, Driving_License, Region_Code, Previously_Insured, Vehicle_Age, Vehicle_Damage, Annual_Premium, Policy_Sales_Channel, Vintage):
27
+ input_data = pd.DataFrame({
28
+ 'Gender': [Gender],
29
+ 'Age': [Age],
30
+ 'Driving_License': [Driving_License],
31
+ 'Region_Code': [Region_Code],
32
+ 'Previously_Insured': [Previously_Insured],
33
+ 'Vehicle_Age': [Vehicle_Age],
34
+ 'Vehicle_Damage': [Vehicle_Damage],
35
+ 'Annual_Premium': [Annual_Premium],
36
+ 'Policy_Sales_Channel': [Policy_Sales_Channel],
37
+ 'Vintage': [Vintage]
38
+ })
39
+
40
+ input_data_transformed = preprocessor.fit_transform(input_data)
41
+
42
+ model = joblib.load('Sigorta.pkl')
43
+
44
+ prediction = model.predict(input_data_transformed)
45
+ return float(prediction[0])
46
+
47
+ # Streamlit UI
48
+ def main():
49
+ st.title("Sigorta Poliçesi Satış Tahmini")
50
+ st.write("Veri Gir")
51
+
52
+ Gender = st.selectbox('Gender', df['Gender'].unique())
53
+ Age = st.slider('Age', int(df['Age'].min()), int(df['Age'].max()))
54
+ Driving_License = st.selectbox('Driving_License', df['Driving_License'].unique())
55
+ Region_Code = st.selectbox('Region_Code', df['Region_Code'].unique())
56
+ Previously_Insured = st.selectbox('Previously_Insured', df['Previously_Insured'].unique())
57
+ Vehicle_Age = st.selectbox('Vehicle_Age', df['Vehicle_Age'].unique())
58
+ Vehicle_Damage = st.selectbox('Vehicle_Damage', df['Vehicle_Damage'].unique())
59
+ Annual_Premium = st.slider('Annual_Premium', float(df['Annual_Premium'].min()), float(df['Annual_Premium'].max()))
60
+ Policy_Sales_Channel = st.selectbox('Policy_Sales_Channel', df['Policy_Sales_Channel'].unique())
61
+ Vintage = st.slider('Vintage', int(df['Vintage'].min()), int(df['Vintage'].max()))
62
+
63
+ if st.button('Predict'):
64
+ result = mantar_pred(Gender, Age, Driving_License, Region_Code, Previously_Insured, Vehicle_Age, Vehicle_Damage, Annual_Premium, Policy_Sales_Channel, Vintage)
65
+ st.write(f'The predicted result is: {result:.2f}')
66
+
67
+ if __name__ == '__main__':
68
+ main()
derin-renim-classification-ile-sigorta-apraz-sa.ipynb ADDED
The diff for this file is too large to render. See raw diff
 
requirements.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ streamlit
2
+ scikit-learn
3
+ pandas
4
+ tensorflow
scaler.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2673b71eebc72002646253c511278dd0281b194b18bbbb7ecf5141c78b3b878b
3
+ size 1070