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
X = \left[ | |
\begin{array}{rrr} | |
x_{01} &...& x_{0k} & ... & x_{0K} \\ | |
... \\ | |
x_{t1} &...& x_{tk} & ... & x_{tK} \\ | |
... \\ | |
x_{T1} &...& x_{Tk} & ... & x_{TK} | |
\end{array} | |
\right] |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
MIT License | |
Copyright (c) 2018 yatszhash | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
copies of the Software, and to permit persons to whom the Software is | |
furnished to do so, subject to the following conditions: |
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
public static void setPrivateField(Object targetObj, String fieldName, Object value) | |
throws NoSuchFieldException, IllegalAccessException | |
{ | |
Class c = targetObj.getClass(); | |
Field field = c.getDeclaredField(fieldName); | |
field.setAccessible(true); | |
field.set(targetObj, value); | |
} | |
public static Object invokePrivateMethod(Object targetObj, String methodName, |
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
import re | |
import numpy as np | |
class BaseMatcher(object): | |
def __init__(self, pattern, threshold): | |
self.pattern = pattern | |
self.compiled_pattern = re.compile(pattern=self.pattern) | |
self.threshold = threshold | |
def match(self, X): |
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
from sklearn.base import BaseEstimator | |
import numpy as np | |
import gensim | |
from itertools import chain | |
import MeCab | |
class TopicModelVectorizer(BaseEstimator): | |
tagger = MeCab.Tagger("-Owakati") | |
def __init__(self, topic_type, dic_file_name=None, model_file_name=None): | |
self.topic_model = None |
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
# coding: utf-8 | |
from sklearn.feature_extraction.text import TfidfVectorizer, CountVectorizer | |
from sklearn.base import BaseEstimator | |
import MeCab | |
import numpy as np | |
from itertools import chain | |
class JpTfidfVectorizer(TfidfVectorizer): | |
tagger = MeCab.Tagger("-Owakati") |