Questions tagged [joblib]

Joblib is a set of tools to provide lightweight pipelining in Python.

Joblib is a set of tools to provide lightweight pipelining in Python.

https://joblib.readthedocs.io/en/latest/

715 questions
8
votes
1 answer

ModuleNotFoundError: No module named 'sklearn.linear_model._base'

I am trying to load a model saved as a .joblib file. I have tried pickle, sklearn.externals.joblib and joblib itself. All the same error. Below is an example of what I am trying to do. clf = joblib.load("linear_regression_model.joblib") This model…
Natalie
  • 447
  • 1
  • 4
  • 16
8
votes
2 answers

How to implement parallel, delayed in such a way that the parallelized for loop stops when output goes below a threshold?

Suppose I have the following code: from scipy import * import multiprocessing as mp num_cores = mp.cpu_count() from joblib import Parallel, delayed import matplotlib.pyplot as plt def func(x,y): return y/x def main(y, xmin,xmax, dx): x =…
user247534
  • 103
  • 8
8
votes
1 answer

Error pickling a `matlab` object in joblib `Parallel` context

I'm running some Matlab code in parallel from inside a Python context (I know, but that's what's going on), and I'm hitting an import error involving matlab.double. The same code works fine in a multiprocessing.Pool, so I am having trouble figuring…
mostsquares
  • 834
  • 8
  • 27
8
votes
1 answer

Load and predict new data sklearn

I trained a Logistic model, cross-validated and saved it to file using joblib module. Now I want to load this model and predict new data with it. Is this the correct way to do this? Especially the standardization. Should I use scaler.fit() on my…
8
votes
2 answers

Joblib memory usage keeps growing

I have the following problem. My purpose is to process a bunch of documents (bring all words to normal form, e.g. 'was' --> 'be', 'were' --> 'be', 'went' --> 'go'). Which means, I need to open each file in a directory, change its content and save…
fremorie
  • 713
  • 2
  • 9
  • 20
8
votes
0 answers

using Joblib memory library with partial objects

I have a function with two parameters: def foo(x,y): # some complicated math return result and I define partials using the functools library: f1 = partial(foo,1) f2 = partial(foo,2) Now I would like to use the joblib.Memory library to cache…
motam79
  • 3,542
  • 5
  • 34
  • 60
8
votes
1 answer

Python multiprocessing (joblib) best way for argument passing

I've noticed a huge delay when using multiprocessing (with joblib). Here is a simplified version of my code: import numpy as np from joblib import Parallel, delayed class Matcher(object): def match_all(self, arr1, arr2): args = ((elem1,…
Luigolas
  • 366
  • 2
  • 9
7
votes
4 answers

Error , Unsuccessful TensorSliceReader constructor: Failed to find any matching files for ram to unpickle a file

I am running into this error , i can't unpickle a file on my jupyter notebook: import os import pickle import joblib import pandas as pd from sklearn.preprocessing import MinMaxScaler filename = open("loan_model3.pkl", "rb") mdl =…
abdalla mahgoub
  • 71
  • 1
  • 1
  • 5
7
votes
4 answers

AttributeError: 'MinMaxScaler' object has no attribute 'clip'

I get the following error when I attempt to load a saved sklearn.preprocessing.MinMaxScaler /shared/env/lib/python3.6/site-packages/sklearn/base.py:315: UserWarning: Trying to unpickle estimator MinMaxScaler from version 0.23.2 when using version…
Bobs Burgers
  • 761
  • 1
  • 5
  • 26
7
votes
3 answers

How to parallelize the for loop inside a async function and track for loop execution status?

Recently, I have asked a question regarding how to track the progress of a for loop inside a API deployed. Here's the link. The solution code that worked for me is, from fastapi import FastAPI, UploadFile from typing import List import…
user_12
  • 1,778
  • 7
  • 31
  • 72
7
votes
5 answers

Cannot import Sklearn from sklearn.externals.joblib

I am a beginner and I just started with machine learning. I am trying to import classes like imputer from sklearn but i am unable to do it. from sklearn.preprocessing import Imputer,LabelEncoder,OneHotEncoder,StandardScaler ImportError: cannot…
Ayush Bajpayee
  • 71
  • 1
  • 1
  • 2
7
votes
2 answers

joblib parallel processing of a multiple return values function

I use joblib to parallelise a function (with multiprocessing). But, this function return 4 values but when I get the results from Parallel it gives me only 3 values from joblib import Parallel, delayed import numpy as np from array import…
7
votes
1 answer

Python Joblib Parallel: How to combine results per worker?

Context I have a function that produces a large 2D numpy array (with fixed shape) as output. I am calling this function 1000 times using joblib (Parallel with a multiprocessing backend) on 8 CPUs. At the end of the job, I add up all the arrays…
Miguel
  • 416
  • 3
  • 16
7
votes
2 answers

How to populate global variable with Python joblib?

I want to run some code in parallel and populate a global variable with the results in Python. I have written an example code to check the behavior of joblib, but I don't know how to get the results back. The example code is: import numpy as…
angel.torrado
  • 73
  • 1
  • 3
7
votes
2 answers

Error while using joblib with imported function

I'm using joblib to parallelize my python 3.5 code. If I do: from modules import f from joblib import Parallel, delayed if __name__ == '__main__': Parallel( n_jobs = n_jobs,backend = "multiprocessing")(delayed(f)(i) for i in range( 10…