Python Extreme Learning Machine (ELM) is a machine learning technique used for classification/regression tasks.
- Free software: BSD license
- Documentation: https://elm.readthedocs.org.
- ELM Kernel
- ELM Random Neurons
- MLTools
Python Extreme Learning Machine (ELM) is a machine learning technique used for classification/regression tasks.
License: Other
Python Extreme Learning Machine (ELM) is a machine learning technique used for classification/regression tasks.
when i try to run search_param function i got this issue:
Traceback (most recent call last):
File "<pyshell#383>", line 1, in
elmk.search_param(data, cv="kfold", of="accuracy", eval=10)
File "C:\Users\abdel\AppData\Local\Programs\Python\Python37\lib\site-packages\elm\elmk.py", line 489, in search_param
param_kernel=param_ranges[1])
File "C:\Users\abdel\AppData\Local\Programs\Python\Python37\lib\site-packages\optunity\api.py", line 212, in minimize
pmap=pmap)
File "C:\Users\abdel\AppData\Local\Programs\Python\Python37\lib\site-packages\optunity\api.py", line 245, in optimize
solution, report = solver.optimize(f, maximize, pmap=pmap)
File "C:\Users\abdel\AppData\Local\Programs\Python\Python37\lib\site-packages\optunity\solvers\CMAES.py", line 163, in optimize
halloffame=hof, verbose=False)
File "C:\Users\abdel\AppData\Local\Programs\Python\Python37\lib\site-packages\deap\algorithms.py", line 487, in eaGenerateUpdate
for ind, fit in zip(population, fitnesses):
File "C:\Users\abdel\AppData\Local\Programs\Python\Python37\lib\site-packages\optunity\solvers\CMAES.py", line 156, in evaluate
individual)]))),)
File "C:\Users\abdel\AppData\Local\Programs\Python\Python37\lib\site-packages\optunity\functions.py", line 301, in wrapped_f
value = f(*args, **kwargs)
File "C:\Users\abdel\AppData\Local\Programs\Python\Python37\lib\site-packages\optunity\functions.py", line 356, in wrapped_f
return f(*args, **kwargs)
File "C:\Users\abdel\AppData\Local\Programs\Python\Python37\lib\site-packages\optunity\constraints.py", line 151, in wrapped_f
return f(*args, **kwargs)
File "C:\Users\abdel\AppData\Local\Programs\Python\Python37\lib\site-packages\optunity\constraints.py", line 129, in wrapped_f
return f(*args, **kwargs)
File "C:\Users\abdel\AppData\Local\Programs\Python\Python37\lib\site-packages\optunity\constraints.py", line 266, in func
return f(*args, **kwargs)
File "C:\Users\abdel\AppData\Local\Programs\Python\Python37\lib\site-packages\elm\elmk.py", line 426, in wrapper_1param
dataprocess=dataprocess)
File "C:\Users\abdel\AppData\Local\Programs\Python\Python37\lib\site-packages\elm\mltools.py", line 800, in kfold_cross_validation
cv_testing_error = CVError(testing_errors)
File "C:\Users\abdel\AppData\Local\Programs\Python\Python37\lib\site-packages\elm\mltools.py", line 563, in init
self.calc_metrics()
File "C:\Users\abdel\AppData\Local\Programs\Python\Python37\lib\site-packages\elm\mltools.py", line 576, in calc_metrics
fold.dict_errors[error] = fold.get(error)
File "C:\Users\abdel\AppData\Local\Programs\Python\Python37\lib\site-packages\elm\mltools.py", line 428, in get
self._calc(error, self.expected_targets, self.predicted_targets)
File "C:\Users\abdel\AppData\Local\Programs\Python\Python37\lib\site-packages\elm\mltools.py", line 358, in _calc
self.dict_errors[name] = np.count_nonzero(_a == _b) / _b.size
ZeroDivisionError: division by zero
this my code:
data= mltools.read("C:/these1.data")
elmk = elm.ELMKernel()
elmk.search_param(data, cv="kfold", of="accuracy", eval=10)
this is my data:
array([[6000, 1999],
[6196, 2000],
[7474, 2001],
[7813, 2002],
[4684, 2003],
[4933, 2004],
[5261, 2005],
[5485, 2006],
[5869, 2007],
[6155, 2008],
[6566, 2009],
[7005, 2010],
[7372, 2011],
[7631, 2012],
[7255, 2013],
[6404, 2014],
[6736, 2015],
[6414, 2016]])
Note that i have the same issue if i use ELMRandom()
No errors occours until the following statement (the loaded data matches the data set contained in the file):
elmk.search_param(data, cv="kfold", of="accuracy", eval=10)
I get the following error:
`##### Start search #####
Traceback (most recent call last):
File "D:/elm/elm", line 18, in <module>
elmk.search_param(data, cv="kfold", of="accuracy", eval=10)
File "C:\Users\roberto\AppData\Local\Programs\Python\Python35\lib\site-packages\elm\elmk.py", line 489, in search_param
param_kernel=param_ranges[1])
File "C:\Users\roberto\AppData\Local\Programs\Python\Python35\lib\site-packages\optunity\api.py", line 212, in minimize
pmap=pmap)
File "C:\Users\roberto\AppData\Local\Programs\Python\Python35\lib\site-packages\optunity\api.py", line 245, in optimize
solution, report = solver.optimize(f, maximize, pmap=pmap)
File "C:\Users\roberto\AppData\Local\Programs\Python\Python35\lib\site-packages\optunity\solvers\CMAES.py", line 139, in optimize
sigma=self.sigma)
File "C:\Users\roberto\AppData\Local\Programs\Python\Python35\lib\site-packages\deap\cma.py", line 84, in __init__
self.dim = len(self.centroid)
TypeError: len() of unsized object
Windows 10, python 3.5.2,, JetBrains PyCharm Community Edition 2016.2(64) as ide
I have used the following code in Python 3.6 but nothing is running
#download an example dataset from
from sklearn import datasets
data = datasets.load_iris()
iris = pd.DataFrame(data.data, columns=data.feature_names)
elmk = elm.ELMKernel()
elmk.search_param(iris, cv="kfold", of="accuracy", eval=10)
tr_set, te_set = elm.split_sets(iris, training_percent=.8, perm=True)
#train and test
tr_result = elmk.train(iris)
te_result = elmk.test(te_set)
print(te_result.get_accuracy)
I'm unable to find a function to save the model to a file and load the model to predict class of a new sample.
error while running the example:
elmk = elm.ELMKernel()
elmk.search_param(X, y, cv="kfold", of="accuracy", eval=10)
tr_set, te_set = elm.split_sets(data, training_percent=.8, perm=True)
tr_result = elmk.train(tr_set)
te_result = elmk.test(te_set)
print(te_result.get_accuracy)
error message:
`elmk
Start search
TypeError Traceback (most recent call last)
in
6 # to be optimized and perform 10 searching steps.
7 # best parameters will be saved inside 'elmk' object
----> 8 elmk.search_param(X, y, cv="kfold", of="accuracy", eval=10)
9
10 # split data in training and testing sets
c:\users\e580\appdata\local\programs\python\python36\lib\site-packages\elm\elmk.py in search_param(self, database, dataprocess, path_filename, save, cv, of, kf, eval)
487 num_evals=eval,
488 param_c=param_ranges[0],
--> 489 param_kernel=param_ranges[1])
490
491 elif kernel_function == "poly":
c:\users\e580\appdata\local\programs\python\python36\lib\site-packages\optunity\api.py in minimize(f, num_evals, solver_name, pmap, **kwargs)
210 solver = make_solver(**suggestion)
211 solution, details = optimize(solver, func, maximize=False, max_evals=num_evals,
--> 212 pmap=pmap)
213 return solution, details, suggestion
214
c:\users\e580\appdata\local\programs\python\python36\lib\site-packages\optunity\api.py in optimize(solver, func, maximize, max_evals, pmap)
243 time = timeit.default_timer()
244 try:
--> 245 solution, report = solver.optimize(f, maximize, pmap=pmap)
246 except fun.MaximumEvaluationsException:
247 # early stopping because maximum number of evaluations is reached
c:\users\e580\appdata\local\programs\python\python36\lib\site-packages\optunity\solvers\CMAES.py in optimize(self, f, maximize, pmap)
137 else:
138 strategy = deap.cma.Strategy(centroid=self.start.values(),
--> 139 sigma=self.sigma)
140 toolbox.register("generate", strategy.generate, Individual)
141 toolbox.register("update", strategy.update)
c:\users\e580\appdata\local\programs\python\python36\lib\site-packages\deap\cma.py in init(self, centroid, sigma, **kargs)
88 self.centroid = numpy.array(centroid)
89
---> 90 self.dim = len(self.centroid)
91 self.sigma = sigma
92 self.pc = numpy.zeros(self.dim)
TypeError: len() of unsized object
`
i tried thies example:
`import elm
data = elm.read("C:/Users/abdel/Downloads/elmdevel/tests/data/iris.data")
elmk = elm.ELMKernel()
elmk.search_param(data, cv="kfold", of="accuracy", eval=10)
tr_set, te_set = elm.split_sets(data, training_percent=.8, perm=True)
tr_result = elmk.train(tr_set)
te_result = elmk.test(te_set)
print(te_result.get_accuracy)`
and i have this prolem:
C:\Users\abdel\PycharmProjects\Test1\venv\lib\site-packages\deap\tools_hypervolume\pyhv.py:33: ImportWarning: Falling back to the python version of hypervolume module. Expect this to be very slow.
"module. Expect this to be very slow.", ImportWarning)
elmk
Traceback (most recent call last):
File "C:/Users/abdel/PycharmProjects/Test1/test1.py", line 7, in
elmk.search_param(data, cv="kfold", of="accuracy", eval=10)
File "C:\Users\abdel\PycharmProjects\Test1\venv\lib\site-packages\elm\elmk.py", line 489, in search_param
param_kernel=param_ranges[1])
File "C:\Users\abdel\PycharmProjects\Test1\venv\lib\site-packages\optunity\api.py", line 212, in minimize
pmap=pmap)
File "C:\Users\abdel\PycharmProjects\Test1\venv\lib\site-packages\optunity\api.py", line 245, in optimize
solution, report = solver.optimize(f, maximize, pmap=pmap)
File "C:\Users\abdel\PycharmProjects\Test1\venv\lib\site-packages\optunity\solvers\CMAES.py", line 154, in optimize
halloffame=hof, verbose=False)
File "C:\Users\abdel\PycharmProjects\Test1\venv\lib\site-packages\deap\algorithms.py", line 486, in eaGenerateUpdate
fitnesses = toolbox.map(toolbox.evaluate, population)
File "C:\Users\abdel\PycharmProjects\Test1\venv\lib\site-packages\optunity\solvers\CMAES.py", line 147, in evaluate
individual)])),)
File "C:\Users\abdel\PycharmProjects\Test1\venv\lib\site-packages\optunity\functions.py", line 286, in wrapped_f
value = f(*args, **kwargs)
File "C:\Users\abdel\PycharmProjects\Test1\venv\lib\site-packages\optunity\functions.py", line 341, in wrapped_f
return f(*args, **kwargs)
File "C:\Users\abdel\PycharmProjects\Test1\venv\lib\site-packages\optunity\constraints.py", line 150, in wrapped_f
return f(*args, **kwargs)
File "C:\Users\abdel\PycharmProjects\Test1\venv\lib\site-packages\optunity\constraints.py", line 128, in wrapped_f
return f(*args, **kwargs)
File "C:\Users\abdel\PycharmProjects\Test1\venv\lib\site-packages\optunity\constraints.py", line 265, in func
return f(*args, **kwargs)
File "C:\Users\abdel\PycharmProjects\Test1\venv\lib\site-packages\elm\elmk.py", line 426, in wrapper_1param
dataprocess=dataprocess)
File "C:\Users\abdel\PycharmProjects\Test1\venv\lib\site-packages\elm\mltools.py", line 776, in kfold_cross_validation
folds.append(database[k * fold_size: (k + 1) * fold_size, :])
TypeError: slice indices must be integers or None or have an index method
Process finished with exit code 1
I have found a couple of error running the example on a python 3.4 platform.
The main difference is that in python 2.7 dictionary.values() gives a list, instead in 3.4 it is returning a view
So I found out that for fix this issue you have to modify:
-api.py file line 205 -> solution = operator.itemgetter(index)(list(f.call_log.keys()))._asdict()
-cma.py file line 82 -> solution = self.centroid = numpy.array(list(centroid))
Can you fix this error please and better check the python 3.x compatibility ??
Best regards,
Sandro
Could not find a version that satisfies the requirement deap==1.0.2 (from -r requirements.txt (line 2)) (from versions: 0.9.1, 0.9.2, 1.0.0rc3, 1.0.0, 1.0.1, 1.0.2.post2, 1.2.0, 1.2.1a0, 1.2.1a1, 1.2.1a2, 1.2.1b0, 1.2.1rc3, 1.2.1, 1.2.2)
No matching distribution found for deap==1.0.2 (from -r requirements.txt (line 2))
code implementation
scores = cross_val_score(clf, X, y, cv=5, scoring='accuracy')
error message:
TypeError Traceback (most recent call last)
in
2 for clf, label in zip([elm1, elm2, elm3, elm4, elm5, elm6, elm7, elm8, elm9, elm10, eclf], labels):
3
--> 4 scores = cross_val_score(clf, X, y, cv=5, scoring='accuracy')
5 print("Accuracy: %0.2f (+/- %0.2f) [%s]" % (scores.mean(), scores.std(), label))c:\users\e580\appdata\local\programs\python\python36\lib\site-packages\sklearn\utils\validation.py in inner_f(*args, **kwargs)
61 extra_args = len(args) - len(all_args)
62 if extra_args <= 0:
--> 63 return f(*args, **kwargs)
64
65 # extra_args > 0c:\users\e580\appdata\local\programs\python\python36\lib\site-packages\sklearn\model_selection_validation.py in cross_val_score(estimator, X, y, groups, scoring, cv, n_jobs, verbose, fit_params, pre_dispatch, error_score)
441
442 # To ensure multimetric format is not supported
-> 443 scorer = check_scoring(estimator, scoring=scoring)
444
445 cv_results = cross_validate(estimator=estimator, X=X, y=y, groups=groups,c:\users\e580\appdata\local\programs\python\python36\lib\site-packages\sklearn\utils\validation.py in inner_f(*args, **kwargs)
61 extra_args = len(args) - len(all_args)
62 if extra_args <= 0:
-> 63 return f(*args, **kwargs)
64
65 # extra_args > 0c:\users\e580\appdata\local\programs\python\python36\lib\site-packages\sklearn\metrics_scorer.py in check_scoring(estimator, scoring, allow_none)
426 if not hasattr(estimator, 'fit'):
427 raise TypeError("estimator should be an estimator implementing "
-> 428 "'fit' method, %r was passed" % estimator)
429 if isinstance(scoring, str):
430 return get_scorer(scoring)TypeError: estimator should be an estimator implementing 'fit' method, <elm.elmk.ELMKernel object at 0x000001E2CA30BEF0> was passed
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.