Skip to content

Instantly share code, notes, and snippets.

View gabriel19913's full-sized avatar
🏠
Working from home

Gabriel Aparecido Fonseca gabriel19913

🏠
Working from home
View GitHub Profile
from sklearn.decomposition import PCA
pca = PCA(15, random_state = seed)
pca.fit(scaled_X)
variance = pca.explained_variance_ratio_
var=np.cumsum(np.round(pca.explained_variance_ratio_, decimals=7)*100)
import matplotlib.pyplot as plt
import seaborn as sns
plt.figure(figsize=(10,10))
sns.set(font_scale=1.5)
ax=sns.heatmap(df.corr(), cmap = "RdBu_r")
bottom, top = ax.get_ylim()
ax.set_ylim(bottom + 0.5, top - 0.5)
plt.tight_layout()
plt.savefig('pearson.png')
from sklearn.preprocessing import StandardScaler
scaler = StandardScaler()
scaled_X = scaler.fit_transform(X)
Collecting bottleneck
Using cached https://files.pythonhosted.org/packages/05/ae/cedf5323f398ab4e4ff92d6c431a3e1c6a186f9b41ab3e8258dff786a290/Bottleneck-1.2.1.tar.gz
Requirement already satisfied: numpy in c:\users\gabri\anaconda3\lib\site-packages (from bottleneck) (1.16.0)
Building wheels for collected packages: bottleneck
Building wheel for bottleneck (setup.py) ... error
ERROR: Complete output from command 'C:\Users\gabri\Anaconda3\python.exe' -u -c 'import setuptools, tokenize;__file__='"'"'C:\\Users\\gabri\\AppData\\Local\\Temp\\pip-install-6t52qrhz\\bottleneck\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\gabri\AppData\Local\Temp\pip-wheel-jglc7sxb' --python-tag cp37:
ERROR: running bdist_wheel
running build
running build_py
creating build
@gabriel19913
gabriel19913 / condaenv.txt
Created May 24, 2019 16:50 — forked from pratos/condaenv.txt
To package a conda environment (Requirement.txt and virtual environment)
# For Windows users# Note: <> denotes changes to be made
#Create a conda environment
conda create --name <environment-name> python=<version:2.7/3.5>
#To create a requirements.txt file:
conda list #Gives you list of packages used for the environment
conda list -e > requirements.txt #Save all the info about packages to your folder
from sklearn.datasets import load_wine
from sklearn.utils import shuffle
import numpy as np
from sklearn.model_selection import KFold
from sklearn.preprocessing import scale
from sklearn import tree
from sklearn.metrics import accuracy_score
from sklearn.model_selection import cross_val_score
from sklearn.metrics import accuracy_score
clear all
clc
x1 = -0.25 + 0.08 * randn(1, 10);
x2 = 0.5 + 0.08 * randn(1, 10);
C1 = [x1;x2];
x1 = 0.7 + 0.08 * randn(1, 10);
x2 = 0.25 + 0.08 * randn(1, 10);
C2 = [x1;x2];
C1 = np.random.multivariate_normal(np.array([5, 5]), np.array([[1, 0],[0, 1]]), 500)
C2 = np.random.multivariate_normal(np.array([0, 0]), np.array([[1, 0],[0, 1]]), 500)
data1 = pd.DataFrame({'X1':C1[:,0],'X2':C1[:,1]})
data1['Class'] = np.full((500, 1), 'C1')
data2 = pd.DataFrame({'X1':C2[:,0],'X2':C2[:,1]})
data1['Class'] = np.full((500, 1), 'C2')
data = pd.concat([data1, data2], sort=True)
%%time
#Importing libraries
import pandas as pd
import json as JSON
from json import load
import numpy as np
import requests
import matplotlib.pyplot as plt
import seaborn as sns
import time
rom selenium import webdriver
from bs4 import BeautifulSoup
import csv
browser = webdriver.Chrome('C:\\Users\\100pau\\workspace\\chromedriver.exe')
browser.get('https://www.centauro.com.br/capacete-peels-mirage-storm-preto-e-verde-fosco-m00w4e-mktp.html?cor=34')
html = browser.execute_script("return document.getElementsByTagName('html')[0].innerHTML")
soup = BeautifulSoup(html, 'html.parser')