Skip to content

Instantly share code, notes, and snippets.

View JhonatanHern's full-sized avatar
🎯
Focusing

Jhonatan JhonatanHern

🎯
Focusing
View GitHub Profile
const fs = require('fs').promises
const moduleFolders = ['defs', 'lib', 'rpc', 'storage', 'storage_consts']
const findOffenders = async fileArray => {
const offenders = []
for (let index = 0; index < fileArray.length; index++) {
const file = fileArray[index]
const data = (await fs.readFile(file)).toString()
if (data[0]!=='/'){
const {
getDNA,
buildConfig,
buildRunner,
} = require('../init')
const runner = buildRunner()
const config = buildConfig({
proposal: getDNA('proposal'),
##
#
# System mutations entrypoint
#
# Conventions for all operations are as follows:
# - input record data is provided in named sub-fields of the request & response
# - the sub-field ID is the lower camelCase name of the record type
#
# CREATE:
# - fields which are required by the record are required in input parameters
#https://archive.ics.uci.edu/ml/datasets/Post-Operative+Patient
library(neuralnet)
library(dplyr)
read.table('post-operative.data',sep=',') -> po
randomized_data <- sample_frac(po,1)
training <- randomized_data[1:79,]
testd <- randomized_data[80:90,]
- - - - - - - - - - - - - - - - - Particionamiento
Se suelen usar distancias estilo euclideana, Manhattan o Minkowski.
Se generan particiones (asignar etiquetas a un area) similares a "nubes"
Cada nube tiene un "centroide"
Se usan dos distancias:
Distancia Inte-cluster
Distancia Intra-cluster
Un algoritmo usado es el de k-means. Este requiere una función para sacar el promedio de un conjunto de observaciones y
@JhonatanHern
JhonatanHern / Clusters
Last active September 17, 2019 19:09
Clusterización:
Detección de grupos en datasets mediante distancias multidimensionales
Tipos de algoritmos para cálculo de distancia según tipo de variables:
------------------------------ Numérica (con números)
( (x11-x12)**2 + (x21-x22)**2 + ... + (xn1-xn2)**2 )**(1/2) # Euclideana
|x11-x12| + ... + |xn1-xn2| # Manhattan
#[macro_use]
extern crate hdk;
extern crate serde;
#[macro_use]
extern crate serde_derive;
extern crate serde_json;
#[macro_use]
extern crate holochain_json_derive;
const path = require('path')
const tape = require('tape')
const { Diorama, tapeExecutor, backwardCompatibilityMiddleware } = require('@holochain/diorama')
process.on('unhandledRejection', error => {
// Will print "unhandledRejection err is not defined"
console.error('got unhandledRejection:', error);
})
@JhonatanHern
JhonatanHern / irisClasificator.R
Created July 5, 2019 22:11
Neural network used for clasification with the iris dataset
library(neuralnet)
library(dplyr)
random.iris <- sample_frac(iris,1)
miris <- random.iris[1:105,]
testd <- random.iris[106:150,]
miris <- mutate(miris,
setosa = Species == "setosa",
@JhonatanHern
JhonatanHern / basicNN.R
Created July 2, 2019 21:42
Basic Neural Network
library(neuralnet)
# creating training data set
TKS= c(20,10,30,20,80,30,90,99,99,40,12,32)
CSS= c(90,20,40,50,50,80,90,99,99,10,20,30)
Placed=c(1 ,0 ,0 ,0 ,1 ,1 ,1 ,1 ,1 ,0 ,0 ,0)
df=data.frame(TKS,CSS,Placed)
nn=neuralnet(Placed~TKS+CSS,data=df, hidden=3, act.fct = "logistic", linear.output = FALSE)