Skip to content

Instantly share code, notes, and snippets.

View mikaelsouza's full-sized avatar
🐟
Working from home

Mikael Souza mikaelsouza

🐟
Working from home
View GitHub Profile
print("Hello World!")
@mikaelsouza
mikaelsouza / lc.ml
Created November 2, 2022 23:19 — forked from EduardoRFS/lc.ml
type term = Var of string | Lam of string * term | App of term * term
type value = Closure of ((string * value) list * string * term)
let rec eval env term =
match term with
| Var var -> List.assoc var env
| Lam (param, body) -> Closure (env, param, body)
| App (lambda, argument) -> (
let lambda = eval env lambda in
let argument = eval env argument in
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
MAX_SIZE = 3
device = torch.device('cpu')
# generating vocab
sentences = [
@mikaelsouza
mikaelsouza / hashmap.py
Last active January 13, 2020 20:43
Implementação de um HashMap simples em Python
class HashMap(object):
def __init__(self, bucket_size=10):
self.bucket_size = bucket_size
self.buckets = [None] * self.bucket_size
def insert(self, key, value):
hashed_key = hash(key)
bucket_index = hashed_key % self.bucket_size
self.buckets[bucket_index] = value
import warnings
import math
from functools import reduce
import collections
from collections import defaultdict
import numpy as np
from keras.datasets import mnist
from sklearn.tree import DecisionTreeClassifier
from sklearn.preprocessing import KBinsDiscretizer
from math import log2
import numpy as np
import sklearn.datasets as datasets
from keras import layers, models, utils
def main():
# Loading dataset
boston_dataset = datasets.load_boston()
# Defining inputs and outputs of the neural network