manuel-calzolari / sklearn-genetic

Genetic feature selection module for scikit-learn
https://sklearn-genetic.readthedocs.io
GNU Lesser General Public License v3.0
324 stars 77 forks source link

value error for multi-class 4 dimension input #6

Closed RoadToML closed 4 years ago

RoadToML commented 5 years ago

Hey I have a dog breed dataset, shape (-1, 100,100,3). I get the following error

ValueError: Found array with dim 4. Estimator expected <= 2.

My estimator is my_model_2 a 5 layer CNN.

model = KerasClassifier(build_fn=my_model_2, epochs=10, validation_split = 0.1)

selector = GeneticSelectionCV(estimator=model,
                              cv=2,
                              verbose=1,
                              scoring="accuracy",
                              max_features=5,
                              n_population=50,
                              crossover_proba=0.5,
                              mutation_proba=0.2,
                              n_generations=40,
                              crossover_independent_proba=0.5,
                              mutation_independent_proba=0.05,
                              tournament_size=3,
                              n_gen_no_change=10,
                              caching=True,
                              n_jobs=-1)

the selector is default (except cv=2) for testing.

Is this supported? or do i need to change the shape of my data.

thank you.

manuel-calzolari commented 4 years ago

Sorry for the extremely late reply.

This module can be used when the data is tabular.

Please feel free to reopen the issue if necessary.