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 sklearn.naive_bayes import EMNB, MultinomialNB, BernoulliNB | |
from sklearn.cross_validation import KFold | |
from sklearn.datasets import load_svmlight_file | |
from scipy.sparse import vstack | |
import numpy as np | |
X, y = load_svmlight_file("mpqa_en.vec") | |
y = np.asarray(y, np.int32) | |
n_labeled = int(0.8 * X.shape[0]) | |
X_labeled = X[:n_labeled] |
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 sklearn.datasets import load_svmlight_file | |
from sklearn.naive_bayes import MultinomialNB | |
from sklearn.cross_validation import StratifiedKFold | |
from sklearn import metrics | |
X, y = load_svmlight_file("mpqa_en.vec") | |
kf = StratifiedKFold(y, k = 10, indices=True) | |
clf = MultinomialNB() | |
for train_index, test_index in kf: | |
X_train, X_test = X[train_index], X[test_index] | |
y_train, y_test = y[train_index], y[test_index] |
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 sklearn.datasets import load_svmlight_file | |
from sklearn.naive_bayes import MultinomialNB | |
from sklearn.svm.sparse import LinearSVC | |
from sklearn.cross_validation import StratifiedKFold | |
from sklearn import metrics | |
import numpy as np | |
X, y = load_svmlight_file("fr.vec") | |
y[y == -1] = 0 | |
kf = StratifiedKFold(y, k = 10, indices=True) |
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
#!/usr/bin/env python2 | |
import random | |
import nltk | |
from sklearn.linear_model import LogisticRegression | |
import numpy as np | |
from sklearn.feature_extraction.text import CountVectorizer | |
from nltk.corpus import movie_reviews | |
documents = [(movie_reviews.raw(fileid), category) |
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
import XMonad | |
import Data.List | |
import XMonad.Hooks.ManageHelpers | |
import XMonad.Util.EZConfig | |
import XMonad.Config.Gnome | |
import XMonad.Config.Desktop (desktopLayoutModifiers) | |
import XMonad.Layout.NoBorders (smartBorders) | |
import XMonad.Layout.PerWorkspace (onWorkspace) | |
import XMonad.Layout.CenteredMaster (centerMaster) | |
import XMonad.Layout.SimpleFloat (simpleFloat) |
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
#!/usr/bin/env python2 | |
from nltk.corpus.reader import TaggedCorpusReader | |
from nltk.tokenize import RegexpTokenizer | |
from shogun.Kernel import CommUlongStringKernel | |
from shogun.Features import StringUlongFeatures, StringCharFeatures, RAWBYTE | |
from shogun.PreProc import SortUlongString | |
from scikits.learn.cluster import affinity_propagation | |
import numpy as np | |
def read_reviews(): |
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
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" => General | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" Sets how many lines of history VIM has to remember | |
set history=300 | |
" Enable filetype plugin | |
filetype plugin on | |
filetype indent on |
NewerOlder