This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import re | |
import unicodedata | |
''' | |
listado de palabras que quiero descartar | |
''' | |
pal_comunes = ['los','las','sin','con','tan','por'] | |
lista_categorias = ['lacteos','comestibles','auto','hogar'] | |
lista_productos = ['leche','huevo','aceite','yerba'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Download stories of a Pivotal Tracker project. | |
You need the project ID (an int) and your API token. The latter can be | |
obtained in ``https://www.pivotaltracker.com/profile``, or using curl:: | |
$ curl -u username:password -X GET https://www.pivotaltracker.com/services/v3/tokens/active | |
""" | |
import getpass | |
import pickle |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Merge sort in C */ | |
#include<stdio.h> | |
#include<stdlib.h> | |
// Function to Merge Arrays L and R into A. | |
// lefCount = number of elements in L | |
// rightCount = number of elements in R. | |
void Merge(int *A,int *L,int leftCount,int *R,int rightCount) { | |
int i,j,k; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
struct Base1 | |
{ | |
virtual void hola() = 0; | |
}; | |
struct Base2 | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def classify_elements(dataset, interest_key, classifications_number): | |
""" | |
This function tries to classify a set of continuous features from a | |
dataset into a | |
""" | |
keys = dataset.keys() | |
if interest_key not in keys: | |
print 'The feature is not in the dataset' | |
return | |
count_elements = len(dataset) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
""" | |
Random HAL9000 quotes generator. Quotes are taken from quotes.hal file. | |
""" | |
from random import randint | |
class bcolors: | |
HEADER = '\033[95m' | |
OKBLUE = '\033[94m' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
class DirectTransformer: | |
"""Utility for building class-like features from a single-point function, but that may need | |
some general configuration first (you usually override __init__ for that) | |
""" | |
def fit(self, X, y=None): | |
return self |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
class OneHotTransformer: | |
def __init__(self, func): | |
self.f = func | |
def fit(self, X, y=None): | |
unseen = object() | |
seen = set() | |
for x in X: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sklearn.feature_extraction.text import CountVectorizer | |
class ProjectionCountVectorizer(CountVectorizer): | |
def __init__(self, projection_path, *args, **kwargs): | |
self.projection_path = projection_path.split('/') | |
super().__init__(*args, **kwargs) | |
def build_preprocessor(self): | |
built = super().build_preprocessor() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Singleton(object): | |
_instances = {} | |
def __new__(class_, *args, **kwargs): | |
if class_ not in class_._instances: | |
class_._instances[class_] = super(Singleton, class_).__new__(class_, *args, **kwargs) | |
return class_._instances[class_] | |
class MyClass(Singleton): | |
pass |
OlderNewer