Skip to content

Instantly share code, notes, and snippets.

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

Émerson Silva SilvaEmerson

🏠
Working from home
View GitHub Profile
"""
Stratified K-Fold implementation
"""
def stratified_k_fold(arr, k=None, class_ratio=.5):
if k == None:
return None
number_elements_fold = len(arr) // k
folds = [[]] * k
import time
import random
comparison_num = 0
class Quick(object):
def particao(self, a, ini, fim):
global comparison_num
comparison_num += 1
pivo = a[fim-1]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@SilvaEmerson
SilvaEmerson / Curry.py
Last active October 21, 2024 12:46
Currying in Python
from inspect import signature
def get_params_len(fn): return len(signature(fn).parameters)
def curry(fn):
fn_params_len = get_params_len(fn)
temp_params = []
#include <iostream>
#include <vector>
using namespace std;
vector<int> numbers;
typedef struct node {
struct node *left;
struct node *rigth;
@SilvaEmerson
SilvaEmerson / ImageProcessing.ipynb
Last active August 24, 2018 20:21
Scikit-Image demo
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
public class Main {
public static void main(String[] args){
Process processo1 = new Process("Processo1");
Process processo2 = processo1.fork("Processo2");
System.out.println("Processo 1 UID: " + processo1.getOwner());
System.out.println("Processo 2 UID: " + processo2.getOwner());
System.out.println("Data de criação do Processo 1: " + processo1.getCreationDateTime());
System.out.println("Data de criação do Processo 2: " + processo1.getCreationDateTime());
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import tensorflow as tf
import numpy as np
X_train, X_test = np.load('X_train.npy'), np.load('X_test.npy')
Y_train, Y_test = np.load('Y_train.npy'), np.load('Y_test.npy')
Y_train, Y_test = tf.keras.utils.to_categorical(Y_train, num_classes=4), tf.keras.utils.to_categorical(Y_test, num_classes=4)
features_num = len(X_train[0])
l1 = 50