This file contains hidden or 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 matplotlib import use | |
| from pylab import * | |
| from scipy.stats import beta, norm, uniform | |
| from random import random | |
| from numpy import * | |
| import numpy as np | |
| import os | |
| # Input data |
This file contains hidden or 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
| register /me/Software/elephant-bird/pig/target/elephant-bird-pig-3.0.6-SNAPSHOT.jar | |
| register /me/Software/pig/build/ivy/lib/Pig/json-simple-1.1.jar | |
| set elephantbird.jsonloader.nestedLoad 'true' | |
| set default_parallel 4 | |
| /* Remove files from previous runs */ | |
| rmf /tmp/prior_words.txt | |
| rmf /tmp/prior_genres.txt | |
| rmf /tmp/p_word_given_genre.txt |
This file contains hidden or 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
| DEFINE tf_idf(token_records, id_field, token_field) RETURNS out_relation { | |
| /* Calculate the term count per document */ | |
| doc_word_totals = foreach (group $token_records by ($id_field, $token_field)) generate | |
| FLATTEN(group) as ($id_field, token), | |
| COUNT_STAR($token_records) as doc_total; | |
| /* Calculate the document size */ | |
| pre_term_counts = foreach (group doc_word_totals by $id_field) generate | |
| group AS $id_field, |
This file contains hidden or 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
| cat mysql-statement | |
| > insert into mytable (k, v) values (1,2); | |
| > insert into mytable (k, v) values (2,2); | |
| > insert into mytable (k, v) values (3,2); | |
| scp mysql-statement to an ec2 machine | |
| ssh to the ec2 machine | |
| $ mysql -h hostname -u username -p password database_name < mysql-statement |
This file contains hidden or 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
| http://danzambonini.com/self-improving-bayesian-sentiment-analysis-for-twitter/ | |
| http://www.laurentluce.com/posts/twitter-sentiment-analysis-using-python-and-nltk/ | |
| [PDF] | |
| Sentiment Analysis of Twitter Data - Department of Computer ... | |
| www.cs.columbia.edu/~julia/papers/Agarwaletal11.pdf | |
This file contains hidden or 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
| # -*- coding: utf-8 -*- | |
| """ | |
| LICENSE: BSD (same as pandas) | |
| example use of pandas with oracle mysql postgresql sqlite | |
| - updated 9/18/2012 with better column name handling; couple of bug fixes. | |
| - used ~20 times for various ETL jobs. Mostly MySQL, but some Oracle. | |
| to do: | |
| save/restore index (how to check table existence? just do select count(*)?), | |
| finish odbc, |
This file contains hidden or 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
| license: gpl-3.0 |
NewerOlder