Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getting error from "aorta_data_analysis.ipynb" #5

Open
btlantis opened this issue Oct 26, 2023 · 3 comments
Open

getting error from "aorta_data_analysis.ipynb" #5

btlantis opened this issue Oct 26, 2023 · 3 comments

Comments

@btlantis
Copy link

btlantis commented Oct 26, 2023

Dear jingcheng-du,
I am trying to run "aorta_data_analysis.ipynb" on google colab. However, I am getting error when I run cell [18]. Here is the error I got as following:

TypeError Traceback (most recent call last)
in <cell line: 24>()
29 else:
30 idx, sim = get_similar_vectors(test_emebd[k][np.newaxis, ...], ref_cell_embeddings)
---> 31 pred = mode(y_train[idx], axis=0)
32 neighbors_list_gpt_v1.append(y_train[idx])
33 gt_list.append(gt)

1 frames
/usr/local/lib/python3.10/dist-packages/scipy/stats/_stats_py.py in mode(a, axis, nan_policy, keepdims)
509 "array was deprecated in SciPy 1.9.0 and removed in SciPy "
510 "1.11.0. Please consider np.unique.")
--> 511 raise TypeError(message)
512
513 if a.size == 0:

TypeError: Argument a is not recognized as numeric. Support for input that cannot be coerced to a numeric array was deprecated in SciPy 1.9.0 and removed in SciPy 1.11.0. Please consider np.unique.

PS: I only modify "N_TRUNC_GENE = 1000" into "N_TRUNC_GENE = 20" (try to reducing embedding process??)
Could you please help me with that?
Thank you so much!

Best Regards,
Ben

@ShengZhaoDE
Copy link

ShengZhaoDE commented Nov 1, 2023

change
pred = mode(y_train[idx], axis=0)
to
vals,counts = np.unique(y_train[idx], return_counts=True) pred = vals[np.argmax(counts)]

works for me.

@SmileSpring1823
Copy link

SmileSpring1823 commented Nov 10, 2023

Hey there,

I made the change. But I get "0.0" for the accuracy score.

Seems like the predictions just return the first letter:

print("gt")
print(gt_list[0:23])

print("pred")
print(pred_list[0:23])

gt
['Tcell', 'SMC1', 'NK', 'SMC1', 'MonoMaphDC', 'NK', 'Tcell', 'Tcell', 'Tcell', 'MonoMaphDC', 'Tcell', 'MonoMaphDC', 'MonoMaphDC', 'SMC2', 'Tcell', 'SMC1', 'Tcell', 'Tcell', 'MonoMaphDC', 'SMC1', 'SMC1', 'NK', 'Tcell']
pred
['T', 'S', 'T', 'S', 'M', 'M', 'T', 'T', 'T', 'M', 'T', 'M', 'M', 'S', 'T', 'S', 'T', 'T', 'M', 'S', 'S', 'T', 'T']

Any suggestions?

EDIT: You just need to remove the [0][0] at the append for pred

@HelloWorldLTY
Copy link

Hi, it seems that it is a problem related to the neighbor searching. I suggest installing this package directly from github rather than pypl:

https://github.com/nmslib/hnswlib

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants