Skip to content

Instantly share code, notes, and snippets.

View maxim5's full-sized avatar

Maxim Podkolzine maxim5

View GitHub Profile
@maxim5
maxim5 / kmeans_assignment.py
Created April 19, 2018 15:57
K-means assignment implementation in numpy
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'maxim'
import numpy as np
def kmeans_assignment(centroids, points):
num_centroids, dim = centroids.shape
num_points, _ = points.shape
@maxim5
maxim5 / xor_regression_nn_tf.py
Last active April 13, 2018 08:55
Neural network that learns a XOR operation via regression (L2 loss) in Tensorflow
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'maxim'
import tensorflow as tf
import numpy as np
def random_normal(shape):
return (np.random.random(shape) - 0.5) * 2
@maxim5
maxim5 / numpy_neural_network.py
Created February 27, 2018 18:10
A pure numpy neural network implementation that learns an OR operation
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
__author__ = 'maxim'
import sys
import numpy as np
import matplotlib.pyplot as plt
@maxim5
maxim5 / pretrained_word2vec_lstm_gen.py
Last active July 2, 2023 10:40
Text generator based on LSTM model with pre-trained Word2Vec embeddings in Keras
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
__author__ = 'maxim'
import numpy as np
import gensim
import string
import com.datastax.driver.core.Cluster;
import com.datastax.driver.core.ResultSet;
import com.datastax.driver.core.Row;
import com.datastax.driver.core.Session;
import java.util.List;
public class Main {
public static void main(String[] args) {
try {