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
from __future__ import division | |
import random | |
l = [0, 1, 2] | |
def generate_choice(): | |
choice = random.choice(l) | |
cross = random.choice(l) | |
show = random.choice(list(set(l) - {choice, cross})) |
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
from __future__ import division | |
import math | |
def func(x): | |
return 50 * math.sin(x) | |
x_args = [(2 * x * math.pi)/50 for x in range(51)] | |
y_args = [func(x) for x in x_args] | |
y_min, y_max = min(y_args), max(y_args) |
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
clc; clear; | |
%% train | |
data_train = load('Lab2_training.txt'); | |
x_train = data_train(:, 1:4)'; | |
y_train = data_train(:, 5:7)'; | |
%% test | |
data_test = load('Lab2_testing.txt'); | |
x_test = data_test(:, 1:4)'; | |
y_test = data_test(:, 5:7)'; |
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
from __future__ import division | |
import numpy as np | |
import math | |
n = 100000 | |
def probability(dim): | |
sums = (np.random.uniform(-1, 1, (n, dim)) ** 2).sum(axis=1) | |
return ((sums < 1).real.sum() / n) * (2.0 ** dim) |
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 | |
t = np.loadtxt('f2.txt') | |
def random_result(dim): | |
res = np.zeros(t.size, dtype=np.int8) | |
y = np.random.randint(0, dim[0], dim[1]) | |
x = np.arange(0, dim[1], dtype=np.int8) |
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
from __future__ import division | |
import numpy as np | |
import matplotlib.pyplot as plt | |
if __name__ == "__main__": | |
n = 10**6 | |
x_pos = np.zeros(n) | |
y_pos = np.zeros(n) |
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 | |
_gamma1d25 = 1.1330030963193471 | |
_gamma2d5 = 3.323350970447843 | |
_beta = 1.5 | |
_l = (_gamma2d5 * np.sin(np.pi * _beta / 2.0)) | |
_m = _gamma1d25 * _beta * pow(2.0, (_beta - 1.0) / 2.0) | |
_omega = np.power(_l / _m, 1 / _beta) |
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
from __future__ import division | |
from visual import * | |
import numpy as np | |
radS = 0.4 | |
radH = 0.4 | |
length = 100. | |
k = 0.5 | |
dt = 0.1 | |
n_balls = 52 |
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
from __future__ import division | |
import tweepy | |
import configparser | |
config = configparser.ConfigParser() | |
config.read('config.ini') | |
access_token_secret = config['TWEEPY']['access_token_secret'] | |
consumer_secret = config['TWEEPY']['consumer_secret'] | |
consumer_key = config['TWEEPY']['consumer_key'] |
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
from collections import defaultdict | |
class Context(object): | |
def __init__(self): | |
self._classes = {} | |
self._instances = {} | |
def feature(self, component_cls): |
OlderNewer