Skip to content

Instantly share code, notes, and snippets.

💜
Testing statuses

Mikael Brevik mikaelbr

💜
Testing statuses
Block or report user

Report or block mikaelbr

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
@mikaelbr
mikaelbr / jsmodule.js
Created Oct 5, 2012
JS Module Template
View jsmodule.js
;(function () {
var moduleName = 'someName',
methods = {},
root = this;
// Private methods
var _foo = function () {
};
View .priv_config.sh
# Include passwords/API keys etc, stored as env. (if exists)
if [ -f ~/.priv/env_config.sh ];
then
source ~/.priv/env_config.sh
fi
@mikaelbr
mikaelbr / mnb_gridsearch_test.py
Created Feb 26, 2013
A rudimentary experiment file for gridsearching on multinominal naive bayes classification.
View mnb_gridsearch_test.py
#!/usr/bin/python
import sys
import numpy as np
import logging
from os import path
from sklearn import decomposition, linear_model
from sklearn.feature_extraction.text import CountVectorizer, TfidfTransformer
from sklearn.naive_bayes import MultinomialNB
from sklearn.pipeline import Pipeline
View classifier_stats.log
## Done training
# Stats for LogisticRegression
## Best params: {'vect__ngram_range': (1, 1), 'tfidf__smooth_idf': False, 'tfidf__sublinear_tf': True, 'vect__preprocessor': <function no_usernames at 0xa1540d4>, 'tfidf__use_idf': True, 'vect__stop_words': None, 'clf__penalty': 'l1', 'clf__C': 2.0}
## Best Score: 0.68442947358
precision recall f1-score support
"negative" 0.51 0.24 0.33 384
"objective" 0.67 0.84 0.75 1326
"positive" 0.73 0.62 0.67 968
@mikaelbr
mikaelbr / SA_output.log
Created Mar 11, 2013
Sentiment Analysis Grid Search Output log
View SA_output.log
######################################################################
# Showing for <methods.boost.Boosting object at 0x916aa6c>
# Total Score: 0.638452237001
precision recall f1-score support
negative 0.74 0.21 0.32 340
neutral 0.61 0.85 0.71 739
positive 0.67 0.62 0.65 575
avg / total 0.66 0.64 0.61 1654
@mikaelbr
mikaelbr / score.out
Created Mar 13, 2013
Score output for predictions
View score.out
TASK B
Comparing predictions demo.pred to gold standard twitter-dev-gold-B.tsv.
File: demo.pred -- no errors found
Prediction file: 1654 lines
1654 unique
Breakdown by class:
positive 580
neutral 891
negative 183
File: twitter-dev-gold-B.tsv -- no errors found
View sa_out2.log
######################################################################
# Showing for <models.svm.SVM object at 0x1052c9f90>
Best params: {'steps': [('vect', TfidfVectorizer(analyzer='word', binary=False, charset='utf-8',
charset_error='ignore', dtype=<type 'long'>, input='content',
lowercase=True, max_df=1.0, max_features=None, max_n=None,
min_df=2, min_n=None, ngram_range=(1, 1), norm='l2',
preprocessor=<function remove_noise at 0x104787410>,
smooth_idf=True, stop_words=None, strip_accents=None,
sublinear_tf=True, token_pattern=u'(?u)\\b\\w\\w+\\b',
tokenizer=<function tokenize at 0x104787848>, use_idf=False,
@mikaelbr
mikaelbr / index.html
Created Sep 15, 2013
A simple piano-key to sound script based on michaelmp/js-piano. Index.html shows how the actual sounds are included.
View index.html
<!DOCTYPE html>
<html>
<head>
<title>FRP Piano</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<audio id="sound-A2" src="samples/A2.ogg" preload="auto"></audio>
<audio id="sound-B2" src="samples/B2.ogg" preload="auto"></audio>
View piano.coffee
# An example of Functional Reactive Programming, by implementing a
# simple collaborative piano.
# By Mikael Brevik <@mikaelbr>
socket = io.connect()
scale = [
'A2', 'Bb2', 'B2', 'C3', 'Db3', 'D3', 'Eb3', 'E3', 'F3', 'Gb3', 'G3', 'Ab3',
'A3', 'Bb3', 'B3', 'C4', 'Db4', 'D4', 'Eb4', 'E4', 'F4', 'Gb4', 'G4', 'Ab4',
'A4', 'Bb4', 'B4', 'C5'
View piano_markup.html
<div id="p-wrapper">
<ul id="piano">
<li><div class="anchor clickable" data-note="A2"></div></li>
<li><div class="anchor clickable" data-note="B2"></div><span></span></li>
<li><div class="anchor clickable" data-note="C3"></div></li>
<li><div class="anchor clickable" data-note="D3"></div><span></span></li>
<li><div class="anchor clickable" data-note="E3"></div><span></span></li>
<li><div class="anchor clickable" data-note="F3"></div></li>
<li><div class="anchor clickable" data-note="G3"></div><span></span></li>
<li><div class="anchor clickable" data-note="A3"></div><span></span></li>
You can’t perform that action at this time.