Giter Site home page Giter Site logo

Comments (3)

lvdmaaten avatar lvdmaaten commented on July 25, 2024

Yeah that doesn't sound like a bad solution for now. I don't have access to a Windows-machine, so would you mind taking a crack at it @jlorince?

from bhtsne.

nitheshj avatar nitheshj commented on July 25, 2024

@jlorince It would be helpful if you can elaborate on the stopgap solution. I'm trying to run this in windows and os.fork is causing the issues. Thanks in advance.

from bhtsne.

AliFlux avatar AliFlux commented on July 25, 2024

I ended up modifying the code to remove the fork. Turns out, fork is just used to make the command prompt responsive to keyboard interrupts. Removing that also makes this compatible with jupyter and spyder.

Just replace the function with this one:

def run_bh_tsne(data, no_dims=2, perplexity=50, theta=0.5, randseed=-1, verbose=False, initial_dims=50, use_pca=True, max_iter=1000):
    '''
    Run TSNE based on the Barnes-HT algorithm

    Parameters:
    ----------
    data: file or numpy.array
        The data used to run TSNE, one sample per row
    no_dims: int
    perplexity: int
    randseed: int
    theta: float
    initial_dims: int
    verbose: boolean
    use_pca: boolean
    max_iter: int
    '''

    tmp_dir_path = mkdtemp()

    if _is_filelike_object(data):
        data = load_data(data)

    init_bh_tsne(data, tmp_dir_path, no_dims=no_dims, perplexity=perplexity, theta=theta, randseed=randseed,verbose=verbose, initial_dims=initial_dims, use_pca=use_pca, max_iter=max_iter)

    res = []
    for result in bh_tsne(tmp_dir_path, verbose):
        sample_res = []
        for r in result:
            sample_res.append(r)
        res.append(sample_res)
    rmtree(tmp_dir_path)
    return np.asarray(res, dtype='float64')

from bhtsne.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.