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
#--------TENSORFLOW------------- | |
#MULTINOMIAL LOGISTIC CLASSIFIER | |
#APPLIED TO THE IRIS DATASET | |
import matplotlib.pyplot as plt | |
import numpy as np | |
import tensorflow as tf | |
import scipy as sp | |
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 numpy as np | |
import scipy.spatial as ss | |
u = np.array([1,2,3]) | |
u1 = np.array([1,2,3]) | |
v = np.array([2,3,-4]) | |
a = ss.distance.cosine(u, v) | |
a1 = ss.distance.cosine(u, u1) |
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 numpy as np | |
from numpy import linalg as la | |
a = np.array([[3,1,1],[-1,3,1]],dtype='float32') | |
b = np.matmul(a,a.T) | |
eivalues, eivectors =la.eig(b) | |
#CAREFUL : the match is between the list | |
#of eigenvectors.T and eigenvalues |
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 smtplib | |
from email.MIMEMultipart import MIMEMultipart | |
from email.MIMEText import MIMEText | |
from email.MIMEBase import MIMEBase | |
from email import encoders | |
fromaddr = "YOUR EMAIL" | |
toaddr = "EMAIL ADDRESS YOU SEND TO" | |
msg = MIMEMultipart() |
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
x = float(input('Digite um número qualquer (positivo ou negativo): ')) | |
y = str(input('Digite um substantivo precedido de seu artigo definido: ')) | |
z = str(input('Digite um predicado que concorde em número e gênero com o substantivo: ')) | |
if x > 0: | |
w = "Na sociedade dominada pela indústria cultural, " | |
k = "instante único" | |
u = " em si" | |
l = " Benjamin " | |
elif x < 0: |
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
https://rdipietro.github.io/friendly-intro-to-cross-entropy-loss/ |
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
http://www.atmos.washington.edu/~dennis/MatrixCalculus.pdf |
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 tracemalloc | |
tracemalloc.start() | |
# ... run your application ... | |
snapshot = tracemalloc.take_snapshot() | |
top_stats = snapshot.statistics('lineno') | |
print("[ Top 10 ]") |
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 numpy as np | |
import random | |
import unittest | |
from math import isnan | |
def softmax(x): | |
""" | |
Compute the softmax function for each row of the input x. | |
It is crucial that this function is optimized for speed because |
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
#code adapted from http://tillbergmann.com/blog/python-gradient-descent.html | |
%matplotlib inline | |
import numpy as np | |
import seaborn as sns | |
import matplotlib.pyplot as plt | |
import matplotlib.animation as animation | |
from scipy import stats | |
from sklearn.datasets.samples_generator import make_regression |