synaptix 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- synaptix-0.1.0/PKG-INFO +98 -0
- synaptix-0.1.0/README.md +36 -0
- synaptix-0.1.0/setup.cfg +4 -0
- synaptix-0.1.0/setup.py +91 -0
- synaptix-0.1.0/synaptix/__init__.py +37 -0
- synaptix-0.1.0/synaptix/intelligenceartificial.py +370 -0
- synaptix-0.1.0/synaptix.egg-info/PKG-INFO +98 -0
- synaptix-0.1.0/synaptix.egg-info/SOURCES.txt +9 -0
- synaptix-0.1.0/synaptix.egg-info/dependency_links.txt +1 -0
- synaptix-0.1.0/synaptix.egg-info/requires.txt +31 -0
- synaptix-0.1.0/synaptix.egg-info/top_level.txt +1 -0
synaptix-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: synaptix
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Librería de Inteligencia Artificial para Python (ML, DL, Visión, NLP, IA Clásica).
|
|
5
|
+
Home-page: https://github.com/Immanuel3008/SynaptIX
|
|
6
|
+
Author: Emmanuel Ascendra Perez
|
|
7
|
+
Author-email: ascendraemmanuel@gmail.com
|
|
8
|
+
Project-URL: Repositorio, https://github.com/Immanuel3008/SynaptIX
|
|
9
|
+
Project-URL: Reportar Bugs, https://github.com/Immanuel3008/SynaptIX/issues
|
|
10
|
+
Project-URL: Documentación, https://github.com/Immanuel3008/SynaptIX/wiki
|
|
11
|
+
Keywords: machine learning,deep learning,artificial intelligence,data science,computer vision,nlp,synaptixx
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Intended Audience :: Science/Research
|
|
15
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
16
|
+
Classifier: Topic :: Scientific/Engineering :: Mathematics
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Requires-Python: >=3.8
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
Requires-Dist: numpy>=1.20.0
|
|
26
|
+
Requires-Dist: pandas>=1.3.0
|
|
27
|
+
Requires-Dist: scipy>=1.7.0
|
|
28
|
+
Requires-Dist: matplotlib>=3.4.0
|
|
29
|
+
Provides-Extra: ml
|
|
30
|
+
Requires-Dist: scikit-learn>=1.0.0; extra == "ml"
|
|
31
|
+
Requires-Dist: statsmodels>=0.13.0; extra == "ml"
|
|
32
|
+
Provides-Extra: dl
|
|
33
|
+
Requires-Dist: tensorflow>=2.5.0; extra == "dl"
|
|
34
|
+
Provides-Extra: vision
|
|
35
|
+
Requires-Dist: opencv-python>=4.5.0; extra == "vision"
|
|
36
|
+
Provides-Extra: nlp
|
|
37
|
+
Requires-Dist: nltk>=3.6.0; extra == "nlp"
|
|
38
|
+
Requires-Dist: scikit-learn>=1.0.0; extra == "nlp"
|
|
39
|
+
Provides-Extra: viz
|
|
40
|
+
Requires-Dist: seaborn>=0.11.0; extra == "viz"
|
|
41
|
+
Requires-Dist: plotly>=5.0.0; extra == "viz"
|
|
42
|
+
Provides-Extra: all
|
|
43
|
+
Requires-Dist: scikit-learn>=1.0.0; extra == "all"
|
|
44
|
+
Requires-Dist: statsmodels>=0.13.0; extra == "all"
|
|
45
|
+
Requires-Dist: tensorflow>=2.5.0; extra == "all"
|
|
46
|
+
Requires-Dist: opencv-python>=4.5.0; extra == "all"
|
|
47
|
+
Requires-Dist: nltk>=3.6.0; extra == "all"
|
|
48
|
+
Requires-Dist: seaborn>=0.11.0; extra == "all"
|
|
49
|
+
Requires-Dist: plotly>=5.0.0; extra == "all"
|
|
50
|
+
Dynamic: author
|
|
51
|
+
Dynamic: author-email
|
|
52
|
+
Dynamic: classifier
|
|
53
|
+
Dynamic: description
|
|
54
|
+
Dynamic: description-content-type
|
|
55
|
+
Dynamic: home-page
|
|
56
|
+
Dynamic: keywords
|
|
57
|
+
Dynamic: project-url
|
|
58
|
+
Dynamic: provides-extra
|
|
59
|
+
Dynamic: requires-dist
|
|
60
|
+
Dynamic: requires-python
|
|
61
|
+
Dynamic: summary
|
|
62
|
+
|
|
63
|
+
📦 Descripción para PyPI (Plantilla Profesional)
|
|
64
|
+
|
|
65
|
+
StatsLibX es un paquete de Python diseñado para proporcionar una solución sencilla, eficiente y flexible para manejar volumenes de datos.
|
|
66
|
+
|
|
67
|
+
Este proyecto surge con la idea de ofrecer una alternativa moderna, intuitiva y ligera que permita a desarrolladores y entusiastas integrar la estadistica descriptiva e inferencial sin complicaciones, con multiples funcionalidades y utilidades pensadas para el futuro.
|
|
68
|
+
|
|
69
|
+
✨ Características principales
|
|
70
|
+
|
|
71
|
+
⚡ Rápido y eficiente: optimizado para ofrecer un rendimiento suave incluso en tareas exigentes.
|
|
72
|
+
|
|
73
|
+
🧩 Fácil de usar: una API limpia para que empieces en segundos.
|
|
74
|
+
|
|
75
|
+
🔧 Altamente extensible: personalízalo según tus necesidades.
|
|
76
|
+
|
|
77
|
+
📚 Documentación clara: ejemplos simples y prácticos.
|
|
78
|
+
|
|
79
|
+
🔮 Diseñado con visión a futuro: construido para escalar y adaptarse.
|
|
80
|
+
|
|
81
|
+
🚀 Ejemplo rápido
|
|
82
|
+
```python
|
|
83
|
+
from statslibx import DescriptiveStats, InferentialStats, UtilsStats
|
|
84
|
+
|
|
85
|
+
stats = DescriptiveStats(data) # InferentialStats(data), UtilsStats()
|
|
86
|
+
stats.help()
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
📦 Instalación
|
|
90
|
+
```bash
|
|
91
|
+
pip install statslibx
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
🤝 Contribuciones
|
|
95
|
+
|
|
96
|
+
¡Todas las mejoras e ideas son bienvenidas!
|
|
97
|
+
|
|
98
|
+
E-mail: ascendraemmanuel@gmail.com
|
synaptix-0.1.0/README.md
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
📦 Descripción para PyPI (Plantilla Profesional)
|
|
2
|
+
|
|
3
|
+
StatsLibX es un paquete de Python diseñado para proporcionar una solución sencilla, eficiente y flexible para manejar volumenes de datos.
|
|
4
|
+
|
|
5
|
+
Este proyecto surge con la idea de ofrecer una alternativa moderna, intuitiva y ligera que permita a desarrolladores y entusiastas integrar la estadistica descriptiva e inferencial sin complicaciones, con multiples funcionalidades y utilidades pensadas para el futuro.
|
|
6
|
+
|
|
7
|
+
✨ Características principales
|
|
8
|
+
|
|
9
|
+
⚡ Rápido y eficiente: optimizado para ofrecer un rendimiento suave incluso en tareas exigentes.
|
|
10
|
+
|
|
11
|
+
🧩 Fácil de usar: una API limpia para que empieces en segundos.
|
|
12
|
+
|
|
13
|
+
🔧 Altamente extensible: personalízalo según tus necesidades.
|
|
14
|
+
|
|
15
|
+
📚 Documentación clara: ejemplos simples y prácticos.
|
|
16
|
+
|
|
17
|
+
🔮 Diseñado con visión a futuro: construido para escalar y adaptarse.
|
|
18
|
+
|
|
19
|
+
🚀 Ejemplo rápido
|
|
20
|
+
```python
|
|
21
|
+
from statslibx import DescriptiveStats, InferentialStats, UtilsStats
|
|
22
|
+
|
|
23
|
+
stats = DescriptiveStats(data) # InferentialStats(data), UtilsStats()
|
|
24
|
+
stats.help()
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
📦 Instalación
|
|
28
|
+
```bash
|
|
29
|
+
pip install statslibx
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
🤝 Contribuciones
|
|
33
|
+
|
|
34
|
+
¡Todas las mejoras e ideas son bienvenidas!
|
|
35
|
+
|
|
36
|
+
E-mail: ascendraemmanuel@gmail.com
|
synaptix-0.1.0/setup.cfg
ADDED
synaptix-0.1.0/setup.py
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
from setuptools import setup, find_packages
|
|
2
|
+
|
|
3
|
+
# Cargar README como descripción larga
|
|
4
|
+
try:
|
|
5
|
+
with open("README.md", "r", encoding="utf-8") as fh:
|
|
6
|
+
long_description = fh.read()
|
|
7
|
+
except FileNotFoundError:
|
|
8
|
+
long_description = "SynaptixX – Librería unificada de IA, ML, DL, Visión y NLP para Python."
|
|
9
|
+
|
|
10
|
+
setup(
|
|
11
|
+
name="synaptix", # ← más único para PyPI
|
|
12
|
+
version="0.1.0",
|
|
13
|
+
author="Emmanuel Ascendra Perez",
|
|
14
|
+
author_email="ascendraemmanuel@gmail.com",
|
|
15
|
+
description="Librería de Inteligencia Artificial para Python (ML, DL, Visión, NLP, IA Clásica).",
|
|
16
|
+
long_description=long_description,
|
|
17
|
+
long_description_content_type="text/markdown",
|
|
18
|
+
url="https://github.com/Immanuel3008/SynaptIX",
|
|
19
|
+
project_urls={
|
|
20
|
+
"Repositorio": "https://github.com/Immanuel3008/SynaptIX",
|
|
21
|
+
"Reportar Bugs": "https://github.com/Immanuel3008/SynaptIX/issues",
|
|
22
|
+
"Documentación": "https://github.com/Immanuel3008/SynaptIX/wiki",
|
|
23
|
+
},
|
|
24
|
+
packages=find_packages(),
|
|
25
|
+
include_package_data=True,
|
|
26
|
+
|
|
27
|
+
classifiers=[
|
|
28
|
+
"Development Status :: 3 - Alpha",
|
|
29
|
+
"Intended Audience :: Developers",
|
|
30
|
+
"Intended Audience :: Science/Research",
|
|
31
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
32
|
+
"Topic :: Scientific/Engineering :: Mathematics",
|
|
33
|
+
"Programming Language :: Python :: 3",
|
|
34
|
+
"Programming Language :: Python :: 3.8",
|
|
35
|
+
"Programming Language :: Python :: 3.9",
|
|
36
|
+
"Programming Language :: Python :: 3.10",
|
|
37
|
+
"Programming Language :: Python :: 3.11",
|
|
38
|
+
"Programming Language :: Python :: 3.12",
|
|
39
|
+
],
|
|
40
|
+
|
|
41
|
+
python_requires=">=3.8",
|
|
42
|
+
|
|
43
|
+
# Dependencias base
|
|
44
|
+
install_requires=[
|
|
45
|
+
"numpy>=1.20.0",
|
|
46
|
+
"pandas>=1.3.0",
|
|
47
|
+
"scipy>=1.7.0",
|
|
48
|
+
"matplotlib>=3.4.0",
|
|
49
|
+
],
|
|
50
|
+
|
|
51
|
+
# Dependencias opcionales
|
|
52
|
+
extras_require={
|
|
53
|
+
"ml": [
|
|
54
|
+
"scikit-learn>=1.0.0",
|
|
55
|
+
"statsmodels>=0.13.0",
|
|
56
|
+
],
|
|
57
|
+
"dl": [
|
|
58
|
+
"tensorflow>=2.5.0",
|
|
59
|
+
],
|
|
60
|
+
"vision": [
|
|
61
|
+
"opencv-python>=4.5.0",
|
|
62
|
+
],
|
|
63
|
+
"nlp": [
|
|
64
|
+
"nltk>=3.6.0",
|
|
65
|
+
"scikit-learn>=1.0.0", # TF-IDF
|
|
66
|
+
],
|
|
67
|
+
"viz": [
|
|
68
|
+
"seaborn>=0.11.0",
|
|
69
|
+
"plotly>=5.0.0",
|
|
70
|
+
],
|
|
71
|
+
"all": [
|
|
72
|
+
"scikit-learn>=1.0.0",
|
|
73
|
+
"statsmodels>=0.13.0",
|
|
74
|
+
"tensorflow>=2.5.0",
|
|
75
|
+
"opencv-python>=4.5.0",
|
|
76
|
+
"nltk>=3.6.0",
|
|
77
|
+
"seaborn>=0.11.0",
|
|
78
|
+
"plotly>=5.0.0",
|
|
79
|
+
],
|
|
80
|
+
},
|
|
81
|
+
|
|
82
|
+
keywords=[
|
|
83
|
+
"machine learning",
|
|
84
|
+
"deep learning",
|
|
85
|
+
"artificial intelligence",
|
|
86
|
+
"data science",
|
|
87
|
+
"computer vision",
|
|
88
|
+
"nlp",
|
|
89
|
+
"synaptixx",
|
|
90
|
+
],
|
|
91
|
+
)
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"""
|
|
2
|
+
SynaptIX - Librería de Inteligencia Artificial para Python
|
|
3
|
+
Autor: Emmanuel Ascendra
|
|
4
|
+
Versión: 0.1.0
|
|
5
|
+
|
|
6
|
+
Incluye:
|
|
7
|
+
- Machine Learning
|
|
8
|
+
- Deep Learning
|
|
9
|
+
- Visión Artificial
|
|
10
|
+
- Procesamiento del Lenguaje Natural
|
|
11
|
+
- IA Clásica
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
__version__ = "0.1.0"
|
|
15
|
+
__author__ = "Emmanuel Ascendra"
|
|
16
|
+
|
|
17
|
+
# Importar clases principales
|
|
18
|
+
from .intelligenceartificial import Intelligence
|
|
19
|
+
|
|
20
|
+
# Qué exponer con: from synaptix import *
|
|
21
|
+
__all__ = [
|
|
22
|
+
"Intelligence",
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
# Mensaje de bienvenida
|
|
26
|
+
def welcome():
|
|
27
|
+
"""Imprime información sobre la librería SynaptIX."""
|
|
28
|
+
header = f"\033[1;96mSynaptIX v{__version__}\033[0m"
|
|
29
|
+
print(header)
|
|
30
|
+
print("Librería integral de Inteligencia Artificial para Python")
|
|
31
|
+
print(f"Autor: {__author__}\n")
|
|
32
|
+
|
|
33
|
+
print("Clases disponibles:")
|
|
34
|
+
print(" • Intelligence : IA completa (ML, DL, Visión, NLP, IA clásica)\n")
|
|
35
|
+
|
|
36
|
+
print("Usa help(Intelligence) para ver todos los métodos.")
|
|
37
|
+
print("Repositorio: https://github.com/Immanuel3008/SynaptIX")
|
|
@@ -0,0 +1,370 @@
|
|
|
1
|
+
import numpy as np
|
|
2
|
+
import pandas as pd
|
|
3
|
+
from typing import Optional, Union, Literal, List
|
|
4
|
+
from datetime import datetime
|
|
5
|
+
|
|
6
|
+
from sklearn.linear_model import LinearRegression, LogisticRegression
|
|
7
|
+
from sklearn.svm import SVC
|
|
8
|
+
from sklearn.cluster import KMeans
|
|
9
|
+
from sklearn.feature_extraction.text import TfidfVectorizer
|
|
10
|
+
from sklearn.preprocessing import StandardScaler
|
|
11
|
+
from sklearn.model_selection import train_test_split
|
|
12
|
+
|
|
13
|
+
import cv2 # opcional si se usa visión
|
|
14
|
+
from collections import deque
|
|
15
|
+
import heapq
|
|
16
|
+
|
|
17
|
+
class Intelligence:
|
|
18
|
+
"""
|
|
19
|
+
Clase general para Inteligencia Artificial + ML + DL + Visión + NLP + IA clásica.
|
|
20
|
+
Compatible con estilo StatsLibX.
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
def __init__(self, data: Union[pd.DataFrame, np.ndarray, list],
|
|
24
|
+
backend: Literal['pandas'] = 'pandas'):
|
|
25
|
+
if isinstance(data, np.ndarray):
|
|
26
|
+
if data.ndim == 1:
|
|
27
|
+
data = pd.DataFrame({'var': data})
|
|
28
|
+
else:
|
|
29
|
+
data = pd.DataFrame(data, columns=[f'var_{i}' for i in range(data.shape[1])])
|
|
30
|
+
|
|
31
|
+
if isinstance(data, list):
|
|
32
|
+
data = pd.DataFrame({'var': data})
|
|
33
|
+
|
|
34
|
+
self.data = data
|
|
35
|
+
self.backend = backend
|
|
36
|
+
self._numeric_cols = data.select_dtypes(include=[np.number]).columns.tolist()
|
|
37
|
+
|
|
38
|
+
# ============================================================================
|
|
39
|
+
# MACHINE LEARNING
|
|
40
|
+
# ============================================================================
|
|
41
|
+
|
|
42
|
+
def linear_regression(self, y: str, X: List[str]):
|
|
43
|
+
"""
|
|
44
|
+
Regresión Lineal (scikit-learn)
|
|
45
|
+
"""
|
|
46
|
+
model = LinearRegression()
|
|
47
|
+
model.fit(self.data[X], self.data[y])
|
|
48
|
+
|
|
49
|
+
return {
|
|
50
|
+
"type": "linear_regression",
|
|
51
|
+
"coef": model.coef_,
|
|
52
|
+
"intercept": model.intercept_,
|
|
53
|
+
"predict": model.predict
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
def logistic_regression(self, y: str, X: List[str]):
|
|
57
|
+
"""
|
|
58
|
+
Regresión Logística para clasificación
|
|
59
|
+
"""
|
|
60
|
+
model = LogisticRegression()
|
|
61
|
+
model.fit(self.data[X], self.data[y])
|
|
62
|
+
|
|
63
|
+
return {
|
|
64
|
+
"type": "logistic_regression",
|
|
65
|
+
"classes": model.classes_,
|
|
66
|
+
"coef": model.coef_,
|
|
67
|
+
"predict": model.predict
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
def svm_classifier(self, y: str, X: List[str], kernel="rbf"):
|
|
71
|
+
"""
|
|
72
|
+
SVM Classifier
|
|
73
|
+
"""
|
|
74
|
+
model = SVC(kernel=kernel, probability=True)
|
|
75
|
+
model.fit(self.data[X], self.data[y])
|
|
76
|
+
|
|
77
|
+
return {
|
|
78
|
+
"type": "svm_classifier",
|
|
79
|
+
"kernel": kernel,
|
|
80
|
+
"predict": model.predict,
|
|
81
|
+
"predict_proba": model.predict_proba
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
def kmeans(self, n_clusters=3, columns=None):
|
|
85
|
+
"""
|
|
86
|
+
K-Means Clustering
|
|
87
|
+
"""
|
|
88
|
+
cols = columns or self._numeric_cols
|
|
89
|
+
model = KMeans(n_clusters=n_clusters)
|
|
90
|
+
model.fit(self.data[cols])
|
|
91
|
+
|
|
92
|
+
return {
|
|
93
|
+
"type": "kmeans",
|
|
94
|
+
"centroids": model.cluster_centers_,
|
|
95
|
+
"labels": model.labels_,
|
|
96
|
+
"predict": model.predict
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
# ============================================================================
|
|
100
|
+
# DEEP LEARNING
|
|
101
|
+
# ============================================================================
|
|
102
|
+
|
|
103
|
+
def dense_network(self, input_dim, layers=[32,16,8], activation="relu"):
|
|
104
|
+
"""
|
|
105
|
+
Red neuronal densa simple implementada 'a mano' (sin frameworks).
|
|
106
|
+
Solo forward.
|
|
107
|
+
"""
|
|
108
|
+
|
|
109
|
+
weights = []
|
|
110
|
+
biases = []
|
|
111
|
+
|
|
112
|
+
prev = input_dim
|
|
113
|
+
for layer in layers:
|
|
114
|
+
weights.append(np.random.randn(prev, layer) * 0.1)
|
|
115
|
+
biases.append(np.zeros((layer,)))
|
|
116
|
+
prev = layer
|
|
117
|
+
|
|
118
|
+
def forward(x):
|
|
119
|
+
out = x
|
|
120
|
+
for W, b in zip(weights, biases):
|
|
121
|
+
out = np.dot(out, W) + b
|
|
122
|
+
out = np.maximum(out, 0) if activation == "relu" else np.tanh(out)
|
|
123
|
+
return out
|
|
124
|
+
|
|
125
|
+
return {
|
|
126
|
+
"type": "dense_network",
|
|
127
|
+
"forward": forward,
|
|
128
|
+
"weights": weights
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
def cnn(self):
|
|
132
|
+
"""
|
|
133
|
+
Placeholder CNN simple; retornas estructura.
|
|
134
|
+
"""
|
|
135
|
+
return {
|
|
136
|
+
"type": "cnn",
|
|
137
|
+
"note": "Implementación ligera; aquí puedes usar TensorFlow/PyTorch luego."
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
# ============================================================================
|
|
141
|
+
# VISIÓN ARTIFICIAL
|
|
142
|
+
# ============================================================================
|
|
143
|
+
|
|
144
|
+
def detect_edges(self, image, method="canny"):
|
|
145
|
+
"""
|
|
146
|
+
Detección de bordes con Canny u Sobel
|
|
147
|
+
"""
|
|
148
|
+
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
|
|
149
|
+
|
|
150
|
+
if method == "canny":
|
|
151
|
+
edges = cv2.Canny(gray, 100, 200)
|
|
152
|
+
else:
|
|
153
|
+
sx = cv2.Sobel(gray, cv2.CV_64F, 1, 0)
|
|
154
|
+
sy = cv2.Sobel(gray, cv2.CV_64F, 0, 1)
|
|
155
|
+
edges = np.sqrt(sx**2 + sy**2)
|
|
156
|
+
|
|
157
|
+
return edges
|
|
158
|
+
|
|
159
|
+
def image_features(self, image):
|
|
160
|
+
"""
|
|
161
|
+
Histogramas y características simples
|
|
162
|
+
"""
|
|
163
|
+
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
|
|
164
|
+
hist = cv2.calcHist([gray], [0], None, [256], [0,256]).flatten()
|
|
165
|
+
|
|
166
|
+
return {
|
|
167
|
+
"mean": float(np.mean(gray)),
|
|
168
|
+
"std": float(np.std(gray)),
|
|
169
|
+
"histogram": hist
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
# ============================================================================
|
|
173
|
+
# PROCESAMIENTO DEL LENGUAJE NATURAL (NLP)
|
|
174
|
+
# ============================================================================
|
|
175
|
+
|
|
176
|
+
def tokenize(self, text: str):
|
|
177
|
+
"""
|
|
178
|
+
Tokenización básica
|
|
179
|
+
"""
|
|
180
|
+
return text.lower().replace(",", "").replace(".", "").split()
|
|
181
|
+
|
|
182
|
+
def vectorize_tfidf(self, documents: List[str]):
|
|
183
|
+
"""
|
|
184
|
+
TF-IDF vectorization
|
|
185
|
+
"""
|
|
186
|
+
tfidf = TfidfVectorizer()
|
|
187
|
+
X = tfidf.fit_transform(documents)
|
|
188
|
+
|
|
189
|
+
return {
|
|
190
|
+
"type": "tfidf",
|
|
191
|
+
"matrix": X,
|
|
192
|
+
"vocab": tfidf.vocabulary_,
|
|
193
|
+
"transform": tfidf.transform
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
# ============================================================================
|
|
197
|
+
# IA CLÁSICA
|
|
198
|
+
# ============================================================================
|
|
199
|
+
|
|
200
|
+
def a_star(self, start, goal, graph: dict):
|
|
201
|
+
"""
|
|
202
|
+
Algoritmo A*
|
|
203
|
+
Grafo como dict: {nodo: {vecino: costo}}
|
|
204
|
+
"""
|
|
205
|
+
|
|
206
|
+
def heuristic(a, b):
|
|
207
|
+
return abs(a - b)
|
|
208
|
+
|
|
209
|
+
pq = [(0, start)]
|
|
210
|
+
visited = set()
|
|
211
|
+
parent = {start: None}
|
|
212
|
+
g = {start: 0}
|
|
213
|
+
|
|
214
|
+
while pq:
|
|
215
|
+
cost, node = heapq.heappop(pq)
|
|
216
|
+
if node == goal:
|
|
217
|
+
break
|
|
218
|
+
|
|
219
|
+
if node in visited:
|
|
220
|
+
continue
|
|
221
|
+
|
|
222
|
+
visited.add(node)
|
|
223
|
+
|
|
224
|
+
for nxt, w in graph[node].items():
|
|
225
|
+
new_cost = g[node] + w
|
|
226
|
+
if nxt not in g or new_cost < g[nxt]:
|
|
227
|
+
g[nxt] = new_cost
|
|
228
|
+
f = new_cost + heuristic(nxt, goal)
|
|
229
|
+
heapq.heappush(pq, (f, nxt))
|
|
230
|
+
parent[nxt] = node
|
|
231
|
+
|
|
232
|
+
# reconstruir camino
|
|
233
|
+
path = []
|
|
234
|
+
curr = goal
|
|
235
|
+
while curr is not None:
|
|
236
|
+
path.append(curr)
|
|
237
|
+
curr = parent[curr]
|
|
238
|
+
path.reverse()
|
|
239
|
+
|
|
240
|
+
return path
|
|
241
|
+
|
|
242
|
+
def genetic_algorithm(self, fitness_fn, population_size=10, generations=20):
|
|
243
|
+
"""
|
|
244
|
+
Algoritmo genético muy simple
|
|
245
|
+
"""
|
|
246
|
+
|
|
247
|
+
population = [np.random.rand() for _ in range(population_size)]
|
|
248
|
+
|
|
249
|
+
for _ in range(generations):
|
|
250
|
+
scores = np.array([fitness_fn(ind) for ind in population])
|
|
251
|
+
probs = scores / np.sum(scores)
|
|
252
|
+
selected = np.random.choice(population, size=population_size, p=probs)
|
|
253
|
+
|
|
254
|
+
new_pop = []
|
|
255
|
+
for _ in range(population_size):
|
|
256
|
+
a, b = np.random.choice(selected, 2)
|
|
257
|
+
child = (a + b) / 2
|
|
258
|
+
child += np.random.randn() * 0.01
|
|
259
|
+
new_pop.append(child)
|
|
260
|
+
|
|
261
|
+
population = new_pop
|
|
262
|
+
|
|
263
|
+
best = max(population, key=fitness_fn)
|
|
264
|
+
return best
|
|
265
|
+
|
|
266
|
+
def help(self):
|
|
267
|
+
"""
|
|
268
|
+
Muestra ayuda completa de la clase Intelligence
|
|
269
|
+
"""
|
|
270
|
+
help_text = """
|
|
271
|
+
╔════════════════════════════════════════════════════════════════════════════╗
|
|
272
|
+
║ 🤖 CLASE Intelligence - AYUDA COMPLETA ║
|
|
273
|
+
╚════════════════════════════════════════════════════════════════════════════╝
|
|
274
|
+
|
|
275
|
+
📝 DESCRIPCIÓN:
|
|
276
|
+
Clase para Machine Learning, Deep Learning, Visión Artificial,
|
|
277
|
+
Procesamiento de Lenguaje Natural e Inteligencia Artificial clásica.
|
|
278
|
+
Compatible con estilo StatsLibX.
|
|
279
|
+
|
|
280
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
281
|
+
|
|
282
|
+
📋 MÉTODOS PRINCIPALES:
|
|
283
|
+
|
|
284
|
+
┌────────────────────────────────────────────────────────────────────────────┐
|
|
285
|
+
│ 1. ⭐ MACHINE LEARNING │
|
|
286
|
+
└────────────────────────────────────────────────────────────────────────────┘
|
|
287
|
+
• linear_regression(y, X) → Regresión lineal
|
|
288
|
+
• logistic_regression(y, X) → Regresión logística (clasificación)
|
|
289
|
+
• svm_classifier(y, X, kernel='rbf') → SVM classifier
|
|
290
|
+
• kmeans(n_clusters=3, columns=None) → K-Means clustering
|
|
291
|
+
|
|
292
|
+
┌────────────────────────────────────────────────────────────────────────────┐
|
|
293
|
+
│ 2. ⭐ DEEP LEARNING │
|
|
294
|
+
└────────────────────────────────────────────────────────────────────────────┘
|
|
295
|
+
• dense_network(input_dim, layers=[32,16], activation='relu') → Red densa
|
|
296
|
+
• cnn() → Red convolucional placeholder
|
|
297
|
+
|
|
298
|
+
┌────────────────────────────────────────────────────────────────────────────┐
|
|
299
|
+
│ 3. ⭐ VISIÓN ARTIFICIAL │
|
|
300
|
+
└────────────────────────────────────────────────────────────────────────────┘
|
|
301
|
+
• detect_edges(image, method='canny') → Detección de bordes
|
|
302
|
+
• image_features(image) → Histogramas y características básicas
|
|
303
|
+
|
|
304
|
+
┌────────────────────────────────────────────────────────────────────────────┐
|
|
305
|
+
│ 4. ⭐ NLP (Procesamiento del Lenguaje) │
|
|
306
|
+
└────────────────────────────────────────────────────────────────────────────┘
|
|
307
|
+
• tokenize(text) → Tokenización básica
|
|
308
|
+
• vectorize_tfidf(documents) → Vectorización TF-IDF
|
|
309
|
+
|
|
310
|
+
┌────────────────────────────────────────────────────────────────────────────┐
|
|
311
|
+
│ 5. ⭐ IA CLÁSICA │
|
|
312
|
+
└────────────────────────────────────────────────────────────────────────────┘
|
|
313
|
+
• a_star(start, goal, graph) → Búsqueda A* en grafos
|
|
314
|
+
• genetic_algorithm(fitness_fn, population_size=10, generations=20)
|
|
315
|
+
→ Algoritmo genético simple
|
|
316
|
+
|
|
317
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
318
|
+
|
|
319
|
+
💡 EJEMPLOS DE USO:
|
|
320
|
+
|
|
321
|
+
┌─ Inicialización ─────────────────────────────────────────────────────────┐
|
|
322
|
+
│ import pandas as pd │
|
|
323
|
+
│ from intelligence import Intelligence │
|
|
324
|
+
│ df = pd.read_csv('datos.csv') │
|
|
325
|
+
│ ai = Intelligence(df) │
|
|
326
|
+
└──────────────────────────────────────────────────────────────────────────┘
|
|
327
|
+
|
|
328
|
+
┌─ Machine Learning ───────────────────────────────────────────────────────┐
|
|
329
|
+
│ lr = ai.linear_regression(y='target', X=['feat1','feat2']) │
|
|
330
|
+
│ print(lr['coef_'], lr['intercept']) │
|
|
331
|
+
└──────────────────────────────────────────────────────────────────────────┘
|
|
332
|
+
|
|
333
|
+
┌─ Deep Learning ──────────────────────────────────────────────────────────┐
|
|
334
|
+
│ net = ai.dense_network(input_dim=3, layers=[8,4]) │
|
|
335
|
+
│ out = net['forward'](np.array([[1,2,3]])) │
|
|
336
|
+
└──────────────────────────────────────────────────────────────────────────┘
|
|
337
|
+
|
|
338
|
+
┌─ Visión ─────────────────────────────────────────────────────────────────┐
|
|
339
|
+
│ edges = ai.detect_edges(image) │
|
|
340
|
+
│ feats = ai.image_features(image) │
|
|
341
|
+
└──────────────────────────────────────────────────────────────────────────┘
|
|
342
|
+
|
|
343
|
+
┌─ NLP ────────────────────────────────────────────────────────────────────┐
|
|
344
|
+
│ tokens = ai.tokenize("Hola mundo") │
|
|
345
|
+
│ tfidf = ai.vectorize_tfidf(["texto 1","texto 2"]) │
|
|
346
|
+
└──────────────────────────────────────────────────────────────────────────┘
|
|
347
|
+
|
|
348
|
+
┌─ IA Clásica ─────────────────────────────────────────────────────────────┐
|
|
349
|
+
│ path = ai.a_star(start='A', goal='B', graph=graph_dict) │
|
|
350
|
+
│ best = ai.genetic_algorithm(fitness_fn=lambda x: -x**2) │
|
|
351
|
+
└──────────────────────────────────────────────────────────────────────────┘
|
|
352
|
+
|
|
353
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
354
|
+
|
|
355
|
+
🎯 CARACTERÍSTICAS CLAVE:
|
|
356
|
+
|
|
357
|
+
✓ ML, DL, visión, NLP e IA clásica integrados
|
|
358
|
+
✓ Métodos compatibles con estilo StatsLibX
|
|
359
|
+
✓ Salidas uniformes y fáciles de encadenar
|
|
360
|
+
✓ Implementación ligera y escalable
|
|
361
|
+
|
|
362
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
363
|
+
|
|
364
|
+
📚 DOCUMENTACIÓN ADICIONAL:
|
|
365
|
+
Para más información sobre métodos específicos, use:
|
|
366
|
+
help(Intelligence.nombre_metodo)
|
|
367
|
+
|
|
368
|
+
╚════════════════════════════════════════════════════════════════════════════╝
|
|
369
|
+
"""
|
|
370
|
+
print(help_text)
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: synaptix
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Librería de Inteligencia Artificial para Python (ML, DL, Visión, NLP, IA Clásica).
|
|
5
|
+
Home-page: https://github.com/Immanuel3008/SynaptIX
|
|
6
|
+
Author: Emmanuel Ascendra Perez
|
|
7
|
+
Author-email: ascendraemmanuel@gmail.com
|
|
8
|
+
Project-URL: Repositorio, https://github.com/Immanuel3008/SynaptIX
|
|
9
|
+
Project-URL: Reportar Bugs, https://github.com/Immanuel3008/SynaptIX/issues
|
|
10
|
+
Project-URL: Documentación, https://github.com/Immanuel3008/SynaptIX/wiki
|
|
11
|
+
Keywords: machine learning,deep learning,artificial intelligence,data science,computer vision,nlp,synaptixx
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Intended Audience :: Science/Research
|
|
15
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
16
|
+
Classifier: Topic :: Scientific/Engineering :: Mathematics
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Requires-Python: >=3.8
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
Requires-Dist: numpy>=1.20.0
|
|
26
|
+
Requires-Dist: pandas>=1.3.0
|
|
27
|
+
Requires-Dist: scipy>=1.7.0
|
|
28
|
+
Requires-Dist: matplotlib>=3.4.0
|
|
29
|
+
Provides-Extra: ml
|
|
30
|
+
Requires-Dist: scikit-learn>=1.0.0; extra == "ml"
|
|
31
|
+
Requires-Dist: statsmodels>=0.13.0; extra == "ml"
|
|
32
|
+
Provides-Extra: dl
|
|
33
|
+
Requires-Dist: tensorflow>=2.5.0; extra == "dl"
|
|
34
|
+
Provides-Extra: vision
|
|
35
|
+
Requires-Dist: opencv-python>=4.5.0; extra == "vision"
|
|
36
|
+
Provides-Extra: nlp
|
|
37
|
+
Requires-Dist: nltk>=3.6.0; extra == "nlp"
|
|
38
|
+
Requires-Dist: scikit-learn>=1.0.0; extra == "nlp"
|
|
39
|
+
Provides-Extra: viz
|
|
40
|
+
Requires-Dist: seaborn>=0.11.0; extra == "viz"
|
|
41
|
+
Requires-Dist: plotly>=5.0.0; extra == "viz"
|
|
42
|
+
Provides-Extra: all
|
|
43
|
+
Requires-Dist: scikit-learn>=1.0.0; extra == "all"
|
|
44
|
+
Requires-Dist: statsmodels>=0.13.0; extra == "all"
|
|
45
|
+
Requires-Dist: tensorflow>=2.5.0; extra == "all"
|
|
46
|
+
Requires-Dist: opencv-python>=4.5.0; extra == "all"
|
|
47
|
+
Requires-Dist: nltk>=3.6.0; extra == "all"
|
|
48
|
+
Requires-Dist: seaborn>=0.11.0; extra == "all"
|
|
49
|
+
Requires-Dist: plotly>=5.0.0; extra == "all"
|
|
50
|
+
Dynamic: author
|
|
51
|
+
Dynamic: author-email
|
|
52
|
+
Dynamic: classifier
|
|
53
|
+
Dynamic: description
|
|
54
|
+
Dynamic: description-content-type
|
|
55
|
+
Dynamic: home-page
|
|
56
|
+
Dynamic: keywords
|
|
57
|
+
Dynamic: project-url
|
|
58
|
+
Dynamic: provides-extra
|
|
59
|
+
Dynamic: requires-dist
|
|
60
|
+
Dynamic: requires-python
|
|
61
|
+
Dynamic: summary
|
|
62
|
+
|
|
63
|
+
📦 Descripción para PyPI (Plantilla Profesional)
|
|
64
|
+
|
|
65
|
+
StatsLibX es un paquete de Python diseñado para proporcionar una solución sencilla, eficiente y flexible para manejar volumenes de datos.
|
|
66
|
+
|
|
67
|
+
Este proyecto surge con la idea de ofrecer una alternativa moderna, intuitiva y ligera que permita a desarrolladores y entusiastas integrar la estadistica descriptiva e inferencial sin complicaciones, con multiples funcionalidades y utilidades pensadas para el futuro.
|
|
68
|
+
|
|
69
|
+
✨ Características principales
|
|
70
|
+
|
|
71
|
+
⚡ Rápido y eficiente: optimizado para ofrecer un rendimiento suave incluso en tareas exigentes.
|
|
72
|
+
|
|
73
|
+
🧩 Fácil de usar: una API limpia para que empieces en segundos.
|
|
74
|
+
|
|
75
|
+
🔧 Altamente extensible: personalízalo según tus necesidades.
|
|
76
|
+
|
|
77
|
+
📚 Documentación clara: ejemplos simples y prácticos.
|
|
78
|
+
|
|
79
|
+
🔮 Diseñado con visión a futuro: construido para escalar y adaptarse.
|
|
80
|
+
|
|
81
|
+
🚀 Ejemplo rápido
|
|
82
|
+
```python
|
|
83
|
+
from statslibx import DescriptiveStats, InferentialStats, UtilsStats
|
|
84
|
+
|
|
85
|
+
stats = DescriptiveStats(data) # InferentialStats(data), UtilsStats()
|
|
86
|
+
stats.help()
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
📦 Instalación
|
|
90
|
+
```bash
|
|
91
|
+
pip install statslibx
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
🤝 Contribuciones
|
|
95
|
+
|
|
96
|
+
¡Todas las mejoras e ideas son bienvenidas!
|
|
97
|
+
|
|
98
|
+
E-mail: ascendraemmanuel@gmail.com
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
numpy>=1.20.0
|
|
2
|
+
pandas>=1.3.0
|
|
3
|
+
scipy>=1.7.0
|
|
4
|
+
matplotlib>=3.4.0
|
|
5
|
+
|
|
6
|
+
[all]
|
|
7
|
+
scikit-learn>=1.0.0
|
|
8
|
+
statsmodels>=0.13.0
|
|
9
|
+
tensorflow>=2.5.0
|
|
10
|
+
opencv-python>=4.5.0
|
|
11
|
+
nltk>=3.6.0
|
|
12
|
+
seaborn>=0.11.0
|
|
13
|
+
plotly>=5.0.0
|
|
14
|
+
|
|
15
|
+
[dl]
|
|
16
|
+
tensorflow>=2.5.0
|
|
17
|
+
|
|
18
|
+
[ml]
|
|
19
|
+
scikit-learn>=1.0.0
|
|
20
|
+
statsmodels>=0.13.0
|
|
21
|
+
|
|
22
|
+
[nlp]
|
|
23
|
+
nltk>=3.6.0
|
|
24
|
+
scikit-learn>=1.0.0
|
|
25
|
+
|
|
26
|
+
[vision]
|
|
27
|
+
opencv-python>=4.5.0
|
|
28
|
+
|
|
29
|
+
[viz]
|
|
30
|
+
seaborn>=0.11.0
|
|
31
|
+
plotly>=5.0.0
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
synaptix
|