Você está na página 1de 5

IPN_CURSO_ML_1SEMANA

November 4, 2022

[1]: //Machine Learning IPN - Trabajo 8 marzo 2021 - Andres Nares Monroy

File "<ipython-input-1-5152fb035b20>", line 1


//Machine Learning IPN - Trabajo 8 marzo 2021 - Andres Nares Monroy
^
SyntaxError: invalid syntax

[1]: print("hello world")


import pandas as pd
import numpy as np
from numpy import random

hello world

[8]: x = np.random.normal(0,1,101)
import matplotlib.pyplot as plt
plt.hist(x)
plt.show()

print("hello")

1
hello

[9]: x = np.linspace(-1, 1, 21)


y = np.zeros(21)
for i in range(21):
y[i] = x[i] ** 2
print(i)
plt.scatter(x, y)
plt.show()

0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

2
17
18
19
20

[10]: x = np.linspace(-1, 1, 21)


y = np.linspace(-1, 1, 21)
z = np.zeros((21,21))
for i in range(21):
for j in range(21):
z[i][j] = x[j] ** 2 + y[i] ** 2

print(z)

[[2. 1.81 1.64 1.49 1.36 1.25 1.16 1.09 1.04 1.01 1. 1.01 1.04 1.09
1.16 1.25 1.36 1.49 1.64 1.81 2. ]
[1.81 1.62 1.45 1.3 1.17 1.06 0.97 0.9 0.85 0.82 0.81 0.82 0.85 0.9
0.97 1.06 1.17 1.3 1.45 1.62 1.81]
[1.64 1.45 1.28 1.13 1. 0.89 0.8 0.73 0.68 0.65 0.64 0.65 0.68 0.73
0.8 0.89 1. 1.13 1.28 1.45 1.64]
[1.49 1.3 1.13 0.98 0.85 0.74 0.65 0.58 0.53 0.5 0.49 0.5 0.53 0.58
0.65 0.74 0.85 0.98 1.13 1.3 1.49]
[1.36 1.17 1. 0.85 0.72 0.61 0.52 0.45 0.4 0.37 0.36 0.37 0.4 0.45
0.52 0.61 0.72 0.85 1. 1.17 1.36]
[1.25 1.06 0.89 0.74 0.61 0.5 0.41 0.34 0.29 0.26 0.25 0.26 0.29 0.34
0.41 0.5 0.61 0.74 0.89 1.06 1.25]

3
[1.16 0.97 0.8 0.65 0.52 0.41 0.32 0.25 0.2 0.17 0.16 0.17 0.2 0.25
0.32 0.41 0.52 0.65 0.8 0.97 1.16]
[1.09 0.9 0.73 0.58 0.45 0.34 0.25 0.18 0.13 0.1 0.09 0.1 0.13 0.18
0.25 0.34 0.45 0.58 0.73 0.9 1.09]
[1.04 0.85 0.68 0.53 0.4 0.29 0.2 0.13 0.08 0.05 0.04 0.05 0.08 0.13
0.2 0.29 0.4 0.53 0.68 0.85 1.04]
[1.01 0.82 0.65 0.5 0.37 0.26 0.17 0.1 0.05 0.02 0.01 0.02 0.05 0.1
0.17 0.26 0.37 0.5 0.65 0.82 1.01]
[1. 0.81 0.64 0.49 0.36 0.25 0.16 0.09 0.04 0.01 0. 0.01 0.04 0.09
0.16 0.25 0.36 0.49 0.64 0.81 1. ]
[1.01 0.82 0.65 0.5 0.37 0.26 0.17 0.1 0.05 0.02 0.01 0.02 0.05 0.1
0.17 0.26 0.37 0.5 0.65 0.82 1.01]
[1.04 0.85 0.68 0.53 0.4 0.29 0.2 0.13 0.08 0.05 0.04 0.05 0.08 0.13
0.2 0.29 0.4 0.53 0.68 0.85 1.04]
[1.09 0.9 0.73 0.58 0.45 0.34 0.25 0.18 0.13 0.1 0.09 0.1 0.13 0.18
0.25 0.34 0.45 0.58 0.73 0.9 1.09]
[1.16 0.97 0.8 0.65 0.52 0.41 0.32 0.25 0.2 0.17 0.16 0.17 0.2 0.25
0.32 0.41 0.52 0.65 0.8 0.97 1.16]
[1.25 1.06 0.89 0.74 0.61 0.5 0.41 0.34 0.29 0.26 0.25 0.26 0.29 0.34
0.41 0.5 0.61 0.74 0.89 1.06 1.25]
[1.36 1.17 1. 0.85 0.72 0.61 0.52 0.45 0.4 0.37 0.36 0.37 0.4 0.45
0.52 0.61 0.72 0.85 1. 1.17 1.36]
[1.49 1.3 1.13 0.98 0.85 0.74 0.65 0.58 0.53 0.5 0.49 0.5 0.53 0.58
0.65 0.74 0.85 0.98 1.13 1.3 1.49]
[1.64 1.45 1.28 1.13 1. 0.89 0.8 0.73 0.68 0.65 0.64 0.65 0.68 0.73
0.8 0.89 1. 1.13 1.28 1.45 1.64]
[1.81 1.62 1.45 1.3 1.17 1.06 0.97 0.9 0.85 0.82 0.81 0.82 0.85 0.9
0.97 1.06 1.17 1.3 1.45 1.62 1.81]
[2. 1.81 1.64 1.49 1.36 1.25 1.16 1.09 1.04 1.01 1. 1.01 1.04 1.09
1.16 1.25 1.36 1.49 1.64 1.81 2. ]]

[11]: red_data = pd.read_csv("C:


,→\\Users\ASTRONAUTA\Documents\ATOM\winequality\winequalityred.csv")

white_data = pd.read_csv("C:
,→\\Users\ASTRONAUTA\Documents\ATOM\winequality\winequality-white.csv")

print(red_data.head(10))
print(white_data.head(10))
print(red_data.describe())
print(white_data.describe())

fixed acidity;"volatile acidity";"citric acid";"residual


sugar";"chlorides";"free sulfur dioxide";"total sulfur
dioxide";"density";"pH";"sulphates";"alcohol";"quality"
0 7.4;0.7;0;1.9;0.076;11;34;0.9978;3.51;0.56;9.4;5
1 7.8;0.88;0;2.6;0.098;25;67;0.9968;3.2;0.68;9.8;5
2 7.8;0.76;0.04;2.3;0.092;15;54;0.997;3.26;0.65;…
3 11.2;0.28;0.56;1.9;0.075;17;60;0.998;3.16;0.58…

4
4 7.4;0.7;0;1.9;0.076;11;34;0.9978;3.51;0.56;9.4;5
5 7.4;0.66;0;1.8;0.075;13;40;0.9978;3.51;0.56;9.4;5
6 7.9;0.6;0.06;1.6;0.069;15;59;0.9964;3.3;0.46;9…
7 7.3;0.65;0;1.2;0.065;15;21;0.9946;3.39;0.47;10;7
8 7.8;0.58;0.02;2;0.073;9;18;0.9968;3.36;0.57;9.5;7
9 7.5;0.5;0.36;6.1;0.071;17;102;0.9978;3.35;0.8;…
fixed acidity;"volatile acidity";"citric acid";"residual
sugar";"chlorides";"free sulfur dioxide";"total sulfur
dioxide";"density";"pH";"sulphates";"alcohol";"quality"
0 7;0.27;0.36;20.7;0.045;45;170;1.001;3;0.45;8.8;6
1 6.3;0.3;0.34;1.6;0.049;14;132;0.994;3.3;0.49;9…
2 8.1;0.28;0.4;6.9;0.05;30;97;0.9951;3.26;0.44;1…
3 7.2;0.23;0.32;8.5;0.058;47;186;0.9956;3.19;0.4…
4 7.2;0.23;0.32;8.5;0.058;47;186;0.9956;3.19;0.4…
5 8.1;0.28;0.4;6.9;0.05;30;97;0.9951;3.26;0.44;1…
6 6.2;0.32;0.16;7;0.045;30;136;0.9949;3.18;0.47;…
7 7;0.27;0.36;20.7;0.045;45;170;1.001;3;0.45;8.8;6
8 6.3;0.3;0.34;1.6;0.049;14;132;0.994;3.3;0.49;9…
9 8.1;0.22;0.43;1.5;0.044;28;129;0.9938;3.22;0.4…
fixed acidity;"volatile acidity";"citric acid";"residual
sugar";"chlorides";"free sulfur dioxide";"total sulfur
dioxide";"density";"pH";"sulphates";"alcohol";"quality"
count 1599
unique 1359
top 7.2;0.695;0.13;2;0.076;12;20;0.99546;3.29;0.54…
freq 4
fixed acidity;"volatile acidity";"citric acid";"residual
sugar";"chlorides";"free sulfur dioxide";"total sulfur
dioxide";"density";"pH";"sulphates";"alcohol";"quality"
count 4898
unique 3961
top 7;0.15;0.28;14.7;0.051;29;149;0.99792;2.96;0.3…
freq 8

[ ]:

Você também pode gostar