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

tsne.fit_transform() prematurely ends before function return in a function call #124

Open
ruyian opened this issue Aug 12, 2023 · 0 comments

Comments

@ruyian
Copy link

ruyian commented Aug 12, 2023

I encountered an issue while working on my project and reported it on GitHub. The issue relates to a specific function call within my code.

I have a code snippet that includes a function call to fit_transform() as shown below:

def f():
    ...

    logger.info("Start TSNE")
    reduced_features = TSNE(n_components=2, perplexity=15, learning_rate=10).fit_transform(features)
    logger.info("Finish TSNE for features")

    ...
    return reduced_features

def main():
    ...
    f()
    logger.info("Finished dim reduction")

    g()

In this code excerpt, I've incorporated a call to fit_transform(). Utilizing a logger, I aim to document the execution progress. However, I observed that only the message "Start TSNE" is logged, while the subsequent log messages are conspicuously absent. Adding to the complexity, the function g() is unexpectedly invoked even though the preceding function f() should return a value that serves as an argument for g().

What's even more puzzling is that the program ends with g() triggering an exception, indicating that it is executed before the completion of f(). This behavior is not only unexpected and peculiar, given the dependency of g() on the return value of f().

I suspect that there might be an element of parallelization at play here. However, the complicating factor is that g() requires an argument that hinges on the output of f()'s t-SNE transformation.

I'm reaching out for insights into why this behavior is occurring and, more importantly, how to effectively address it. Your assistance in unraveling this conundrum would be immensely appreciated.

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

1 participant