Skip to content

Instantly share code, notes, and snippets.

View felipessalvatore's full-sized avatar

Felipe Salvatore felipessalvatore

View GitHub Profile
http://www.atmos.washington.edu/~dennis/MatrixCalculus.pdf
https://rdipietro.github.io/friendly-intro-to-cross-entropy-loss/
@felipessalvatore
felipessalvatore / adorno.py
Created March 24, 2017 11:17
This is one of my first programs
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:
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()
@felipessalvatore
felipessalvatore / eig.py
Last active December 21, 2016 19:14
Calculating eigenvalues and eigenvectors in numpy
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
@felipessalvatore
felipessalvatore / cosine.py
Created December 14, 2016 18:17
Calculating the cosine distance using scipy
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)
@felipessalvatore
felipessalvatore / tf_cl_iris.py
Created October 26, 2016 02:03
Multinomial logistic classifier applied to the iris dataset
#--------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
@felipessalvatore
felipessalvatore / open_image.py
Created October 25, 2016 13:27
Open an image in Jupyter notebook
from IPython.display import Image
Image(filename="nome do arquivo")
@felipessalvatore
felipessalvatore / ve_ba_cla.py
Created October 25, 2016 13:26
Very basic class creation in python
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):
@felipessalvatore
felipessalvatore / basic_pickle.py
Created October 25, 2016 13:25
Basic pickle manipulation in python
#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>saving
import pickle
a = 1
b = [23,4,4,22]
c = "Hello"
d = "Baby I got me"
e = 99999