Skip to content
Permalink
Browse files

Refactoring and explanations.

  • Loading branch information...
dermatologist committed Apr 26, 2019
1 parent b409b96 commit 032f50170c79d71128ca76e9a859f555b826e6bd
Showing with 7 additions and 23 deletions.
  1. +1 −1 qrmine.py
  2. +0 −22 src/ml_qrmine/mlqrmine.py
  3. +6 −0 src/nlp_qrmine/sentiment.py
@@ -14,7 +14,7 @@
@click.command()
@click.option('--verbose', '-v', is_flag=True, help="Will print verbose messages.")
@click.option('--inp', '-i', multiple=True, default='',
help='Input file in the text format with <break> Topic </break>')
help='Input file in the text format with <break>Topic</break>')
@click.option('--out', '-o', multiple=False, default='',
help='Output file name')
@click.option('--csv', multiple=False, default='',
@@ -173,28 +173,6 @@ def svm_confusion_matrix(self):
y_pred = classifier.predict(X_test)
return confusion_matrix(y_test, y_pred)

# def knn_search(self, K=3, r=3):
# """ find K nearest neighbours of data among D """
# D = self._X
# x = self._X[[r-1], :]
#
# print("KNN: ", x)
# (recs, vs) = D.shape
#
# print(recs)
# #ndata = D.shape[0]
# #K = K if K < ndata else ndata
# K = K if K < recs else recs
#
# print(K)
# # euclidean distances from the other points
# sqd = sqrt(((D - x[:, :recs]) ** 2).sum(axis=0))
# idx = argsort(sqd) # sorting
# # return the indexes of K nearest neighbours
# print(idx[:K])
#
# return idx[:K]

# https://stackoverflow.com/questions/45419203/python-numpy-extracting-a-row-from-an-array
def knn_search(self, n=3, r=3):
kdt = KDTree(self._X, leaf_size=2, metric='euclidean')
@@ -25,6 +25,12 @@ def hamming(self, str1, str2):
Returns the sentiment with maximum score
pos, neg or neu
The Positive, Negative and Neutral scores represent the proportion of text that falls in these categories.
The Compound score is a metric that calculates the sum of all the lexicon ratings which have been normalized between -1(most extreme negative) and +1 (most extreme positive).
More here: https://medium.com/analytics-vidhya/simplifying-social-media-sentiment-analysis-using-vader-in-python-f9e6ec6fc52f
"""

0 comments on commit 032f501

Please sign in to comment.
You can’t perform that action at this time.