You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, when I use the package, I have the following issues:
code is:
d1 = np.random.rand(100,10)
d2 = np.random.rand(100,10)
d3 = np.random.rand(100,10)
data = [d1,d2,d3]
params = pyrea.parea_2_genetic(data, k_min=2, k_max=5)
it returns the error:
TypeError Traceback (most recent call last)
Cell In[14], line 1
----> 1 params_hierarchical = pyrea.parea_1_genetic(data, k_min=2, k_max=5, k_final=3, n_generations=10, n_population=10)
File ~/anaconda3/envs/eval/lib/python3.10/site-packages/deap/algorithms.py:151, in eaSimple(population, toolbox, cxpb, mutpb, ngen, stats, halloffame, verbose)
149 invalid_ind = [ind for ind in population if not ind.fitness.valid]
150 fitnesses = toolbox.map(toolbox.evaluate, invalid_ind)
--> 151 for ind, fit in zip(invalid_ind, fitnesses):
152 ind.fitness.values = fit
154 if halloffame is not None:
File ~/anaconda3/envs/eval/lib/python3.10/site-packages/pyrea/core.py:795, in parea_1_genetic..evaluate(individual)
792 with warnings.catch_warnings():
793 warnings.simplefilter("ignore")
--> 795 sil = parea_1(data,
796 individual[0],
797 individual[1],
...
839 xp, is_array_api_compliant = get_namespace(array)
841 # store reference to original array to check if copy is needed when
842 # function returns
TypeError: np.matrix is not supported. Please convert to a numpy array with np.asarray.
Do you know how to fix it?
Thanks.
The text was updated successfully, but these errors were encountered:
yeah this is because I used the numpy.matrix class and this now deprecated in newer versions of NumPy. I would need to change Pyrea's code to use the numpy.array class instead. Which is on the agenda, and I will do so in the coming days actually. Once I have made the changes, I will update the package and let you know.
Hi, when I use the package, I have the following issues:
code is:
d1 = np.random.rand(100,10)
d2 = np.random.rand(100,10)
d3 = np.random.rand(100,10)
data = [d1,d2,d3]
params = pyrea.parea_2_genetic(data, k_min=2, k_max=5)
it returns the error:
TypeError Traceback (most recent call last)
Cell In[14], line 1
----> 1 params_hierarchical = pyrea.parea_1_genetic(data, k_min=2, k_max=5, k_final=3, n_generations=10, n_population=10)
File ~/anaconda3/envs/eval/lib/python3.10/site-packages/pyrea/core.py:833, in parea_1_genetic(data, k_min, k_max, k_final, n_population, n_generations)
830 stats.register("max", np.max)
832 # Run the genetic algorithm
--> 833 pop, log = algorithms.eaSimple(population, toolbox, cxpb=0.7, mutpb=0.2, ngen=n_generations, stats=stats, halloffame=hall_of_fame, verbose=True)
835 print(f"\nSummary:\n{log}")
837 return hall_of_fame[0]
File ~/anaconda3/envs/eval/lib/python3.10/site-packages/deap/algorithms.py:151, in eaSimple(population, toolbox, cxpb, mutpb, ngen, stats, halloffame, verbose)
149 invalid_ind = [ind for ind in population if not ind.fitness.valid]
150 fitnesses = toolbox.map(toolbox.evaluate, invalid_ind)
--> 151 for ind, fit in zip(invalid_ind, fitnesses):
152 ind.fitness.values = fit
154 if halloffame is not None:
File ~/anaconda3/envs/eval/lib/python3.10/site-packages/pyrea/core.py:795, in parea_1_genetic..evaluate(individual)
792 with warnings.catch_warnings():
793 warnings.simplefilter("ignore")
--> 795 sil = parea_1(data,
796 individual[0],
797 individual[1],
...
839 xp, is_array_api_compliant = get_namespace(array)
841 # store reference to original array to check if copy is needed when
842 # function returns
TypeError: np.matrix is not supported. Please convert to a numpy array with np.asarray.
Do you know how to fix it?
Thanks.
The text was updated successfully, but these errors were encountered: