{ "info": { "author": "Michael J.T. O'Kelly", "author_email": "mokelly@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Operating System :: Unix", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4" ], "description": "##############\nWabbit Wappa\n##############\n\n.. image:: https://travis-ci.org/mokelly/wabbit_wappa.svg?branch=master\n :target: https://travis-ci.org/mokelly/wabbit_wappa\n\n**Wabbit Wappa** is a full-featured Python wrapper for the lightning fast `Vowpal Wabbit `_ (\"VW\") \nmachine learning utility. Wabbit Wappa makes it easier to use VW's powerful features while abstracting away its idiosyncratic syntax and interface.\n\n.. contents:: :local:\n\n****************\nFeatures\n****************\n\n* Complete Pythonic wrapper for the Vowpal Wabbit training and test syntax\n* Online training and testing, with no need to restart VW or reload the trained model to go between them\n* Save the trained model on the fly\n\n****************\nGetting Started\n****************\n\nIf you're unfamiliar with Vowpal Wabbit, this documentation is no substitute for \nthe `detailed tutorials `_\nat the VW wiki. You'll eventually need to read those to understand VW's advanced features.\n\nInstallation\n===============\n\nYou have three installation options, depending on your comfort with compiling and installing the VW utility.\n\n**If you already have Vowpal Wabbit installed**::\n\n pip install wabbit_wappa\n\n**If you still need to install VW (currently version 7.7) and its dependencies**:\n\nStart by cloning the WW repository::\n\n git clone https://github.com/mokelly/wabbit_wappa.git\n cd wabbit_wappa\n\nThen run the included install script (which more or less follows the VW instructions)::\n\n scripts/vw-install.sh\n export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib;\n python setup.py install\n\n(The \"export\" line should be added to your .profile if you don't want to run it every time you use Vowpal Wabbit.)\n\n**If you want a virtual machine with everything all set up for you:**\n \n*Windows users, this is your only option at present*\n\nFirst install the virtual machine manager `Vagrant `_ along with your favorite virtualization system (such as `VirtualBox `_).\nThen from the Wabbit Wappa source directory type::\n\n vagrant up\n\nThis will launch an Ubuntu VM and provision it with VW and WW, completely automatically! Once that's all complete, just SSH to your new VM with::\n\n vagrant ssh\n \nTesting\n---------\n\nMake sure everything is installed and configured correctly by running the tests::\n\n py.test\n\nUsage Example\n===============\n\nLet's walk through an example of using Wabbit Wappa. We will teach VW to recognize\ncapitalized characters.\n(You can find the whole script at ``examples/capitalization_demo.py``.)\n\nStart a default VW process in Logistic Regression mode::\n\n >>> from wabbit_wappa import *\n >>> vw = VW(loss_function='logistic')\n >>> print vw.command\n vw --save_resume --quiet --loss_function logistic --predictions /dev/stdout\n\nBehind the scenes, Wabbit Wappa generates a command line including default parameters critical\nto interaction with this wrapper. VW is immediately run as a subprocess.\n\nNow train the logistic model by sending 10 labeled examples to the VW learner::\n\n for i in range(10):\n label, features = get_example() # Random example; see capitalization_demo.py\n vw.send_example(label, features=features)\n\nFrom examples like these::\n\n Label -1: ['z', 'x', 'n', 'F', 'C', 'B', 'f', 'p', 'O'] is mostly lowercase\n Label -1: ['S', 'u', 'e', 'K', 'f', 'w', 'l', 'C', 'd'] is mostly lowercase\n Label -1: ['g', 'v', 'q', 'z', 'x', 'B', 'T', 'p', 'M'] is mostly lowercase\n Label 1: ['j', 'i', 'k', 'D', 'm', 'N', 'Q', 'Z', 'L'] is mostly uppercase\n Label 1: ['B', 'U', 'V', 'R', 'i', 'h', 'T', 'A', 'v'] is mostly uppercase\n Label 1: ['Y', 'u', 'R', 'K', 's', 'X', 'g', 'M', 'j'] is mostly uppercase\n Label -1: ['t', 'L', 'a', 'g', 'D', 'E', 'f', 'G', 'u'] is mostly lowercase\n Label 1: ['F', 'W', 'y', 'i', 'U', 'E', 'X', 'r', 'e'] is mostly uppercase\n Label -1: ['s', 'e', 'h', 'U', 'J', 'C', 'j', 'P', 'b'] is mostly lowercase\n Label 1: ['A', 'k', 'H', 'G', 'a', 'b', 'w', 'Q', 'V'] is mostly uppercase\n\nVW begins to find the pattern: a +1 label if the capital letters outnumber the\nlowercase, and -1 otherwise.\n\nHow well trained is our model? Let's run 100 tests on new random examples::\n\n for i in range(num_tests):\n label, features = get_example()\n # Give the features to the model, witholding the label\n response = vw.get_prediction(features)\n prediction = response.prediction\n # Test whether the floating-point prediction is in the right direction\n if cmp(prediction, 0) == label:\n num_good_tests += 1\n\n(For logistic regression, a ``prediction`` value greater than zero representa\na label of +1; that is why ``cmp(prediction, 0)`` is used.)\n\n >>> print \"Correctly predicted\", num_good_tests, \"out of\", num_tests\n Correctly predicted 60 out of 100\n\nWe can go on training, without restarting the process. Let's train on 1,000 more examples::\n\n for i in range(1000):\n label, features = get_example()\n vw.send_example(label, features=features)\n\nNow how good are our predictions?\n\n Correctly predicted 98 out of 100\n\nWe can save the model to disk at any point in the process::\n\n filename = 'capitalization.saved.model'\n vw.save_model(filename)\n\nand reload our model using the 'i' argument::\n\n >>> vw2 = VW(loss_function='logistic', i=filename)\n >>> print vw2.command\n vw -i capitalization.saved.model --save_resume --quiet --loss_function logistic --predictions /dev/stdout\n\nThe ``vw2`` model will now give just the same predictions that ``vw`` would have; and the default ``save_resume=True`` parameter\nmeans we can continue training from where we left off.\n\nTo shut down the VW subprocess before your program exits, call ``vw.close()``.\n\n\n****************\nDocumentation\n****************\n\nNamespaces\n===============\n\nThe most important Vowpal Wabbit feature not discussed above is namespaces. VW\nuses namespaces to divide features into groups, which is used for some of its\nadvanced features. Without discussing in detail *why* you would use them,\nhere's *how* to use namespaces in Wabbit Wappa.\n\nTo reproduce an example from this `Vowpal Wabbit tutorial `_::\n\n namespace1 = Namespace('excuses', 0.1, [('the', 0.01), 'dog', 'ate', 'my', 'homework'])\n namespace2 = Namespace('teacher', features='male white Bagnell AI ate breakfast'.split())\n\nThese namespaces can then be used as examples in training and prediction::\n\n vw.send_example(response=1.,\n importance=.5,\n tag=\"example_39\",\n namespaces=[namespace1, namespace2])\n response = vw.get_prediction(namespaces=[namespace1, namespace2])\n prediction = response.prediction\n\nAlternatively, Namespaces can be queued up to be used automatically in the next\nexample or prediction sent to the VW subprocess::\n\n vw.add_namespace(namespace1)\n vw.add_namespace(namespace2)\n vw.send_example(response=-1., importance=.5, tag=\"example_39\")\n\nor::\n\n vw.add_namespace('excuses', 0.1, [('the', 0.01), 'dog', 'ate', 'my', 'homework'])\n vw.add_namespace('teacher', features='male white Bagnell AI ate breakfast'.split())\n response = vw.get_prediction()\n prediction = response.prediction\n\nTokens in Vowpal Wabbit may not contain the space character, ``:`` or ``|``. By default,\nWabbit Wappa will detect and escape these characters::\n\n >>> namespace = Namespace('Metric Features', 3.28, [('hei|ght', 1.5), ('len:gth', 2.0)])\n >>> print namespace.to_string()\n Metric\\_Features:3.28 hei\\\\ght:1.5 len\\;gth:2.0\n\nIf you wish, you can get the raw VW input lines and pass them to the subprocess directly::\n\n vw.add_namespace(namespace1)\n vw.add_namespace(namespace2)\n raw_line = vw.make_line(response=1., importance=.5, tag=\"example_39\")\n vw.send_line(raw_line)\n\n >>> print raw_line\n 1.0 0.5 'example_39|excuses:0.1 the:0.01 dog ate my homework |teacher male white Bagnell AI ate breakfast\n\n\nVW Options\n===============\n\nIn the ``VW()`` constructor, each named argument corresponds\nto a Vowpal Wabbit option. Single character keys are mapped to single-dash options;\ne.g. ``b=20`` yields ``-b 20``. Multiple character keys map to double-dash options:\n``quiet=True`` yields ``--quiet``.\n\nBoolean values are interpreted as flags: present if True, absent if False (or not given).\nAll non-boolean values are treated as option arguments, as in the `-b` example above.\n\nIf an option argument is a list, that option is repeated multiple times;\ne.g. ``q=['ab', 'bc']`` yields ``-q ab -q bc``.\n\nRun ``vw -h`` from your terminal for a listing of most options.\n\nNote that Wabbit Wappa makes no attempt to validate the inputs or\nensure they are compatible with its functionality. For instance, changing the\ndefault ``predictions='/dev/stdout'`` will probably make that ``VW()`` instance\nnon-functional.\n\nActive Learning\n=================\n\nActive Learning is an approach to training somewhere between supervised and unsupervised.\nWhen getting labeled data is very expensive (such as when users must be solicited for\ntheir preferences), an Active Learning approach assigns an \"importance\" value to each\nunlabeled example, so that only the most critical labels need be acquired.\n\nVowpal Wabbit's `Active Learning `_\ninterface requires you to start a VW instance in server mode and communicate with it\nvia a socket. Wabbit Wappa abstracts all that away, providing the same interface for both\nregular and Active learning::\n\n vw = VW(loss_function='logistic', active_mode=True, active_mellowness=0.1)\n response = vw.get_prediction(features)\n if response.importance >= 1.:\n label = get_expensive_label(features)\n vw.send_example(label, features=features)\n\nSee ``examples/active_learning_demo.py`` for a fully worked example.\n\n\nAPI Documentation\n===================\n\nFor complete explanation of all parameters, refer to the docstrings::\n\n import wabbit_wappa\n help(wabbit_wappa)\n\n\n\n\n\n\n\n****************\nHistory\n****************\n\n0.0.1 (2014-03-31)\n=====================\n\n* First release on GitHub\n\n0.0.2 (2014-04-07)\n=====================\n\n* Good unit test coverage\n* Full documentation, instructions and demo\n* Added command line builder with Pythonic interface\n\n0.1.2 (2014-04-09)\n=====================\n\n* Now installable using pip\n* Updated VW version to 7.6\n* Tweaked line detection to speed up process communication\n\n0.2.0 (2014-04-13)\n=====================\n\n* Active Learning interface, with documentation and example script\n* Minor performance boosts\n* **Backwards-incompatible change:** ``get_prediction()`` now returns a ``VWResult`` object, with the predicted value accessible as ``result.prediction``.\n \n0.3.0 (2014-10-16)\n======================\n\n* Python 3 compatibility (thanks `Antti Haapala `_!)\n* Much faster line buffering (50% overall speed improvement) (thanks `Antti Haapala `_!)\n* Updated VW version to 7.7\n* Updated Ubuntu in VM to Trusty\n* Travis integration", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/mokelly/wabbit_wappa", "keywords": "wabbit_wappa", "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "wabbit_wappa", "package_url": "https://pypi.org/project/wabbit_wappa/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/wabbit_wappa/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/mokelly/wabbit_wappa" }, "release_url": "https://pypi.org/project/wabbit_wappa/0.3.0/", "requires_dist": null, "requires_python": null, "summary": "Wabbit Wappa is a full-featured Python wrapper for the Vowpal Wabbit machine learning utility.", "version": "0.3.0" }, "last_serial": 1276098, "releases": { "0.1.2": [ { "comment_text": "", "digests": { "md5": "ae67050e9ddc1c184de9e3c4cccbfe85", "sha256": "5183f70bb45256d92575be9ba710b4028d55eddf523b1cf63558f660b5e801d2" }, "downloads": -1, "filename": "wabbit_wappa-0.1.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "ae67050e9ddc1c184de9e3c4cccbfe85", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 14988, "upload_time": "2014-04-09T15:45:23", "url": "https://files.pythonhosted.org/packages/f3/d4/1498249e7e15653386e152b76bd40f49c98216b5d45ee731f0177660e54d/wabbit_wappa-0.1.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d42b9ef0bfa3a2d8eb5010c160fd3e04", "sha256": "99b1f4a280813f4ba1ab01ce07451025bafec2916fe04ff6235abffe938ee42a" }, "downloads": -1, "filename": "wabbit_wappa-0.1.2.tar.gz", "has_sig": false, "md5_digest": "d42b9ef0bfa3a2d8eb5010c160fd3e04", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19357, "upload_time": "2014-04-09T15:45:00", "url": "https://files.pythonhosted.org/packages/50/72/37c19e3737f964ad38c3e1ad00d1788ef0f9381d85ea625cf1b0baa87c25/wabbit_wappa-0.1.2.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "5c0a050337f3ec081db5bab09e240b34", "sha256": "c2058aeae65121725f3901a5b102033bcd911661bfdef1ec1a51eb1984d62ef0" }, "downloads": -1, "filename": "wabbit_wappa-0.2.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "5c0a050337f3ec081db5bab09e240b34", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 18448, "upload_time": "2014-04-13T13:47:53", "url": "https://files.pythonhosted.org/packages/3d/81/852995e3bfc504ffbbd1e73eb0ebdd6bca740257ed8f1fe36abc5028fbb3/wabbit_wappa-0.2.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7ab6b40d7151d5893ce65c0a0e859c8f", "sha256": "29881f8095468f2ea01454fbb29db79484a37a63dcd3f753e14af38b489c0c4d" }, "downloads": -1, "filename": "wabbit_wappa-0.2.0.tar.gz", "has_sig": false, "md5_digest": "7ab6b40d7151d5893ce65c0a0e859c8f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 22419, "upload_time": "2014-04-13T13:47:43", "url": "https://files.pythonhosted.org/packages/7a/5b/91de32cd4e0e48f4df6af468b24dcf32fec6ae3d49fda87786bed574dd0d/wabbit_wappa-0.2.0.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "75a78933e2d8f276ddd545c9ccfe53a3", "sha256": "c03d34a04852e065237cdc0362731f5d34d561a55dd006a36e4f6eb79f4bd720" }, "downloads": -1, "filename": "wabbit_wappa-0.3.0.tar.gz", "has_sig": false, "md5_digest": "75a78933e2d8f276ddd545c9ccfe53a3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 23001, "upload_time": "2014-10-20T05:27:41", "url": "https://files.pythonhosted.org/packages/3c/19/91a846c5f82a951a849413683a7acec4c5037a75c5b29bdad09fa1e4a47e/wabbit_wappa-0.3.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "75a78933e2d8f276ddd545c9ccfe53a3", "sha256": "c03d34a04852e065237cdc0362731f5d34d561a55dd006a36e4f6eb79f4bd720" }, "downloads": -1, "filename": "wabbit_wappa-0.3.0.tar.gz", "has_sig": false, "md5_digest": "75a78933e2d8f276ddd545c9ccfe53a3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 23001, "upload_time": "2014-10-20T05:27:41", "url": "https://files.pythonhosted.org/packages/3c/19/91a846c5f82a951a849413683a7acec4c5037a75c5b29bdad09fa1e4a47e/wabbit_wappa-0.3.0.tar.gz" } ] }