mxbi / mlcrate Goto Github PK
View Code? Open in Web Editor NEWA python module of handy tools and functions, mainly for ML and Kaggle
License: MIT License
A python module of handy tools and functions, mainly for ML and Kaggle
License: MIT License
When I passing a lambda function to fill in additional parameters, the map function can not find the f function that is called inside lambda function:
import mlcrate as mlc
pool = mlc.SuperPool()
def f(x,y):
return x ** (2/y)
res = pool.map(lambda x: f(x, 2), range(1000))
Traceback (most recent call last):
File "C:\Anaconda3\lib\site-packages\multiprocess\pool.py", line 119, in worker
result = (True, func(*args, **kwds))
File "C:\Anaconda3\lib\site-packages\pathos\helpers\mp_helper.py", line 15, in <lambda>
func = lambda args: f(*args)
File "C:\Anaconda3\lib\site-packages\mlcrate\__init__.py", line 125, in func_tracked
return func(x), i
File "<ipython-input-3-c53f7e0849d6>", line 8, in <lambda>
NameError: name 'f' is not defined
Also when I have a global variable in the function, the map function also can not find the global variable
import mlcrate as mlc
pool = mlc.SuperPool()
y = 2
def f(x):
return x ** (2/y)
res = pool.map(f, range(1000))
Traceback (most recent call last):
File "C:\Anaconda3\lib\site-packages\multiprocess\pool.py", line 119, in worker
result = (True, func(*args, **kwds))
File "C:\Anaconda3\lib\site-packages\pathos\helpers\mp_helper.py", line 15, in <lambda>
func = lambda args: f(*args)
File "C:\Anaconda3\lib\site-packages\mlcrate\__init__.py", line 125, in func_tracked
return func(x), i
File "<ipython-input-4-474bcea6b16a>", line 7, in f
NameError: name 'y' is not defined
Is there a way to pass these objects to the process pool to let the pool know which global function and variable we want to use?
Hi There,
This project is still using an old implementation of LGTM's automated code review, which has now been disabled. To continue using automated code review, and receive checks on your Pull Requests, please install the GitHub App on this repository.
Thanks,
The LGTM Team
ValueError Traceback (most recent call last)
in ()
----> 1 comb=mlc.load("comb_all_features1.feather")
~/anaconda3/lib/python3.6/site-packages/mlcrate/init.py in load(filename)
33 fp = open(filename, 'rb')
34
---> 35 return pickle.load(fp)
36
37 class LinewiseCSVWriter:
ValueError: could not convert string to float: EA1`
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.