This file contains hidden or 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
#Num momento do Assigment 1 precisei comparar duas arrays de arrays | |
#com um número grande de elementos. Fazer um loop duplo é custoso demais. | |
#Uma saida que achei no forum foi usar o hash do python. Assim, geramos um | |
#código único para cada array e comparamos os códigos e não as arrays. | |
#exemplo: | |
import hashlib | |
a = np.arrange([np.arrange([1,2]),np.arrange([2,2]), np.arrange([3,2])]) | |
b = np.arrange([np.arrange([1,2]),np.arrange([2,222]), np.arrange([3333,2])]) |
This file contains hidden or 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 matplotlib | |
import numpy as np | |
import matplotlib.cm as cm | |
import matplotlib.mlab as mlab | |
import matplotlib.pyplot as plt | |
%matplotlib inline | |
features = np.array([0.8,0.9,1.0,1.1,1.4,\ |
This file contains hidden or 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
#APPLIED TO THE IRIS DATASET | |
import matplotlib.pyplot as plt | |
import numpy as np | |
import scipy as sp | |
import os | |
from sklearn.linear_model import LogisticRegression | |
from six.moves import cPickle as pickle | |
from sklearn.datasets import load_iris | |
%matplotlib inline |
This file contains hidden or 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 matplotlib.pyplot as plt | |
import numpy as np | |
import scipy as sp | |
import os | |
from sklearn.linear_model import LogisticRegression | |
from six.moves import cPickle as pickle | |
from sklearn.datasets import load_iris | |
%matplotlib inline |
This file contains hidden or 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 random | |
import numpy as np | |
import matplotlib.pyplot as plt | |
from pylab import norm | |
class BasicNN: | |
bias = 0.5 | |
weights = [] | |
This file contains hidden or 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
#SOFTMAX FUNCTION | |
import matplotlib.pyplot as plt | |
import numpy as np | |
import scipy as sp | |
import os | |
from sklearn.linear_model import LogisticRegression | |
from six.moves import cPickle as pickle | |
from sklearn.datasets import load_iris | |
%matplotlib inline |
This file contains hidden or 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
#ARRAY TRANSFORMATION | |
import numpy as np | |
#o melhor modo de transformar uma lista de matrizes n x n | |
# em uma lista de listas de tamanho n*n eh | |
def reformat(lista,n): | |
lista = lista.reshape((-1, n*n)).astype(np.float32) |
This file contains hidden or 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
#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>saving | |
import pickle | |
a = 1 | |
b = [23,4,4,22] | |
c = "Hello" | |
d = "Baby I got me" | |
e = 99999 |
This file contains hidden or 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 Conta: | |
#Exemplo mais simples de classe" | |
#Como inicialiar o objeto de uma classe" | |
def __init__(self): | |
self.data = [] | |
self.saldo = 2200 | |
self.ano = 2016 | |
self.nome = "Felipe" | |
def f(self,z): |
This file contains hidden or 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 IPython.display import Image | |
Image(filename="nome do arquivo") |
OlderNewer