Escolar Documentos
Profissional Documentos
Cultura Documentos
November 4, 2022
[ ]:
,→")
#toefl = pd.read_csv("C:\\Users\ASTRONAUTA\Documents\admission_predic.csv")
import pandas as pd
toefl = pd.read_csv("C:\\Users\ASTRONAUTA\Downloads\data.csv")
toefl.head(10)
[5]: Serial No. GRE Score TOEFL Score University Rating SOP LOR CGPA \
0 1 337 118 4 4.5 4.5 9.65
1 2 324 107 4 4.0 4.5 8.87
2 3 316 104 3 3.0 3.5 8.00
3 4 322 110 3 3.5 2.5 8.67
4 5 314 103 2 2.0 3.0 8.21
5 6 330 115 5 4.5 3.0 9.34
6 7 321 109 3 3.0 4.0 8.20
7 8 308 101 2 3.0 4.0 7.90
8 9 302 102 1 2.0 1.5 8.00
9 10 323 108 3 3.5 3.0 8.60
1
0 1 0.92
1 1 0.76
2 1 0.72
3 1 0.80
4 0 0.65
5 1 0.90
6 1 0.75
7 0 0.68
8 0 0.50
9 0 0.45
})
y = toefl["Chance of Admit"]
[7]: m = X.x1
plt.plot(X.x1,y)
␣
,→---------------------------------------------------------------------------
<ipython-input-7-5fe489efdc9b> in <module>
1 m = X.x1
----> 2 plt.plot(X.x1,y)
3
2
[8]: #3. Visualiza cada eje respecto al valor de predicción (3 puntos)
[42]: y
[42]: 0 0.92
1 0.76
3
2 0.72
3 0.80
4 0.65
…
395 0.82
396 0.84
397 0.91
398 0.67
399 0.95
Name: Chance of Admit, Length: 400, dtype: float64
regr = linear_model.LinearRegression()
regr.fit(X,y)
print(regr.coef_)
[33]: 0.7554005844257312
regressor.fit(O,y)
v2a_predict = regressor.predict(O)
v2a_predict
print(regressor.coef_)
plt.scatter(X.x1, X.x2, c=v2a_predict)
4
fig = plt.figure()
ax = fig.add_subplot(111, projection="3d")
ax.view_init(0, 40)
[0.19211109 0.03838883]
5
[45]: #EJEMPLOS QUE NO FUNCIONARON
print(slope1)
plt.scatter(rs,y)
plt.plot(rs,predict1,c = 'red')
[0.20884723]
6
[23]: rs2 = np.array([X.x7]).reshape((-1,1))
model2 = LinearRegression().fit(rs2,y)
model2.score(rs2,y)
slope2 = model2.coef_
print(slope2)
predict2 = model.predict(rs2)
#print(predict2)
plt.scatter(rs2,y)
plt.plot(rs2,predict2,color = 'red')
[0.15830218]
7
[97]: print('hola')
hola
ax = fig.add_subplot(111, projection='3d')
8
[ ]: