You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I recently encountered an issue while running a TensorFlow-Modisco workflow which involves TSNE computations. The workflow fails with a TypeError related to PCA initialization, specifically when handling sparse input matrices. The error message is as follows:
# install TF-modisco
!pipinstallmodisco==0.5.16.0importsklearnprint(sklearn.__version__)
importmodisco# check parametersimportinspectdefget_default_args(func):
signature=inspect.signature(func)
return {
k: v.defaultfork, vinsignature.parameters.items()
ifv.defaultisnotinspect.Parameter.empty
}
get_default_args(modisco.tfmodisco_workflow.workflow.TfModiscoWorkflow)
fromimportlibimportreload# reload(modisco.util)# reload(modisco.pattern_filterer)# reload(modisco.aggregator)# reload(modisco.core)# reload(modisco.seqlet_embedding.advanced_gapped_kmer)# reload(modisco.affinitymat.transformers)# reload(modisco.affinitymat.core)# reload(modisco.affinitymat)# reload(modisco.cluster.core)# reload(modisco.cluster)# reload(modisco.tfmodisco_workflow.seqlets_to_patterns)# reload(modisco.tfmodisco_workflow)# reload(modisco)null_per_pos_scores=modisco.coordproducers.LaplaceNullDist(num_to_samp=5000)
# prepare TF-modisco function to run for dev or hkdefmy_tfmodisco(task):
...
[Restofyourcodehere]
...
returntfmodisco_results# function to visualize motifsfromcollectionsimportCounterimportnumpyasnpfrommodisco.visualizationimportviz_sequencereload(viz_sequence)
frommatplotlibimportpyplotaspltimportmodisco.affinitymat.corereload(modisco.affinitymat.core)
importmodisco.cluster.phenograph.corereload(modisco.cluster.phenograph.core)
importmodisco.cluster.phenograph.clusterreload(modisco.cluster.phenograph.cluster)
importmodisco.cluster.corereload(modisco.cluster.core)
importmodisco.aggregatorreload(modisco.aggregator)
defmodisco_motif_plots(task):
...
[Restofyourcodehere]
...
hdf5_results.close()
# Run TF-Modisco - takes around 10minsdev_tfmodisco_results=my_tfmodisco('Dev_contrib_scores')
# save resultsimportmodisco.utilreload(modisco.util)
grp=h5py.File("/content/drive/MyDrive/DeepSTARR_tutorial/Dev_modisco_results.hdf5", "w")
dev_tfmodisco_results.save_hdf5(grp)
grp.close()
TypeErrorTraceback (mostrecentcalllast)
[<ipython-input-121-086db4f84169>] in<cellline: 2>()
1# Run TF-Modisco - takes around 10mins---->2dev_tfmodisco_results=my_tfmodisco('Dev_contrib_scores')
345# save results5frames
[/usr/local/lib/python3.10/dist-packages/sklearn/manifold/_t_sne.py] in_fit(self, X, skip_num_points)
833834ifisinstance(self.init, str) andself.init=="pca"andissparse(X):
-->835raiseTypeError(
836"PCA initialization is currently not supported "837"with the sparse input matrix. Use "TypeError: PCAinitializationiscurrentlynotsupportedwiththesparseinputmatrix. Useinit="random"instead.
ThisformattedcodecanbecopieddirectlyintoaMarkdowneditor. Thetriplebackticks (` ````) are used to start and end the code block, and `python` afterthefirstsetofbackticksindicatesthattheblockcontainsPythoncode, whichhelpsinsyntaxhighlighting. 😊👨💻
The text was updated successfully, but these errors were encountered:
Hi @JoneSu1, the fix for this had been helpfully contributed by another user in v0.5.16.3, but I hadn't pushed it to pypi. I just pushed it to pypi, so if you download the latest version you shouldn't get this error. Best, Avanti
(btw "tf" here stands for "transcription factor", it was given that prefix to distinguish it from Eclipse Modisco)
Hello TensorFlow-Modisco Community,
I recently encountered an issue while running a TensorFlow-Modisco workflow which involves TSNE computations. The workflow fails with a TypeError related to PCA initialization, specifically when handling sparse input matrices. The error message is as follows:
The text was updated successfully, but these errors were encountered: