PHYSBO icon indicating copy to clipboard operation
PHYSBO copied to clipboard

Can physbo handle sparse features?

Open UnixJunkie opened this issue 4 years ago • 7 comments

from scipy import sparse
X = sparse.csr_matrix(...)

UnixJunkie avatar Jun 07 '21 04:06 UnixJunkie

That would be cool. Some molecular representations are very sparse.

UnixJunkie avatar Jun 07 '21 04:06 UnixJunkie

The present version of PHYSBO cannot directly deal with sparse matrices.

If zero in X means an exact zero, please convert to a dense matrix via X.todense(). When it takes too long time, please let us know again.

If zero in X means a missing value, replace missing numbers with some (dummy) numbers such as a mean value over samples.

yomichi avatar Jun 11 '21 01:06 yomichi

You should consider it: not all molecular representations are dense. I will try the todense() method, but this will use a lot of memory.

UnixJunkie avatar Jun 11 '21 01:06 UnixJunkie

but this will use a lot of memory.

Agree. This is just a workaround. Could you show the typical number of samples, features, and nonzero features?

yomichi avatar Jun 11 '21 01:06 yomichi

Here is a typical line:

mol_name,dependant_variable,[0:10;1:11;2:7;3:8;4:8;5:11;6:9;7:5;8:6;9:7;10:4;11:5;12:3;13:
3;14:3;15:2;16:4;17:3;18:3;19:4;20:1;21:4;22:4;23:2;24:3;25:5;26:3;27:6;28:4;29:
4;30:11;31:2;32:7;33:3;34:4;35:6;36:2;37:6;38:3;39:6;40:4;41:4;42:3;43:4;44:2;46
:1;47:4;48:2;50:2;51:1;52:5;53:2;57:2;59:6;60:1;62:1;64:1;65:3;66:2;68:7;69:5;70
:2;71:4;73:5;74:3;75:4;77:1;79:1;84:1;86:2;87:1;89:3;91:2;92:2;99:2;100:6;101:3;
102:2;105:4;108:1;110:1;113:3;114:1;116:3;117:1;118:1;119:2;120:2;121:1;122:1;12
3:1;125:2;129:1;137:3;138:3;142:2;147:3;150:2;151:2;154:1;156:1;161:1;162:1;168:
1;169:1;178:2;179:2;190:2;191:5;192:1;194:2;201:3;202:1;203:1;205:1;207:1;208:4;
209:1;212:2;214:1;216:1;217:1;220:2;221:2;223:1;224:3;225:2;226:2;228:3;231:1;23
7:1;238:1;241:1;243:1;246:1;249:1;250:2;253:2;255:4;256:1;259:1;260:3;261:2;262:
2;268:1;269:3;272:1;273:3;276:2;277:2;280:1;283:1;284:1;285:3;290:1;296:3;304:2;
305:3;306:1;309:4;313:1;315:2;318:2;321:2;325:2;326:1;330:1;334:1;336:1;338:4;33
9:2;360:3;363:3;365:4;367:2;372:1;380:1;384:1;390:1;391:2;394:1;396:1;398:1;401:
3;414:1;425:1;428:1;441:1;446:1;451:1;453:1;454:1;461:1;462:2;471:1;474:2;480:1;
488:1;490:2;511:1;516:1;523:2;530:1;532:1;534:1;536:1;558:1;572:1;579:1;583:1;61
5:1;617:1;622:1;624:1;625:1;636:2;642:2;644:2;645:2;655:2;661:1;683:1;688:1;689:
2;702:1;712:1;730:1;731:1;733:1;736:2;743:1;755:2;798:1;805:1;835:1;865:1;876:2;
885:2;892:1;902:1;905:1;916:1;926:1;936:3;940:2;946:3;962:1;982:1;1008:1;1048:1;
1094:1;1116:1;1129:1;1130:1;1140:1;1158:1;1188:1;1196:2;1210:1;1298:1;1351:1;136
2:1;1365:1;1372:1;1450:1;1459:1;1460:1;1469:1;1521:1;1579:1;1589:1;1634:1;1647:1
;1649:1;1729:1;1792:1;1795:1;1883:1;1921:1;1956:1;1975:1;2063:1;2069:1;2153:1;22
13:1;2519:1;2532:1;2665:1;2717:1;2845:1;3235:1;3247:1;4308:1;4729:1;4840:1]

The wrapping is due to github.

UnixJunkie avatar Jun 11 '21 02:06 UnixJunkie

Samples are in the thousands usually (from hundreds to about 10k per dataset). The number of features is ~17000. Non zero features might be in the hundreds for one molecule.

UnixJunkie avatar Jun 11 '21 02:06 UnixJunkie

OK, we've understood that the support for sparse matrices is highly demanded in molecular science. We want to implement it in PHYSBO in the future, but I'm sorry that I cannot promise when we will do it. Thank you for the suggestion.

yomichi avatar Jun 11 '21 04:06 yomichi