Skip to content

Commit ebf25c6

Browse files
all
0 parents  commit ebf25c6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+376660
-0
lines changed

basics/AverageMarks.xlsx

12.1 KB
Binary file not shown.

basics/Dummies & OHE.ipynb

+2,469
Large diffs are not rendered by default.

basics/Student_ List.xlsx

13.1 KB
Binary file not shown.

basics/Untitled.ipynb

+507
Large diffs are not rendered by default.

basics/Untitled1.ipynb

+295
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,295 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": 1,
6+
"id": "18373d59",
7+
"metadata": {},
8+
"outputs": [],
9+
"source": [
10+
"\n",
11+
"from sklearn import svm, datasets\n",
12+
"iris = datasets.load_iris()"
13+
]
14+
},
15+
{
16+
"cell_type": "code",
17+
"execution_count": 2,
18+
"id": "7149cb62",
19+
"metadata": {},
20+
"outputs": [
21+
{
22+
"data": {
23+
"text/html": [
24+
"<div>\n",
25+
"<style scoped>\n",
26+
" .dataframe tbody tr th:only-of-type {\n",
27+
" vertical-align: middle;\n",
28+
" }\n",
29+
"\n",
30+
" .dataframe tbody tr th {\n",
31+
" vertical-align: top;\n",
32+
" }\n",
33+
"\n",
34+
" .dataframe thead th {\n",
35+
" text-align: right;\n",
36+
" }\n",
37+
"</style>\n",
38+
"<table border=\"1\" class=\"dataframe\">\n",
39+
" <thead>\n",
40+
" <tr style=\"text-align: right;\">\n",
41+
" <th></th>\n",
42+
" <th>sepal length (cm)</th>\n",
43+
" <th>sepal width (cm)</th>\n",
44+
" <th>petal length (cm)</th>\n",
45+
" <th>petal width (cm)</th>\n",
46+
" <th>flower</th>\n",
47+
" </tr>\n",
48+
" </thead>\n",
49+
" <tbody>\n",
50+
" <tr>\n",
51+
" <th>47</th>\n",
52+
" <td>4.6</td>\n",
53+
" <td>3.2</td>\n",
54+
" <td>1.4</td>\n",
55+
" <td>0.2</td>\n",
56+
" <td>setosa</td>\n",
57+
" </tr>\n",
58+
" <tr>\n",
59+
" <th>48</th>\n",
60+
" <td>5.3</td>\n",
61+
" <td>3.7</td>\n",
62+
" <td>1.5</td>\n",
63+
" <td>0.2</td>\n",
64+
" <td>setosa</td>\n",
65+
" </tr>\n",
66+
" <tr>\n",
67+
" <th>49</th>\n",
68+
" <td>5.0</td>\n",
69+
" <td>3.3</td>\n",
70+
" <td>1.4</td>\n",
71+
" <td>0.2</td>\n",
72+
" <td>setosa</td>\n",
73+
" </tr>\n",
74+
" <tr>\n",
75+
" <th>50</th>\n",
76+
" <td>7.0</td>\n",
77+
" <td>3.2</td>\n",
78+
" <td>4.7</td>\n",
79+
" <td>1.4</td>\n",
80+
" <td>versicolor</td>\n",
81+
" </tr>\n",
82+
" <tr>\n",
83+
" <th>51</th>\n",
84+
" <td>6.4</td>\n",
85+
" <td>3.2</td>\n",
86+
" <td>4.5</td>\n",
87+
" <td>1.5</td>\n",
88+
" <td>versicolor</td>\n",
89+
" </tr>\n",
90+
" <tr>\n",
91+
" <th>...</th>\n",
92+
" <td>...</td>\n",
93+
" <td>...</td>\n",
94+
" <td>...</td>\n",
95+
" <td>...</td>\n",
96+
" <td>...</td>\n",
97+
" </tr>\n",
98+
" <tr>\n",
99+
" <th>145</th>\n",
100+
" <td>6.7</td>\n",
101+
" <td>3.0</td>\n",
102+
" <td>5.2</td>\n",
103+
" <td>2.3</td>\n",
104+
" <td>virginica</td>\n",
105+
" </tr>\n",
106+
" <tr>\n",
107+
" <th>146</th>\n",
108+
" <td>6.3</td>\n",
109+
" <td>2.5</td>\n",
110+
" <td>5.0</td>\n",
111+
" <td>1.9</td>\n",
112+
" <td>virginica</td>\n",
113+
" </tr>\n",
114+
" <tr>\n",
115+
" <th>147</th>\n",
116+
" <td>6.5</td>\n",
117+
" <td>3.0</td>\n",
118+
" <td>5.2</td>\n",
119+
" <td>2.0</td>\n",
120+
" <td>virginica</td>\n",
121+
" </tr>\n",
122+
" <tr>\n",
123+
" <th>148</th>\n",
124+
" <td>6.2</td>\n",
125+
" <td>3.4</td>\n",
126+
" <td>5.4</td>\n",
127+
" <td>2.3</td>\n",
128+
" <td>virginica</td>\n",
129+
" </tr>\n",
130+
" <tr>\n",
131+
" <th>149</th>\n",
132+
" <td>5.9</td>\n",
133+
" <td>3.0</td>\n",
134+
" <td>5.1</td>\n",
135+
" <td>1.8</td>\n",
136+
" <td>virginica</td>\n",
137+
" </tr>\n",
138+
" </tbody>\n",
139+
"</table>\n",
140+
"<p>103 rows × 5 columns</p>\n",
141+
"</div>"
142+
],
143+
"text/plain": [
144+
" sepal length (cm) sepal width (cm) petal length (cm) petal width (cm) \\\n",
145+
"47 4.6 3.2 1.4 0.2 \n",
146+
"48 5.3 3.7 1.5 0.2 \n",
147+
"49 5.0 3.3 1.4 0.2 \n",
148+
"50 7.0 3.2 4.7 1.4 \n",
149+
"51 6.4 3.2 4.5 1.5 \n",
150+
".. ... ... ... ... \n",
151+
"145 6.7 3.0 5.2 2.3 \n",
152+
"146 6.3 2.5 5.0 1.9 \n",
153+
"147 6.5 3.0 5.2 2.0 \n",
154+
"148 6.2 3.4 5.4 2.3 \n",
155+
"149 5.9 3.0 5.1 1.8 \n",
156+
"\n",
157+
" flower \n",
158+
"47 setosa \n",
159+
"48 setosa \n",
160+
"49 setosa \n",
161+
"50 versicolor \n",
162+
"51 versicolor \n",
163+
".. ... \n",
164+
"145 virginica \n",
165+
"146 virginica \n",
166+
"147 virginica \n",
167+
"148 virginica \n",
168+
"149 virginica \n",
169+
"\n",
170+
"[103 rows x 5 columns]"
171+
]
172+
},
173+
"execution_count": 2,
174+
"metadata": {},
175+
"output_type": "execute_result"
176+
}
177+
],
178+
"source": [
179+
"import pandas as pd\n",
180+
"df = pd.DataFrame(iris.data,columns=iris.feature_names)\n",
181+
"df['flower'] = iris.target\n",
182+
"df['flower'] = df['flower'].apply(lambda x: iris.target_names[x])\n",
183+
"df[47:150]"
184+
]
185+
},
186+
{
187+
"cell_type": "code",
188+
"execution_count": 3,
189+
"id": "01221468",
190+
"metadata": {},
191+
"outputs": [],
192+
"source": [
193+
"from sklearn.model_selection import train_test_split\n",
194+
"X_train, X_test, y_train, y_test = train_test_split(iris.data, iris.target, test_size=0.3)"
195+
]
196+
},
197+
{
198+
"cell_type": "code",
199+
"execution_count": 4,
200+
"id": "85bd2f18",
201+
"metadata": {},
202+
"outputs": [
203+
{
204+
"data": {
205+
"text/plain": [
206+
"0.9777777777777777"
207+
]
208+
},
209+
"execution_count": 4,
210+
"metadata": {},
211+
"output_type": "execute_result"
212+
}
213+
],
214+
"source": [
215+
"\n",
216+
"model = svm.SVC(kernel='rbf',C=30,gamma='auto')\n",
217+
"model.fit(X_train,y_train)\n",
218+
"model.score(X_test, y_test)"
219+
]
220+
},
221+
{
222+
"cell_type": "code",
223+
"execution_count": 5,
224+
"id": "0d7f7aeb",
225+
"metadata": {},
226+
"outputs": [
227+
{
228+
"ename": "NameError",
229+
"evalue": "name 'cross_val_score' is not defined",
230+
"output_type": "error",
231+
"traceback": [
232+
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
233+
"\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)",
234+
"\u001b[1;32m<ipython-input-5-044c4818af04>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0mcross_val_score\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0msvm\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mSVC\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mkernel\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;34m'linear'\u001b[0m\u001b[1;33m,\u001b[0m\u001b[0mC\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;36m10\u001b[0m\u001b[1;33m,\u001b[0m\u001b[0mgamma\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;34m'auto'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m,\u001b[0m\u001b[0miris\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mdata\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0miris\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mtarget\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mcv\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;36m5\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m",
235+
"\u001b[1;31mNameError\u001b[0m: name 'cross_val_score' is not defined"
236+
]
237+
}
238+
],
239+
"source": [
240+
"cross_val_score(svm.SVC(kernel='linear',C=10,gamma='auto'),iris.data, iris.target, cv=5)"
241+
]
242+
},
243+
{
244+
"cell_type": "code",
245+
"execution_count": 6,
246+
"id": "67b2e343",
247+
"metadata": {},
248+
"outputs": [
249+
{
250+
"ename": "NameError",
251+
"evalue": "name 'cross_val_score' is not defined",
252+
"output_type": "error",
253+
"traceback": [
254+
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
255+
"\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)",
256+
"\u001b[1;32m<ipython-input-6-2ee90564f888>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0mcross_val_score\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0msvm\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mSVC\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mkernel\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;34m'rbf'\u001b[0m\u001b[1;33m,\u001b[0m\u001b[0mC\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;36m10\u001b[0m\u001b[1;33m,\u001b[0m\u001b[0mgamma\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;34m'auto'\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m,\u001b[0m\u001b[0miris\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mdata\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0miris\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mtarget\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mcv\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;36m5\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m",
257+
"\u001b[1;31mNameError\u001b[0m: name 'cross_val_score' is not defined"
258+
]
259+
}
260+
],
261+
"source": [
262+
"cross_val_score(svm.SVC(kernel='rbf',C=10,gamma='auto'),iris.data, iris.target, cv=5)"
263+
]
264+
},
265+
{
266+
"cell_type": "code",
267+
"execution_count": null,
268+
"id": "26102575",
269+
"metadata": {},
270+
"outputs": [],
271+
"source": []
272+
}
273+
],
274+
"metadata": {
275+
"kernelspec": {
276+
"display_name": "Python 3",
277+
"language": "python",
278+
"name": "python3"
279+
},
280+
"language_info": {
281+
"codemirror_mode": {
282+
"name": "ipython",
283+
"version": 3
284+
},
285+
"file_extension": ".py",
286+
"mimetype": "text/x-python",
287+
"name": "python",
288+
"nbconvert_exporter": "python",
289+
"pygments_lexer": "ipython3",
290+
"version": "3.8.8"
291+
}
292+
},
293+
"nbformat": 4,
294+
"nbformat_minor": 5
295+
}

basics/alloted.xlsx

8.1 KB
Binary file not shown.

basics/areas.csv

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
areas,prices
2+
2000,13438.356164383564
3+
4500,62582.19178082192
4+
4000,52753.42465753425
5+
3100,35061.643835616436
6+
4650,65530.821917808214

basics/carprice.csv

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Car Model,Mileage,Sell Price($),Age(yrs)
2+
BMW X5,69000,18000,6
3+
BMW X5,35000,34000,3
4+
BMW X5,57000,26100,5
5+
BMW X5,22500,40000,2
6+
BMW X5,46000,31500,4
7+
Audi A5,59000,29400,5
8+
Audi A5,52000,32000,5
9+
Audi A5,72000,19300,6
10+
Audi A5,91000,12000,8
11+
Mercedez Benz C class,67000,22000,6
12+
Mercedez Benz C class,83000,20000,7
13+
Mercedez Benz C class,79000,21000,7
14+
Mercedez Benz C class,59000,33000,5

basics/carprices.csv

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
Mileage,Age(yrs),Sell Price($)
2+
69000,6,18000
3+
35000,3,34000
4+
57000,5,26100
5+
22500,2,40000
6+
46000,4,31500
7+
59000,5,26750
8+
52000,5,32000
9+
72000,6,19300
10+
91000,8,12000
11+
67000,6,22000
12+
83000,7,18700
13+
79000,7,19500
14+
59000,5,26000
15+
58780,4,27500
16+
82450,7,19400
17+
25400,3,35000
18+
28000,2,35500
19+
69000,5,19700
20+
87600,8,12800
21+
52000,5,28200

0 commit comments

Comments
 (0)