GithubHelp home page GithubHelp logo

Comments (3)

SimonBlanke avatar SimonBlanke commented on May 16, 2024

I was not able to reproduce this error in Ubuntu 20.04 with the same python and hyperactive version. The fact that it works on my end surprises me, because Hyperactive uses multiprocessing as default. I always thought multiprocessing cannot handle lambda because it uses pickle.

Maybe you could try using joblib for Hyperactive. It is a shot in the dark but maybe this works for your OS.

Here is a snipped to try out:

import numpy as np
from hyperactive import Hyperactive

space = dict(alpha=np.linspace(0, 1), beta=np.linspace(0, 1), start=[-0.95], end=[0.95])
points = np.random.rand(10)

def model(opt):
    rv = lambda x: x
    return np.sum(rv(points))

hyper = Hyperactive(distribution="joblib")
hyper.add_search(
    model,
    space,
    n_iter=50,
    n_jobs=2,
)
hyper.run()

Let me know if this solves your problem.

It is difficult for me to reproduce this error, because I do not have access to MacOS. I hope we find a solution with joblib.

from hyperactive.

m-rph avatar m-rph commented on May 16, 2024

Joblib works, thanks!

One more thing, n_jobs is independent of the number of runs, is this correct? So if I wanted to run the experiment 50 times, I'd have to call run 50 times and collect the results each time, is this correct? I am asking because running:

hyper.add_search(model, space, n_iter=50, n_jobs=N)

gives me min(N, 12) for N >= -1, and I assume 12 is because my CPU shows 12 cores.

from hyperactive.

SimonBlanke avatar SimonBlanke commented on May 16, 2024

Very good! It works now, because joblib uses an alternative to pickle.

I am not sure i understand your question.
n_jobs opens n processes during the optimization run. Each of those processes runs n_iter iterations. If n_jobs == -1 then n_jobs is set to the number of CPU cores available.

I hope this answers your question. If you need more clarification or have another question feel free to open another issue.

from hyperactive.

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.