From b48e65c27584e3b95acfcdf745fcaaef16fffc61 Mon Sep 17 00:00:00 2001 From: mhall Date: Wed, 9 Dec 2009 20:38:36 +0000 Subject: [PATCH] For the fp and fn fields of the cost matrix a default value of 1 rather than 0 was being set when the contents of the field in question was not parseable as a number. git-svn-id: https://svn.scms.waikato.ac.nz/svn/weka/trunk/weka@6137 e0a1b77d-ad91-4216-81b1-defd5f83fa92 --- src/main/java/weka/gui/beans/CostBenefitAnalysis.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/java/weka/gui/beans/CostBenefitAnalysis.java b/src/main/java/weka/gui/beans/CostBenefitAnalysis.java index b15105b6..34b3aa2f 100644 --- a/src/main/java/weka/gui/beans/CostBenefitAnalysis.java +++ b/src/main/java/weka/gui/beans/CostBenefitAnalysis.java @@ -170,10 +170,10 @@ public class CostBenefitAnalysis extends JPanel protected JLabel m_cost_predictedB = new JLabel("Predicted (b)", SwingConstants.RIGHT); protected JLabel m_cost_actualA = new JLabel(" Actual (a)"); protected JLabel m_cost_actualB = new JLabel(" Actual (b)"); - protected JTextField m_cost_aa = new JTextField(5); + protected JTextField m_cost_aa = new JTextField("0.0", 5); protected JTextField m_cost_ab = new JTextField("1.0", 5); protected JTextField m_cost_ba = new JTextField("1.0", 5); - protected JTextField m_cost_bb = new JTextField(5); + protected JTextField m_cost_bb = new JTextField("0.0" ,5); protected JButton m_maximizeCB = new JButton("Maximize Cost/Benefit"); protected JButton m_minimizeCB = new JButton("Minimize Cost/Benefit"); protected JRadioButton m_costR = new JRadioButton("Cost"); @@ -613,7 +613,7 @@ public class CostBenefitAnalysis extends JPanel try { tpCost = Double.parseDouble(m_cost_aa.getText()); } catch (NumberFormatException n) {} - double fpCost = 1.0; + double fpCost = 0.0; try { fpCost = Double.parseDouble(m_cost_ba.getText()); } catch (NumberFormatException n) {} @@ -621,11 +621,11 @@ public class CostBenefitAnalysis extends JPanel try { tnCost = Double.parseDouble(m_cost_bb.getText()); } catch (NumberFormatException n) {} - double fnCost = 1.0; + double fnCost = 0.0; try { fnCost = Double.parseDouble(m_cost_ab.getText()); } catch (NumberFormatException n) {} - + totalRandomCB += posInSample * tpCost; totalRandomCB += negInSample * fpCost; totalRandomCB += posOutSample * fnCost; @@ -872,7 +872,7 @@ public class CostBenefitAnalysis extends JPanel try { tpCost = Double.parseDouble(m_cost_aa.getText()); } catch (NumberFormatException n) {} - double fpCost = 1.0; + double fpCost = 0.0; try { fpCost = Double.parseDouble(m_cost_ba.getText()); } catch (NumberFormatException n) {} @@ -880,7 +880,7 @@ public class CostBenefitAnalysis extends JPanel try { tnCost = Double.parseDouble(m_cost_bb.getText()); } catch (NumberFormatException n) {} - double fnCost = 1.0; + double fnCost = 0.0; try { fnCost = Double.parseDouble(m_cost_ab.getText()); } catch (NumberFormatException n) {} -- 2.11.4.GIT