Last active
October 1, 2016 20:29
-
-
Save AadityaJ/fd4dd8ac26883a06df72fee3b0e06d5f to your computer and use it in GitHub Desktop.
Provides basics for later scikit learn interface implementation. File structure : 1)base.py and __init__.py in gensim/gensim/sklearn_integration 2)test_sklearn_integration.py added to gensim/gensim/test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
scikit learn interface for gensim for easy use of gensim with scikit-learn | |
""" | |
import numpy as np | |
class BaseClass(object): | |
def __init__(self): | |
"""init""" | |
def run(self): | |
return np.array([0,0,0]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""scikit learn wrapper for gensim | |
Contains various gensim based implementations | |
which match with scikit-learn standards . | |
See [1] for complete set of conventions. | |
[1] http://scikit-learn.org/stable/developers/ | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# | |
# Copyright (C) 2010 Radim Rehurek <radimrehurek@seznam.cz> | |
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html | |
""" | |
Tests for sklearn_integration interface | |
""" | |
import logging | |
import unittest | |
import os | |
import os.path | |
import numpy as np | |
from gensim.sklearn_integration import base | |
class TestSklearn(unittest.TestCase): | |
""" | |
write test script | |
""" | |
#for now | |
def testRun(self): | |
model=base.BaseClass() | |
self.assertTrue(np.array_equal(model.run(),np.array([0,0,0]))) | |
if __name__ == '__main__': | |
logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.DEBUG) | |
unittest.main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Result ::
$ python test_sklearn_integration.py
.
Ran 1 test in 0.000s
OK