diff --git a/python/Modulo-09-Data-IA/81-numpy/reto.py b/python/Modulo-09-Data-IA/81-numpy/reto.py new file mode 100644 index 0000000..f6d9649 --- /dev/null +++ b/python/Modulo-09-Data-IA/81-numpy/reto.py @@ -0,0 +1,8 @@ +# Copyright (C) 2026 Alenia Studios +# SPDX-License-Identifier: GPL-3.0-or-later + +import numpy as np + +precios_base = np.array([50, 120, 300, 45]) +precios_descuento = precios_base - 20 +print(precios_descuento) diff --git a/python/Modulo-09-Data-IA/82-pandas/reto.py b/python/Modulo-09-Data-IA/82-pandas/reto.py new file mode 100644 index 0000000..48f2e68 --- /dev/null +++ b/python/Modulo-09-Data-IA/82-pandas/reto.py @@ -0,0 +1,13 @@ +# Copyright (C) 2026 Alenia Studios +# SPDX-License-Identifier: GPL-3.0-or-later + +import pandas as pd + +boleta_calificaciones = { + "Alumno": ["Juan", "Maria", "Pedro"], + "Matematicas": [85, 95, 70], + "Historia": [90, 88, 75] +} + +registro_oficial = pd.DataFrame(boleta_calificaciones) +print(registro_oficial) diff --git a/python/Modulo-09-Data-IA/83-limpieza-datos/reto.py b/python/Modulo-09-Data-IA/83-limpieza-datos/reto.py new file mode 100644 index 0000000..be87917 --- /dev/null +++ b/python/Modulo-09-Data-IA/83-limpieza-datos/reto.py @@ -0,0 +1,13 @@ +# Copyright (C) 2026 Alenia Studios +# SPDX-License-Identifier: GPL-3.0-or-later + +import pandas as pd + +inventario_sucio = { + "Zapato": ["Tenis", "Bota", "Sandalia", "Mocasín"], + "Precio": [50, None, 15, None] +} + +tabla_inventario = pd.DataFrame(inventario_sucio) +tabla_salvada = tabla_inventario.fillna(10) +print(tabla_salvada) diff --git a/python/Modulo-09-Data-IA/84-matplotlib/reto.py b/python/Modulo-09-Data-IA/84-matplotlib/reto.py new file mode 100644 index 0000000..940d3c7 --- /dev/null +++ b/python/Modulo-09-Data-IA/84-matplotlib/reto.py @@ -0,0 +1,10 @@ +# Copyright (C) 2026 Alenia Studios +# SPDX-License-Identifier: GPL-3.0-or-later + +import matplotlib.pyplot as plt + +meses = ["Enero", "Febrero", "Marzo", "Abril"] +pesos = [2, 4, 7, 11] + +plt.plot(meses, pesos) +plt.show() diff --git a/python/Modulo-09-Data-IA/85-scikit-learn/reto.py b/python/Modulo-09-Data-IA/85-scikit-learn/reto.py new file mode 100644 index 0000000..6b4735e --- /dev/null +++ b/python/Modulo-09-Data-IA/85-scikit-learn/reto.py @@ -0,0 +1,14 @@ +# Copyright (C) 2026 Alenia Studios +# SPDX-License-Identifier: GPL-3.0-or-later + +import sklearn +from sklearn.linear_model import LinearRegression + +grados_pasado = [[10], [20], [30]] +ventas_pasado = [20, 40, 60] + +modelo = LinearRegression() +modelo.fit(grados_pasado, ventas_pasado) + +prediccion = modelo.predict([[40]]) +print(prediccion) diff --git a/python/Modulo-09-Data-IA/86-regresion/reto.py b/python/Modulo-09-Data-IA/86-regresion/reto.py new file mode 100644 index 0000000..fdc1734 --- /dev/null +++ b/python/Modulo-09-Data-IA/86-regresion/reto.py @@ -0,0 +1,17 @@ +# Copyright (C) 2026 Alenia Studios +# SPDX-License-Identifier: GPL-3.0-or-later + +from sklearn.linear_model import LinearRegression +import matplotlib.pyplot as plt + +temperaturas = [[15], [20], [25], [30]] +vasos_reales = [10, 22, 35, 48] + +modelo = LinearRegression() +modelo.fit(temperaturas, vasos_reales) + +predicciones = modelo.predict(temperaturas) + +plt.scatter(temperaturas, vasos_reales) +plt.plot(temperaturas, predicciones) +plt.show() diff --git a/python/Modulo-09-Data-IA/87-clasificacion/reto.py b/python/Modulo-09-Data-IA/87-clasificacion/reto.py new file mode 100644 index 0000000..2311e2d --- /dev/null +++ b/python/Modulo-09-Data-IA/87-clasificacion/reto.py @@ -0,0 +1,13 @@ +# Copyright (C) 2026 Alenia Studios +# SPDX-License-Identifier: GPL-3.0-or-later + +from sklearn.tree import DecisionTreeClassifier + +X = [[0, 2], [1, 5], [10, 50], [15, 80]] +y = ["Normal", "Normal", "Spam", "Spam"] + +modelo = DecisionTreeClassifier() +modelo.fit(X, y) + +prediccion = modelo.predict([[12, 60]]) +print(prediccion) diff --git a/python/Modulo-09-Data-IA/88-nlp/reto.py b/python/Modulo-09-Data-IA/88-nlp/reto.py new file mode 100644 index 0000000..9b5b287 --- /dev/null +++ b/python/Modulo-09-Data-IA/88-nlp/reto.py @@ -0,0 +1,14 @@ +# Copyright (C) 2026 Alenia Studios +# SPDX-License-Identifier: GPL-3.0-or-later + +from sklearn.feature_extraction.text import CountVectorizer + +resenas = [ + "La comida es excelente", + "La comida es terrible", + "Excelente servicio" +] + +traductor = CountVectorizer() +matriz_numeros = traductor.fit_transform(resenas) +print(matriz_numeros.toarray()) diff --git a/python/Modulo-09-Data-IA/89-llms/reto.py b/python/Modulo-09-Data-IA/89-llms/reto.py new file mode 100644 index 0000000..49238b3 --- /dev/null +++ b/python/Modulo-09-Data-IA/89-llms/reto.py @@ -0,0 +1,25 @@ +# Copyright (C) 2026 Alenia Studios +# SPDX-License-Identifier: GPL-3.0-or-later + +import time + +def oraculo_clima(prompt): + time.sleep(1) + prompt_limpio = prompt.lower() + if "madrid" in prompt_limpio: + return "En Madrid hará sol, 25 grados." + elif "londres" in prompt_limpio: + return "En Londres lloverá, no olvides tu paraguas." + else: + return "Lo siento, mis satélites no llegan ahí aún." + +print("Consultando a los astros por Madrid...") +print(f"🤖 Oráculo: {oraculo_clima('Madrid')}") +print() + +print("Consultando a los astros por Londres...") +print(f"🤖 Oráculo: {oraculo_clima('Londres')}") +print() + +print("Consultando a los astros por Bogotá...") +print(f"🤖 Oráculo: {oraculo_clima('Bogotá')}") diff --git a/python/Modulo-09-Data-IA/90-RETO-predictor/reto.py b/python/Modulo-09-Data-IA/90-RETO-predictor/reto.py new file mode 100644 index 0000000..0fdff40 --- /dev/null +++ b/python/Modulo-09-Data-IA/90-RETO-predictor/reto.py @@ -0,0 +1,17 @@ +# Copyright (C) 2026 Alenia Studios +# SPDX-License-Identifier: GPL-3.0-or-later + +from sklearn.linear_model import LinearRegression + +print("Entrenando al tasador automático...") +tamaños = [[50], [80], [100], [150]] +precios = [100, 160, 200, 300] + +modelo = LinearRegression() +modelo.fit(tamaños, precios) +print("¡Entrenamiento completado!") + +print("Calculando precio para una casa de 120 metros cuadrados...") +prediccion = modelo.predict([[120]]) + +print(f"🔮 El precio sugerido es: ${prediccion[0]} miles de dólares.")