-
Motivation: Deep learning in vision, speech, text, robotics.
-
Deep learning courses:
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 functools import singledispatch | |
| class Document: | |
| pass | |
| class Paragraph(Document): | |
| def __init__(self, text): | |
| self.text = text |
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
| {-# LANGUAGE TypeOperators #-} | |
| {-# LANGUAGE GeneralizedNewtypeDeriving #-} | |
| import Control.Applicative | |
| import Data.Char | |
| import Data.List (intersperse) | |
| import Data.Monoid hiding (All, Any) | |
| import Data.Foldable hiding (all, any) | |
| import Prelude hiding (all, any) |
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 typing import ( | |
| List, | |
| TypeVar, | |
| ) | |
| # Type aliases | |
| A = TypeVar('A') | |
| Digit = int | |
| Matrix = List[List[A]] | |
| Grid = Matrix[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
| /** | |
| * Created by eurus on 28/02/2017. | |
| */ | |
| package components | |
| import collection.immutable.Queue | |
| import ActionType._ | |
| sealed trait SignalValue | |
| object `0` extends SignalValue { |
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 logging | |
| from gensim.models.doc2vec import ( | |
| Doc2Vec, | |
| TaggedDocument, | |
| ) | |
| logging.basicConfig( | |
| format='%(asctime)s : %(threadName)s : %(levelname)s : %(message)s', | |
| level=logging.DEBUG, |
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 descriptors_to_sufficient_statistics(xx, gmm, **kwargs): | |
| # yael assumes that the data is in C-contiguous format. | |
| xx = np.ascontiguousarray(np.atleast_2d(xx)) | |
| N = xx.shape[0] | |
| K = gmm.k | |
| D = gmm.d | |
| # Compute posterior probabilities using yael. | |
| Q = gmm_predict_proba(xx, gmm) # NxK |
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
| class Expr(object): | |
| def accept(self, visitor): | |
| method_name = 'visit_{}'.format(self.__class__.__name__.lower()) | |
| visit = getattr(visitor, method_name) | |
| return visit(self) | |
| class Int(Expr): | |
| def __init__(self, value): |
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
| class Expr(object): | |
| def accept(self, visitor): | |
| method_name = 'visit_{}'.format(self.__class__.__name__.lower()) | |
| visit = getattr(visitor, method_name) | |
| return visit(self) | |
| class Int(Expr): | |
| def __init__(self, value): | |
| self.value = value |
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 | |
| def fvecs_read(filename, c_contiguous=True): | |
| fv = np.fromfile(filename, dtype=np.float32) | |
| if fv.size == 0: | |
| return np.zeros((0, 0)) | |
| dim = fv.view(np.int32)[0] | |
| assert dim > 0 | |
| fv = fv.reshape(-1, 1 + dim) |