Skip to content

Instantly share code, notes, and snippets.

View robotcator's full-sized avatar
🍒
Focusing

robotcator robotcator

🍒
Focusing
View GitHub Profile
@robotcator
robotcator / translation_matrix_for_doc2vec.py
Created August 9, 2017 10:15
backmapping learned doc vector for sentiment analysis
# coding=utf-8
from gensim.models import Doc2Vec
from sklearn.linear_model import LogisticRegression
from collections import namedtuple
import numpy as np
import gensim
def read_sentimentDocs():
SentimentDocument = namedtuple('SentimentDocument', 'words tags split sentiment')
@robotcator
robotcator / doc2vec-sentiment-analysis.py
Last active August 9, 2017 10:16
doc2vec for sentiment analysis
# coding=utf-8
from gensim.models import Doc2Vec
from sklearn.linear_model import LogisticRegression
from collections import namedtuple
import numpy as np
import gensim
def read_sentimentDocs():
SentimentDocument = namedtuple('SentimentDocument', 'words tags split sentiment')
class LRUCache{
private:
int _capacity;
int _len;
list<pair<int,int> > l;
map<int, list<pair<int, int> >::iterator> mp;
public:
LRUCache(int capacity) {
_capacity = capacity;
struct node{
int key;
int value;
node* prev;
node* next;
node(int _key, int _value) {
key = _key;
value = _value;
prev = NULL;
next = NULL;
@robotcator
robotcator / download_text8.py
Last active June 25, 2020 13:10
a script downloads the text8.zip corpus.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import six
import os
if six.PY3:
from urllib.request import urlopen
else:
from urllib2 import urlopen