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
""" | |
RC.py | |
Implements a Reservoir Computer (RC), also known as an Echo State Network (ESN), | |
for modeling and predicting nonlinear dynamical systems. | |
Key features: | |
- Fixed, sparse reservoir with random weights | |
- Only the output weights are trained via ridge regression | |
- Suitable for chaotic systems like Lorenz, Rössler, Mackey-Glass |
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
# sample names | |
name_01 = "Ria Arora" | |
name_02 = "John Mathew Appleseed" | |
name_03 = "Kumar Anurag" | |
# for getting indices of name-initials | |
def get_initals_index(name): | |
initials_index_list = [0] | |
for i,v in enumerate(name): | |
if v == ' ': |
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
## Bitwise NOT(~) in Python | |
a = 12 | |
print ("Bitwise NOT on 12 = ",~a) | |
''' | |
[1] Bitwise NOT on Positive Numbers (in Python): | |
a = 12 |
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 time import sleep | |
import threading | |
import time | |
class RepeatedTimer(object): | |
def __init__(self, interval, function, *args, **kwargs): | |
self._timer = None | |
self.interval = interval | |
self.function = function | |
self.args = 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
def int_to_en(num): | |
d = { 0 : 'zero', 1 : 'one', 2 : 'two', 3 : 'three', 4 : 'four', 5 : 'five', | |
6 : 'six', 7 : 'seven', 8 : 'eight', 9 : 'nine', 10 : 'ten', | |
11 : 'eleven', 12 : 'twelve', 13 : 'thirteen', 14 : 'fourteen', | |
15 : 'fifteen', 16 : 'sixteen', 17 : 'seventeen', 18 : 'eighteen', | |
19 : 'nineteen', 20 : 'twenty', | |
30 : 'thirty', 40 : 'forty', 50 : 'fifty', 60 : 'sixty', | |
70 : 'seventy', 80 : 'eighty', 90 : 'ninety' } | |
k = 1000 | |
m = k * 1000 |
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
Enter any number: 156 | |
Prime Factors of a: [2, 2, 3, 13] |
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
number = int(input("Enter the no that you want to search in list: ")) | |
l = [1,2,3,1,5,44,1,1,-10,1,1] | |
number_index = -1 | |
print("All occurences (index position) of a number in list:") | |
for i in range(l.count(number)): | |
if i == 0: |
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 scipy.stats import chi2_contingency | |
from scipy.stats import chi2 | |
def chi_test(): | |
''' | |
Output | |
1. stat: Float | |
2. dof : Integer | |
3. p_val: Float | |
4. res: String |
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 scipy import stats | |
import math | |
def poisson(): | |
''' | |
output: ans : Float | |
''' | |
#Write your code here | |
#Assign the probability value to the variable ans | |
#Round off to 2 decimal places |
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 scipy import stats | |
def binomial(): | |
''' | |
output: ans : Float | |
''' | |
#Write your code here | |
#Assign the probability value to the variable ans | |
#Round off to 2 decimal places | |
n = 4 |
NewerOlder