Skip to content

Instantly share code, notes, and snippets.

View sotelo's full-sized avatar

Jose sotelo

  • Montréal
View GitHub Profile
@sotelo
sotelo / scatter.expectativas.R
Created April 2, 2014 18:41
Código para graficar un scatter de cualesquiera dos variables de una tabla en formato long. Incluye código para graficar medianas.
scatter.expectativas <- function(Variables, nombres = '', xmin = FALSE, obs = NA, reg = F)
{
Datos <-read.csv('Encuestas.csv')
Datos <- subset(Datos, Datos$Horizonte %in% Variables, drop = TRUE)
Datos$FechaEnc <- as.Date(sapply(Datos$FechaEncuesta, as.fecha))
if(xmin) Datos <- subset(Datos, Datos$FechaEnc >= xmin, drop = TRUE)
if(!is.na(obs)) Datos <- subset(Datos, Datos$FechaEnc %in% obs, drop = TRUE)
@sotelo
sotelo / mapa_estados.R
Created June 23, 2014 18:44
Mapa con datos de INEGI
# Paso 1.
# Descargar este archivo y extraer los contenidos en la carpeta XX
# http://mapserver.inegi.org.mx/MGN/mge2010v5_0a.zip
# Paso 2.
# Fijar el directorio de trabajo la carpeta XX en la que descargaste los archivos
setwd("d:/User Profiles/G13087/Documents/R/Mapas/INEGI/Estados")
# Paso 3.
@sotelo
sotelo / mapa_municipios.R
Created June 23, 2014 18:47
Municipios de Mexico con datos de INEGI.
# http://mapserver.inegi.org.mx/MGN/mge2010v5_0a.zip
setwd("d:/User Profiles/G13087/Documents/R/Mapas/INEGI/Municipios")
rm(list = ls())
require("rgdal")
require("maptools")
require("ggplot2")
require("plyr")
require("rgeos")
@sotelo
sotelo / main.py
Created February 11, 2015 18:06
CV HW1
# Jose Sotelo
# 2015
# Universite de Montreal
import matplotlib.pyplot as plt
import numpy as np
# x = np.linspace(0, 3*np.pi, 500)
# plt.plot(x, np.sin(x**2))
# plt.title('A simple chirp');
# plt.show()
@sotelo
sotelo / main.py
Last active August 29, 2015 14:17
phoneme extraction
# coding: utf-8
# In[ ]:
import re
import commands
import numpy as np
import scipy.io.wavfile
import itertools
@sotelo
sotelo / main.py
Last active August 29, 2015 14:20
A description of the problems I found with Aggregators.
import theano
import numpy
from numpy.testing import assert_allclose
from collections import OrderedDict
from fuel.datasets import IndexableDataset
from fuel.streams import DataStream
from fuel.schemes import SequentialScheme
from theano import tensor
@sotelo
sotelo / main.py
Created May 1, 2015 20:50
BN evaluation script
from theano import function
from blocks.bricks import MLP, Identity
from blocks.filter import VariableFilter
from blocks.initialization import Constant
from blocks.roles import INPUT
from blocks.utils import shared_floatx
from theano import function, tensor
from blocks.graph import ComputationGraph, apply_batch_normalization
import numpy
@sotelo
sotelo / simpler.py
Created May 18, 2015 15:45
Different behaviour in gpu and cpu.
import theano
import numpy
from collections import OrderedDict
from fuel.datasets import IndexableDataset
from fuel.streams import DataStream
from fuel.schemes import SequentialScheme
from theano import tensor
@sotelo
sotelo / variance_aggregation.py
Created May 18, 2015 17:18
Mean and Variance aggregation scheme.
from theano import tensor
from theano.ifelse import ifelse
from blocks.utils import shared_like
from blocks.monitoring.aggregation import AggregationScheme, Aggregator
class MeanAndVariance(AggregationScheme):
"""Aggregation scheme which computes the mean.
Parameters
----------
numerator : :class:`~tensor.TensorVariable`
@sotelo
sotelo / arbol.R
Created May 19, 2015 04:21
grafica arbol
library("igraph")
num_layer = 7
num_nodes = (num_layer+1)*num_layer/2
M <-matrix(rep(0,num_nodes*num_nodes),nrow=num_nodes,ncol=num_nodes)
layout <- matrix(rep(0, 2*num_nodes), nrow=num_nodes)
node = 0
for(layer in 1:num_layer){