This file contains 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 integrate(t1, t2, t, y): | |
"""Integral (area under the curve) of a piecewise constant function. | |
Parameters | |
---------- | |
t1 : int or float | |
beginning of the interval | |
t2 : int or float | |
end of the interval. Greater than or equal to t1. | |
t : array-like |
This file contains 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 merge_intervals(intervals): | |
# Input parameter intervals should be a list of tuples of (start, end) times | |
# Step 1: Sort the intervals by their starting times | |
intervals.sort(key=lambda x: x[0]) | |
# Step 2: Initialize an empty list for merged intervals | |
merged = [] | |
# Step 3: Loop through each interval in the sorted list |
This file contains 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
mpg | cylinders | displacement | horsepower | weight | acceleration | year | origin | name | |
---|---|---|---|---|---|---|---|---|---|
18 | 8 | 307 | 130 | 3504 | 12 | 70 | 1 | chevrolet chevelle malibu | |
15 | 8 | 350 | 165 | 3693 | 11.5 | 70 | 1 | buick skylark 320 | |
18 | 8 | 318 | 150 | 3436 | 11 | 70 | 1 | plymouth satellite | |
16 | 8 | 304 | 150 | 3433 | 12 | 70 | 1 | amc rebel sst | |
17 | 8 | 302 | 140 | 3449 | 10.5 | 70 | 1 | ford torino | |
15 | 8 | 429 | 198 | 4341 | 10 | 70 | 1 | ford galaxie 500 | |
14 | 8 | 454 | 220 | 4354 | 9 | 70 | 1 | chevrolet impala | |
14 | 8 | 440 | 215 | 4312 | 8.5 | 70 | 1 | plymouth fury iii | |
14 | 8 | 455 | 225 | 4425 | 10 | 70 | 1 | pontiac catalina |
This file contains 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
# Statistical estimation based on resampling | |
# TO DO: Detailed docstrings | |
# TO DO: Make a repo with detailed usage examples. | |
import numpy as np | |
# Estimate the confidence interval for a statistic on a given data. | |
def ci_est(data, statistic="mean", nsamples=100, samplesize=None, | |
confidencelevel=0.95, method="bootstrap"): | |
data = np.array(data) # 1d array |
This file contains 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
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
""" | |
Created on Sat Apr 27 22:23:16 2019 | |
@author: kaan | |
""" | |
import numpy as np | |
class Bootstrap: | |
def __init__(self): |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.