Skip to content

Instantly share code, notes, and snippets.

View giuseppebonaccorso's full-sized avatar
🎯
Focusing

Giuseppe Bonaccorso giuseppebonaccorso

🎯
Focusing
View GitHub Profile
@yanofsky
yanofsky / LICENSE
Last active June 5, 2024 21:51
A script to download all of a user's tweets into a csv
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
@baraldilorenzo
baraldilorenzo / readme.md
Last active June 13, 2024 03:07
VGG-16 pre-trained model for Keras

##VGG16 model for Keras

This is the Keras model of the 16-layer network used by the VGG team in the ILSVRC-2014 competition.

It has been obtained by directly converting the Caffe model provived by the authors.

Details about the network architecture can be found in the following arXiv paper:

Very Deep Convolutional Networks for Large-Scale Image Recognition

K. Simonyan, A. Zisserman

@mttk
mttk / upscaling_gym_render.py
Created June 29, 2016 11:46
Scaling up the displays from the OpenAI gym to allow a visible simulation of smaller renders (ex. atari games) for presentative purposes
import logging
import os, sys
import numpy as np
import matplotlib.pyplot as plt
import gym
import Image
# Import the renderer as it's what we'll be using to plot
from gym.envs.classic_control import rendering
@giuseppebonaccorso
giuseppebonaccorso / neural_styler.py
Last active May 17, 2017 08:41
Neural artistic styler
'''
Neural artistic styler
Based on: Leon A. Gatys, Alexander S. Ecker, Matthias Bethge, "A Neural Algorithm of Artistic Style", arXiv:1508.06576
Examples: https://www.bonaccorso.eu
See also: https://github.com/fchollet/keras/blob/master/examples/neural_style_transfer.py
Giuseppe Bonaccorso (https://www.bonaccorso.eu)
'''
from __future__ import print_function
@giuseppebonaccorso
giuseppebonaccorso / cifar_convnet.py
Last active September 30, 2019 01:48
CIFAR-10 image classification with Keras ConvNet
'''
Cifar-10 classification
Original dataset and info: https://www.cs.toronto.edu/~kriz/cifar.html for more information
See: https://www.bonaccorso.eu/2016/08/06/cifar-10-image-classification-with-keras-convnet/ for further information
'''
from __future__ import print_function
import numpy as np
@giuseppebonaccorso
giuseppebonaccorso / svd_recommender_tensorflow.py
Last active February 12, 2023 11:07
SVD Recommendations using Tensorflow
import numpy as np
import tensorflow as tf
# Set random seed for reproducibility
np.random.seed(1000)
nb_users = 5000
nb_products = 2000
nb_factors = 500
max_rating = 5
@giuseppebonaccorso
giuseppebonaccorso / cluster_instability.py
Created August 3, 2017 13:47
Assessing clustering optimality with instability index
from sklearn.cluster import KMeans
from sklearn.datasets import make_blobs
from sklearn.metrics.pairwise import pairwise_distances
import multiprocessing
# Set random seed for reproducibility
np.random.seed(1000)
# Generate a dummy dataset
@giuseppebonaccorso
giuseppebonaccorso / twitter_sentiment_analysis_convnet.py
Last active March 16, 2020 19:26
Twitter Sentiment Analysis with Gensim Word2Vec and Keras Convolutional Networks
import keras.backend as K
import multiprocessing
import tensorflow as tf
from gensim.models.word2vec import Word2Vec
from keras.callbacks import EarlyStopping
from keras.models import Sequential
from keras.layers.core import Dense, Dropout, Flatten
from keras.layers.convolutional import Conv1D
@giuseppebonaccorso
giuseppebonaccorso / hodgkin-huxley-main.py
Created August 19, 2017 15:06
Hodgkin-Huxley spiking neuron model in Python
import matplotlib.pyplot as plt
import numpy as np
from scipy.integrate import odeint
# Set random seed (for reproducibility)
np.random.seed(1000)
# Start and end time (in milliseconds)
tmin = 0.0
@giuseppebonaccorso
giuseppebonaccorso / oja.py
Last active June 8, 2019 00:19
Oja's rule (Hebbian Learning)
import numpy as np
from sklearn.datasets import make_blobs
from sklearn.preprocessing import StandardScaler
# Set random seed for reproducibility
np.random.seed(1000)
# Create and scale dataset
X, _ = make_blobs(n_samples=500, centers=2, cluster_std=5.0, random_state=1000)