Skip to content

Instantly share code, notes, and snippets.

View mkozturk's full-sized avatar

Kaan Öztürk mkozturk

  • Kavaken (fulltime), Boğaziçi University (parttime)
  • Istanbul
  • X @mkozturk
View GitHub Profile
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
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
@mkozturk
mkozturk / Auto.csv
Created July 17, 2019 13:33
Automobile dataset for teaching purposes
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
@mkozturk
mkozturk / resample.py
Created May 3, 2019 06:51
Some functions that estimate confidence intervals and p-values using resampling methods
# 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
@mkozturk
mkozturk / bootstrap.py
Created April 28, 2019 20:51
A class to generate statistical estimates with bootstrapping
#!/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):
@mkozturk
mkozturk / yazitura.ipynb
Last active November 4, 2022 10:14
Yazı-tura atmak, p değeri ve büyük sayılar yasası
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mkozturk
mkozturk / regex.ipynb
Created December 12, 2013 13:52
Regular expression lecture
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.