Skip to content

Commit

Permalink
Merge pull request #123 from paxtonfitzpatrick/pep396
Browse files Browse the repository at this point in the history
bug fixes, test updates, other minor fixes
  • Loading branch information
paxtonfitzpatrick committed Jun 3, 2021
2 parents 94fa39c + 4d6041b commit 6c847a4
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 11 deletions.
5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ sudo: false
services:
- xvfb
python:
- '2.7'
- '3.5'
- '3.6'
- '3.7'
- '3.8'
- '3.9'
before_script:
- export DISPLAY=:99.0
- sleep 3
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ This will work on clean systems, but if you encounter issues you may need to run

<h2>Requirements</h2>

+ python 2.7, 3.4+
+ python>=3.6
+ pandas>=0.18.0
+ seaborn>=0.7.1
+ matplotlib>=1.5.1
Expand Down
12 changes: 6 additions & 6 deletions quail/analysis/recmat.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,16 @@ def recall_matrix(egg, match='exact', distance='euclidean', features=None):
return _recmat_smooth(egg.pres, egg.rec, features, distance, match)

def _recmat_exact(presented, recalled, features):
lists = presented.index.to_numpy()()
lists = presented.index.to_numpy()
cols = max(presented.shape[1], recalled.shape[1])
result = np.empty((presented.shape[0], cols))*np.nan
for li, l in enumerate(lists):
p_list = presented.loc[l]
r_list = recalled.loc[l]
for i, feature in enumerate(features):
get_feature = lambda x: np.array(x[feature]) if not np.array(pd.isnull(x['item'])).any() else np.nan
p = np.vstack(p_list.apply(get_feature).to_numpy()())
r = r_list.dropna().apply(get_feature).to_numpy()()
p = np.vstack(p_list.apply(get_feature).to_numpy())
r = r_list.dropna().apply(get_feature).to_numpy()
r = np.vstack(list(filter(lambda x: x is not np.nan, r)))
try:
m = [np.where((p==x).all(axis=1))[0] for x in r]
Expand Down Expand Up @@ -90,15 +90,15 @@ def _recmat_smooth(presented, recalled, features, distance, match):
return recmat

def _similarity_smooth(presented, recalled, features, distance):
lists = presented.index.to_numpy()()
lists = presented.index.to_numpy()
res = np.empty((len(lists), len(features), recalled.iloc[0].shape[0], presented.iloc[0].shape[0]))*np.nan
for li, l in enumerate(lists):
p_list = presented.loc[l]
r_list = recalled.loc[l]
for i, feature in enumerate(features):
get_feature = lambda x: np.array(x[feature]) if np.array(pd.notna(x['item'])).any() else np.nan
p = np.vstack(p_list.apply(get_feature).to_numpy()())
r = r_list.dropna().apply(get_feature).to_numpy()()
p = np.vstack(p_list.apply(get_feature).to_numpy())
r = r_list.dropna().apply(get_feature).to_numpy()
r = np.vstack(list(filter(lambda x: x is not np.nan, r)))
tmp = 1 - cdist(r, p, distance)
res[li, i, :tmp.shape[0], :] = tmp
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ numpy>=1.10.4
scipy>=0.17.1
matplotlib>=1.5.1
seaborn>=0.9.0
pandas>=0.18.1
pandas>=0.24.0
future
six
deepdish
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

setup(
name='quail',
version='0.2.0',
version='0.2.1',
description=DESCRIPTION,
long_description=LONG_DESCRIPTION,
author='Contextual Dynamics Lab',
Expand Down

0 comments on commit 6c847a4

Please sign in to comment.