Prajwal3009 commited on
Commit
73f4503
·
verified ·
1 Parent(s): fbc2095

Upload 6 files

Browse files
Files changed (6) hide show
  1. Lasso Regression.pkl +3 -0
  2. feedbacko.csv +2 -0
  3. feedbacko.py +28 -0
  4. gross_premimum.py +178 -0
  5. insurance(R).csv +0 -0
  6. insurance.csv +0 -0
Lasso Regression.pkl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b07b1d5479f558ac9a6494f837b04309561a988ab3bb93c8b39f37e5b9bb4099
3
+ size 129
feedbacko.csv ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ timestamp,briefit,feedbacko
2
+ 2024-01-15 14:15:13,5,super
feedbacko.py ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import pandas as pd
3
+ from datetime import datetime
4
+ def run_feedback():
5
+ df = pd.read_csv('feedbacko.csv')
6
+ st.title('Feedback Form')
7
+ brief = st.slider('Rate your experience ⭐️', min_value=1, max_value=5, value=3)
8
+ feedback_text = st.text_area('Provide additional comments or feedback:')
9
+
10
+ if st.button('Submit Feedback'):
11
+ # Check if 'feedbacko' is empty and replace it with None
12
+ feedback_text = None if not feedback_text else feedback_text
13
+
14
+ timestamp = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
15
+
16
+ new_data = {
17
+ 'timestamp': timestamp,
18
+ 'briefit': brief,
19
+ 'feedbacko': feedback_text
20
+ }
21
+ new_df = pd.DataFrame([new_data])
22
+ combined_df = pd.concat([df, new_df], ignore_index=True, axis=0)
23
+ combined_df = combined_df.drop_duplicates(subset=['feedbacko'])
24
+ combined_df = combined_df.dropna(subset=['briefit'])
25
+ combined_df.to_csv('feedbacko.csv', index=False)
26
+ st.success('Thank You for your feedback')
27
+
28
+
gross_premimum.py ADDED
@@ -0,0 +1,178 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python
2
+ # coding: utf-8
3
+
4
+ # In[145]:
5
+
6
+
7
+ from sklearn.ensemble import ExtraTreesRegressor
8
+ from sklearn.model_selection import train_test_split
9
+ from sklearn.preprocessing import StandardScaler
10
+ from sklearn.pipeline import Pipeline
11
+ from sklearn.compose import ColumnTransformer
12
+ from sklearn.preprocessing import LabelEncoder
13
+ import pandas as pd
14
+
15
+
16
+ # In[146]:
17
+
18
+
19
+ data = pd.read_csv('insurance.csv')
20
+ data_new = data.copy(deep = True)
21
+
22
+
23
+ # In[147]:
24
+
25
+
26
+ data.head()
27
+
28
+
29
+ # In[148]:
30
+
31
+
32
+ data.isnull().sum()
33
+
34
+
35
+ # In[149]:
36
+
37
+
38
+ data.dropna(inplace = True)
39
+
40
+
41
+ # In[150]:
42
+
43
+
44
+ X = data.drop('gross_premium', axis = 1)
45
+ y = data['gross_premium']
46
+
47
+
48
+ # In[151]:
49
+
50
+
51
+ import re
52
+
53
+ obj_columns = list(data.select_dtypes("object").columns)
54
+ obj_columns
55
+
56
+
57
+ # In[152]:
58
+
59
+
60
+ import re
61
+
62
+ for col in obj_columns:
63
+ data[col] = data[col].astype("str")
64
+ data[col] = data[col].apply(lambda x: re.sub(r'[^a-zA-Z0-9]', '', x.lower())).astype("str")
65
+
66
+
67
+ # In[153]:
68
+
69
+
70
+ season_catogory = list(data.season.values)
71
+ scheme_catogory = list(data.scheme.values)
72
+ state_catogory = list(data.state_name.values)
73
+ district_catogory = list(data.district_name.values)
74
+
75
+
76
+ # In[154]:
77
+
78
+
79
+ columns = ['season','scheme','state_name','district_name']
80
+ from sklearn.preprocessing import LabelEncoder
81
+ encoder = LabelEncoder()
82
+ for col in columns:
83
+ data[col] = encoder.fit_transform(data[col])
84
+
85
+
86
+ # In[155]:
87
+
88
+
89
+ season_label = list(data.season.values)
90
+ scheme_label = list(data.scheme.values)
91
+ state_label = list(data.state_name.values)
92
+ district_label = list(data.district_name.values)
93
+
94
+
95
+ # In[156]:
96
+
97
+
98
+ season_category_label_dict = dict(zip(season_catogory, season_label))
99
+
100
+ scheme_category_label_dict = dict(zip(scheme_catogory, scheme_label))
101
+
102
+ state_category_label_dict = dict(zip(state_catogory, state_label))
103
+
104
+ district_category_label_dict = dict(zip(district_catogory, district_label))
105
+
106
+
107
+ # In[157]:
108
+
109
+
110
+
111
+ # In[163]:
112
+
113
+
114
+ # X = data.iloc[:,:-1]
115
+ # y = data.iloc[:,-1]
116
+
117
+
118
+ # In[164]:
119
+
120
+
121
+ # X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)
122
+
123
+
124
+ # # In[165]:
125
+
126
+
127
+ # from sklearn.linear_model import LinearRegression
128
+
129
+
130
+ # In[166]:
131
+
132
+
133
+ # model = LinearRegression()
134
+
135
+
136
+ # # In[167]:
137
+
138
+
139
+ # model.fit(X, y)
140
+
141
+
142
+ # In[168]:
143
+
144
+
145
+ # import pickle as pk
146
+ # filename= 'crop_grosspremimum_Jp.pkl'
147
+ # pk.dump(model,open(filename,'wb'))
148
+
149
+
150
+ # In[169]:
151
+
152
+
153
+ def encoding(input_data):
154
+ input_data[0] = season_category_label_dict[input_data[0].lower().replace(" ","").replace(" ","").replace(" ","").replace(" ","")]
155
+ input_data[1] = scheme_category_label_dict[input_data[1].lower().replace(" ","").replace(" ","").replace(" ","").replace(" ","")]
156
+ input_data[2] = state_category_label_dict[input_data[2].lower().replace(" ","").replace(" ","").replace(" ","").replace(" ","")]
157
+ input_data[3] = district_category_label_dict[input_data[3].lower().replace(" ","").replace(" ","").replace(" ","").replace(" ","")]
158
+ return input_data
159
+
160
+
161
+ # In[170]:
162
+
163
+
164
+ # crop_grosspremimum = pk.load(open(filename, "rb"))
165
+
166
+
167
+ # # In[172]:
168
+
169
+
170
+ # data = ["kharif","PMFBY","Andhra Pradesh","Chittoor",18.82,22410.65,792.39,50.93,50.93,614]
171
+ # crop_grosspremimum.predict([encoding(data)])[0]
172
+
173
+
174
+ # In[ ]:
175
+
176
+
177
+
178
+
insurance(R).csv ADDED
The diff for this file is too large to render. See raw diff
 
insurance.csv ADDED
The diff for this file is too large to render. See raw diff