This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class LinearRegressor(Object): | |
def gradient_descent(self, x, y, alpha, max_iterations): | |
num_rows = x.shape[1] + 1 | |
w = np.array([random.random() for item in range(num_rows)]).reshape(num_rows,1) | |
best_weights = [] | |
lowest_cost = None | |
iter = 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
import pandas as pd | |
import numpy as np | |
import matplotlib.pyplot as plt | |
import autograd.numpy as np # Thinly-wrapped numpy | |
from autograd import grad as compute_grad # The only autograd function you may ever need | |
class learner(): | |
def __init__(self,**args): |
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
from scipy.stats import t | |
import numpy as np | |
def confidence_interval_for(samples=[], confidence=0.95): | |
sample_size = len(samples) | |
degrees_freedom = sample_size - 1 | |
outlier_tails = (1.0 - confidence) / 2.0 | |
t_distribution_number = -1 * t.ppf(outlier_tails, degrees_freedom) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
from scipy.stats import t | |
import numpy as np | |
def confidence_interval_for_collection(sample_size=[], standard_deviation=[], mean=[], confidence=0.95): | |
degrees_freedom = [count - 1 for count in sample_size] | |
outlier_tails = (1.0 - confidence) / 2.0 | |
confidence_collection = [outlier_tails for _ in sample_size] | |
t_distribution_number = [-1 * t.ppf(tails, df) for tails, df in zip(confidence_collection, degrees_freedom)] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def t_test_for(num_samples_1, standard_deviation_1, mean_1, num_samples_2, standard_deviation_2, mean_2, confidence=0.95): | |
alpha = 1 - confidence | |
total_degrees_freedom = num_samples_1 + num_samples_2 - 2 | |
t_distribution_number = -1 * t.ppf(alpha, total_degrees_freedom) | |
degrees_freedom_1 = num_samples_1 - 1 | |
degrees_freedom_2 = num_samples_2 - 1 | |
sum_of_squares_1 = (standard_deviation_1 ** 2) * degrees_freedom_1 | |
sum_of_squares_2 = (standard_deviation_2 ** 2) * degrees_freedom_2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Topic < ActiveRecord::Base | |
... | |
def applicable_formulas | |
[self, chapter, section, unit, *ancestors].compact.flat_map(&:formula_ids)/code> | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rails_helper' | |
RSpec.describe ReceiptDataSourceTransition do | |
describe "get_receipts" do | |
before do | |
Receipt.delete_all | |
end | |
it "gets similarly structured responses from both repository and service" do | |
#Subjects Under Test |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rails_helper' | |
RSpec.describe Repositories::ReceiptDataSource do | |
describe "get_receipts" do | |
before do | |
Receipt.delete_all | |
end | |
it "gets all receipts" do | |
@subject_under_test = Repositories::ReceiptDataSource.new |