Skip to content

Instantly share code, notes, and snippets.

View aliayoubi's full-sized avatar

Ali Ayoubi aliayoubi

View GitHub Profile
@aliayoubi
aliayoubi / cache-json.php
Created February 28, 2017 15:30 — forked from ScottPhillips/cache-json.php
Cache Remote JSON Feed
<?php
/**
* API Request Caching
*
* Use server-side caching to store API request's as JSON at a set
* interval, rather than each pageload.
*
* @arg Argument description and usage info
*/
@aliayoubi
aliayoubi / List.md
Created December 11, 2016 11:28 — forked from msurguy/List.md
List of open source projects made with Laravel

Other people's projects:

My projects (tutorials are on my blog at http://maxoffsky.com):

@aliayoubi
aliayoubi / gist:03f9bf54d8203a606105dae6f021e626
Created November 25, 2016 09:08 — forked from fnielsen/gist:1226214
Email classification example with Python, NLTK, ...
documents = [ dict(
email=open("conference/%d.txt" % n).read().strip(),
category='conference') for n in range(1,372) ]
documents.extend([ dict(
email=open("job/%d.txt" % n).read().strip(),
category='job') for n in range(1,275)])
documents.extend([ dict(
email=open("spam/%d.txt" % n).read().strip(),
category='spam') for n in range(1,799) ])
@aliayoubi
aliayoubi / tfpdf.py
Created November 14, 2016 10:19 — forked from bllchmbrs/tfpdf.py
TF IDF Explained in Python Along with Scikit-Learn Implementation
from __future__ import division
import string
import math
tokenize = lambda doc: doc.lower().split(" ")
document_0 = "China has a strong economy that is growing at a rapid pace. However politically it differs greatly from the US Economy."
document_1 = "At last, China seems serious about confronting an endemic problem: domestic violence and corruption."
document_2 = "Japan's prime minister, Shinzo Abe, is working towards healing the economic turmoil in his own country for his view on the future of his people."
document_3 = "Vladimir Putin is working hard to fix the economy in Russia as the Ruble has tumbled."
،
.
,
'
"
-
=
/
\
|
def accuracy(self, questions, restrict_vocab=30000, most_similar=most_similar, lowercase=True):
"""
Compute accuracy of the model. `questions` is a filename where lines are
4-tuples of words, split into sections by ": SECTION NAME" lines.
See https://code.google.com/p/word2vec/source/browse/trunk/questions-words.txt for an example.
The accuracy is reported (=printed to log and returned as a list) for each
section separately, plus there's one aggregate summary at the end.
Use `restrict_vocab` to ignore all questions containing a word whose frequency