Skip to content

Instantly share code, notes, and snippets.

View mmmayo13's full-sized avatar

Matthew Mayo mmmayo13

View GitHub Profile
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>KDnuggets Weekly Digest</title>
</head>
<body style="background-color:#FFFFFF; font-family:arial,verdana,tahoma; font-size:14px;">
<table style="border:0px; border-collapse:collapse; width:680px; margin-left:auto; margin-right:auto;">
<td>
<!-- Header -->
<table style="width:100%; border-collapse:collapse;">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>KDnuggets Weekly Digest</title>
</head>
<body style="background-color:#FFFFFF; font-family:arial,verdana,tahoma; font-size:14px;">
<table style="border:0px; border-collapse:collapse; width:680px; margin-left:auto; margin-right:auto;">
<td>
<!-- Header -->
<table style="width:100%; border-collapse:collapse;">
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>KDnuggets Weekly Digest</title>
</head>
<body
style="
background-color: #ffffff;
font-family: arial, verdana, tahoma;
font-size: 14px;
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>KDnuggets Weekly Digest</title>
</head>
<body style="background-color:#FFFFFF; font-family:arial,verdana,tahoma; font-size:14px;">
<table style="border:0px; border-collapse:collapse; width:680px; margin-left:auto; margin-right:auto;">
<td>
<!-- Header -->
<table style="width:100%; border-collapse:collapse;">
from math import sqrt, floor
import numpy as np
def random(ds, k, random_state=42):
"""
Create random cluster centroids.
Parameters
----------
from collections import Counter
from string import punctuation
from sklearn.feature_extraction.stop_words import ENGLISH_STOP_WORDS as stop_words
import spacy
def count_words(tokens):
word_counts = {}
for token in tokens:
if token not in stop_words and token not in punctuation and token is not '\n':
if token not in word_counts.keys():
class Vocabulary:
PAD_token = 0 # Used for padding short sentences
SOS_token = 1 # Start-of-sentence token
EOS_token = 2 # End-of-sentence token
def __init__(self, name):
self.name = name
self.word2index = {}
self.word2count = {}
self.index2word = {PAD_token: "PAD", SOS_token: "SOS", EOS_token: "EOS"}
import os
import speech_recognition as sr
from pydub import AudioSegment
from pydub.playback import play
from gtts import gTTS as tts
def speak(text):
import numpy
import GA
"""
The y=target is to maximize this equation ASAP:
from keras import models
from keras.layers import Dense, Dropout
from keras.utils import to_categorical
from keras.datasets import mnist
from keras.utils.vis_utils import model_to_dot
from IPython.display import SVG
import livelossplot
plot_losses = livelossplot.PlotLossesKeras()