如何确定不平衡数据集的class_weights

时间:2019-11-29 09:57:54

标签: keras data-science imbalanced-data

我正在处理不平衡的数据集。我正在尝试借助class_weights建立模型。因此,我可以在什么基础上确定class_weights

标签及其数量如下:

label    Count
2        47213
3        2096
4        2021
1        737
0        176

那么我应该给class_weight变量赋什么值:

model.fit(X_train, Y_train, nb_epoch=5, batch_size=32, class_weight=class_weight)

1 个答案:

答案 0 :(得分:2)

您可以为此雇用import org.junit.*; import org.openqa.selenium.WebElement; import org.openqa.selenium.remote.DesiredCapabilities; import java.util.concurrent.TimeUnit; import java.net.URL; import io.appium.java_client.windows.WindowsDriver; private static WindowsDriver CalculatorSession = null; private static WebElement CalculatorResult = null; @BeforeClass public static void setup() { try { DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setCapability("app", "Microsoft.WindowsCalculator_8wekyb3d8bbwe!App"); CalculatorSession = new WindowsDriver(new URL("http://127.0.0.1:4723"), capabilities); CalculatorSession.manage().timeouts().implicitlyWait(2, TimeUnit.SECONDS); CalculatorResult = CalculatorSession.findElementByAccessibilityId("CalculatorResults"); Assert.assertNotNull(CalculatorResult); }catch(Exception e){ e.printStackTrace(); } finally { } } 中的compute_class_weight

sklearn