modAL icon indicating copy to clipboard operation
modAL copied to clipboard

AttributeError: 'DataFrame' object has no attribute 'reshape'

Open ghezalahmad opened this issue 4 years ago • 2 comments

Hi, In this code I get the error. Where the X_pool shape is (1024, 8).

query_idx, query_instances = learner.query(X_pool, n_instances=5)

Please let me know what is wrong here.

I used the Ranked batch-model sampling.

ghezalahmad avatar Sep 02 '21 15:09 ghezalahmad

I think it comes from the function select_cold_start_instance in which there is a reshape:

    return best_coldstart_instance_index, X[best_coldstart_instance_index].reshape(1, -1)

try using X_pool.values ? otherwise, there should be a check in the function to check that the type of X and apply to reshape to X.values if X is a DataFrame.

damienlancry avatar Oct 14 '21 01:10 damienlancry

I think the problem is that dataframe ojects are not supported, only numpy arrays or sparse matrices (X: Union[numpy.ndarray, scipy.sparse.csr.csr_matrix]).

elisamercanti avatar Oct 14 '21 15:10 elisamercanti