Skip to content

Instantly share code, notes, and snippets.

View spolu's full-sized avatar

Stanislas Polu spolu

View GitHub Profile
TOP:
----
A browser for the HTML5 era
Entirely written in Javascript. Free. Modular. Hackable.
>> Modular <<
Everything in the browser is a module, a web-app running in its own process.
Construct your own browsing experience by selecting the right modules for you.
>> Hackable <<
### Keybase proof
I hereby claim:
* I am spolu on github.
* I am spolu (https://keybase.io/spolu) on keybase.
* I have a public key whose fingerprint is 6DFA 0BAC D550 92AA 07D8 AEC9 907A 38FD AFBB 5163
To claim this, I am signing this object:
@spolu
spolu / mi.js
Last active August 29, 2015 14:06
/**********************************************************************/
/* count_: the number of occurrences of the feature (n-gram or word) */
/* all_count: training set size */
/* f_count_: the number of occurrences of `feature & female` */
/* m_count_: the number of occurrences of `feature & male` */
/* all_count_f: number of occurrences of `female` */
/* all_count_m: number of occurrences of `male` */
/**********************************************************************/
/* p(feature) */
@spolu
spolu / top_mi_female
Created September 22, 2014 21:41
Top hashtags by Mutual Information
TOP MUTUALLY DEPENDENT TERMS
┌───────────────────┬────────────────────────┬─────────────────────┬─────────────────────┬────────────────────────┬────────┐
│feat  │MI │P(F|feat) │P(M|feat)  │P(feat)  │count  │
├───────────────────┼────────────────────────┼─────────────────────┼─────────────────────┼────────────────────────┼────────┤
│ 2013 │ 0.0007369516096940501 │ 0.4390515775552617 │ 0.5609484224447384 │ 0.0007522301748728375 │ 52930 │
├───────────────────┼────────────────────────┼─────────────────────┼─────────────────────┼────────────────────────┼────────┤
│ some │ 0.000736858500749544 │ 0.445240713107673 │ 0.5547592868923271 │ 0.0007238350135390772 │ 50932 │
├───────────────────┼────────────────────────┼─────────────────────┼─────────────────────┼────────────────────────┼────────┤
│ old │ 0.0007365194018360236 │ 0.4566446562018109 │ 0.5433553437981891 │ 0.0007188608861783085
@spolu
spolu / top_mi.log
Created September 22, 2014 21:46
Top Mutually dependent Terms
┌───────────────────┬────────────────────────┬─────────────────────┬─────────────────────┬────────┐
│ feat │ MI │ P(F|feat) │ P(M|feat) │ count │
├───────────────────┼────────────────────────┼─────────────────────┼─────────────────────┼────────┤
│ 2013 │ 0.0007369516096940501 │ 0.4390515775552617 │ 0.5609484224447384 │ 52930 │
│ some │ 0.000736858500749544 │ 0.445240713107673 │ 0.5547592868923271 │ 50932 │
│ old │ 0.0007365194018360236 │ 0.4566446562018109 │ 0.5433553437981891 │ 50582 │
│ followme │ 0.0007364834465793508 │ 0.4685242121445043 │ 0.5314757878554958 │ 52040 │
│ em │ 0.0007364028645929781 │ 0.47138620491724864 │ 0.5286137950827514 │ 52265 │
│ 1 │ 0.0007363022436669361 │ 0.47312624679395837 │ 0.5268737532060416 │ 52635 │
│ picoftheday │ 0.000736169463191504 │ 0.41519248894366706 │ 0.5848075110563329 │ 55172 │
@spolu
spolu / top_female_cond.log
Last active August 29, 2015 14:06
Top Female Terms
TOP WOMENs WORDS [P(F|feat)]
┌─────────────────┬────────────────────────┬────────────────────┬─────────────────────┬────────┐
│ feat │ MI │ P(F|feat) │ P(M|feat) │ count │
├─────────────────┼────────────────────────┼────────────────────┼─────────────────────┼────────┤
│ obrigada │ 0.00027892588535643266 │ 0.9685880320402072 │ 0.03141196795979268 │ 6367 │
│ nails │ 0.0005797362527263134 │ 0.9323099021456146 │ 0.0676900978543855 │ 22278 │
│ nail │ 0.0003044173746727099 │ 0.9318902523093892 │ 0.06810974769061078 │ 7253 │
│ lipstick │ 0.00027485524057785637 │ 0.9307852898667095 │ 0.0692147101332905 │ 6227 │
│ nomakeup │ 0.00027682050785528235 │ 0.9210108073744437 │ 0.07898919262555626 │ 6292 │
│ girly │ 0.00027218400694593495 │ 0.9180381293791755 │ 0.08196187062082451 │ 6137 │
@spolu
spolu / top_male_cond
Last active August 29, 2015 14:06
Top Male Terms
TOP MENs WORDS [P(M|feat)]
┌───────────────────┬────────────────────────┬─────────────────────┬─────────────────────┬─────────┐
│ feat │ MI │ P(F|feat) │ P(M|feat) │ count │
├───────────────────┼────────────────────────┼─────────────────────┼─────────────────────┼─────────┤
│ instagay │ 0.00022357298801020352 │ 0.08653846153846154 │ 0.9134615384615384 │ 4576 │
│ instaboy │ 0.00028438645833364835 │ 0.11872780608306316 │ 0.8812721939169369 │ 6477 │
│ beard │ 0.00023996501077783796 │ 0.13137099960489926 │ 0.8686290003951008 │ 5062 │
│ bmw │ 0.00023463541132113985 │ 0.17349643221202854 │ 0.8265035677879714 │ 4905 │
│ ps3 │ 0.00024576041454740495 │ 0.17954588818927686 │ 0.8204541118107231 │ 5241 │
│ legend │ 0.000242332533506523 │ 0.2024133904242896 │ 0.7975866095757104 │ 5138 │
@spolu
spolu / nn_def.hh
Created September 22, 2014 23:25
Neural Network Definition
//
// ## NN Class
//
class NN : public ObjectWrap {
/* ... */
vector<int> layers_; /* layers structure */
vector< vector< vector<double> > > W_; /* weights */
/* ... */
};
@spolu
spolu / nn_activation.cc
Created September 22, 2014 23:41
NN activation function
for(int j = 0; j < layers_[l-1]; j++) {
sum_[l][i] += W_[l][i][j] * val_[l-1][j];
}
/* Activation function */
val_[l][i] = 1 / (1 + exp(-sum_[l][i]));
@spolu
spolu / nn_train.cc
Created September 23, 2014 00:24
NN train
do {
err = 0;
for(unsigned int i = 0; i < train_in_.size(); i++) {
vector<double> res = this->learn(train_in_[i], train_out_[i]);
/* error calculation */
double e = 0;
for(unsigned int j = 0; j < res.size(); j++) {
e += pow(res[j] - train_out_[i][j], 2);
}
err += e / res.size();