Skip to content

Instantly share code, notes, and snippets.

View toniesteves's full-sized avatar

Toni Esteves toniesteves

View GitHub Profile
@toniesteves
toniesteves / knn_impute.py
Created May 17, 2020 19:30 — forked from YohanObadia/knn_impute.py
Imputation of missing values with knn.
import numpy as np
import pandas as pd
from collections import defaultdict
from scipy.stats import hmean
from scipy.spatial.distance import cdist
from scipy import stats
import numbers
def weighted_hamming(data):
@toniesteves
toniesteves / artists_releases_spec.rb
Created February 11, 2018 00:42 — forked from stuliston/artists_releases_spec.rb
Testing HABTM with rspec and factory girl
require 'spec_helper'
describe "Artists to releases relationship" do
before(:all) do
@kanye = FactoryGirl.create(:artist, :name => 'Kanye West')
@jz = FactoryGirl.create(:artist, :name => 'Jay Z')
@watch_the_throne = FactoryGirl.create(:release, :name => 'Watch the Throne')
@dropout = FactoryGirl.create(:release, :name => 'The College Dropout')
end
@toniesteves
toniesteves / alias_matchers.md
Created August 22, 2017 13:51 — forked from JunichiIto/alias_matchers.md
List of alias matchers in RSpec 3

This list is based on aliases_spec.rb.

You can see also Module: RSpec::Matchers API.

matcher aliased to description
a_truthy_value be_truthy a truthy value
a_falsey_value be_falsey a falsey value
be_falsy be_falsey be falsy
a_falsy_value be_falsey a falsy value
@toniesteves
toniesteves / album_spec.rb
Created March 20, 2017 17:41 — forked from IPrism/album_spec.rb
Example for testing mongoid assocications with Rspec
require 'spec_helper'
describe Album do
before(:all) do
@album = Factory.build(:album)
@website = @album.website
end
it "should be valid" do
@album.should be_valid
end