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
| ### PROGRAMMING FIBONACCI NUMBERS FROM BEGINNER TO EXPERT | |
| ### Method: 1 | |
| print('Method: 1') | |
| def fibonacci(no): | |
| series = [1,1] | |
| for _ in range(1, no-1): | |
| series.append(series[-1] + series[-2]) | |
| return series |
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.spatial.distance import euclidean | |
| from collections import Counter | |
| class KNeighborsClassifier: | |
| def __init__(self, k=5): | |
| self.k = k | |
| def fit(self, X_train, y_train): |
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 gym | |
| import random | |
| import numpy as np | |
| import tflearn | |
| from tflearn.layers.core import input_data, dropout, fully_connected | |
| from tflearn.layers.estimator import regression | |
| from statistics import mean, median | |
| from collections import Counter | |
| LR = 1e-3 |
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 matplotlib.pyplot as plt | |
| import matplotlib.dates as mdates | |
| import urllib | |
| import numpy as np | |
| def bytespdates2num(formt, encoding='utf-8'): | |
| strconverter = mdates.strpdate2num(formt) | |
| def bytesconverter(b): | |
| s = b.decode(encoding) | |
| return strconverter(s) |
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 urllib.request | |
| import urllib.parse | |
| def get(url): | |
| try: | |
| headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36'} | |
| req = urllib.request.Request(url, headers=headers) | |
| reqeust = urllib.request.urlopen(req) | |
| resp = request.read().decode() |
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 | |
| time_taken_for_one_weight = 0.04 | |
| weights_to_try = 1000 | |
| weights_in_net = 8 # for 1 layer | |
| one_year = 3600*24*365 | |
| years_to_train = time_taken_for_one_weight*(weights_to_try**weights_in_net)/one_year | |
| print('{:,}'.format(years_to_train)) |
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 re | |
| ''' | |
| Identifiers: | |
| \d = any number | |
| \D = anything but a number | |
| \s = space | |
| \S = anything but a space | |
| \w = any letter |
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
| # coding: utf-8 | |
| # # 5-Layer Convnet for classifying the MNIST dataset | |
| # In[1]: | |
| # importing the dependencies | |
| import tensorflow as tf | |
| import numpy as np |
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 nltk | |
| from nltk.corpus import state_union | |
| from nltk.tokenize import PunktSentenceTokenizer | |
| ''' | |
| POS tag list: | |
| CC coordinating conjunction | |
| CD cardinal digit |
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 os | |
| import numpy as np | |
| project_dir = '/Users/victor/Documents/Devcrib/DigiSchools/desktop/digischools-desktop' | |
| ignored_files = ['node_modules', 'package-lock.json', 'uploads', 'fonts', | |
| 'bootstrap-grid.min.css', 'bootstrap.css', 'bootstrap.min.css', 'dropzone.css', | |
| 'owl.carousel.min.js', 'jquery.min.js', 'jquery-1.10.2.js', 'owl.carousel.min.css', | |
| 'owl.theme.default.min.css', 'owl.video.play.png', 'pretty.min.css', | |
| 'jquery_upload.min.js', 'datatables.min.js', 'dataTables', 'datatables.min.css', | |
| 'bootstrap.min.js', 'dropzone.js', 'tether.min.js', 'wow.min.js', 'font-awesome.min.css', |