<jupyter_start><jupyter_text>Consumo de gasolina en Estados Unidos  1. Importar librerías<jupyter_code>import pandas as pd
from sklearn.svm import SVC

import matplotlib.pyplot as plt
import seaborn as sb
from sklearn.metrics import accuracy_score
from sklearn.model_selection import train_test_split<jupyter_output><empty_output><jupyter_text>2. Cargar dataset<jupyter_code>df_gasoline = pd.read_csv(
    "https://raw.githubusercontent.com/luisFernandoCastellanosG/Machine_learning/master/Databasets/petrol_consumption"
    ".csv")<jupyter_output><empty_output><jupyter_text>3. Conociendo los datos del dataset<jupyter_code>df_gasoline.head()
df_gasoline.describe()

print("\nValores nulos totales: \n", df_gasoline.isnull().sum())<jupyter_output>Valores nulos totales: 
 gasolina_impuesto                       0
ingreso_promedio                        0
carreteras_pavimentadas                 0
porcen_licencias_conducion_poblacion    0
gasolina_Consumo                        0
dtype: int64<jupyter_text>4. Gráficas de las variables del dataset<jupyter_code>plot_data = df_gasoline.columns
sb.pairplot(df_gasoline[plot_data], height=2)
plt.tight_layout()
plt.show()<jupyter_output><empty_output><jupyter_text>5. Matriz de correlaciones<jupyter_code>correlation_mat = df_gasoline.corr()
sb.heatmap(correlation_mat, annot=True)
plt.show()<jupyter_output><empty_output><jupyter_text>6. Eliminar columnas innecesarias<jupyter_code>df_gasoline.drop(['carreteras_pavimentadas', 'ingreso_promedio'], axis=1, inplace=True)
df_gasoline.dropna(inplace=True)
print("\nColumnas del modelo: \n", df_gasoline.head())<jupyter_output>Columnas del modelo: 
    gasolina_impuesto  porcen_licencias_conducion_poblacion  gasolina_Consumo
0                9.0                                 0.525               541
1                9.0                                 0.572               524
2                9.0                                 0.580               561
3                7.5                                 0.529               414
4                8.0                                 0.544               410<jupyter_text>7. Graficando los datos<jupyter_code>fig, ax = plt.subplots(figsize=(6, 4))
ax.scatter(df_gasoline.gasolina_impuesto, df_gasoline.porcen_licencias_conducion_poblacion,
           c=df_gasoline.gasolina_Consumo)
ax.set_title("Consumo de gasolina")
plt.show()<jupyter_output><empty_output><jupyter_text>8. Separando los datos para el entrenamiento y testeo<jupyter_code>x_axis = df_gasoline.drop('gasolina_Consumo', axis=1)
y_axis = df_gasoline['gasolina_Consumo']
[x_train, x_test, y_train, y_test] = train_test_split(x_axis, y_axis, test_size=0.2, random_state=4)<jupyter_output><empty_output><jupyter_text>9. Instanciando Support Vector Machine<jupyter_code>svm = SVC(kernel='rbf')
svm.fit(x_train, y_train)<jupyter_output><empty_output><jupyter_text>10. Inferencia del modelo<jupyter_code>y_pred = svm.predict(x_test)
inferencia = accuracy_score(y_test, y_pred)
print(f"\nInferencia del modelo: {str(inferencia)} %")<jupyter_output>Inferencia del modelo: 0.0 %
{'fraction_non_alphanumeric': 0.09179370742783004, 'fraction_numerical': 0.02530003243593902, 'mean_word_length': 3.5892857142857144, 'pattern_counts': {'":': 0, '<': 38, '<?xml version=': 0, '>': 38, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '10', 'dir': 'jupyter-structured-clean-dedup', 'id': '536489', 'license': 'MIT', 'n_tokens_mistral': 1155, 'n_tokens_neox': 1111, 'n_words': 172, 'path': 'machine_learning/P1T7_oil consume_JNPM.ipynb', 'repo_name': 'jaidernperez/deep-learning', 'size': '3083'}