Skip to content

Commit

Permalink
Fixed some warnings and deprecations.
Browse files Browse the repository at this point in the history
This includes the warning from #6, although the underlying task of
refactoring the inheritance stuff still needs to be tackled (#7).
  • Loading branch information
thvitt committed Oct 10, 2020
1 parent d022f42 commit 31bf8a7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion delta/cluster.py
Expand Up @@ -193,7 +193,7 @@ def evaluate(self):
Returns:
pandas.Series: All scores for the current clustering
"""
result = pd.Series()
result = pd.Series(dtype='float64')
result["Cluster Errors"] = self.cluster_errors()
result["Adjusted Rand Index"] = self.adjusted_rand_index()
result["Homogeneity"], result["Completeness"], result["V Measure"] = \
Expand Down
6 changes: 5 additions & 1 deletion delta/corpus.py
Expand Up @@ -10,6 +10,8 @@ class which represents the feature matrix. Also contained are default
import os
import glob
from fnmatch import fnmatch
from typing import Type

import regex as re
import pandas as pd
import collections
Expand Down Expand Up @@ -249,6 +251,8 @@ def __init__(self, operation):

class Corpus(pd.DataFrame):

_metadata = ['metadata']

def __init__(self, subdir=None, file=None, corpus=None,
feature_generator=FeatureGenerator(),
document_describer=DefaultDocumentDescriber(),
Expand Down Expand Up @@ -444,7 +448,7 @@ def _load_wordlist(self, filename, **kwargs):
Yields:
Features from the given file
"""
ENTRY = re.compile('\s*([^#]+)')
ENTRY = re.compile(r'\s*([^#]+)')
with open(filename, 'r', **kwargs) as f:
for line in f:
match = ENTRY.match(line)
Expand Down
5 changes: 4 additions & 1 deletion delta/deltas.py
Expand Up @@ -600,6 +600,9 @@ def __call__(self, corpus):


class DistanceMatrix(pd.DataFrame):

_metadata = ['metadata']

"""
A distance matrix is the result of applying a :class:`DeltaFunction` to a
:class:`Corpus`.
Expand Down Expand Up @@ -781,7 +784,7 @@ def evaluate(self):
Returns:
pandas.Series: All scores implemented for distance matrixes
"""
result = pd.Series()
result = pd.Series(dtype='float64')
result["F-Ratio"] = self.f_ratio()
result["Fisher's LD"] = self.fisher_ld()
result["Simple Score"] = self.simple_score()
Expand Down

0 comments on commit 31bf8a7

Please sign in to comment.