問題タブ [imblearn]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
python - Imblearn balanced_batch_generator - can't run my CNN model
Currently, I'm working on my first Convolutional Neural Network for a project in university. I have to create a model that can recognize if a cable has a defect by only using images of "good" and "defect" cables in Google Colab.
My dataset is unbalanced; I have more images of 'good' cables then 'defect' ones. That's why I used the imblearn-library and its function 'balanced_batch_generator' so that I could oversample the minority class. To work with the generator, I needed to reshape my X from dim 4 in dim 2. Now when I want to run the balanced batches in my model, I get an error due to the 2x2 shape and I don't know how to reshape the batches inside of the generator to get the model running.
I also tried to put a 'Flatten'-layer as the first layer with typed in input_shape to change the dense layer from the batch_generator but then I can't compile/build the model because it expects more dimensions than I can put in.
Here is my code:
Error message:
Can anybody help me? Or give me a hint?
python - RandomOverSampler と DecisionTreeClassifier で imblearn.pipeline を使用しようとしています
GridSearchCV を使用して DecisionTreeClassifiers のハイパーパラメーターを設定しようとしていますが、データのバランスが取れていないため、imblearn.over_sampling.RandomOverSampler を使用しようとしています。
これはエラーを返します:
ここで何が間違っていますか?
編集:以下に投稿されたソリューション