simple-tensorflow
v1.0.14
Published
Simplificación de la libreria tensorflow.js para que sea mas facil de usar.
Downloads
6
Maintainers
Readme
Un npm que simplifica bastante la libreria tensorflow.js.
Instalación
Antes de instalarlo, debe tener instalado Node.js y Python 2.7 La instalación se realiza mediante el comando de instalación npm:
$ npm install simple-tensorflow --save
Características
- Reducción de dificultad para crear una red neuronal
- Separación de las capas
- User-Friendly
- Entrenamiento Rapido
Conceptos Basicos
- Las capas son la estructura del cerebro de la red neuronal,la primera capa de los modelos siempre debe llevar la dimensión del input
- Las perdidas son diferentes funciones para evaluar que tan bien/mal lo esta haciendo la red neuronal,la mejor depende para que se este utilizando.
- Los optimizadores son la manera en la que la red neuronal se adapta a los datos.
Opciones Modelo
Perdida
- meanSquaredError
- meanAbsoluteError
- meanAbsolutePercentageError
- meanSquaredLogarithmicError
- squaredHinge
- hinge
- categoricalHinge
- logcosh
- categoricalCrossentropy
- sparseCategoricalCrossentropy
- binaryCrossentropy
- kullbackLeiblerDivergence
- poisson
- cosineProximity
Optimizadores
- sgd
- momentum
- adagrad
- adadelta
- adam
- adamax
- rmsprop
Opciones
- iteraciones: Numero de veces que la red aprendera los datos.
- aleatorio: Esto indicara si se cambiara el orden de los datos.
- logs: Numero del 0 al 2 que indicara cuanta información se dara en cada entrenamiento por medio de la consola.
Capas
- Dense
- BatchNormalization
- Reshape
- Conv2D
Configuración de las capas
Cada capa puede tener una configuración diferente pero esta es la configuración que suelen tener todas
- neuronas
- activacion
- entrada
Activaciones
Las capas necesitan una función de activación para funcionar correctamente
- elu
- hardSigmoid
- linear
- relu
- relu6
- selu
- sigmoid
- softmax
- softplus
- softsign
- tanh
- swish
- mish
Ejemplos
Ejemplo 1: XOR Basico
const neural = require('simple-tensorflow')
let capa1 = new neural.Dense({neuronas:2,entrada:2})
let capa2 = new neural.Dense({neuronas:1})
const modelo = new neural.Modelo([capa1,capa2],'meanSquaredError','sgd')
let datosx = [[1,1],[1,0],[0,1],[0,0]]
let datosy = [0,1,1,0]
modelo.entrenar(datosx,datosy,{
iteraciones:5,
aleatorio:true
}).then(() => {
let entrada = [[1,1]]
let resultado = modelo.predecir(entrada)
console.log(resultado) //Si usaste [1,1] o [0,0] al ser un XOR debe darte un numero cercano a 0 pero si usaste [1,0] o [0,1] debe darte un numero cercano a 1
})
Creado por: Discord Safe