Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MRG] Keras wrapper for Word2Vec model in Gensim #1248

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
01c3dde
removed unnecessary keep_bocab_item import
chinmayapancholi13 Mar 24, 2017
8797cd1
removed duplicate warnings import
chinmayapancholi13 Mar 24, 2017
d09442c
updated warning message for trim_rule
chinmayapancholi13 Mar 24, 2017
9dc3b3e
Merge branch 'develop' of https://github.com/RaRe-Technologies/gensim…
chinmayapancholi13 Mar 29, 2017
e14bc91
added keras wrapper for word2vec
chinmayapancholi13 Mar 30, 2017
01eeb56
added tests for training and embedding layer
chinmayapancholi13 Mar 31, 2017
40f4b06
added newline at EOF
chinmayapancholi13 Mar 31, 2017
27842a9
keras dependency
chinmayapancholi13 Mar 31, 2017
913b2cf
added theano and tensorflow dependency
chinmayapancholi13 Mar 31, 2017
ce7ef3d
updated test file
chinmayapancholi13 Mar 31, 2017
ea5225e
added ipython notebook
chinmayapancholi13 Apr 2, 2017
cbb213c
added 20NewsGroups example in tests
chinmayapancholi13 Apr 5, 2017
cebb3ae
added 20NewsGroups example in ipynb
chinmayapancholi13 Apr 5, 2017
1ebca5d
added param train_embeddings
chinmayapancholi13 Apr 6, 2017
b7c3e2d
moved get_embedding_layer function to keyedvectors
chinmayapancholi13 May 18, 2017
123f5d7
updated ipynb for keras integration and added extra line after class …
chinmayapancholi13 May 18, 2017
d682180
PEP8 changes in code
chinmayapancholi13 May 18, 2017
54a9d97
more PEP8 changes
chinmayapancholi13 May 18, 2017
1e3c59e
deleted data in and updated docstring in __init__.py
chinmayapancholi13 May 18, 2017
031400c
added another classification example in ipynb
chinmayapancholi13 May 19, 2017
4ac5a09
Merge branch 'develop' of https://github.com/RaRe-Technologies/gensim…
chinmayapancholi13 May 19, 2017
a8f569b
added txt to flake8 ignore list
chinmayapancholi13 May 20, 2017
dd743be
added csv to flake8 ignore list and updated test data slightly
chinmayapancholi13 May 20, 2017
d07d767
added flag for conditional dependency due to Keras
chinmayapancholi13 May 25, 2017
1d61219
check to skip keras tests if keras not installed
chinmayapancholi13 May 25, 2017
dfc0625
resolved merge conflict in flake8_diff.sh
chinmayapancholi13 May 25, 2017
685ba38
removed 20NewsGroups data from test_data and modified tests accordingly
chinmayapancholi13 May 26, 2017
3543127
refactored test_keras_integration.py
chinmayapancholi13 May 26, 2017
437d8bc
modified ipynb after removing test data for 20NewsGroups example
chinmayapancholi13 May 27, 2017
042d674
Merge branch 'develop' of https://github.com/RaRe-Technologies/gensim…
chinmayapancholi13 May 29, 2017
6ca5c52
changes as per feedback from @tmylk
chinmayapancholi13 May 29, 2017
860deca
updated assert statement for 'testEmbeddingLayerCosineSim'
chinmayapancholi13 May 29, 2017
45cad0a
update test_env in setup.py
chinmayapancholi13 May 29, 2017
6d7a3e2
catching ImportError properly
chinmayapancholi13 May 29, 2017
36210cc
resolved merge conflict in setup.py
chinmayapancholi13 May 29, 2017
448e350
removed 'keras_integration' folder
chinmayapancholi13 May 30, 2017
d06f2f4
added note in 'get_embedding_layer' about mem usage
chinmayapancholi13 May 30, 2017
af94bfe
removed Tensorflow and Theano from 'test_env' in setup.py
chinmayapancholi13 May 31, 2017
405e556
reduced number of epochs for 20NewsGroups example to reduce test time
chinmayapancholi13 May 31, 2017
d1251e5
removed theano, tensorflow install commands
chinmayapancholi13 Jun 2, 2017
bc198d7
added tensorflow installation in .travis.yml
chinmayapancholi13 Jun 4, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ install:
- pip install testfixtures
- pip install unittest2
- pip install scikit-learn
- pip install tensorflow
- pip install keras
- pip install Morfessor==2.0.2a4
- python setup.py install
script:
script:
- python setup.py test
- pip install flake8
- continuous_integration/travis/flake8_diff.sh
2 changes: 1 addition & 1 deletion continuous_integration/travis/flake8_diff.sh
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,6 @@ check_files() {
if [[ "$MODIFIED_FILES" == "no_match" ]]; then
echo "No file has been modified"
else
check_files "$(echo "$MODIFIED_FILES" )" "--ignore=E501,E731,E12,W503 --exclude=*.sh,*.md,*.yml,*.rst,*.ipynb,*.vec,Dockerfile*"
check_files "$(echo "$MODIFIED_FILES" )" "--ignore=E501,E731,E12,W503 --exclude=*.sh,*.md,*.yml,*.rst,*.ipynb,*.txt,*.csv,*.vec,Dockerfile*"
fi
echo -e "No problem detected by flake8\n"
46 changes: 46 additions & 0 deletions docs/notebooks/datasets/keras_classifier_training_data.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
subject,content
mathematics,linear algebra
mathematics,topology
mathematics,algebra
mathematics,calculus
mathematics,variational calculus
mathematics,functional field
mathematics,real analysis
mathematics,complex analysis
mathematics,differential equation
mathematics,statistics
mathematics,statistical optimization
mathematics,probability
mathematics,stochastic calculus
mathematics,numerical analysis
mathematics,differential geometry
physics,renormalization
physics,classical mechanics
physics,quantum mechanics
physics,statistical mechanics
physics,functional field
physics,path integral
physics,quantum field theory
physics,electrodynamics
physics,condensed matter
physics,particle physics
physics,topological solitons
physics,astrophysics
physics,spontaneous symmetry breaking
physics,atomic molecular and optical physics
physics,quantum chaos
theology,divine providence
theology,soteriology
theology,anthropology
theology,pneumatology
theology,Christology
theology,Holy Trinity
theology,eschatology
theology,scripture
theology,ecclesiology
theology,predestination
theology,divine degree
theology,creedal confessionalism
theology,scholasticism
theology,prayer
theology,eucharist
1 change: 1 addition & 0 deletions docs/notebooks/datasets/word_vectors_training_data.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
anarchism originated as a term of abuse first used against early working class radicals including the diggers of the english revolution and the sans culottes of the french revolution whilst the term is still used in a pejorative way to describe any act that used violent means to destroy the organization of society it has also been taken up as a positive label by self defined anarchists the word anarchism is derived from the greek without archons ruler chief king anarchism as a political philosophy is the belief that rulers are unnecessary and should be abolished although there are differing interpretations of what this means anarchism also refers to related social movements that advocate the elimination of authoritarian institutions particularly the state the word anarchy as most anarchists use it does not imply chaos nihilism or anomie but rather a harmonious anti authoritarian society in place of what are regarded as authoritarian political structures and coercive economic institutions anarchists advocate social relations based upon voluntary association of autonomous individuals mutual aid and self governance while anarchism is most easily defined by what it is against anarchists also offer positive visions of what they believe to be a truly free society however ideas about how an anarchist society might work vary considerably especially with respect to economics there is also disagreement about how a free society might be brought about origins and predecessors kropotkin and others argue that before recorded history human society was organized on anarchist principles most anthropologists follow kropotkin and engels in believing that hunter gatherer bands were egalitarian and lacked division of labour accumulated wealth or decreed law and had equal access to resources william godwin anarchists including the the anarchy organisation and rothbard find anarchist attitudes in taoism from ancient china kropotkin found similar ideas in stoic zeno of citium according to kropotkin zeno repudiated the omnipotence of the state its intervention and regimentation and proclaimed the sovereignty of the moral law of the individual the anabaptists of one six th century europe are sometimes considered to be religious forerunners of modern anarchism bertrand russell in his history of western philosophy writes that the anabaptists repudiated all law since they held that the good man will be guided at every moment by the holy spirit from this premise they arrive at communism the diggers or true levellers were an early communistic movement during the time of the english civil war and are considered by some as forerunners of modern anarchism in the modern era the first to use the term to mean something other than chaos was louis armand baron de lahontan in his nouveaux voyages dans l am rique septentrionale one seven zero three where he described the indigenous american society which had no state laws prisons priests or private property as being in anarchy russell means a libertarian and leader in the american indian movement has repeatedly stated that he is an anarchist and so are all his ancestors in one seven nine three in the thick of the french revolution william godwin published an enquiry concerning political justice although godwin did not use the word anarchism many later anarchists have regarded this book as the first major anarchist text and godwin as the founder of philosophical anarchism but at this point no anarchist movement yet existed and the term anarchiste was known mainly as an insult hurled by the bourgeois girondins at more radical elements in the french revolution the first self labelled anarchist pierre joseph proudhon it is commonly held that it wasn t until pierre joseph proudhon published what is property in one eight four zero that the term anarchist was adopted as a self description it is for this reason that some claim proudhon as the founder of modern anarchist theory in what is property proudhon answers with the famous accusation property is theft in this work he opposed the institution of decreed property propri t where owners have complete rights to use and abuse their property as they wish such as exploiting workers for profit in its place proudhon supported what he called possession individuals can have limited rights to use resources capital and goods in accordance with principles of equality and justice proudhon s vision of anarchy which he called mutualism mutuellisme involved an exchange economy where individuals and groups could trade the products of their labor using labor notes which represented the amount of working time involved in production this would ensure that no one would profit from the labor of others workers could freely join together in co operative workshops an interest free bank would be set up to provide everyone with access to the means of production proudhon s ideas were influential within french working class movements and his followers were active in the revolution of one eight four eight in france proudhon s philosophy of property is complex it was developed in a number of works over his lifetime and there are differing interpretations of some of his ideas for more detailed discussion see here max stirner s egoism in his the ego and its own stirner argued that most commonly accepted social institutions including the notion of state property as a right natural rights in general and the very notion of society were mere illusions or ghosts in the mind saying of society that the individuals are its reality he advocated egoism and a form of amoralism in which individuals would unite in associations of egoists only when it was in their self interest to do so for him property simply comes about through might whoever knows how to take to defend the thing to him belongs property and what i have in my power that is my own so long as i assert myself as holder i am the proprietor of the thing stirner never called himself an anarchist he accepted only the label egoist nevertheless his ideas were influential on many individualistically inclined anarchists although interpretations of his thought are diverse american individualist anarchism benjamin tucker in one eight two five josiah warren had participated in a communitarian experiment headed by robert owen called new harmony which failed in a few years amidst much internal conflict warren blamed the community s failure on a lack of individual sovereignty and a lack of private property warren proceeded to organise experimenal anarchist communities which respected what he called the sovereignty of the individual at utopia and modern times in one eight three three warren wrote and published the peaceful revolutionist which some have noted to be the first anarchist periodical ever published benjamin tucker says that warren was the first man to expound and formulate the doctrine now known as anarchism liberty xiv december one nine zero zero one benjamin tucker became interested in anarchism through meeting josiah warren and william b greene he edited and published liberty from august one eight eight one to april one nine zero eight it is widely considered to be the finest individualist anarchist periodical ever issued in the english language tucker s conception of individualist anarchism incorporated the ideas of a variety of theorists greene s ideas on mutual banking warren s ideas on cost as the limit of price a heterodox variety of labour theory of value proudhon s market anarchism max stirner s egoism and herbert spencer s law of equal freedom tucker strongly supported the individual s right to own the product of his or her labour as private property and believed in a market economy for trading this property he argued that in a truly free market system without the state the abundance of competition would eliminate profits and ensure that all workers received the full value of their labor other one nine th century individualists included lysander spooner stephen pearl andrews and victor yarros the first international mikhail bakunin one eight one four one eight seven six in europe harsh reaction followed the revolutions of one eight four eight twenty years later in one eight six four the international workingmen s association sometimes called the first international united some diverse european revolutionary currents including anarchism due to its genuine links to active workers movements the international became signficiant from the start karl marx was a leading figure in the international he was elected to every succeeding general council of the association the first objections to marx came from the mutualists who opposed communism and statism shortly after mikhail bakunin and his followers joined in one eight six eight the first international became polarised into two camps with marx and bakunin as their respective figureheads the clearest difference between the camps was over strategy the anarchists around bakunin favoured in kropotkin s words direct economical struggle against capitalism without interfering in the political parliamentary agitation at that time marx and his followers focused on parliamentary activity bakunin characterised marx s ideas as authoritarian and predicted that if a marxist party gained to power its leaders would end up as bad as the ruling class they had fought against in one eight seven two the conflict climaxed with a final split between the two groups at the hague congress this is often cited as the origin of the conflict between anarchists and marxists from this moment the social democratic and libertarian currents of socialism had distinct organisations including rival internationals anarchist communism peter kropotkin proudhon and bakunin both opposed communism associating it with statism however in the one eight seven zero s many anarchists moved away from bakunin s economic thinking called collectivism and embraced communist concepts communists believed the means of production should be owned
Loading