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
/** | |
* Distributed median binning | |
* | |
* See | |
* "Fast Computation of the Median by Successive Binning" | |
* https://www.stat.cmu.edu/~ryantibs/papers/median.pdf | |
* | |
* This code currently only works for an odd number of elements | |
* See https://github.com/goodsoldiersvejk/medianbinning | |
*/ |
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
package main | |
import ( | |
"fmt" | |
"strings" | |
"crypto/sha1" | |
"encoding/base64" | |
) | |
type Document struct { |
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
abstract class NeuralNetwork { | |
val numImmediateInputs: Int | |
var children: Map[Int, NeuralNetwork] | |
/** | |
* The integration function contains implicitly the weights | |
* for this compute unit |
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
class McCullochPitts( | |
val numExcitatoryInputs: Int, | |
val numInhibitoryInputs: Int, | |
val threshold: Int, | |
val inhibitoryInputIndices: Option[Seq[Int]] = None) | |
extends NeuralNetwork { | |
val numImmediateInputs: Int = (numExcitatoryInputs | |
+ numInhibitoryInputs) | |
var children: Map[Int, NeuralNetwork] = Map.empty |
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
package main | |
import ( | |
"math" | |
"fmt" | |
) | |
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
/** | |
* Maximum value algorithm: at each iteration each | |
* node sends to its neighbors the largest value it | |
* has ever seen. | |
*/ | |
package graphalgorithms | |
import org.apache.spark.graphx._ |
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
# svdtext.py | |
""" | |
Singular value decomposition and | |
plotting on text | |
""" | |
import numpy as np | |
import matplotlib.pyplot as plt | |
def svdtext(filename): | |
neighbors = {} |
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 multiprocessing.dummy import Pool | |
from urllib import urlretrieve, urlopen | |
from bs4 import BeautifulSoup | |
import os | |
from datetime import datetime | |
startDate = datetime.strptime('01.01.1996', '%d.%m.%Y') | |
endDate = datetime.strptime('01.01.2018', '%d.%m.%Y') |
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
def logistic_regression(loss_func=tf.losses.log_loss): | |
import numpy as np | |
import tensorflow as tf | |
c1 = np.random.randn(50, 100) + 1 | |
c2 = np.random.randn(50, 100) - 1 | |
X = np.vstack([c1, c2]) | |
Y = np.concatenate([np.ones((50, 1)), np.zeros((50, 1))]) |
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
def margin_perceptron(): | |
import numpy as np | |
import tensorflow as tf | |
c1 = np.random.randn(50, 100) + 1 | |
c2 = np.random.randn(50, 100) - 1 | |
X = np.vstack([c1, c2]) |
OlderNewer