Skip to content

Instantly share code, notes, and snippets.

@AadityaJ
Last active October 1, 2016 20:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AadityaJ/fd4dd8ac26883a06df72fee3b0e06d5f to your computer and use it in GitHub Desktop.
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
"""
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])
"""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/
"""
#!/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()
@AadityaJ
Copy link
Author

AadityaJ commented Oct 1, 2016

Result ::
$ python test_sklearn_integration.py

.

Ran 1 test in 0.000s

OK

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment