Skip to content

Instantly share code, notes, and snippets.

Charanpal Dhanjal charanpald

Block or report user

Report or block charanpald

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@charanpald
charanpald / recommendexp.py
Created Jan 26, 2016
Generate MovieLens recommendations using the SVD
View recommendexp.py
# Run some recommendation experiments using MovieLens 100K
import pandas
import numpy
import scipy.sparse
import scipy.sparse.linalg
import matplotlib.pyplot as plt
from sklearn.metrics import mean_absolute_error
data_dir = "data/ml-100k/"
data_shape = (943, 1682)
@charanpald
charanpald / deeplearning.py
Created Jan 20, 2016
An example of deep learning on the digits dataset using Keras
View deeplearning.py
import numpy
import pandas
from sklearn.datasets import load_digits
from sklearn import preprocessing
from sklearn.cross_validation import KFold
from sklearn.svm import SVC
from sklearn.metrics import zero_one_loss
from keras.models import Sequential
from keras.layers.core import Dense, Activation
@charanpald
charanpald / featureextractexp.py
Created Jan 17, 2016
Some simple experiments with PCA and PLS for feature extraction.
View featureextractexp.py
import numpy
from sklearn.datasets import load_iris
from sklearn import preprocessing
from sklearn.decomposition import PCA
from sklearn.cross_decomposition import PLSRegression
from sklearn.cross_validation import KFold
from sklearn.svm import LinearSVC
from sklearn.metrics import zero_one_loss
dataset = load_iris()
@charanpald
charanpald / kdd99exp.py
Created Jan 10, 2016
KDD CUP 99 Intrusion Detection Code
View kdd99exp.py
import pandas
import numpy
from sklearn.neighbors import KNeighborsClassifier
from sklearn.metrics import confusion_matrix, zero_one_loss
# Must declare data_dir as the directory of training and test files
train_data = data_dir + "kddcup.data.corrected"
train_labels = data_dir + "train_labels.txt"
test_data = data_dir + "corrected"
You can’t perform that action at this time.