This file contains 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
#include <algorithm> | |
#include <cmath> | |
#include <iostream> | |
#include <random> | |
#include <string> | |
#include <vector> | |
// RGB values | |
// Add arithmetic operations to take means squared deviations | |
struct rgb { |
This file contains 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
# See https://github.com/facebookresearch/fastText/blob/master/get-wikimedia.sh | |
# | |
# From https://github.com/facebookresearch/fastText/issues/161: | |
# | |
# We now have a script called 'get-wikimedia.sh', that you can use to download and | |
# process a recent wikipedia dump of any language. This script applies the preprocessing | |
# we used to create the published word vectors. | |
# | |
# The parameters we used to build the word vectors are the default skip-gram settings, | |
# except with a dimensionality of 300 as indicated on the top of the list of word |
This file contains 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 print_function | |
import imageio | |
from PIL import Image | |
import numpy as np | |
import keras | |
from keras.layers import Input, Dense, Conv2D, MaxPooling2D, AveragePooling2D, ZeroPadding2D, Dropout, Flatten, Concatenate, Reshape, Activation | |
from keras.models import Model | |
from keras.regularizers import l2 | |
from keras.optimizers import SGD |
This file contains 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 pandas import DataFrame | |
>>> from sklearn.feature_extraction.text import CountVectorizer | |
>>> docs = ["You can catch more flies with honey than you can with vinegar.", | |
... "You can lead a horse to water, but you can't make him drink."] | |
>>> vect = CountVectorizer(min_df=0., max_df=1.0) | |
>>> X = vect.fit_transform(docs) | |
>>> print(DataFrame(X.A, columns=vect.get_feature_names()).to_string()) | |
but can catch drink flies him honey horse lead make more than to vinegar water with you | |
0 0 2 1 0 1 0 1 0 0 0 1 1 0 1 0 2 2 | |
1 1 2 0 1 0 1 0 1 1 1 0 0 1 0 1 0 2 |