Skip to content

Instantly share code, notes, and snippets.

View juliobguedes's full-sized avatar
:bowtie:
I am definitely a mad man with a box (of coding tools)

Júlio Guedes juliobguedes

:bowtie:
I am definitely a mad man with a box (of coding tools)
View GitHub Profile
@juliobguedes
juliobguedes / notes.py
Last active May 14, 2021 18:41
Script to generate and check notes of major and minor acoustic fields
names = [
'A', 'A#', 'B', 'C', 'C#', 'D',
'D#', 'E', 'F', 'F#', 'G', 'G#'
]
name2int = { n:i for i, n in enumerate(names) }
class Note(object):
def __init__(self, name, major=True) -> None:
super().__init__()
corr = train.corr(method='spearman')
mask = np.zeros_like(corr)
mask[np.triu_indices_from(mask)] = True
fig, ax = plt.subplots()
ax.figure.set_size_inches(10, 10)
sns.heatmap(corr, ax=ax, annot=True, mask=mask, fmt='.2f', cbar=False, square=True, cmap=plt.cm.Blues, center=0)
1 Physical GPUs, 1 Logical GPU
> Preprocessing Spotify dataset. This process may take several hours.
>> Checking if the Spotify MPD is already preprocessed.
>> Preprocessed version was found. Skipping stage.
> Loading Spotify MPD dataset.
>> Dataset loaded.
> Splitting dataset
>> Sampling 10% of dataset
>> Splitting sample with 20% for testing
>> Creating Vocab.
> Preprocessing Spotify dataset. This process may take several hours.
>> Checking if the Spotify MPD is already preprocessed.
>> Preprocessed version was found. Skipping stage.
> Loading Spotify MPD dataset.
>> Dataset loaded.
> Splitting dataset
>> Sampling 1% of dataset
>> Splitting sample with 20% for testing
>> Creating Vocab.
> Building tensorflow datasets.
# (C) Júlio Guedes
# ATAL 2019.2
letters = input()
hello = "hello"
pointer = 0
for l in letters:
if pointer < len(hello):
if (l == hello[pointer]):
dtree_parameters = {
'max_depth': [12, 24, 36, 50],
'min_samples_leaf': [5, 10, 15, 25],
'max_features': ['sqrt', 'log2', None],
'max_leaf_nodes': [50, 100, 175, 250]
}
decision_tree_model = DTree()
decision_tree = GSearchCV(decision_tree_model, dtree_parameters, cv=5, n_jobs=-1, scoring=acc, verbose = 10)
decision_tree.fit(rntr, ry_train)
best_tree = decision_tree.best_estimator_
from sklearn.metrics import confusion_matrix
from sklearn.utils.multiclass import unique_labels
import itertools
def plot_confusion_matrix(cm, classes, normalize=False, title='Confusion matrix',
cmap=plt.cm.get_cmap('Blues'), figsize=None, savefig=None):
# Função importada dos exemplos do SKLearn
if normalize:
cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]
@juliobguedes
juliobguedes / clima_cg_jp-semanal.csv
Created April 23, 2019 13:11
Dados de clima em CG e JP
cidade semana tmedia tmax tmin chuva mes ano
Campina Grande 1992-12-27T00:00:00Z 26.133333333333333 30.4 20.7 0 12 1992
Campina Grande 1993-01-03T00:00:00Z 26.11904761904762 32.4 19.3 0 1 1993
Campina Grande 1993-01-10T00:00:00Z 25.766666666666666 32.2 19.7 0 1 1993
Campina Grande 1993-01-31T00:00:00Z 25.74 32 19.9 0.4 1 1993
Campina Grande 1993-02-07T00:00:00Z 26.314285714285713 32.7 19.6 0.3 2 1993
Campina Grande 1993-02-14T00:00:00Z 26.285714285714285 32.7 20 0 2 1993
Campina Grande 1993-02-21T00:00:00Z 26.47142857142857 32.3 20.4 4.9 2 1993
Campina Grande 1993-02-28T00:00:00Z 26.566666666666666 32.3 21.2 0 2 1993
Campina Grande 1993-10-31T00:00:00Z 25.766666666666666 32.1 19 0 10 1993
@juliobguedes
juliobguedes / website_diff.py
Created September 23, 2018 17:04
Simple code that checks for changes in a website's HTML
# coding: utf-8
# (C) Júlio Barreto
# 22/09/2018
'''
Script to monitor any website's HTML changes
'''
import urllib2, smtplib
from getpass import getpass
from time import sleep
@juliobguedes
juliobguedes / InputField.js
Last active March 18, 2020 18:13
React Native Formik testing
import React from 'react';
import { View } from 'react-native';
import { Input } from 'react-native-elements';
type Props = {
placeholder: string,
value: string,
onChangeText: () => void,
errors: string,
password: boolean