Skip to content

Instantly share code, notes, and snippets.

View psinger's full-sized avatar

Philipp Singer psinger

View GitHub Profile
@psinger
psinger / ref.py
Created August 27, 2014 14:56
reference confusion
def change(a):
a[0,0] = 5
a = a / a.sum()
a[0,0] = 7
print a
a = csr_matrix((2,2))
a[0,0] = 2
a[1,1] = 2
{
"metadata": {
"css": [
""
],
"name": "",
"signature": "sha256:2a33067410fdd0356cedb2c0893414e80734c219ba9dd2bba82e2ad1b379606b"
},
"nbformat": 3,
"nbformat_minor": 0,
i_indices = list()
j_indices = list()
values = list()
for i,k in enumerate(states.keys()):
for v in states.keys()[i+1:]:
if something:
i_indices.append(vocab[k])
j_indices.append(vocab[v])
values.append(10)
function features(row, emit) {
text = row.body
text_no_url = text
url_count = 0
matcher = text.match(/(https:[\/][\/]|http:[\/][\/]|www.)[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(:[a-zA-Z0-9]*)?\/?([a-zA-Z0-9\-\._\?\,\'\/\\\+&%\$#\=~])*/g)
if (matcher != null) {
text_no_url = text.replace(/(https:[\/][\/]|http:[\/][\/]|www.)[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(:[a-zA-Z0-9]*)?\/?([a-zA-Z0-9\-\._\?\,\'\/\\\+&%\$#\=~])*/g, "")
}
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [
{
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [
{
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [
{
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.